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.

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 http://example.com/forumhome.css
Connect: 0.657 TTFB: 1.183 Total time: 7.150


Here is a pastebin of the tcpdump output for the curl request above: http://pastebin.com/2tdZHqFr


I have also tested using webpagetest.org 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 GNU/Linux

nginx conf:

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

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 -> pastebin systcl

site.conf:

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

server_name example.com;    
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:255.255.254.0
      inet6 addr: fe80::215:17ff:fe26:b4bd/64 Scope:Link
      UP BROADCAST RUNNING MULTICAST  MTU:9000  Metric:1
      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)
      Memory:e1a00000-e1a20000 

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
share|improve this question
    
What's the server's load look like? –  Shane Madden Mar 7 '12 at 22:03
    
the load on the server is fine, never goes above 0.10 and averages around 0.5 here is something interesting but i have no idea what it means, its the tcpdump from the curl request in my original post, maybe someone can make sense of it? this is JUST the tcmpdump for the forumhome.css file in the curl request and nothing else. tcpdump: pastebin.com/2tdZHqFr –  waz Mar 8 '12 at 11:16

1 Answer 1

Best check your forward and (especially) reverse dns lookups. This is a usual cause of "slow".

share|improve this answer
    
how do i check the forward and reverse dns lookup are not the cause of slow, is there a way to test if that is the problem? –  waz Mar 8 '12 at 11:15
    
Do a dig on the forward and a dig -x on the reverse. Systems often do a reverse lookup on connections for the logs. For example; "dig example.com" = 10.10.10.10, "dig -x 10.10.10.10". Do it from the nginx host. Post the results along with the /etc/resolv.conf. Hopefully Debian has dig. –  kls Mar 8 '12 at 18:34

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.