Random Instant 502 Bad Gateway Errors

Joe frumentius at gmail.com
Sat May 29 22:46:16 MSD 2010


So yes, I agree with you Loyet.
Currently using apc combined with the fpm spawn.
Frequently fpm restarted, and might be raising up the children in the
future.
We should take care about it very well, based on daily usage experience, to
get the good nginx and fpm tune configuration.


Regards,
Joe


2010/5/30 Jérôme Loyet <jerome at loyet.net>

> 2010/5/29 Joe <frumentius at gmail.com>:
> > Usually using 5 is quiet enough.
>
> either you have a well optimized website with a 99% cache ratio or you
> don't have traffic. In the real world, there is so much web apps which
> consume a lot of resources and for thoses you'll need much more than 5
> children to handle them.
> >
> >
> > Regards,
> > Joe
> >
> >
> > 2010/5/30 Michael Shadle <mike503 at gmail.com>
> >>
> >> 150 children is quite a lot. Sure you need that? :)
> >>
> >> On May 29, 2010, at 6:02 AM, "TheCrach" <nginx-forum at nginx.us> wrote:
> >>
> >>> Hi,
> >>>
> >>> I'm French and I've some problem with nginx 0.8.38 and PHP-FPM 5.3.0
> with
> >>> Suhosin patch :/
> >>> I've got random instant 502 Bad Gateway errors, generaly a refresh make
> >>> the page works again but it's really anoying.
> >>>
> >>> Nginx Config :
> >>> [code]
> >>> user www;
> >>> worker_processes 1;
> >>> daemon on;
> >>>
> >>> error_log /var/log/nginx/error.log;
> >>> pid /var/run/nginx.pid;
> >>>
> >>> worker_rlimit_nofile 32000;
> >>>
> >>> events {
> >>>   worker_connections  4096;
> >>>   use epoll;
> >>> }
> >>>
> >>> http {
> >>>
> >>>   include       mime.types;
> >>>   default_type  text/plain;
> >>>
> >>>   limit_zone http $binary_remote_addr 1m;
> >>>   limit_zone https $binary_remote_addr 1m;
> >>>
> >>>   client_body_timeout 8;
> >>>   client_header_timeout 5;
> >>>   keepalive_timeout 5;
> >>>   keepalive_requests 10;
> >>>   send_timeout 8;
> >>>
> >>>   client_max_body_size 512k;
> >>>
> >>>   access_log off;
> >>>   error_log off;
> >>>
> >>>   client_header_buffer_size    16k;
> >>>   large_client_header_buffers  16 16k;
> >>>
> >>>   output_buffers   2 32k;
> >>>   postpone_output  1460;
> >>>
> >>>   sendfile         on;
> >>>   tcp_nopush       on;
> >>>   tcp_nodelay      on;
> >>>   reset_timedout_connection on;
> >>>
> >>>   ignore_invalid_headers on;
> >>>   autoindex on;
> >>>   msie_padding on;
> >>>
> >>>   gzip  on;
> >>>   gzip_http_version 1.1;
> >>>   gzip_vary on;
> >>>   gzip_comp_level 6;
> >>>   gzip_proxied any;
> >>>   gzip_types text/plain text/css application/json
> >>> application/x-javascript text/xml application/xml application/xml+rss
> >>> text/javascript;
> >>>   gzip_buffers 16 16k;
> >>>   gzip_disable “MSIE [1-6].(?!.*SV1)”;
> >>>
> >>>   server
> >>>   {
> >>>     listen 80 default rcvbuf=8192 sndbuf=16384 backlog=65536;
> >>>     index  index.html index.htm index.php;
> >>>     root   /home/www/;
> >>>
> >>>     limit_conn http 10;
> >>>
> >>>     access_log off;
> >>>
> >>>    location ~* \.(ico|css|js|gif|jpe?g|png)(\?[0-9]+)?$ {
> >>>     expires 3600;
> >>>     break;
> >>>    }
> >>>
> >>>    location ~ \.php(/|$) {
> >>>        include fastcgi_params;
> >>>    }
> >>>
> >>>    location ~ \.php5(/|$) {
> >>>        include fastcgi_params;
> >>>    }
> >>>
> >>>    location ~ \.php4(/|$) {
> >>>        include fastcgi_params;
> >>>    }
> >>>
> >>>    location /cache/status {
> >>>        stub_status on;
> >>>        access_log off;
> >>>    }
> >>>   }
> >>> [/code]
> >>>
> >>> Fastcgi params :
> >>>
> >>> [code]
> >>> fastcgi_connect_timeout 5;
> >>> fastcgi_send_timeout 8;
> >>> fastcgi_buffer_size 512k;
> >>> fastcgi_buffers 64 64k;
> >>> fastcgi_busy_buffers_size 512k;
> >>> fastcgi_temp_file_write_size 512k;
> >>> fastcgi_ignore_client_abort on;
> >>> fastcgi_intercept_errors on;
> >>> fastcgi_read_timeout 45;
> >>>
> >>> fastcgi_pass   unix:/tmp/php.socket;
> >>> fastcgi_index  index.php;
> >>> fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
> >>> fastcgi_param  QUERY_STRING       $query_string;
> >>> fastcgi_param  REQUEST_METHOD     $request_method;
> >>> fastcgi_param  CONTENT_TYPE       $content_type;
> >>> fastcgi_param  CONTENT_LENGTH     $content_length;
> >>> fastcgi_param  SCRIPT_NAME        $fastcgi_script_name;
> >>> 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;
> >>> fastcgi_param  SERVER_SOFTWARE    RD;
> >>> 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;
> >>> fastcgi_param  REDIRECT_STATUS    200;
> >>> [/code]
> >>>
> >>> PHP-FPM conf :
> >>>
> >>> [code]
> >>> <?xml version="1.0" ?>
> >>> <configuration>
> >>>   <section name="global_options">
> >>>       <value name="pid_file">/var/run/php5-fpm.pid</value>
> >>>       <value name="error_log">/var/log/php-fpm.log</value>
> >>>       <value name="log_level">warn</value>
> >>>       <value name="emergency_restart_threshold">60</value>
> >>>       <value name="emergency_restart_interval">1m</value>
> >>>       <value name="process_control_timeout">4s</value>
> >>>       <value name="daemonize">yes</value>
> >>>   </section>
> >>>
> >>>   <workers>
> >>>       <section name="pool">
> >>>           <value name="name">RD</value>
> >>>           <value name="listen_address">/tmp/php.socket</value>
> >>>           <value name="listen_options">
> >>>               <value name="backlog">-1</value>
> >>>               <value name="owner">www</value>
> >>>               <value name="group">www</value>
> >>>               <value name="mode">0666</value>
> >>>           </value>
> >>>
> >>>           <value name="php_defines">
> >>>           </value>
> >>>
> >>>           <value name="user">www</value>
> >>>           <value name="group">www</value>
> >>>
> >>>           <value name="pm">
> >>>               <value name="style">static</value>
> >>>               <value name="max_children">150</value>
> >>>               <value name="apache_like">
> >>>                   <value name="StartServers">25</value>
> >>>                   <value name="MinSpareServers">5</value>
> >>>                   <value name="MaxSpareServers">35</value>
> >>>               </value>
> >>>           </value>
> >>>
> >>>           <value name="request_terminate_timeout">0s</value>
> >>>           <value name="request_slowlog_timeout">0s</value>
> >>>           <value name="slowlog">/var/log/php-fpm.log.slow</value>
> >>>           <value name="rlimit_files">1024</value>
> >>>           <value name="rlimit_core">0</value>
> >>>           <value name="chroot"></value>
> >>>           <value name="chdir"></value>
> >>>           <value name="catch_workers_output">yes</value>
> >>>           <value name="max_requests">65536</value>
> >>>           <value name="allowed_clients">127.0.0.1</value>
> >>>
> >>>           <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>
> >>> [/code]
> >>>
> >>> Server config :
> >>>
> >>> [code]
> >>> Intel Corei5 (Lynnfield) 4x 2.66+ GHz 8 Mo L2 - FSB 1333 MHz
> >>> 64 bits
> >>> 8 Go DDR3
> >>> Intel SSD X25-M 2x 80 Go RAID    0/1
> >>> GigaEthernet
> >>> [/code]
> >>>
> >>> If anyone have an idea :)
> >>>
> >>> It's very strange because it's instant and random whereas it would be
> >>> timedout all the time :/
> >>>
> >>> Thank's in advance.
> >>>
> >>> Posted at Nginx Forum:
> >>> http://forum.nginx.org/read.php?2,91854,91854#msg-91854
> >>>
> >>>
> >>> _______________________________________________
> >>> nginx mailing list
> >>> nginx at nginx.org
> >>> http://nginx.org/mailman/listinfo/nginx
> >>
> >> _______________________________________________
> >> nginx mailing list
> >> nginx at nginx.org
> >> http://nginx.org/mailman/listinfo/nginx
> >
> >
> > _______________________________________________
> > nginx mailing list
> > nginx at nginx.org
> > http://nginx.org/mailman/listinfo/nginx
> >
> >
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://nginx.org/mailman/listinfo/nginx
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nginx.org/pipermail/nginx/attachments/20100530/2d508430/attachment.html>


More information about the nginx mailing list