which version are you using ?
2010/6/14 M.A.G <nginx-forum@nginx.us>:
> [b]Hello Everyone ,[/b]
> Nginx is a very good webserver and really i would like to give millions of thanks to Igor who has made this powerful webserver and dreamcat4 team who made the php-fpm, in the past 4 years i've tried Apache , Litespeed , Lighttpd , but no one of them give me the performance that Nginx gives , my problem and most people suffer from it the stability of Nginx + Php-fpm , I know it's not a Nginx issue , but we hope really to get a soloution to have our servers work in high stability with Nginx+Php-fpm , We tried lot of solotuions to make php-fpm stable like :-
> 1.Use tcp instead of sockets (we suffer from slow browsing when we use it )
> 2.Tried all sugestions in php-fpm.conf.
> 3.Use PHP without any extenstions (xcache,memcache,imagemagick)
> 4.Optimize SQL queries.
> 5.Use Innodb instead of MyISam.
> 6.Buy more ram .
> But all of this solotuions fail when our server go understress .
> The php-fpm crash and start giving this error in error_log
>
> [error] 17863#0: *3161531 connect() to unix:/tmp/php-fpm.socket failed (11: Resource temporarily unavailable) while connecting to upstream, client: 94.99.125.115, server: XXXX, request: "GET /vb/u295.html HTTP/1.1", upstream: "fastcgi://unix:/tmp/php-fpm.socket:", host: "XXXX", referrer: "XXXX"
>
> Here our config files
>
> [color=#FF0000]php-fpm.conf[/color]
>
> [quote]
> <?xml version="1.0" ?>
> <configuration>
>
> All relative paths in this config are relative to php's install prefix
>
> <section name="global_options">
>
> Pid file
> <value name="pid_file">/usr/local/logs/php-fpm.pid</value>
>
> Error log file
> <value name="error_log">/usr/local/logs/php-fpm.log</value>
>
> Log level
> <value name="log_level">notice</value>
>
> When this amount of php processes exited with SIGSEGV or SIGBUS ...
> <value name="emergency_restart_threshold">10</value>
>
> ... in a less than this interval of time, a graceful restart will be initiated.
> Useful to work around accidental curruptions in accelerator's shared memory.
> <value name="emergency_restart_interval">1m</value>
>
> Time limit on waiting child's reaction on signals from master
> <value name="process_control_timeout">5s</value>
>
> Set to 'no' to debug fpm
> <value name="daemonize">yes</value>
>
> </section>
>
> <workers>
>
> <section name="pool">
>
> Name of pool. Used in logs and stats.
> <value name="name">default</value>
>
> Address to accept fastcgi requests on.
> Valid syntax is 'ip.ad.re.ss:port' or just 'port' or '/path/to/unix/socket'
> <value name="listen_address">127.0.0.1:9000</value>
>
> <value name="listen_options">
>
> Set listen(2) backlog
> <value name="backlog">-1</value>
>
> Set permissions for unix socket, if one used.nobody
> In Linux read/write permissions must be set in order to allow connections from web server.
> Many BSD-derrived systems allow connections regardless of permissions.
> <value name="owner">php-fpm</value>
> <value name="group">php-fpm</value>
> <value name="mode">0666</value>
> </value>
>
> Additional php.ini defines, specific to this pool of workers.
> <value name="php_defines">
> <!-- <value name="sendmail_path">/usr/sbin/sendmail -t -i</value> -->
> <!-- <value name="display_errors">0</value> -->
> </value>
>
> Unix user of processes nobody
> <value name="user">php-fpm</value>
>
> Unix group of processes
> <value name="group">php-fpm</value>
>
> Process manager settings
> <value name="pm">
>
> Sets style of controling worker process count.
> Valid values are 'static' and 'apache-like'
> <value name="style">static</value>
>
> Sets the limit on the number of simultaneous requests that will be served.
> Equivalent to Apache MaxClients directive.
> Equivalent to PHP_FCGI_CHILDREN environment in original php.fcgi
> Used with any pm_style.
> <value name="max_children">16</value>
>
> Settings group for 'apache-like' pm style
> <value name="apache_like">
>
> Sets the number of server processes created on startup.
> Used only when 'apache-like' pm_style is selected
> <value name="StartServers">10</value>
>
> Sets the desired minimum number of idle server processes.
> Used only when 'apache-like' pm_style is selected
> <value name="MinSpareServers">10</value>
>
> Sets the desired maximum number of idle server processes.
> Used only when 'apache-like' pm_style is selected
> <value name="MaxSpareServers">25</value>
>
> </value>
>
> </value>
>
> The timeout (in seconds) for serving a single request after which the worker process will be terminated
> Should be used when 'max_execution_time' ini option does not stop script execution for some reason
> '0s' means 'off'
> <value name="request_terminate_timeout">0s</value>
>
> The timeout (in seconds) for serving of single request after which a php backtrace will be dumped to slow.log file
> '0s' means 'off'
> <value name="request_slowlog_timeout">0s</value>
>
> The log file for slow requests
> <value name="slowlog">logs/slow.log</value>
>
> Set open file desc rlimit
> <value name="rlimit_files">65536</value>
>
> Set max core size rlimit
> <value name="rlimit_core">0</value>
>
> Chroot to this directory at the start, absolute path
> <value name="chroot"></value>
>
> Chdir to this directory at the start, absolute path
> <value name="chdir"></value>
>
> Redirect workers' stdout and stderr into main error log.
> If not set, they will be redirected to /dev/null, according to FastCGI specs
> <value name="catch_workers_output">yes</value>
>
> How much requests each process should execute before respawn.
> Useful to work around memory leaks in 3rd party libraries.
> For endless request processing please specify 0
> Equivalent to PHP_FCGI_MAX_REQUESTS
> <value name="max_requests">800</value>
>
> Comma separated list of ipv4 addresses of FastCGI clients that allowed to connect.
> Equivalent to FCGI_WEB_SERVER_ADDRS environment in original php.fcgi (5.2.2+)
> Makes sense only with AF_INET listening socket.
> <value name="allowed_clients">127.0.0.1</value>
>
> Pass environment variables like LD_LIBRARY_PATH
> All $VARIABLEs are taken from current environment
> <value name="environment">
> <value name="HOSTNAME">$HOSTNAME</value>
> <value name="PATH">/usr/local/bin:/usr/bin:/bin</value>
> <value name="TMP">/tmp</value>
> <value name="TMPDIR">/tmp</value>
> <value name="TEMP">/tmp</value>
> <value name="OSTYPE">$OSTYPE</value>
> <value name="MACHTYPE">$MACHTYPE</value>
> <value name="MALLOC_CHECK_">2</value>
> </value>
>
> </section>
>
> </workers>
>
> </configuration>
>
>
> [/quote]
>
>
>
> [color=#FF0000]nginx.conf[/color]
>
> [quote]
> user root;
> # no need for more workers in the proxy mode
> worker_processes 16;
> worker_priority -20;
> worker_cpu_affinity 00001111 11110000 00001111 11110000 00001111 11110000 00001111 11110000 00001111 11110000 00001111 11110000 00001111 11110000 00001111 11110000;
> #error_log logs/error.log info;
>
> worker_rlimit_nofile 65536;
>
> events {
> worker_connections 1024; # you might need to increase this setting for busy servers
> use epoll;
> }
>
> http {
> server_names_hash_max_size 2048;
>
>
>
> types {
> application/zip zip;
> application/x-rar-compressed rar;
>
> text/html html htm;
> text/xml xml;
> application/atom+xml atom;
> application/rss+xml rss;
> text/css css;
> image/gif gif;
> image/jpeg jpeg jpg;
> application/x-javascript js;
> image/png png;
> image/x-icon ico;
> image/x-ms-bmp bmp;
>
> }
>
>
>
>
> default_type application/octet-stream;
>
> sendfile on;
> tcp_nopush on;
> tcp_nodelay on;
> server_tokens off;
>
>
> keepalive_timeout 2;
> gzip on;
> gzip_min_length 1100;
> gzip_buffers 4 32k;
> gzip_types application/x-javascript text/css text/plain application/xml;
> ignore_invalid_headers on;
> gzip_comp_level 9;
> gzip_vary on;
> gzip_disable "MSIE [1-6]\.";
> gzip_http_version 1.1;
> client_header_timeout 6m;
> client_body_timeout 6m;
> send_timeout 6m;
> connection_pool_size 256;
> client_header_buffer_size 16k;
> large_client_header_buffers 4 64k;
> request_pool_size 4k;
> output_buffers 32 64k;
> postpone_output 1460;
> client_body_buffer_size 1024k;
> client_max_body_size 128m;
> #Vhost Start
>
> server {
> access_log off;
> error_page 404 = /404.php;
> error_log logs/vhost-error_log warn;
> listen XXXXXX:80;
> server_name www.XXXXXXXXe.com XXXXXXXXe.com;
> root /home/XXXXXXXX/public_html;
> index index.php index.html index.htm;
> fastcgi_param SCRIPT_FILENAME /home/XXXXXXXX/public_html$fastcgi_script_name;
> fastcgi_param QUERY_STRING $query_string;
> fastcgi_index index.php;
> fastcgi_connect_timeout 300;
> fastcgi_send_timeout 300;
> fastcgi_read_timeout 300;
> fastcgi_buffers 256 16k;
> fastcgi_buffer_size 32k;
> fastcgi_param REQUEST_METHOD $request_method;
> fastcgi_param CONTENT_TYPE $content_type;
> fastcgi_param CONTENT_LENGTH $content_length;
>
> fastcgi_param REQUEST_URI $request_uri;
> fastcgi_param DOCUMENT_URI $document_uri;
> fastcgi_param DOCUMENT_ROOT $document_root;
> fastcgi_param SERVER_PROTOCOL $server_protocol;
>
> fastcgi_param GATEWAY_INTERFACE CGI/1.1;
> fastcgi_param SERVER_SOFTWARE nginx/0.7.65;
>
> fastcgi_param REMOTE_ADDR $remote_addr;
> fastcgi_param REMOTE_PORT $remote_port;
> fastcgi_param SERVER_ADDR $server_addr;
> fastcgi_param SERVER_PORT $server_port;
> fastcgi_param SERVER_NAME $server_name;
>
> location ~ /(upload/Pictures|upx/uploads)/.* {
> #error_page 404 = /ngvaild.gif;
> if (!-e $request_filename) {
> rewrite ^(.*)$ /ngvaild.gif break;
> }
>
> valid_referers none block server_names ~(XXXXXXXXe.com|google);
> if ($invalid_referer) {
>
> rewrite ^(.*)$ /ngvaild.gif break;
> }
> }
>
> location ~* \.(gif|jpg|jpeg|png|bmp)$ {
>
> if (!-e $request_filename) {
> rewrite ^(.*)$ /ngvaild.gif break;
> }
> expires 40d;
> add_header Cache-Control public;
> }
>
> location ~* \.(js|css|ico)$ {
> if (-f $request_filename) {
> break;
> }
> expires 40d;
> add_header Cache-Control public;
> }
>
>
>
> location ~ /vb/ab/.* {
>
> auth_basic "VV PROTECTED";
> auth_basic_user_file /home/XXXXXXXX/.htpasswds/public_html/vb/acp/passwd;
> fastcgi_pass 127.0.0.1:9000;
>
> location ~ /vb/acp/(plugin.php|apm_product.php|backup.php|repair.php|queries.php|diagnostic.php)$ {
> auth_basic "NO TOUCH AREA";
> auth_basic_user_file /home/XXXXXXXX/public_html/vb/acp/passwd;
> fastcgi_pass 127.0.0.1:9000;
> }
> }
>
>
>
>
>
> #####VBSEO STAFF###########
> location ~ \.php$ {
> try_files $uri /404.php;
> fastcgi_pass 127.0.0.1:9000;
> }
>
>
>
> location /vb/ {
>
> if (!-e $request_filename) {
> rewrite ^/vb/(.*)$ /vb/vbseo.php last;
> }
>
>
> }
>
>
>
>
> if ($request_filename ~ "vb/(showthread.php|external.php)$" ) {
> rewrite ^/vb/(.*)$ /vb/vbseo.php last;
> }
>
>
>
>
> rewrite ^/vb/[^/]*-f([0-9]+)\.html$ /vb/vbseo.php?vbseourl=forumdisplay..php&f=$1 last;
> rewrite ^/vb/[^/]*-f([0-9]+)p([0-9]+)\.html$ /vb/vbseo.php?vbseourl=forumdisplay.php&t=$1&page=$2 last;
> rewrite ^/vb/[^/]*-t([0-9]+)\.html$ /vb/vbseo.php?vbseourl=showthread.php&t=$1 last;
> rewrite ^/vb/[^/]*-t([0-9]+)p([0-9]+)\.html$ /vb/vbseo.php?vbseourl=showthread.php&t=$1&page=$2 last;
>
>
>
> }
>
> }
>
>
> [/quote]
>
>
> [color=#FF0000]php-fpm.log[/color]
> [quote]
> Jun 14 07:26:11.013543 [NOTICE] fpm_children_bury(), line 215: child 21907 (pool default) exited with code 0 after 1585.579475 seconds from start
> Jun 14 07:26:11.014206 [NOTICE] fpm_children_make(), line 352: child 23669 (pool default) started
> Jun 14 07:27:19.332773 [NOTICE] fpm_got_signal(), line 48: received SIGCHLD
> Jun 14 07:27:19.332892 [NOTICE] fpm_children_bury(), line 215: child 21963 (pool default) exited with code 0 after 1607.071134 seconds from start
> Jun 14 07:27:19.334142 [NOTICE] fpm_children_make(), line 352: child 23738 (pool default) started
> Jun 14 07:28:56.532830 [NOTICE] fpm_got_signal(), line 48: received SIGCHLD
> Jun 14 07:28:56.532949 [NOTICE] fpm_children_bury(), line 215: child 21910 (pool default) exited with code 0 after 1746.994550 seconds from start
> Jun 14 07:28:56.534301 [NOTICE] fpm_children_make(), line 352: child 23826 (pool default) started
> Jun 14 07:35:42.262547 [NOTICE] fpm_got_signal(), line 56: received SIGTERM
> Jun 14 07:35:42.262659 [NOTICE] fpm_pctl(), line 256: switching to 'terminating' state
> Jun 14 07:35:42.262720 [NOTICE] fpm_pctl_kill_all(), line 172: sending signal 15 SIGTERM to child 23826 (pool default)
> Jun 14 07:35:42.262735 [NOTICE] fpm_pctl_kill_all(), line 172: sending signal 15 SIGTERM to child 23738 (pool default)
> Jun 14 07:35:42.262745 [NOTICE] fpm_pctl_kill_all(), line 172: sending signal 15 SIGTERM to child 23669 (pool default)
> Jun 14 07:35:42.262757 [NOTICE] fpm_pctl_kill_all(), line 172: sending signal 15 SIGTERM to child 23664 (pool default)
> Jun 14 07:35:42.262767 [NOTICE] fpm_pctl_kill_all(), line 172: sending signal 15 SIGTERM to child 23599 (pool default)
> Jun 14 07:35:42.262778 [NOTICE] fpm_pctl_kill_all(), line 172: sending signal 15 SIGTERM to child 23407 (pool default)
> Jun 14 07:35:42.262787 [NOTICE] fpm_pctl_kill_all(), line 172: sending signal 15 SIGTERM to child 23406 (pool default)
> Jun 14 07:35:42.262796 [NOTICE] fpm_pctl_kill_all(), line 172: sending signal 15 SIGTERM to child 23386 (pool default)
> Jun 14 07:35:42.262806 [NOTICE] fpm_pctl_kill_all(), line 172: sending signal 15 SIGTERM to child 23385 (pool default)
> Jun 14 07:35:42.262816 [NOTICE] fpm_pctl_kill_all(), line 172: sending signal 15 SIGTERM to child 23384 (pool default)
> Jun 14 07:35:42.262827 [NOTICE] fpm_pctl_kill_all(), line 172: sending signal 15 SIGTERM to child 23383 (pool default)
> Jun 14 07:35:42.262837 [NOTICE] fpm_pctl_kill_all(), line 172: sending signal 15 SIGTERM to child 23382 (pool default)
> Jun 14 07:35:42.262846 [NOTICE] fpm_pctl_kill_all(), line 172: sending signal 15 SIGTERM to child 23381 (pool default)
> Jun 14 07:35:42.262856 [NOTICE] fpm_pctl_kill_all(), line 172: sending signal 15 SIGTERM to child 23380 (pool default)
> Jun 14 07:35:42.262864 [NOTICE] fpm_pctl_kill_all(), line 172: sending signal 15 SIGTERM to child 23379 (pool default)
> Jun 14 07:35:42.262874 [NOTICE] fpm_pctl_kill_all(), line 172: sending signal 15 SIGTERM to child 23378 (pool default)
> Jun 14 07:35:42.262885 [NOTICE] fpm_pctl_kill_all(), line 181: 16 children are still alive
> Jun 14 07:35:42.262897 [NOTICE] fpm_got_signal(), line 48: received SIGCHLD
> Jun 14 07:35:42.262911 [NOTICE] fpm_got_signal(), line 48: received SIGCHLD
> Jun 14 07:35:42.262921 [NOTICE] fpm_got_signal(), line 48: received SIGCHLD
> Jun 14 07:35:42.262930 [NOTICE] fpm_got_signal(), line 48: received SIGCHLD
> Jun 14 07:35:42.262939 [NOTICE] fpm_got_signal(), line 48: received SIGCHLD
> Jun 14 07:35:42.262949 [NOTICE] fpm_got_signal(), line 48: received SIGCHLD
> Jun 14 07:35:42.262959 [NOTICE] fpm_got_signal(), line 48: received SIGCHLD
> Jun 14 07:35:42.262967 [NOTICE] fpm_got_signal(), line 48: received SIGCHLD
> Jun 14 07:35:42.262977 [NOTICE] fpm_got_signal(), line 48: received SIGCHLD
> Jun 14 07:35:42.334775 [NOTICE] fpm_got_signal(), line 48: received SIGCHLD
> Jun 14 07:35:42.335303 [WARNING] fpm_children_bury(), line 215: child 23384 (pool default) exited on signal 15 SIGTERM after 763.084931 seconds from start
> Jun 14 07:35:42.335543 [WARNING] fpm_children_bury(), line 215: child 23599 (pool default) exited on signal 15 SIGTERM after 579.075245 seconds from start
> Jun 14 07:35:42.337335 [NOTICE] fpm_got_signal(), line 48: received SIGCHLD
> Jun 14 07:35:42.337485 [WARNING] fpm_children_bury(), line 215: child 23406 (pool default) exited on signal 15 SIGTERM after 758.629594 seconds from start
> Jun 14 07:35:42.339772 [NOTICE] fpm_got_signal(), line 48: received SIGCHLD
> Jun 14 07:35:42.339906 [WARNING] fpm_children_bury(), line 215: child 23738 (pool default) exited on signal 15 SIGTERM after 503.005777 seconds from start
> Jun 14 07:35:42.363643 [NOTICE] fpm_got_signal(), line 48: received SIGCHLD
> Jun 14 07:35:42.363953 [WARNING] fpm_children_bury(), line 215: child 23386 (pool default) exited on signal 15 SIGTERM after 761.216650 seconds from start
> Jun 14 07:35:42.366466 [NOTICE] fpm_got_signal(), line 48: received SIGCHLD
> Jun 14 07:35:42.366622 [WARNING] fpm_children_bury(), line 215: child 23381 (pool default) exited on signal 15 SIGTERM after 771.111027 seconds from start
> Jun 14 07:35:42.372580 [NOTICE] fpm_got_signal(), line 48: received SIGCHLD
> Jun 14 07:35:42.372817 [WARNING] fpm_children_bury(), line 215: child 23385 (pool default) exited on signal 15 SIGTERM after 762.486028 seconds from start
> Jun 14 07:35:42.375048 [NOTICE] fpm_got_signal(), line 48: received SIGCHLD
> Jun 14 07:35:42.375380 [WARNING] fpm_children_bury(), line 215: child 23669 (pool default) exited on signal 15 SIGTERM after 571.361207 seconds from start
> Jun 14 07:35:42.375808 [NOTICE] fpm_got_signal(), line 48: received SIGCHLD
> Jun 14 07:35:42.375877 [WARNING] fpm_children_bury(), line 215: child 23380 (pool default) exited on signal 15 SIGTERM after 780.064919 seconds from start
> Jun 14 07:35:42.376968 [NOTICE] fpm_got_signal(), line 48: received SIGCHLD
> Jun 14 07:35:42.377045 [WARNING] fpm_children_bury(), line 215: child 23826 (pool default) exited on signal 15 SIGTERM after 405.842758 seconds from start
> Jun 14 07:35:42.378739 [NOTICE] fpm_got_signal(), line 48: received SIGCHLD
> Jun 14 07:35:42.378850 [WARNING] fpm_children_bury(), line 215: child 23407 (pool default) exited on signal 15 SIGTERM after 757.885698 seconds from start
> Jun 14 07:35:42.379358 [NOTICE] fpm_got_signal(), line 48: received SIGCHLD
> Jun 14 07:35:42.379417 [WARNING] fpm_children_bury(), line 215: child 23383 (pool default) exited on signal 15 SIGTERM after 764.122037 seconds from start
> Jun 14 07:35:42.381932 [NOTICE] fpm_got_signal(), line 48: received SIGCHLD
> Jun 14 07:35:42.382015 [WARNING] fpm_children_bury(), line 215: child 23664 (pool default) exited on signal 15 SIGTERM after 571.862174 seconds from start
> Jun 14 07:35:42.382702 [NOTICE] fpm_got_signal(), line 48: received SIGCHLD
> Jun 14 07:35:42.382791 [WARNING] fpm_children_bury(), line 215: child 23379 (pool default) exited on signal 15 SIGTERM after 791.325330 seconds from start
> Jun 14 07:35:42.382855 [WARNING] fpm_children_bury(), line 215: child 23382 (pool default) exited on signal 15 SIGTERM after 768.029386 seconds from start
> Jun 14 07:35:42.382866 [NOTICE] fpm_got_signal(), line 48: received SIGCHLD
> Jun 14 07:35:42.382976 [NOTICE] fpm_got_signal(), line 48: received SIGCHLD
> Jun 14 07:35:42.383034 [WARNING] fpm_children_bury(), line 215: child 23378 (pool default) exited on signal 15 SIGTERM after 794.374679 seconds from start
> Jun 14 07:35:42.383044 [NOTICE] fpm_pctl_exit(), line 81: exiting, bye-bye!
> Jun 14 07:40:14.250127 [NOTICE] fpm_unix_init_main(), line 284: getrlimit(nofile): max:1024, cur:1024
> Jun 14 07:40:14.278470 [NOTICE] fpm_event_init_main(), line 88: libevent: using epoll
> Jun 14 07:40:14.288697 [NOTICE] fpm_init(), line 52: fpm is running, pid 4587
> [/quote]
>
> I really hope my problem to got fixed , because i am really tried of a lot of crashes every 1-5 hours .
>
>
> Thanks ,
> M.A.G
>
> Posted at Nginx Forum: http://forum.nginx.org/read.php?3,97959,97959#msg-97959
>
>