httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From f...@locus.apache.org
Subject cvs commit: apache-1.3/src/main http_main.c
Date Sat, 19 Aug 2000 01:52:53 GMT
fanf        00/08/18 18:52:53

  Modified:    htdocs/manual/misc perf-bsd44.html perf.html
               src      CHANGES
               src/main http_main.c
  Log:
  Use "accept filtering" on recent versions of FreeBSD iff the
  kernel is configured to support them. This allows Apache to avoid
  having to handle new connections until the request has arrived.
  
  Revision  Changes    Path
  1.14      +64 -0     httpd-docs-1.3/htdocs/manual/misc/perf-bsd44.html
  
  Index: perf-bsd44.html
  ===================================================================
  RCS file: /home/cvs/httpd-docs-1.3/htdocs/manual/misc/perf-bsd44.html,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -u -r1.13 -r1.14
  --- perf-bsd44.html	1998/09/17 14:14:53	1.13
  +++ perf-bsd44.html	2000/08/19 01:52:50	1.14
  @@ -242,6 +242,70 @@
   often maxed out.</BLOCKQUOTE>
   <P>
   
  +<A NAME="accf">
  +<H2>Accept filtering on FreeBSD</H2>
  +</A>
  +
  +<P>
  +
  +Versions of FreeBSD from August 2000 onwards include a feature called
  +&quot;accept filters&quot; which delay the return from accept() until
  +a condition has been met, e.g. an HTTP request has arrived. This
  +postpones the requirement for a child process to handle the new
  +connection which therefore increases the number of connections that a
  +given number of child processes can handle. It also allows a child
  +process to accomplish more immediately after accept() returns (because
  +the request is already available to be read) so there is less context
  +switching.
  +
  +<P>
  +
  +There are two filters in FreeBSD at the time of writing:
  +&quot;dataready&quot; and &quot;httpready&quot;. The former just waits
  +for the first packet to arrive from the client; the latter waits for
  +the end of the HTTP headers. Unfortunately the &quot;httpready&quot;
  +filter breaks support for HTTP/0.9 (which doesn't have headers) so
  +Apache doesn't use it, but the &quot;dataready&quot; filter gives the
  +same benefit in the majority of cases so Apache attempts to use that
  +instead.
  +
  +<P>
  +
  +Accept filters provide the most benefit on servers that are already so
  +busy that they are configured with &quot;<CODE>KeepAlive Off</CODE>&quot;.
  +<A HREF="../keepalive.html">HTTP KeepAlive (aka persistent connections)</A>
  +avoids the cost of setting up a new connection for every request, but
  +connections that are being kept alive use up one of the available
  +child processes. Since there is a limited number of child processes
  +this can significantly reduce the capacity of the server. The viewers
  +of a web site will still get a lot of the benefit of persistent
  +connections even with a very small <CODE>KeepAliveTimeout</CODE> so
  +you should try reducing it before turning it off altogether.
  +
  +<P>
  +
  +To enable accept filtering, you must either load the appropriate
  +accept filter module,
  +e.g. with the command <CODE>kldload accf_data</CODE>,
  +or compile a kernel with <CODE>options ACCEPT_FILTER_DATA</CODE>.
  +Apache will then enable filtering when it is restarted.
  +
  +<P>
  +
  +If you are more concerned about performance than compatibility with
  +absurdly obsolete HTTP/0.9 user agents then you can recompile Apache
  +to use the &quot;httpready&quot; filter. This may be particularly
  +helpful if your web site uses really big cookies, for example.
  +If you are using <CODE>src/Configure</CODE> then add
  +<CODE>-DACCEPT_FILTER_NAME=\&quot;httpready\&quot;</CODE> to the
  +<CODE>EXTRA_CFLAGS</CODE> line in the <CODE>src/Configuration</CODE>
  +file.
  +If you are using APACI (aka <CODE>./configure</CODE>) then use the command
  +<CODE>CFLAGS=-DACCEPT_FILTER_NAME=\'\&quot;httpready\&quot;\' ./configure</CODE>
  +(with all the funky backslashed quotes).
  +
  +<P>
  +
   <HR>
   
   <H3>More welcome!</H3>
  
  
  
  1.25      +1 -0      httpd-docs-1.3/htdocs/manual/misc/perf.html
  
  Index: perf.html
  ===================================================================
  RCS file: /home/cvs/httpd-docs-1.3/htdocs/manual/misc/perf.html,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -u -r1.24 -r1.25
  --- perf.html	1998/09/17 14:14:53	1.24
  +++ perf.html	2000/08/19 01:52:50	1.25
  @@ -53,6 +53,7 @@
   <A HREF="perf-bsd44.html#initial">Quick</A> and
   <A HREF="perf-bsd44.html#detail">detailed</A>
   performance tuning hints for BSD-derived systems.
  +<A HREF="perf-bsd44.html#accf">Accept filtering</A> on FreeBSD.
   
   <P><HR>
   
  
  
  
  1.1569    +5 -0      apache-1.3/src/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/CHANGES,v
  retrieving revision 1.1568
  retrieving revision 1.1569
  diff -u -u -r1.1568 -r1.1569
  --- CHANGES	2000/08/19 01:37:33	1.1568
  +++ CHANGES	2000/08/19 01:52:51	1.1569
  @@ -1,5 +1,10 @@
   Changes with Apache 1.3.13
   
  +  *) Use "accept filtering" on recent versions of FreeBSD iff the
  +     kernel is configured to support them. This allows Apache to avoid
  +     having to handle new connections until the request has arrived.
  +     [Tony Finch]
  +
     *) Fix error handling in make_sock. [Tony Finch]
   
     *) The htdocs/ tree has been moved out of the CVS source tree into
  
  
  
  1.509     +24 -0     apache-1.3/src/main/http_main.c
  
  Index: http_main.c
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/main/http_main.c,v
  retrieving revision 1.508
  retrieving revision 1.509
  diff -u -u -r1.508 -r1.509
  --- http_main.c	2000/08/19 01:37:35	1.508
  +++ http_main.c	2000/08/19 01:52:52	1.509
  @@ -3398,6 +3398,30 @@
   	exit(1);
       }
   
  +#ifdef SO_ACCEPTFILTER
  +    {
  +#ifndef ACCEPT_FILTER_NAME
  +#define ACCEPT_FILTER_NAME "dataready"
  +#endif
  +	/*
  +	 * See htdocs/manual/misc/perf-bsd44.html for a discussion of
  +	 * how to enable this feature and various issues with it.
  +	 */
  +	struct accept_filter_arg af = {
  +	    ACCEPT_FILTER_NAME, ""
  +	};
  +	if (setsockopt(s, SOL_SOCKET, SO_ACCEPTFILTER, &af, sizeof(af)) < 0
  +	    && errno != ENOENT) {
  +	    ap_log_error(APLOG_MARK, APLOG_CRIT, server_conf,
  +			 "make_sock: for %s, setsockopt: (SO_ACCEPTFILTER)",
  +			 addr);
  +	    close(s);
  +	    ap_unblock_alarms();
  +	    exit(1);
  +	}
  +    }
  +#endif
  +
   #ifdef WORKAROUND_SOLARIS_BUG
       s = ap_slack(s, AP_SLACK_HIGH);
   
  
  
  

Mime
View raw message