I'm performing some load tests on my brand new server Apache/PHP/Mysql (Bitnami LAMP stack ). I'm using AWS with 1 EC2 instance behind a loadBalancer. At the moment I'm using loader.io for the tests. I'm testing a very simple API that perform this query:

select *,sleep(0.5) from debug limit 1

I added the sleep(0.5) because I wanted to see how the server behave with multiple concurrent connections and I found a bottleneck: if I run "SHOW PROCESSLIST" I can see only 5 process even if I have 10 concurrent user. The load test show that the connections are queued because the response time is growing during the test from 500 milliseconds to several seconds (depending on the duration of the test and the number of concurrent users).

I checked

select @@max_connections

and it's 151 (the default). max_user_connections is 0. What other parameter should I check to increase the number of concurrent connection on my DB?

If I run the test with 5 concurrent users, each one get a response in 500 milliseconds. If I add more concurrent users than the response time slow down.

If I run the load test on an API that does not access the DB there are no issues even with 400 concurrent users.

Monitoring with HTOP I see:

Tasks: 34, 245 thr; 2 running

Could be here the issue?

Thanks a lot

  • (Did you ask this in another forum?)
    – Rick James
    Commented Feb 22, 2016 at 16:09

2 Answers 2


The solution was actually very easy:

The Bitnami LAMP stack I'm using is configured with PHP-FPM, so the configuration is not on the apache side but in php/etc/common.conf


inreasing the pm.max_children=5 solved the issue.

SHOW GLOBAL STATUS LIKE 'Max_used_connections';

will give the peak number of connections since mysqld started.

Do not run the benchmark as root. There is one extra connection reserved so that root can connect even when max_connections is reached.

As with most benchmarks, it is not measuring anything very related to real life. You are possibly blocking on the first row of debug.


would not be hitting a table, so would probably fill up 151 connections (assuming you could launch them fast enough). Or you would find that you maxed out Apache' MaxClients. Or the benchmark program's capacity. You would find low CPU usage, etc.

  • If I test the same code on my local machine with hundreds of clients I find 65 running processes, so I expect the same result also on the server. I know that I'm not measuring anything very related to real life, but at least I expect to see more than 5 concurrent connection. Commented Feb 22, 2016 at 16:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.