unexpected Sys CPU and Disk write usage spikes

November 13, 2015 934 views
Server Optimization Miscellaneous Ubuntu

Please look at this graph:
24 hours: http://i.imgur.com/YnkbQFP.png
7 days: http://i.imgur.com/9l5KeIk.png
As you can see, there are strange unexpected Sys CPU and Disk write usage spikes at random time. There is no special cron jobs. I also remember that some times there was "/usr/bin/python3 /usr/lib/ubuntu-release-upgrader..." process in top of the top command.
During this spikes i have to reboot server, this helps. And now, after reboot, i get
Could not load list of meta packages: [Errno 12] Cannot allocate memory twice in places, there must be information about pacakges to upgrade.

I have 1024 mb server and same swap file:

                 total       used       free     shared    buffers     cached
Mem:           994        837        156         16          8        167
-/+ buffers/cache:        661        332
Swap:         1023         17       1006

How can i find out the problem of this system load spikes? Thanks.

1 Answer


In order to diagnose the issue, we'd really need to know more about your server.

Please provide:

  • Run uname -a and post the output -- feel free to comment out the hostname.
  • Complete List of Packages Installed (by you - i.e. NGINX, PHP-FPM etc)
  • Run top, press shift+m and finally, press c. Take a screenshot and post the URI.


What this will provide us with is, first and foremost, a look at what all you're running (by looking at the package list), the top processes consuming the most RAM & CPU, and some basic OS information.

From looking at the output of free -m, of your 1GB, you're physically using 670MB (the used column includes cache, so for actual usage you'd subtract the cache column from usage) and have 156MB free, so something is definitely using the RAM, but your SWAP looks fine (you're not tearing through RAM, forcing SWAP usage which would almost immediately begin to affect CPU load).

That said, it is possible that you're running out of RAM from time to time, which would force SWAP usage to prevent a crash (whether it's MySQL, NGINX or something else). Once you begin to use swap, which spurs disk activity, you begin to utilize more CPU as disk (regardless of whether it's an SSD, SATA, SCSI/SAS or Flash drive) is always going to be slower than RAM and accessing it will also always be more "expensive" in terms of CPU "cost."

Have another answer? Share your knowledge.