[bittorrent] TCP stack implementations (was: HAVE messages)

Kenneth Porter shiva at sewingwitch.com
Thu Jun 23 09:50:51 EDT 2005


--On Wednesday, June 22, 2005 5:12 PM -0500 "David P. Mott" 
<dpmott at sep.com> wrote:

> Well stated.  Specifically what about large numbers of connections do the
> TCP stack implementations have issues with?  Is it just having them
> connected, or trying to push/pull data through all of them at once?

The default Linux queue is a simple single FIFO shared by all streams. It's 
easy for one stream to stuff a lot of data in one write and cause high 
latency for other streams.

I normally run the Wondershaper script (available at http://lartc.org/) to 
install a more sophisticated queue. The Wondershaper config creates 3 major 
"token bucket" queues of low/medium/high priority, and provides some simple 
port and address based packet classification to assign packets to each of 
the major queues. The overall bandwidth is limited to just under one's 
actual bandwidth to prevent queuing in upstream routers, to insure that 
one's own policy takes precedence over that of the routers.

The script runs a round-robin queue within each major queue to insure that 
all streams within a priority band get fair access.

Small packets (eg. TCP ACK's) and packets marked with TOS Minimize-Delay 
are classified into the high priority queue.



More information about the BitTorrent mailing list