In Pen 0.14.0, a number of changes have been made to improve performance
with large numbers of simultaneous connections.
First of all, we now keep track of how many connection slots have been
used. Previous versions would accept the connection, figure out that there
was nowhere to put it and close the connection down. Now the new
connection simply waits until a slot becomes available.
Second, the new version uses the slots in the connection table in a
round-robin fashion. Previous versions always scanned the table from 0,
which was clearly not efficient if most slots were used, since most
available slots would be at the end. An example:
If we are accepting connections at a rate of 200 per second and
there are 2000 used slots, the old code scans 400000 slots
every second. The new code should leave empty slots scattered
more or less evenly in the connection table, so a table with
8000 slots should on average only need to scan 4 slots per
connection. That's 800 slots per second, or 1/500 the original.
In practice I expect the distribution to be even better. A table
with 8000 slots would at 200 connections per second roll over after
40 seconds. By that time, nearly all the slots at the beginning
of the table will be empty, so most of the time connections_last+1
will be available.
This archive was generated by hypermail 2.1.2 : Fri Jun 25 2004 - 01:25:40 CEST