For a while, my server has been returning 502 Bad Gateway errors randomly during the day. Sometimes we have the same traffic and everything is fine, other times it causes 502 errors. I have a web traffic of about 50r/s and here is the CPU and RAM usage attached.
I'm using PHP FPM 7.4 with config:
pm.max_childrens = 5
pm.start_servers = 2
VPS Specs:
8 vCore
16 GB Ram
CPU & Ram Usage: click here
PHP-FPM Error Log:
server reached pm.max_children setting (5), consider raising it
If I raise the value, for one minute everything works correctly and then after all the mysql requests return the following error: Lock wait timeout exceeded; try restarting transaction. So the site is unusable.
Thanks for your help