Transmission uTP and UDP buffer optimizations

Recently in debug mode on a box running Transmission to seed BackTrack Torrents:

[17:42:40.319] UDP Failed to set receive buffer: requested 4194304, got 262142 (tr-udp.c:75)
[17:42:40.319] UDP Please add the line "net.core.rmem_max = 4194304" to /etc/sysctl.conf (tr-udp.c:80)
[17:42:40.319] UDP Failed to set send buffer: requested 1048576, got 262142 (tr-udp.c:86)
[17:42:40.319] UDP Please add the line "net.core.wmem_max = 1048576" to /etc/sysctl.conf (tr-udp.c:91)

This message tries to tell us, that for some reason, Transmission would like to have 4 Megabytes of receive buffer and 1 Megabyte send buffer for it’s UDP socket. It turns out that the support for uTP, the uTorrent transport protocol, is implemented using a single socket.

By tuning the two variables, higher throughput can be achieved more easily using uTP.

Here is the relevant part from the changeset:

Since we’re using a single UDP socket to implement multiple uTP sockets,
and since we’re not always timely in servicing an incoming UDP packet,
it’s important to use a large receive buffer. The send buffer is probably
less critical, we increase it nonetheless.

Four Megabyte might seem huge for embedded clients, but running behind a fast dedicated connection, it might even be too small when Transmission has to handle hundreds of connections. I recommend to use 16 Megabyte for receive buffering and 4 for the send buffer. That is, because uTP implements a retransmission algorithm and by scaling up the buffers we achieve less retransmits because of dropped datagrams. Let’s set it up that way.

echo 'net.core.rmem_max = 16777216' >> /etc/sysctl.conf
echo 'net.core.wmem_max = 4194304' >> /etc/sysctl.conf
sysctl -p

Schreibe einen Kommentar

Diese Website verwendet Akismet, um Spam zu reduzieren. Erfahre mehr darüber, wie deine Kommentardaten verarbeitet werden.