Server freezes randomly for a few seconds

I am noticing a weird issue, my Ubuntu (web)server randomly freezes, for a few seconds and afterwards recovering again. The server has the following specifications;

- 2 vCores of 2,4 GHz
- 8GB of RAM
- 40GB SSD
- 100 MBit network

I am mainly running the following services on the server;

- NGINX (webserver and proxy)
- Mysql
- Varnish

The issue doesn't occur every day, but on the days that it does it usually happens very frequently (about every 20 seconds). I am running Netdata as a web monitoring tool and Newrelic for critical issues.

This is a screenshot of the CPU graph taken from the Netdata dashboard This is a screenshot of the CPU graph taken from the Netdata dashboard, as you can see the server stops reporting stats when the freeze occurs. I found out that sometimes the IO/Wait spikes just before seeing the server freeze, but after reading threads and Googling about high IO/Wait I could not find anything useful other than that the [jbd2/vda1-8] process is constantly writing to the disk.

When running monitoring tools like top, ps, iotop and htop I do not see any process using excessive amounts of resources, even when the freezing issue occurs.

When logging into the server using the hosting provider's (OVH's) KVM I see the following message; NMI watchdog: BUG: soft lockup CPU#0/1 stuck for 21s! [process]. Also researching that error message didn't provide much information or a solution. I am currently running out of ideas on what could cause these issues so any help is appreciated.


Your VPS is probably throttling your CPU and disk usage, causing an apparent freeze when the throttling is too severe. Check, via top, if you CPU steal time is high during (or just before/after) freezes.