question about nginx as http forward proxy

Roman Vasilyev roman at anchorfree.com
Fri May 28 06:24:23 MSD 2010


Hi,

I'm trying to use nginx as forward proxy with high loaded server on 
CentOS 5.4. My stats showing good results (about memory/cpu usage and 
traffic). But Apache benchmark showing some percentage of lagged 
sessions. If I'm using Apache as forward proxy I don't see this lags.

Can you recommend me some config changes or may be I can boost nginx up 
other way?

ab -n 1000 -c 5 http://www.google.com/
Apache:
............
Connection Times (ms)
               min  mean[+/-sd] median   max
Connect:       29   43   9.4     40      80
Processing:   120  155  27.7    151     604
Waiting:       61   87  23.2     81     389
Total:        157  197  28.2    192     649
Percentage of the requests served within a certain time (ms)
   50%    192
.......
   99%    277
  100%    649 (longest request)
============================================
Nginx:
..................
Connection Times (ms)
               min  mean[+/-sd] median   max
Connect:       30   47 164.3     35    3035
Processing:   110  164  58.1    157    1005
Waiting:       61   85  37.9     77     604
Total:        150  211 174.4    196    3226

Percentage of the requests served within a certain time (ms)
   50%    196
................
   99%    487
  100%   3226 (longest request)
============================================
Part of my forward proxy config:
worker_processes  32;
worker_rlimit_core 10000000000000000;
working_directory /tmp;
events {
     use epoll;
     worker_connections  10240;
     multi_accept on;
}
http {
     af_headers on;
     include       mime.types;
     default_type  text/plain;

     access_log off;

     sendfile        on;
     tcp_nopush     off;

     keepalive_timeout  1;
     keepalive_requests 30;

     gzip  on;
     gzip_comp_level 6;
     gzip_buffers 16 8k;
     gzip_types text/plain text/css application/json 
application/x-javascript text/xml application/xml application/xml+rss 
text/javascript;
     gzip_disable "MSIE [1-6].(?!.*SV1)";

     resolver 127.0.0.1;

     server {
         location ~ /extern/login_status\.php  {
           if ( $host ~* facebook.com ) {
             return 403;
           }
                 }

         gzip_proxied any;

         gunzip on;
         gunzip_strict off;
         gunzip_options any content_type 200;

         error_log /etc/nginx/logs/error.log alert;
         listen       7070;
         server_name  hss;

         location / {
            proxy_pass  http://$host$request_uri;
            proxy_buffering off;
            proxy_buffers 16 64k;
            proxy_buffer_size 64k;
         }
     }
}



More information about the nginx mailing list