homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

Persistent Connections Slow to Respond to Extra Requests

5+ Year Member

Msg#: 3320954 posted 7:24 am on Apr 25, 2007 (gmt 0)

Hey, I'm writing a program to test the performance of apache (we had a similar problem with lighttpd), and I keep running into a problem with persistent connections. We make single request, like:

GET fileName HTTP/1.1
Host: server:80
Keep-Alive: 300
Connection: keep-alive

And we get a response back. We then make another, similar, request on the same connection, and we get a response back, but there's a huge delay in-between sending our request and getting the response for the second request.

To give you an idea of the times:

request 1: sent at 0 ms, received at 1 ms
request 2: sent at 1 ms, received at 41 ms
request 3: sent at 41 ms, received at 81 ms
request 4: sent at 81 ms, received at 121 ms

And we see this 40 ms delay all throughout. Clearly it doesn't take that long to deliver the file, so we're not sure what gives...why the delay? Just FYI, we're testing on a high-bandwidth, low-latency network.

Also, we do HTTP pipelining, and when we send all these requests at once on one connection, we get the response back extremely quick--we're just not sure why the 40 ms or so delay between requests on the same persistent connection and not on the pipelined connection. There's almost no lag between the machine, so we're not sure what's up.

Not sure if it's a setting we can change, something we're doing wrong, or something apache's just doing slowly.




10+ Year Member

Msg#: 3320954 posted 7:46 pm on Apr 25, 2007 (gmt 0)

What is the round-trip (ping) time from the client to the server?

This looks like your difference. The client may also be doing some waiting, especially if it has no way of knowing when one request is finished -- is your HTTPd sending Content-length, and expires HTTP headers?


5+ Year Member

Msg#: 3320954 posted 12:44 am on Apr 26, 2007 (gmt 0)

The ping is <1ms. We also get the entire first file usually in less than 1 ms or 2 ms, and there's no difference in the size.

This is a C program we are writing (not a typical client). We get the first response back fine (as we do for all of the other ones...they are just slow). We know we are waiting on the Unix read command. Maybe it doesn't write() immediately on our second request, but it does return (not sure how Unix handles it) and there's no delay for the first request.

Any other suggestions?


Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved