Nginx & php Error in EC2 with LB

0

How to solve this and Could this cause the Request time out error?

Get [pool www] server reached pm.max_children setting (5), consider raising it in /var/log/php8.1-fpm.log

Get 768 worker_connections are not enough in /var/log/nginx/error.log

질문됨 한 달 전281회 조회
1개 답변
2
수락된 답변

Hello.

server reached pm.max_children setting (5), consider raising it​/var/log/php8.1-fpm.log

The number of "pm.max_children" is insufficient, so please increase it.
I think there is a configuration file in "/etc/php-fpm.conf" etc., so please edit it there.
After editing, restart the php-fpm process using the "sudo systemctl restart php-fpm" command.

768 worker_connections are not enough​/var/log/nginx/error.log

I think there will be a timeout error.
"worker_connections are not enough​" indicates that the number of simultaneous connections is insufficient, so if there are more accesses than can be processed, a timeout error will occur.
I think you need to increase the value of "worker_connections" as mentioned in the stackoverflow answer below.
https://stackoverflow.com/questions/56723449/nginx-error-1024-worker-connections-are-not-enough

profile picture
전문가
답변함 한 달 전
profile picture
전문가
검토됨 24일 전
  • How can I know the correct numbers to input for the increase, or what is recommended?

  • I often calculate numbers using the following calculations.

    pm.max_children = available memory of instance / average memory usage of php-fpm process
    

    If you are using Linux, you can get the average memory used by the php-fpm process using the following command.

    ps --no-headers -o "rss,cmd" -C php-fpm | awk '{ sum+=$1 } END { printf ("%d%s\n", sum/NR/1024,"M") }'
    

    I often set "worker_connections" to about twice the number shown in the error. In your case, I think it would be a good idea to set it to around "1,536". Be careful not to set the number larger than "worker_rlimit_nofile". https://nginx.org/en/docs/ngx_core_module.html#worker_connections

    It should be kept in mind that this number includes all connections (e.g. connections with proxied servers, among others), not only connections with clients. Another consideration is that the actual number of simultaneous connections cannot exceed the current limit on the maximum number of open files, which can be changed by worker_rlimit_nofile.

    You can check the number of files that can be handled by the OS using the following command.

    cat /proc/sys/fs/file-max
    

    Therefore, I think it is best to calculate "worker_rlimit_nofile" as follows.

    worker_rlimit_nofile = Number of files that can be handled by the OS / Number of Nginx processes
    

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠