GabrielSoarez Posted July 5, 2020 Posted July 5, 2020 Estou tendo problemas de lentidão usando nginx + php-fpm. Com cerca de 20 mil acessos simultâneos o site fica lento, bastante lento, sei que isto é devido aos processos do php-fpm. O código php é limpo e bem estruturado, rodo o site em uma máquina com as seguintes configurações: 8GB de ram, 6vcpus, rede 1gbps. Configuração do meu php-fpm: ; The number of child processes to be created when pm is set to 'static' and the ; maximum number of child processes when pm is set to 'dynamic' or 'ondemand'. ; This value sets the limit on the number of simultaneous requests that will be ; served. Equivalent to the ApacheMaxClients directive with mpm_prefork. ; Equivalent to the PHP_FCGI_CHILDREN environment variable in the original PHP ; CGI. The below defaults are based on a server without much resources. Don't ; forget to tweak pm.* to fit your needs. ; Note: Used when pm is set to 'static', 'dynamic' or 'ondemand' ; Note: This value is mandatory. pm.max_children = 75 ; The number of child processes created on startup. ; Note: Used only when pm is set to 'dynamic' ; Default Value: min_spare_servers + (max_spare_servers - min_spare_servers) / 2 pm.start_servers = 20 ; The desired minimum number of idle server processes. ; Note: Used only when pm is set to 'dynamic' ; Note: Mandatory when pm is set to 'dynamic' pm.min_spare_servers = 20 ; The desired maximum number of idle server processes. ; Note: Used only when pm is set to 'dynamic' ; Note: Mandatory when pm is set to 'dynamic' pm.max_spare_servers = 35 ; The number of seconds after which an idle process will be killed. ; Note: Used only when pm is set to 'ondemand' ; Default Value: 10s pm.process_idle_timeout = 5s; ; The number of requests each child process should execute before respawning. ; This can be useful to work around memory leaks in 3rd party libraries. For ; endless request processing specify '0'. Equivalent to PHP_FCGI_MAX_REQUESTS. ; Default Value: 0 pm.max_requests = 500 rlimit_files = 350000 rlimit_core = unlimited Também uso o opcache, fiz alterações no kernel, nginx etc... Tudo configurado conforme os recursos da máquina. Quando olho o consumo não fica nem 40% de cpu/ram/rede. 0 Quote
Jaime Silva Posted July 5, 2020 Posted July 5, 2020 O Nginx faz cache? Se não o faz, considere isso. 0 Quote Não há bem nem mal que dure para sempre. Um dia tudo acaba.
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.