Ok My site is working fine but when the number of visitors increases it breaks suddenly.To find out why it breaks I have been observing the behaviour of my server using the ‘htop’ command.
Using ‘htop’ I noticed that whenever the second value in the figure,
code Tasks 136 , 100 , 2 running
reaches 166 my site breaks,I get something like " 502 Gateway error" .The problem seems to be not coming from RAM because the RAM usage is just 4 to 5 GB but I have 16GB RAM.And also the CPU usage never reaches 100%.So where is the problem coming from? can anyone help me please!
My Server is information:
16GB RAM, 320 GB storage , 6 CPU
My NGinx configuration is :
worker_processes 6;
worker_connections 2000;
My PHP fpm configuration is :
pm = ondemand
pm.max_children = 100
pm.start_servers = 18
pm.min_spare_servers = 9
pm.max_spare_servers = 18
pm.process_idle_timeout = 10s;
pm.max_requests = 500
Am I missing something,I also use WP Super cache!!
Any help will be grateful,thank you in advance.
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!
Increase max_children to 150 and restart fpm. Also, check the php-fpm error log. It should have further clues on why it’s failing.
It’s happening because your max_connections is being reached. Run these commands and copy/paste the output here:
wget http://mysqltuner.pl
mv index.html mysqltuner.pl
perl mysqltuner.pl
On the last command, you might need to run it like this:
perl mysqltuner.pl --user root -pass <mysql_root_passwd>
I had the same issue and solved it by adding a SWAP to my droplet following “How To Add Swap Space on Ubuntu 20.04”
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.