ApacheBench xenforo

daimpa

Active member
Hello, I've tried to run apachebench to test load my website.
I've a VPS, 4vCPU, 4GB RAM, SSD.
PHP 7.2.
0 plugins installed. Using ui.x theme.

Results seems really bad, with overload with only 4 concurrent users. What do you think?

With
ab -k -n 10000 -c 3 -l URL
I get:
Server Load 3.393066 (4 CPUs) Memory Used 35% (1,358,560 of 3,881,408) Swap Used 23.7% (248,488 of 1,048,572)
With
ab -k -n 1000 -c 7 -l URL
I get:
Server Load 8.6 (4 CPUs)
 
Is this a new website? RAM does that on new sites and it's natural to see it spike for a while. If it's not new then you can take me out of the conversation as I wouldn't know. But I wanted to mention that a brand new site will experience spikes in RAM for a while before it starts to balance out.
 
Is this a new website? RAM does that on new sites and it's natural to see it spike for a while. If it's not new then you can take me out of the conversation as I wouldn't know. But I wanted to mention that a brand new site will experience spikes in RAM for a while before it starts to balance out.
Yes it's a new site, I made something like 1'000 pageviews for test though, and really many apache bench test. Is your point still valid?
Another question: server load isn't relative to CPU? My problem is with CPU, not with RAM.
 
it isn't at the moment, I'll implement it before launching the site, but I would expect 4vCPU 4GB RAM to be capable to handle more than 3 concurrent requests.
I agree, something else is up. You mention it is a VPS, perhaps the physical host is oversubscribed?

What happens if you perform ab against a static html file?
 
Have you run TOP to see what might be showing?
yes, there's mysqld with max 10% cpu
then max 3 php-cgi process, with between 4% and 16% CPU each one, with I'd say average of 8%CPU each one.

In the last test, with CPU at something like 50%, server load was at 3.08. Is this normal?
KVM or OpenVZ? What type of disk subsystem?
KVM. How can I check the disk subsystem?
 
Last edited:
What happens if you perform ab against a static html file?
I think this is a bad result.
With:
ab -k -n 1000000 -c 4 -l URL
I've load average at over 3.00, with 6 httpd process with 37% CPU each one when I run TOP.
 
Last edited:
In the last test, with CPU at something like 50%, server load was at 3.08. Is this normal?

Not really. Your loads shouldn't be anywhere close to that with 4 concurrent users. I wouldn't think those processes would be using that much CPU either, so that's a little....odd.
 
opcache will matter as PHP will require more CPU, almost double on average without it. It's unlikely to be I/O wait or disk related, after the first couple of XF page requests because Mysql will have that data in its RAM buffers. Mysql could be the cause of higher I/O wait if it's not on localhost, and the network it's on has high usage.

Make sure you're not running a default mysql config, they tend to be horrible with too low a setting for the buffer pool. And if you have changed the config, make sure you haven't given it too large a buffer pool as you may be overcommitting the amount of RAM available hence it's hitting swap. I'd go no higher than 1GB on a 4GB machine, so you have resources available for PHP, Apache and processes.

Install glances. You get everything top has, plus a lot more info about network utilization, disk and overall I/O use, CPU loads, I/O wait, etc.

Remember with a VPS its a good bet you don't actually have dedicated RAM, and there's always a chance the host server has overcommitted RAM. VPSs don't tend to be about power, they are generally about having the flexibility of a dedicated with full root. If you want to have dedicated resources, you'll need to go with a VDS (virtual dedicated server), which gives you a fixed dedicated block of ram.
 
opcache will matter as PHP will require more CPU, almost double on average without it. It's unlikely to be I/O wait or disk related, after the first couple of XF page requests because Mysql will have that data in its RAM buffers. Mysql could be the cause of higher I/O wait if it's not on localhost, and the network it's on has high usage.

Make sure you're not running a default mysql config, they tend to be horrible with too low a setting for the buffer pool. And if you have changed the config, make sure you haven't given it too large a buffer pool as you may be overcommitting the amount of RAM available hence it's hitting swap. I'd go no higher than 1GB on a 4GB machine, so you have resources available for PHP, Apache and processes.

Install glances. You get everything top has, plus a lot more info about network utilization, disk and overall I/O use, CPU loads, I/O wait, etc.

Remember with a VPS its a good bet you don't actually have dedicated RAM, and there's always a chance the host server has overcommitted RAM. VPSs don't tend to be about power, they are generally about having the flexibility of a dedicated with full root. If you want to have dedicated resources, you'll need to go with a VDS (virtual dedicated server), which gives you a fixed dedicated block of ram.
It is nothing to with MySQL or PHP. The OP tried on a static HTML file and had the same results.
 
I think this is a bad result.
With:
ab -k -n 1000000 -c 4 -l URL
I've load average at over 3.00, with 6 httpd process with 37% CPU each one when I run TOP.
Absolutely. If you are hitting high loads serving a static file then something is clearly wrong. At this point I would be looking at an oversubscribed host.

What is the time between each request and are you running ab on the same server? If so is ab showing up as consuming high cpu? What are the apache processes consuming CPU wise?
 
Absolutely. If you are hitting high loads serving a static file then something is clearly wrong. At this point I would be looking at an oversubscribed host.

What is the time between each request and are you running ab on the same server? If so is ab showing up as consuming high cpu? What are the apache processes consuming CPU wise?

Given Mysql and PHP have been ruled out, I concur it's probably an oversubscribed host. For instance, Digital Ocean is great for setting up things which aren't going to see much load, or for a testing environment but my experience is many of their non-CPU optimized droplets have less than stellar performance (and things get worse when you start utilizing MySQL heavily).

Who is this hosted with?
 
Given Mysql and PHP have been ruled out, I concur it's probably an oversubscribed host. For instance, Digital Ocean is great for setting up things which aren't going to see much load, or for a testing environment but my experience is many of their non-CPU optimized droplets have less than stellar performance (and things get worse when you start utilizing MySQL heavily).

Who is this hosted with?
Unfortunately the OP has not stated who he is hosting with.
 
Install glances. You get everything top has, plus a lot more info about network utilization, disk and overall I/O use, CPU loads, I/O wait, etc.

I didn't know about that one. It's a nice dashboard of the points of interest without having to check multiple things. Thanks for the tip. (y)
 
I didn't know about that one. It's a nice dashboard of the points of interest without having to check multiple things. Thanks for the tip. (y)
Unfortunately the OP has not stated who he is hosting with.
Given Mysql and PHP have been ruled out, I concur it's probably an oversubscribed host. For instance, Digital Ocean is great for setting up things which aren't going to see much load, or for a testing environment but my experience is many of their non-CPU optimized droplets have less than stellar performance (and things get worse when you start utilizing MySQL heavily).

Who is this hosted with?
Hey guys, sorry for not updating you, really busy days. I'm checking things with my host (it's managed VPS) and I'll update you as soon as they give me a feedback. Thanks again for your support, it's amazing to have such a good community! :)
 
Top Bottom