• Good day,

    We were trying to go live with our wordpress website and it was all fine for 8 hours initially after going live. Then we had a traffic of 1800 simultaneous users and the website started showing Database connection error. The website was hosted in Cloud server with 16 GB RAM. When we contacted the hosting team they said it maybe due to max_concurrent_users set at 60. We have now moved to VPS server and set max_concurrent_users to 2000 but when we do load testing again the website is showing the same error of Database connection error. 

    We feel the wordpress is opening up a connection and then not closing it before the page request is complete. This leaves the connection open which in turn causes load issues. Can anybody here advise if you have faced this and how did you overcome this with a solution? 

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hey,

    The database connection error definitely comes due to hitting or or another limit within your website. I’d suggest running another load test on your website, while having the database open (for example PHPmyAdmin), and in the SQL tab, write a command line “SHOW PROCESSLIST” (https://mariadb.com/kb/en/show-processlist/)

    You will see some rows, that are showing currently actively running processes. So you could easily check if the issue is actually related to max_user_connections.

    If there are no indicators (like lot’s of processes there), but your website is still facing database connection issues, I’d suggest to also investigate a bunch of other possible limits, like CPU.

    Additionally, make sure to enable WP_Debug, and all other possible logs on your website/server, to see if any additional error messages would appear that could help identifying exact error.

    Thread Starter agilesaustralia


    Thanks appreciate your reply, appreciate it. We did the load test again with just 100 users and while observing SQL tab the CPU was reaching 100% in no time (just 100 users), need to understand why its reaching 100% for mysql connection.

    Keep in mind that saying “a cloud server with 16GB or RAM” doesn’t tell anyone anything about the specs of the server. For all anyone knows it could be a 25-year-old 0.6MHz processor that’s had 16GB of RAM dumped on it. 🙂

    In cases like this RAM is not normally the issue. Normally this comes from CPU and network resources. If you’re hosting the database(s) on the same server as the website then network is not an issue, so that would mean a lack of CPU power.

    Also remember that a lot of users = a lot of resource use. Systems like Cloudflare or using a good caching plugin can mitigate that to an extent, but no matter what there’s always going to be a limit that your hardware can handle.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘wordpress website breaks down when load testing saying database connection error’ is closed to new replies.