Nginx slow connect

redgoals nginx-forum at
Thu Mar 8 11:52:34 UTC 2012

Im trying to diagnose a connection issue with nginx on debian. there is
an delay of anything from 2-10 seconds on the connection, im using curl
to test:

curl -o /dev/null -w "Connect: %{time_connect} TTFB:
%{time_starttransfer} Total time: %{time_total} \n" -s
    Connect: 0.657 TTFB: 1.183 Total time: 7.150

Here is a pastebin of the tcpdump output for the curl request above:

Server load averages 0.5 and never goes above 0.10

I have also tested using from different locations and
the same connection issue exists.

the files are served from an ssd mounted on another machine.

Linux main 2.6.32-5-amd64 #1 SMP Wed May 18 23:13:22 UTC 2011 x86_64

nginx conf:

    user www-data;
    worker_processes  4;
    worker_rlimit_nofile 802768;
    error_log  /var/log/nginx/error.log;
    pid        /var/run/;

    events {
    use epoll;
    worker_connections 60000;
    multi_accept on;

    http {
	include       /etc/nginx/mime.types;

	#  access_log	/var/log/nginx/access.log;
	access_log off;
	sendfile        off;
	keepalive_timeout  75;
	tcp_nodelay        on;
	keepalive_requests   2000;
	connection_pool_size       8192;
	client_body_buffer_size     1024K;
	client_header_buffer_size   8k;
	client_max_body_size          10M;
	fastcgi_buffers 4 256k;
	fastcgi_buffer_size 128k;
	fastcgi_busy_buffers_size 256k;
	large_client_header_buffers 8 8k;
	ignore_invalid_headers          on;

	client_header_timeout  60;	
	client_body_timeout    60;
	send_timeout          60;	

	output_buffers   8 32k;
	postpone_output  0;
	server_name_in_redirect off;
	server_tokens           off;

	tcp_nopush  on;

	gzip on;
	gzip_min_length  1100;
	gzip_buffers    32 8k;
        gzip_comp_level 2;
	gzip_types       text/plain text/html application/x-javascript text/xml
text/css text/javascript;
	gzip_vary on;

	include /etc/nginx/conf.d/*.conf;
	include /etc/nginx/sites-enabled/*;

sysctl here ->

    open_file_cache max=5000 inactive=20s;
    open_file_cache_valid    30s;
    open_file_cache_min_uses 2;
    open_file_cache_errors   on;

    server {
	listen   80 ; ## listen for ipv4

	root /mnt/ssd/www/static;

	location ~* \.(css|js)$ {

	expires max;
	add_header Pragma public;
	add_header Cache-Control "public, must-revalidate, proxy-revalidate";

ifconfig eth0:
    eth0  Link encap:Ethernet  HWaddr 00:15:17:26:b4:bd  
          inet addr:x.x.x.x  Bcast:x.x.x.x  Mask:
          inet6 addr: fe80::215:17ff:fe26:b4bd/64 Scope:Link
          RX packets:1136534270 errors:0 dropped:0 overruns:0 frame:0
          TX packets:623191419 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:174357516836 (162.3 GiB)  TX bytes:323522620298
(301.3 GiB)

cat /proc/cpuinfo:

	model name	: Intel(R) Core(TM)2 Quad CPU    Q6600  @ 2.40GHz

cat /proc/meminfo:

    MemTotal:        4058884 kB
    MemFree:         3366684 kB
    Buffers:          117632 kB
    Cached:           288320 kB

Posted at Nginx Forum:,223627,223627#msg-223627

More information about the nginx mailing list