Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 30 Jul 2000 02:30:25 +0000
From:      Tony Finch <dot@dotat.at>
To:        Alfred Perlstein <bright@wintelcom.net>
Cc:        ym g <ymg@graffiti.net>, freebsd-stable@FreeBSD.ORG, new-httpd@apache.org
Subject:   Re: Zen regarding accept filters
Message-ID:  <20000730023025.B1386@hand.dotat.at>
In-Reply-To: <20000729104309.D21967@fw.wintelcom.net>
References:  <20000729130953.10802.qmail@graffiti.net> <20000729104309.D21967@fw.wintelcom.net>

next in thread | previous in thread | raw e-mail | index | archive | help
[I've crossposted this to new-httpd@apache.org and freebsd-stable@freebsd.org]

The patch to enable accept filters in Apache is quite simple (see
below) but unfortunately the httpready filter breaks support for
HTTP/0.9. I'm going to try to fix it but until that is done I don't
think the patch should go into Apache without alerting people to this
fact and making them define BREAK_OLD_HTTP at compile time...

Tony.
-- 
en oeccget g mtcaa    f.a.n.finch
v spdlkishrhtewe y    dot@dotat.at
eatp o v eiti i d.    fanf@covalent.net


--- apache-1.3/src/main/http_main.c	2000/07/29 23:56:19	1.507
+++ apache-1.3/src/main/http_main.c	2000/07/30 02:26:25
@@ -3398,6 +3398,34 @@
 	exit(1);
     }
 
+#if defined(SO_ACCEPTFILTER) && defined(BREAK_OLD_HTTP)
+    {
+	/*
+	 * FreeBSD has a feature called "accept filters" 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. This feature was added to FreeBSD-4.1-STABLE
+	 * on the 28th of July 2000.
+	 */
+	struct accept_filter_arg af = {
+	    "httpready", ""
+	};
+	if (setsockopt(s, SOL_SOCKET, SO_ACCEPTFILTER, &af, sizeof(af)) < 0) {
+	    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);
 


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-stable" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000730023025.B1386>