Question

Why my droplet loads forever when I have more than 400 access?

Posted July 29, 2020 216 views
WordPress

So, I have a Wordpress droplet with 4 shared vcpu and 8gb of ram. When I get about 400 simultaneous access the website gets REALLY SLOW. But my ram and cpu are like 40%.

Now that I’m posting this question, that there’s 20, 40 people online it goes well. But when I have about 400 people, the website loads really slow - but memory and CPU using 40%.

Does anyone knows what could it be and how can I solve it?

Can it be a problem with my mysql settings? Or anything else?

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.

×
1 answer

Hey @guilhermehts

There is not really a particular answer to this however you basically need to start optimizing your server configuration to get the best results given the available server resources.

It could be that you are just reaching the limitations of the server processes you are allowed to spin up.

I would suggest you try to use the ondemand for the process manager pm, only set max children and keep changing this number and monitor by your CPU load per second (via https://loader.io for example) until you reach the best spot, where you are able to serve a certain load without killing your server.

vi /etc/php/PHP_VERSION/fpm/pool.d/www.conf

Replace PHP_VERSION by the current version of PHP you are using (also I am assuming you are using PHP-FPM).

Maybe start by these:

pm = ondemand
pm.max_children = 100
pm.start_servers = 2
pm.process_idle_timeout = 10s;
pm.max_requests = 10000

So you keep increasing or decreasing the pm.max_children and pm.max_requests then run load tests via loader.io to see the impact and re-adjust accordingly. htop is a pretty cool tool to monitory CPU utilization.

Note: It’s a good idea to first test the limits using a PHP page that does not use the database. Also it will not hurt to do some caching for those pages with heavy DB queries.

I hope this helps.

Islam @ SimpleBackups

  • So, the problem seems to be with firewall or something. Because when I use https it gets really slow. When I try just http it loads fast.

    I created a clean index.html file just to check the speed without mysql or anything else. Even this blank file, with https is REALLY slow. Any thoughts about it?

Submit an Answer