Hello all fellow devs,
I have a problem in a production site (laravel). Sometimes(like 4-8 request an hour) the most simple requests are causing this kind of errors:
[13-Dec-2020 18:07:07] WARNING: [pool www] child 514732, script '/home/****/****/public/index.php' (request: "GET /index.php") execution timed out (71.782847 sec), terminating
When i check my access log i see that it is the most simple request. It even happens with request where there is no mysql query executed. When i look at memory usage there is 1GB available when it happens. CPU is running at 10% tops.
- I use digitalocean load balancer to redirect traffic to server.
- There are about 60-120 requests a minute per server
- It is happening on all my servers (i have 4)
- php using opcache
- mysql hosted on separate servers
- redis hosted on separate servers
- I have tried to lower and raise the fpm childs
PHP fpm settings
pm = dynamic
pm.max_children = 40
pm.start_servers = 15
pm.min_spare_servers = 15
pm.max_spare_servers = 25
;pm.process_idle_timeout = 10s;
pm.max_requests = 500
I hope you guys can help me, i have searched all over the internet but nothing works. Thank you so much.
Timo
2
Answers
So it was an issue of the redis connection.
Solution was to use tls1.2.
https://github.com/phpredis/phpredis/issues/1726
The problem come from Redis connection with TLS 1.3 (https://bugs.php.net/bug.php?id=79501)
Redis connection with TLS 1.3 is not stable.
If you connect to Redis with tls protocol, for example your Redis host is
tls://your-redis-domain-here
, PHP will use TLS 1.3 by default. To resolve this issue you have to specifytlsv1.2
in your connection, for example:tlsv1.2://your-redis-domain-here