Archiv der Kategorie: Transmission (English)

Kategorie mit Anleitungen zum BitTorrent Client Transmission, in englischer Sprache. Auf Anfrage (Mail siehe Impressum) können Artikel gern auf Deutsch übersetzt werden.

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 Webinterface mit Apache auf SSL umstellen

Transmission BitTorrent bietet ein Webinterface auf einem konfigurierbaren Port mit Basic-Auth an. Was aber, wenn der Port nicht geöffnet werden soll, oder das Webinterface nur per SSL (HTTPS) erreichbar sein soll? Apache leistet wie folgt Schützenhilfe und stellt die Verschlüsselung sicher.
Transmission Webinterface mit Apache auf SSL umstellen weiterlesen

Compiling Transmission Bittorrent for Debian

Sometimes you have a need to stay current with upstream releases, even though you’d like to rely on the stability of your base distribution. Here’s how this can be accomplished quick and dirty. Lines started with a # are to be executed as root, lines starting with $ can be run as a regular user.

1. Dependencies

First lets install every single dependency Transmission needs and which has a usable version in the Debian respository.

# apt-get install ca-certificates libcurl4-openssl-dev libssl-dev pkg-config build-essential checkinstall intltool

2. libevent

Traditionally, libevent is also needed, but Transmission depends on version numbers only rarely found in Debian. So let’s start with compiling libevent in a directory of your choice. Browse to and get the latest version.

$ cd /var/tmp
$ wget
$ tar xzf libevent-2.0.18-stable.tar.gz
$ cd libevent-2.0.18-stable
$ CFLAGS="-Os -march=native" ./configure && make

Now, we’d really like to upgrade to a new version in the future, so there should be a mechanism other than the classic make install which keeps count of what went where (and at best this isn’t a piece of paper). So we build a very simple Debian package from the compiled files and install it. Basically you just enter the following command and hit return until a nice text message tells you that all is done.

# checkinstall

3. Transmission

Now we need to prepare Transmission for compilation by configuring the source, same thing as with libevent.

$ cd /var/tmp
$ wget
$ tar xjf transmission-2.51.tar.bz2
$ cd transmission-2.51
# CFLAGS="-Os -march=native" ./configure && make && checkinstall

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