On Tue, Feb 2, 2010 at 8:59 AM, Sandro Tosi <sandro.tosi@xxxxxxxxxxx> wrote: > Hello, > we have a rather busy Apache web server (~200/300 contemporary connections). > There are time when Apache is really slow at letting client connects to it. > For example, with curl, I see: > > 02:05:17.885074 == Info: About to connect() to IP_ADDRESS port 80 (#0) > 02:05:17.885280 == Info: Trying IP_ADDRESS... 02:05:20.898748 == Info: > connected > 02:05:20.898785 == Info: Connected to IP_ADDRESS (IP_ADDRESS) port 80 (#0) > ... > 02:05:20.917068 == Info: Closing connection #0 > > and > > 02:06:53.098230 == Info: About to connect() to IP_ADDRESS port 80 (#0) > 02:06:53.099272 == Info: Trying IP_ADDRESS... 02:07:02.111596 == Info: > connected > 02:07:02.111636 == Info: Connected to IP_ADDRESS (IP_ADDRESS) port 80 (#0) > 02:07:02.111731 => Send header, 222 bytes (0xde) > ... > 02:07:02.422093 == Info: Closing connection #0 > > as you can see, we see a 3 seconds (first example) and a 9 seconds (second > example) delay between apache server contact and when the connection is > actually accepted. The delay is always either 3 or 9 seconds, that's quite > weird and it seems to indicate a sort of retry+backoff (3 secs, 3x2 secs (9 > secs total) and so on) implemented in some Apache layers. Getting connected and sending the first bytes on a connection is handled by the TCP layer and below; Apache doesn't have to get involved yet to allow that to happen. Apache does give the TCP layer a hint about how to behave in this part of the request cycle -- ListenBacklog. You could see if increasing that setting in Apache convinces the TCP layer on the Apache side to accept more connections even before Apache wakes up to process them. (A TCP trace would presumably confirm that getting the connect handshake completed in a timely manner is the issue. It might also show something totally unanticipated.) > StartServers 200 > MinSpareServers 150 > MaxSpareServers 300 Given your comment about 200-300 typical active connections, I guess this is ok if your traffic isn't at all spiky. > ServerLimit 2000 > MaxClients 2000 definitely not a problem here > MaxRequestsPerChild 100 This will cause httpd processes to exit relatively quickly and might occasionally increase the amount of time before Apache is able to accept a new connection It is very hard to say for sure that this can; I guess increasing MaxSpareServers could mitigate the potential for temporary windows where a lot more Apache processes have to be created at once due to exiting processes. (I wonder how MinSpare../MaxSpare../MaxRequests.. interact with your actual load.) Anyway, MaxRequestsPerChild rarely needs to be set so low; that would be needed only with barely working application code running inside Apache. Unless you have a real reason to set it so low, either disable it (0) or set it very high (at least some tens of thousands for the prefork MPM). > > KeepAlive off This results in more connections required for real browser traffic, exacerbating any connection problem. --------------------------------------------------------------------- The official User-To-User support forum of the Apache HTTP Server Project. See <URL:http://httpd.apache.org/userslist.html> for more info. To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx " from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx