I have problem with php-fpm where it sometimes get 502 error.
Server specification
Intel(R) Xeon(R) CPU E5-2670 0 @ 2.60GHz [16 cores]
load average: 0.69, 0.56, 0.89
MiB Mem : 31919.7 total, 15710.0 free, 3251.9 used, 12957.8 buff/cache
MiB Swap: 16124.0 total, 16124.0 free, 0.0 used. 28173.1 avail Mem
Here is my php fpm configuration
request_slowlog_timeout = 30s
slowlog = var/log/php-fpm-dsimlife.logs
listen.allowed_clients = 127.0.0.1
pm = ondemand
pm.max_children = 50
pm.start_servers = 0
pm.min_spare_servers = 1
pm.max_spare_servers = 5
pm.max_requests = 20
I have no idea why but it sometimes got error. Here is my php fpm log
[11-Oct-2022 09:16:10] NOTICE: [pool dsimlife-user] child 1061161 exited with code 0 after 7.514844 seconds from start
[11-Oct-2022 09:16:10] NOTICE: [pool dsimlife-user] child 1061182 started
[11-Oct-2022 09:16:12] NOTICE: [pool dsimlife-user] child 1061167 exited with code 0 after 6.608686 seconds from start
[11-Oct-2022 09:16:12] NOTICE: [pool dsimlife-user] child 1061186 started
[11-Oct-2022 09:16:12] NOTICE: [pool dsimlife-user] child 1061168 exited with code 0 after 6.977370 seconds from start
[11-Oct-2022 09:16:12] NOTICE: [pool dsimlife-user] child 1061188 started
[11-Oct-2022 09:16:14] NOTICE: [pool dsimlife-user] child 1061171 exited with code 0 after 6.732083 seconds from start
[11-Oct-2022 09:16:14] NOTICE: [pool dsimlife-user] child 1061190 started
[11-Oct-2022 09:16:14] NOTICE: [pool dsimlife-user] child 1061174 exited with code 0 after 6.031707 seconds from start
[11-Oct-2022 09:16:14] NOTICE: [pool dsimlife-user] child 1061191 started
[11-Oct-2022 09:16:16] NOTICE: [pool dsimlife-user] child 1061182 exited with code 0 after 5.571517 seconds from start
[11-Oct-2022 09:16:16] NOTICE: [pool dsimlife-user] child 1061196 started
[11-Oct-2022 09:16:16] NOTICE: [pool dsimlife-user] child 1061178 exited with code 0 after 6.269093 seconds from start
[11-Oct-2022 09:16:16] NOTICE: [pool dsimlife-user] child 1061197 started
[11-Oct-2022 09:16:16] NOTICE: [pool dsimlife-user] child 1061181 exited with code 0 after 6.235917 seconds from start
[11-Oct-2022 09:16:16] NOTICE: [pool dsimlife-user] child 1061198 started
[11-Oct-2022 09:16:19] NOTICE: [pool dsimlife-user] child 1061186 exited with code 0 after 6.761450 seconds from start
[11-Oct-2022 09:16:19] NOTICE: [pool dsimlife-user] child 1061207 started
[11-Oct-2022 09:16:20] NOTICE: [pool dsimlife-user] child 1061188 exited with code 0 after 7.705888 seconds from start
[11-Oct-2022 09:16:20] NOTICE: [pool dsimlife-user] child 1061208 started
[11-Oct-2022 09:16:20] NOTICE: [pool dsimlife-user] child 1061191 exited with code 0 after 5.793451 seconds from start
[11-Oct-2022 09:16:20] NOTICE: [pool dsimlife-user] child 1061209 started
[11-Oct-2022 09:16:22] NOTICE: [pool dsimlife-user] child 1061190 exited with code 0 after 7.254953 seconds from start
[11-Oct-2022 09:16:22] NOTICE: [pool dsimlife-user] child 1061211 started
[11-Oct-2022 09:16:22] NOTICE: [pool dsimlife-user] child 1061196 exited with code 0 after 6.087081 seconds from start
[11-Oct-2022 09:16:22] NOTICE: [pool dsimlife-user] child 1061213 started
[11-Oct-2022 09:16:22] NOTICE: [pool dsimlife-user] child 1061198 exited with code 0 after 5.729508 seconds from start
[11-Oct-2022 09:16:22] NOTICE: [pool dsimlife-user] child 1061215 started
[11-Oct-2022 09:16:22] NOTICE: [pool dsimlife-user] child 1061197 exited with code 0 after 6.124852 seconds from start
[11-Oct-2022 09:16:22] NOTICE: [pool dsimlife-user] child 1061216 started
[11-Oct-2022 09:16:25] NOTICE: [pool dsimlife-user] child 1061207 exited with code 0 after 6.206840 seconds from start
[11-Oct-2022 09:16:25] NOTICE: [pool dsimlife-user] child 1061221 started
[11-Oct-2022 09:16:25] NOTICE: [pool dsimlife-user] child 1061208 exited with code 0 after 5.254939 seconds from start
[11-Oct-2022 09:16:25] NOTICE: [pool dsimlife-user] child 1061224 started
Everything seems to be fine. I know the problem of 502 caused by backend but looking on the request. My server only receive about 4-7 requests/second. Have no idea why it can lead to 502. I really appreciate any answers