In the past, I used to managed a WordPress site on DigitalOcean droplet (One-click app) with 2 vCore, 4GB of memory, Ubuntu 16.04, Apache 2.4.18, and mysql community version 5.7.29.
Then the website was transferred to a droplet with 2 vCore, 4GB of memory, Ubuntu 18.04, Apache 2.4.29, and mysql community version 8.0.20.
Instantly after went live on the new droplet apache (“apache2 -k start” on htop) started to spike CPU to 30 and 40% and down to 0 to 3% and then after a few moments up again, and down again.
This is how the average graphs looks like (more or less): ||||___| the old server, it used to look like this -----------------.
Both were one-click WordPress servers from DigitalOcean with default settings. Also, in the old server, the CPU usage with the same and sometimes even more load was always a flat line of 3 to 6%.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
What you can do is to monitor the droplet’s performance and check from where the CPU usage is coming from. Apache might be consuming more resources if the traffic to your sites is bigger as well.
The thing is the issue might not be related with your website itself and you might experiencing the speed issues because your server is running low on memory. That is why it’s important to make sure that everything is operating normally.
You can also examine the logs for any killed processes as this will help you to see if the server is killing processes in order to remain stable. You can check this by looking at the /var/log/messages and search for kill, e.g
You can also check for
out of memory(The OOM Killer) references in the log to see if the system is critically low on memory. This usually indicates that you need to upgrade if there are a lot of references.
You can exacute
htopvia ssh to see what process is taking the most CPU or memory. Both tools are really handy when it comes to monitor the server’s performance. I would like to mention that
topcomes installed by default and you might need to install htop.
```sudo apt-get install htop``
Top provides a simple, real-time table of your processes, with the largest consumers on top. Running htop, we can see that it has a similar output, but is colorized, and is more interactive:
There is a really useful tutorial you can check on how to use top, htop, netstat, du and other tools to Monitor Server Resources:
You can also use sar to check what’s going on your droplet. With sar, you can monitor performance of various Linux subsystems (CPU, Memory, I/O…) in real time.
You can use it like this:
To check the memory usage (Free and Used ):
To check the cpu usage:
You can also check this tutorial for monitoring the CPU usage on your droplet:
You can also track the performance with the Droplet Graphs which are available in your control panel. You can find more information here:
Another thing that you could try using is this script here which summarizes your access logs. It would summarize your access log and give you the following information:
Another thing that could be causing the high CPU load is a cron job or any other scheduled task. I would recommend checking your
crontaband reviewing your cron jobs. To do that you can run this command here:
Hope that this helps!
Could you please elaborate more on the current issue that you’re experiencing?
Want to learn more? Join the DigitalOcean Community!
Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.
Sign up now
I’m glad that this is working for you! :)