Re: incoming connection balancing

From: Henrik Nordstrom <hno@dont-contact.us>
Date: Sat, 03 Feb 2007 21:50:49 +0100

lör 2007-02-03 klockan 22:40 +0800 skrev Adrian Chadd:
> A sudden late-night idea - why not set the "how often to poll for
> incoming sockets" as dependant on the number of incoming connections
> handled in one httpAccept() / httpsAccept() ? The idea being that
> if the incoming request rate is increasing so will the backlog of
> FDs; polling them faster should then drop the accept queue depth.

It's tricky to get the balance correct. Optimally we want to get them
out of the accept queue when the first request is sitting in the socket
buffer, and no faster than the rate we can sustain.

At least on Linux there is no technical need to drain the accept queue
depth, the kernel happily keeps large amounts of sockets there until we
are ready to do something meaningful with them.

> (One could then make sure we're acutally using persistent events
> under epoll rather than oneshot events for each incoming connection.
> Its late and I don't want to dig through the code or I won't be
> able to sleep..)

We use persistent event for all types of connections. It's just our
internal data structures which is one-shot, this is then filtered by the
comm loop by not updating the fd interest until after the callback has
completed.

See commSetEvents() and comm_call_handlers(). Specifically the (not)
SIMPLE_COMM_HANDLER section in comm_call_handlers.

Regards
Henrik

Received on Sat Feb 03 2007 - 13:50:55 MST

This archive was generated by hypermail pre-2.1.9 : Thu Mar 01 2007 - 12:00:02 MST