Is possible to get know what process consumed all memory or why server start killing all processes? All started about 02:47 Kern.log Syslog.log
Asked
Active
Viewed 2,677 times
0
-
2I like 'free', 'top' and better 'htop' to get an quick overview about processes and resources. You can easily sort and filter in htop which really helps – dufte May 10 '16 at 13:05
2 Answers
2
To list the processes sorted by the memory usage
ps --sort -rss -eo pid,pmem,rss,vsz,comm
More information here : how-to-detect-a-memory-leak
The server is killing processes to free memory, this is what happens when all the virtual pages are allocated (swap+ram). If possible the best would be to restart the server to have all the stopped services restarted and and memory free.
More information here : Debug out-of-memory with /var/log/messages
Edit:
May 8 03:53:21 bwnet kernel: [5088999.370529] Free swap = 0kB
May 8 03:53:21 bwnet kernel: [5088999.370530] Total swap = 0kB
Reading your logs it seems that you have no swap. You may allocate some, that will allows you to manage the problem before it becomes critical.
-
yes. server start killing all processes and after kill Bash, there was problem to connect on it. Only restart of virtual server fix it...and now I cant see which process was real problem. – Jan Zof May 11 '16 at 07:55
-
We have virtual server with SSD disk and 8 GB RAM. About 3.5 GB memory is used. What is your recomendation about swap - how big swap and is really needed? Problem with memory leak is maybe maximaly 2x in year. Server is still running... – Jan Zof May 11 '16 at 07:55
-
@JanZof If it is not critical, just monitor the memory usage. Beware that if the allocation rate is very high you may have your monitoring killed before it reports :) . With some swap the server will be trashing pages before killing processes. During trashing the server will be slower but you would be able to apply corrective procedure in time. Check the virtual server memory allocation graph to have an idea of the grow rate and how much swap you need to have a secure intervention. – Emmanuel May 13 '16 at 13:26
-
@JanZof If you have access to different class of storage, just ask for the cheapest, no need to put the swap on SSD, swap is more a security than an alternative to memory. You should install a system activity reporting tool, like SAR to have better view. – Emmanuel May 13 '16 at 13:33
2
- Install
htop
viasudo apt install htop
- start
htop
by typinghtop
- Press F6 to trigger the sort-function and select MEM% on the left side via arrow keys
As a result you get a dynamic list of all processes sorted by mem-usage

dufte
- 13,272
- 5
- 39
- 43