By guilhermehts
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?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
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
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.