0

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

  • 2
    I 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

enter image description here

  • Install htop via sudo apt install htop
  • start htop by typing htop
  • 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

| improve this answer | |
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.

| improve this answer | |
  • 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 7: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 7: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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.