• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Resolved php-fpm.sock failed +1000 users online

Dumitru

New Pleskian
Hello, the error from prels Log, nginx error
connect() to unix:///var/www/vhosts/system/domen.com/php-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream

--- this is full messages from logfile --------------------
2017/01/30 18:40:08 [error] 18036#0: *18740698 connect() to unix:///var/www/vhosts/system/domen.com/php-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream, client: 111.111.111.111, server: domen.com, request: "POST /index.php HTTP/1.1", upstream: "fastcgi://unix:///var/www/vhosts/system/domen.com/php-fpm.sock:", host: "domen.com", referrer: "http://domen.com/index.php"
-----------------------------------------------------------------------------
this is online card game then the users is more then 1200 online this error is tarting appear
sometimes then croon start to sort some data in database this error can come again
we using php7+nginx , Centos 7, Plesk 12.5.3 the same error in Plesc Onyx 17.0
avarange load cpu and ram is ok
statistics.png

soket.jpg
 
Last edited:
Out of curiosity what are pm.worker_connections and pm.max_children set too ? if i recall correct isnt the plesk default 5 children per user pool ? not sure what the worker connection limit is but sounds like you may be hitting it
 
we try different settings this is what we have now:
In attachments you can find all the stings for nginx, my.cnf, from /opt/plesk/php/php.ini,

Also I have several servers with plesk and this error is the same in plesk 12.5.30 and in Plesk and in Plesk Onyx 17.0.17

Nginx -----------
worker_processes auto;
worker_connections 200000; (we try 8000 results was worse, 400k no difference)
multi_accept on;
-------------------
 

Attachments

  • my_cnf.txt
    5.6 KB · Views: 46
  • nginx_conf.txt
    1.1 KB · Views: 39
  • php_ini.txt
    68.9 KB · Views: 29
I have this settings in Plesk
this pm.max_children for plesk php seting is not the same like php.ini at /var/www/vhosts/system/example.com/conf ?

PHP Settings
--------------------------------------------------------------
pm.process_idle_timeout = 72s
opcache.enable=1
opcache.memory_consumption=4024
opcache.max_accelerated_files=4000
opcache.revalidate_freq=60

pm = dynamic
pm.max_children = 300
pm.min_spare_servers 4
pm.start_servers = 8
pm.min_spare_servers = 14
pm.max_spare_servers = 80
pm.max_requests = 8000
memory_limit = 1G
short_open_tag = on
max_execution_time = 3600
max_input_time = 3600
log_errors = on
upload_max_filesize = 6M
post_max_size = 512M
----------------------------------------------------

And this in Nginx directives

access_log off;
keepalive_timeout 60;

#GZIP compress
gzip on;
gzip_min_length 100;
gzip_comp_level 3;

gzip_types text/plain;
gzip_types text/css
gzip_types text/javascript;
fastcgi_read_timeout 60;
-------------------------------------------
 
I wont to ask if I have pm.max_children = 300 in plesk I still need php.ini in conf file ?

ok my avarage php-fpm is 16Mb to 25mb
ps --no-headers -o "rss,cmd" -C php-fpm | awk '{ sum+=$1 } END { printf ("%d%s\n", sum/NR/1024,"M") }'
or ps -ylC php-fpm --sort:rss the RSS column shows non-swapped physical memory usage by PHP-FPM processes in kilo Bytes.
php-fpm.png

25M / 40Gb free memory on server = 1600

In my case I need
pm.max_children = 1600 ? it is right ?
 
Not sure what the first question was. I think this is the answer, anyway: PHP FPM settings are on a per-domain basis, so only what is in /var/www/vhosts/system/example.com/conf is relevant and must then be ported into the php-fpm.conf file of the domain by running # /usr/local/psa/bin/php_settings -u

The second question was, if 1600 children is good value for your server. I'd say no, because your calculation does hot consider a headroom. Normally I'd reserve 30% for unforeseen stuff. So if you come to the conclusion that 1600 is the max, better downgrade to 1120. I am not sure however, whether calculating that really helps, because in the end, your server just does not have enough resources for what your website needs. It won't work right with 1120, because that's not enough for the number of users who are surfing on it, and it won't work right with 1600 (for the reason that you already know: 1600 children will use up all available RAM).

Interesting thinking, though. Thank you for sharing your approach.
 
Back
Top