You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by David Robinson <dr...@ast.cam.ac.uk> on 1996/02/25 17:34:00 UTC

Apache 1.1 slowness (with fix)

My benchmarks of 1.1b0 suggested that it was much slower than I remembered
1.0 could be... This patch cures the problem:

  Subject: Don't flush output after headers are written if we are not doing
         keep-alives
  Affects: http_protocol.c
  ChangeLog: Only call bflush() after sending the header if we are using
             keep-alives, to workround a netscape bug; otherwise it hurts
             performance.
 Comments: Needs my other patches applied first.

My system is a SPARCclassic running Solaris 2.5, with an unloaded 10BaseT
ethernet.

Without the patch, the response time for a request for a tiny file (6 bytes)
was ~60ms.
With the patch, it is 29ms.

When using keepalives, there is a connection overhead of 5-10ms, with a
response time of 50 ms for each request. With the patch, the final request
has its response time reduced to 10ms.

Thus, on my system, it is faster to not use keepalives.

Interesting fact; doing the same test with the spyglass server shows that
it too flushes the output after writing the headers, and so it also has
a response time of 55 ms for each request in a keep-alive connection.
However, it has a connection overhead of > 200ms! So for a client which
doesn't support keep-alives, the time taken to service a request was
~270ms; thus Apache is now 9x faster than the spyglass server. 8-)

I seem to recall that the number of requests used in Spyglass's benchmark
was huge; if we reduce this to, 5, then Apache is still roughly twice as fast.

`fast', here, means response time measured by the client.

 David.

-------- the patch itself:
*** http_protocol.c.orig	Sun Feb 25 15:14:01 1996
--- http_protocol.c	Sun Feb 25 16:03:04 1996
***************
*** 573,579 ****
  
      bputs("\015\012",fd);
  
!     bflush(r->connection->client);  /* only if kept-alive??? */
  
      bsetopt(fd, BO_BYTECT, &zero);
      r->sent_bodyct = 1;		/* Whatever follows is real body stuff... */
--- 573,580 ----
  
      bputs("\015\012",fd);
  
!     if (c->keepalive)
! 	bflush(r->connection->client);  /* For bugs in Netscape, perhaps */
  
      bsetopt(fd, BO_BYTECT, &zero);
      r->sent_bodyct = 1;		/* Whatever follows is real body stuff... */