Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

We're running a fairly large site using nginx and PHP-FPM and we're getting a lot of errors as the site load is quite high. We're getting "connect() failed (110: Connection timed out) while connecting to upstream"...upstream: "fastcgi://127.0.0.1:9000"

Here's my config file for PHP-FPM.

PHP-FPM:

[www]
listen = 127.0.0.1:9000
listen.allowed_clients = 127.0.0.1
user = nginx
group = nginx
pm = dynamic
pm.max_children = 100
pm.start_servers = 20
pm.min_spare_servers = 5
pm.max_spare_servers = 35
pm.max_requests = 100

slowlog = /var/log/php-fpm/www-slow.log

php_admin_value[error_log] = /var/log/php-fpm/www-error.log
php_admin_flag[log_errors] = on

What's the recommended config/number of servers/children for a high traffic site?

We tried using Unix Sockets instead of TCP and got no noticeable improvements. Right now the errors are: connect() to unix:/var/run/php-fcgi.sock failed (11: Resource temporarily unavailable) while connecting to upstream...upstream: "fastcgi://unix:/var/run/php-fcgi.sock:"...

Thanks,

Leonard

share|improve this question
add comment

1 Answer

Use unix sockets, instead of TCP/IP. So, you'd do something like:

listen = /tmp/php.sock

If you don't want to do something like that, check your firewall rules. If you're using any sort of conntrack rules, you could easily be filling up the table for that. See if there's any log messages in dmesg about it. You shouldn't really be using conntrack on a high-load server, so disabling that is probably a good idea.

Also, check your ulimit settings. If the number of open files is set too low, you could run into issues.

share|improve this answer
    
Hi we had actually switched over from using Unix sockets to TCP as the issue was happening on Unix Sockets. I've switched back to Unix sockets with no noticeable improvement. We're also looking into caching using Varnish... –  Leonard Teo Feb 24 '12 at 11:09
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.