Date: Thu, 25 Nov 1999 19:05:14 +0000 From: Tony Finch <dot@dotat.at> To: dillon@apollo.backplane.com, hackers@freebsd.org Subject: Re: mbuf wait code (revisited) -- review? Message-ID: <E11r4Cg-00050F-00@fanf.eng.demon.net> In-Reply-To: <199911181700.JAA85880@apollo.backplane.com> References: <Pine.LNX.3.96.991118114107.30813W-100000@devserv.devel.redhat.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Matthew Dillon <dillon@apollo.backplane.com> wrote: > > The solution Apache takes is to surround the accept() with a file lock > so only one process blocks in accept() at any given point (the file lock > uses wakeup_one and is safe). Apache doesn't lock accept() if there's only one listening socket. (Look for the #define SINGLE_LISTEN_UNSERIALIZED_ACCEPT in apache-1.3/src/include/ap_config.h) > The solution that I took with BestWWWD was to have just one process > accept all the connections and then have it dole the descriptor out to the > appropriate sub-processes over a unix-domain socket. Demon has a large server based on thttpd running on IRIX. One of the changes that was made to thttpd was to fork the server several times to get some parallelism for disk operations. When I came to port the code to FreeBSD I found that it worked fine as it was on a UP machine, but on an SMP machine when a connection came in two processes would symultaneously wake up from select() then try to accept() the connection; one would succeed and one would block and snarl up a load of other connections. My solution was the same as Matt's :-) (I'm not happy about the extra context switching that it requires but I was more interested in working code than performance; I haven't benchmarked it.) Tony. -- i am the dot at dotat dot at To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?E11r4Cg-00050F-00>