Schlagwort-Archive: transmission

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

Transmission auto-delete Quota Skript

Möchte man immer die aktuellsten frei zugänglichen Linux-Distributions Torrents herunterladen, um andere Nutzer durch die eigene Bandbreite zu unterstützen, wird irgendwann die Festplatte voll. Dieses Skript schafft Abhilfe.

# transmission-quota.bash
# FIFO quota for transmission-daemon.
# This script forces a maximum size upon
# your transmission download directory
# by deleting the oldest torrent, until
# the quota is met again.
# Run regularily from cron:
# */5 * * * *     /home/torrent/transmission-quota.bash

# Where is your transmission download directory?

# How big in bytes may the download directory grow?

# Wheres your transmission-remote binary?

# Login:Password, if applicable

# URL to Transmission RPC Interface (usually http://X:9091/transmission/rpc)

# # # No Configuration needed below here # # #

while [ "`du -sb ${TR_DIR} | awk '{print $1}'`" -gt "${TR_MAXBYTES}" ]; do
        CURRENT_SEEDING=`${CLIPATH} ${TR_URL} -n ${TR_UPASS} -l | awk '{ if ($2 == "100%") print $1 }' | sed 's/*$//'`
        OLDEST_TIMESTAMP=`date +%s`

        for torrent in ${CURRENT_SEEDING}
                DATE_ADDED=`${CLIPATH} ${TR_URL} -n ${TR_UPASS} -t ${torrent} -i |grep "Date added:" | sed 's/Date added://g'`
                TIMESTAMP_ADDED=`date --date "${DATE_ADDED}" +%s`
                if [ "${TIMESTAMP_ADDED}" -lt "${OLDEST_TIMESTAMP}" ]; then
        ${CLIPATH} ${TR_URL} -n ${TR_UPASS} -t ${OLDEST_ID} --remove-and-delete &> /dev/null
        DAYS_AGO=`echo $(( ( $(date +%s) - $OLDEST_TIMESTAMP ) / 3600 / 24 ))`
        echo deleted torrent id ${OLDEST_ID} from ${DAYS_AGO} days ago | logger -t transmission-quota