Wednesday 13 February 2008

rtorrent on debian NSLU2

A few days ago I installed rtorrent on my debian slug. Rtorrent presents itself to be installed on the NSLU2 because of its
"[...] focus on high performance and good code.".

Therefore I expected a low memory and cpu footprint.
Furthermore, rtorrent makes use of ncurses and is therefore predestined to be detached with 'screen'.

Unfortunenately it turned out that the rtorrent-process (both libtorrent-0.12.0.0 with rtorrent-0.8.0 (unstable) and ibtorrent-0.11.9 with rtorrent-0.7.9.tar.gz) got regularly (every 2 hours or so) killed.

Dmesg in both cases:
Out of memory: Killed process 9754 (rtorrent).

Obviously, rtorrent consumes too much of the little RAM the NSLU2 has to offer. Being somewhat contrary to the quotation cited above...

In addition, it took rtorrent ages to hash a new torrent or to rehash a torrent when rtorrent got killed.

The hash problem could quite easily be resolved. With a little help from here all that had to be done was adjusting the hash parameters in ~/.rtorrent.rc:


# Hash read-ahead controls how many MB to request the kernel to read
hash_read_ahead = 5

# Interval between attempts to check the hash, in milliseconds.
hash_interval = 10

# Number of attempts to check the hash while using the mincore status,
# before forcing. Overworked systems might need lower values to get a
# decent hash checking rate.
hash_max_tries = 3


The one problem remaining was the crashes. To cut a long story short: today rtorrent runs stably on my NSLU2. The only downer is with my current configuration I can only download one torrent at a time. Elsewise it gets killed again.


Here is my current .rtorrent.rc. The trigger to avoid the kills was adjusting the peers settings. Default was a much higher number (I don't remember.. ;)). I will continue adjusting it step by step to higher values to establish what I can expect from my NSLU2.


min_peers = 1
max_peers = 40

min_peers_seed = 1
max_peers_seed = 10

max_uploads = 2

download_rate = 0
upload_rate = 50

directory = ./dl-torrents
session = ./session

# Watch a directory for new torrents, and stop those that have been
# deleted.
schedule = watch_directory,5,5,load_start=/home/torrent/torrents/*.torrent
schedule = untied_directory,5,5,stop_untied=

# Close torrents when diskspace is low.
schedule = low_diskspace,5,60,close_low_diskspace=100M
schedule = ratio,60,60,"stop_on_ratio=120,200M,150"

port_range = 30890-30998
port_random = yes

check_hash = no

use_udp_trackers = yes

# this setting remains from the actual (unstable)
# beta or alpha from rtorrent with dht tracker support.
# Thus commented out because I use a previous version
# dht_port = 30999

peer_exchange = yes

# here go the settings for faster hashing
hash_read_ahead = 5
hash_interval = 10
hash_max_tries = 3

3 comments:

Anonymous said...

tnx for the tip! I just got a NSLU and I am trying rtorrent on it.

You said that rtorrent keeps crashing due to low memory. Is that true even with virtual memory? I've been running it for just a couple of hours with 6 active torrents and everything seems fine.

I'll let you know if anything happens.

Tnx.

Fritz said...

Hi,

thanks for stopping by. The issue with rtorrent has been resolved, it was the malicious oomkiller.. ;)

Please see http://practical-fritz.blogspot.com/2008/05/rtorrent-finally-running-stably.html for further details.

Rtorrent is now running very smoothly on my nslu2. And ssh on a mobile phone rocks.. ;)

Anonymous said...

rTorrent Those of you who've been downloading and seeding torrents for years probably don't need much help anymore, but if you're new to torrents,