I'm trying to understand why our proxied requests have a much greater
chance of significant delay than non-proxied requests.

The server is an 8-core (dual quad) Intel machine. Making requests
directly to the nginx backend is just far more reliable. Here's a
shell script output that just continuously requests a blank 0k image
file from nginx directly on its own port, and spits out a timestamp if
the delay isn't 0 or 1 seconds:

Thu Mar 5 12:36:17 PST 2009
beginning continuous test of nginx port 8080
Thu Mar 5 12:38:06 PST 2009
Nginx Time is 2 seconds



Here's the same test running through haproxy, simultaneously:

Thu Mar 5 12:36:27 PST 2009
beginning continuous test of haproxy port 80
Thu Mar 5 12:39:39 PST 2009
Nginx Time is 3 seconds
Thu Mar 5 12:39:48 PST 2009
Nginx Time is 3 seconds
Thu Mar 5 12:39:55 PST 2009
Nginx Time is 3 seconds
Thu Mar 5 12:40:03 PST 2009
Nginx Time is 3 seconds
Thu Mar 5 12:40:45 PST 2009
Nginx Time is 3 seconds
Thu Mar 5 12:40:48 PST 2009
Nginx Time is 3 seconds
Thu Mar 5 12:40:55 PST 2009
Nginx Time is 3 seconds
Thu Mar 5 12:40:58 PST 2009
Nginx Time is 3 seconds
Thu Mar 5 12:41:55 PST 2009
Nginx Time is 3 seconds
Thu Mar 5 12:42:01 PST 2009
Nginx Time is 3 seconds
Thu Mar 5 12:42:08 PST 2009
Nginx Time is 3 seconds
Thu Mar 5 12:42:29 PST 2009
Nginx Time is 3 seconds
Thu Mar 5 12:42:38 PST 2009
Nginx Time is 3 seconds
Thu Mar 5 12:43:05 PST 2009
Nginx Time is 3 seconds
Thu Mar 5 12:43:15 PST 2009
Nginx Time is 3 seconds
Thu Mar 5 12:44:08 PST 2009
Nginx Time is 3 seconds
Thu Mar 5 12:44:25 PST 2009
Nginx Time is 3 seconds
Thu Mar 5 12:44:30 PST 2009
Nginx Time is 3 seconds
Thu Mar 5 12:44:33 PST 2009
Nginx Time is 3 seconds
Thu Mar 5 12:44:39 PST 2009
Nginx Time is 3 seconds
Thu Mar 5 12:44:46 PST 2009
Nginx Time is 3 seconds
Thu Mar 5 12:44:54 PST 2009
Nginx Time is 3 seconds
Thu Mar 5 12:45:07 PST 2009
Nginx Time is 3 seconds
Thu Mar 5 12:45:16 PST 2009
Nginx Time is 3 seconds
Thu Mar 5 12:45:45 PST 2009
Nginx Time is 3 seconds
Thu Mar 5 12:45:54 PST 2009
Nginx Time is 3 seconds
Thu Mar 5 12:45:58 PST 2009
Nginx Time is 3 seconds
Thu Mar 5 12:46:05 PST 2009
Nginx Time is 3 seconds
Thu Mar 5 12:46:08 PST 2009
Nginx Time is 3 seconds
Thu Mar 5 12:46:32 PST 2009
Nginx Time is 3 seconds
Thu Mar 5 12:46:48 PST 2009
Nginx Time is 3 seconds
Thu Mar 5 12:46:53 PST 2009
Nginx Time is 3 seconds
Thu Mar 5 12:46:58 PST 2009
Nginx Time is 3 seconds
Thu Mar 5 12:47:40 PST 2009
Nginx Time is 3 seconds

My sanitized haproxy config is here (mongrel backend was omitted for brevity) :
http://pastie.org/408729

Are the ACLs just too expensive? Nginx is running with 4 processes,
and the box shows mostly idle.
top - 21:02:14 up 15 days,  2:47,  4 users,  load average: 1.83, 1.59, 1.44
Tasks: 171 total,   2 running, 168 sleeping,   0 stopped,   1 zombie
Cpu(s): 11.7%us,  2.7%sy,  0.0%ni, 84.8%id,  0.1%wa,  0.0%hi,  0.7%si,  0.0%st
Mem:   8201632k total,  8155856k used,    45776k free,   180244k buffers
Swap:        0k total,        0k used,        0k free,  7418644k cached

 PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
31749 root      20   0 38052  31m  508 S    7  0.4   3:16.78 haproxy
9471 nginx     20   0 14164 2156  748 S    3  0.0   0:21.54 nginx
2555 root      20   0  5880  712  580 S    3  0.0 333:45.38 syslogd
9470 nginx     20   0 14284 2380  740 S    3  0.0   0:26.54 nginx
9469 nginx     20   0 14240 2328  748 S    1  0.0   0:26.20 nginx
5054 root      20   0 99.6m  24m 3188 S    0  0.3   0:12.36 ruby
23699 root      20   0 74828  820  388 R    0  0.0   0:00.01 bash
28744 root      20   0 74696  976  548 S    0  0.0   0:07.27 bash
   1 root      20   0 10316  680  568 S    0  0.0   0:10.09 init

Reply via email to