Basic Linux Troubleshooting
Some basics to help you sort out what may be going on with you system..
Top 5 CPU consuming processes:
$ sudo ps -Ao user,pid,pcpu,pmem,comm:50 --sort=-pcpu | head -n 6
USER PID %CPU %MEM COMMAND
sensu 14787 83.0 0.3 metrics-sqs.rb
sensu 14785 81.3 0.3 metrics-sqs.rb
sensu 14793 21.0 0.1 metrics-disk-us
sensu 6702 0.1 0.3 sensu-client
root 27190 0.1 0.8 dockerd
Top 5 Memory consuming processes:
$ sudo ps -Ao user,pid,pcpu:4,pmem:4,rss:10,comm:50 --sort=-rss | head -n 6
USER PID %CPU %MEM RSS COMMAND
mysql 77855 72.4 13.3 33689392 mysqld
root 20147 0.2 0.2 510060 pushy-client
sensu 106656 0.0 0.0 27316 sensu-client
root 69899 0.0 0.0 20608 sssd_nss
root 3618 0.0 0.0 14044 rsyslogd
Have I used all my memory?
$ sudo free -m
total used free shared buffers cached
Mem: 70352 19401 50950 0 670 2788
-/+ buffers/cache: 15943 54409
Swap: 0 0 0
Since Linux will try to use all available ram for buffers/cache, the free column on the "Mem:" line is misleading, the actual memory that is available for your application is listed on the -/+ buffers/cache line. If you're really curious and what more information please check out Linux ate my ram! Also: the -m switch displays it in megabytes.
Does the Kernel have any clues?
Often out of memory issues or other hardware issues and be found by asking the kernel.
$ sudo dmesg | tail
[11686.040460] flasherav invoked oom-killer: gfp_mask=0x201da, order=0, oom_adj=0, oom_score_adj=0
[11686.040467] flasherav cpuset=/ mems_allowed=0
[11686.040472] Pid: 2859, comm: flasherav Not tainted 3.0.0-12-generic #20-Ubuntu
[11686.040476] Call Trace:
Never skip running this step!