Cyberpanel – Managing High Server Loads

This post will be one in progress for a while, as I’m really just learning how to identify and mitigate the causes for increased server loads.  I’ve been a bit spoiled having other companies host my websites, but I wanted to take the deeper dive into managing my own website server.  Cyberpanel has been pretty good so far, working for the most part without me having to put in too much extra effort.  It also doesn’t seem to be causing too much overhead on my VPS.

First, I’m using the $6/month Vultr.com server.  I get one core and 1gb of RAM, powered by latest generation AMD EPYC CPUs and NVMe SSD.

I set it up with cyberpanel on Ubuntu 20.04 and I’ve migrated over about 10 websites.  All but one are WordPress sites.  The sites are low traffic, but a few do have some dynamic plugins that probably aren’t particularly efficient.

On the Vultr website, they have nice graphs with usage statistics.  It looks like the server is generally around 25-35% vCPU usage with a few spikes each day up to 75%.  There were one or two spikes that someone got above 100% during the past week.  Maybe with these being virtual cores there is some flexibility?

In the Cyberpanel interface, it shows the load numbers in the top right corner.  The server loads were typically around 0.5-0.7 and sometimes would increase up to 5-6 for the 1 minute load, and get up to 2-3 for the 5 minute load.  The general rule I’ve heard is that the load should be less than the number of cores you have.  So with me having 1 core, I assume my server load should mostly be below 1.  As far as I can tell, the websites have always loaded quickly, so it is probably unnecessary for me to try to figure out.  But, here I am.

I know I can see some of the information as to what is using CPU processor through the “top” command in the console.  I also figured out how to install htop which I like better.  But from there, I’m pretty new to the rest.  I can see the CPU and memory usage for the processes, but sometimes the load numbers seem to go much higher even while the CPU usage from processes doesn’t look all that high.

There are two processes that are always running.  One of them is

kworker/0:0-events

and typically uses about 3.3% CPU.  I’m assuming this is a cyberpanel related process.  The other process is listed as “python”, but if I hit the “c” command I can see more detail and it is definitely a cyberpanel process, listed as:

/user/local/CyberCP/bin/phython /usr/local/CyberCP/WebTerminal/CPWebSocket.py

And that process uses about 1-3% CPU.

When watching top during a “spike” in load, I noticed typically one of the websites was getting traffic of some variety.  Using FTP, I went to the server logs for the specific domain that was showing high CPU usage (which was often very brief, yet was associated with an increase in the load numbers).  I noticed that I was getting a lot of bot traffic. Great.

I don’t know if there is a plugin that will automatically deal with bot traffic, but the two areas that were getting hit the hardest were wp-login and xml-rpc

To address those issues, I installed a plugin to limit login attempts and that seems to have taken care of the hammering of the wp-login

Addressing the xml-rpc was a bit more involved, but not terrible.  I could have just installed a plugin and disabled it completely, but I do use Jetpack, which apparently still relies on xmlrpc to function.  There is a way to limit traffic with .htaccess but since I already am using cloudflare, I took advantage of the free cloudflare firewall rules and blocked that traffic using this method, which still allows jetpack to function.

Fortunately, once I created the rule, cloudflare has an option to “edit expression” where I could just cut and paste the firewall rule into each of my wordpress domain entries.

As far as I can tell, the websites are all functioning (I don’t think I screwed up any of the firewall rules), and the loads seem to have become more even.  I’ll have to give things more time, but the vultr interface shows vCPU usage has been between 15-25% with no spikes above that level since I made these changes.  The top load numbers look better, but it’ll take some time to see how things look if the sites are getting more traffic.  The 5 minute load seems to have stayed below 0.7 and the 15 minute load has been pretty stable around 0.4-0.5

As I said, my sites always seemed to load just fine, but I’m sure there will come a time that I’ll need to better troubleshoot high loads on the server.  My goal is to keep my websites running as fast as possible, and keeping the server loads reasonable is a big part of that.

 

 

Leave a Reply