Trickle

From ArchWiki
Revision as of 14:34, 3 November 2012 by Robotanarchy (Talk | contribs) (Added systemd .service file)

Jump to: navigation, search

Tango-document-new.pngThis article is a stub.Tango-document-new.png

Notes: moar content needed (Discuss in Talk:Trickle#)

trickle is a portable lightweight userspace bandwidth shaper, that either runs in collaborative mode (together with trickled) or in stand alone mode.

It works by preloading its own socket library wrappers, that limit traffic by delaying data.

Also trickle runs entirely in userspace.[1]

Installation

As usually:

pacman -S trickle

Daemon configuration

If you want to have application specific settings with trickled, create the optional /etc/trickled.conf file as described in the trickled.conf(5) man page. For example:

[ssh]
Priority = 1
Time-Smoothing = 0.1
Length-Smoothing = 2
[ftp]
Priority = 8
Time-Smoothing = 5
Length-Smoothing = 20

Systemd integration

Create the following two files and customize them to your needs.

/etc/systemd/system/trickled.service
[Unit]
Description=trickle bandwith shaper

[Service]
EnvironmentFile=/etc/conf.d/trickled_systemd
ExecStart=/usr/bin/trickled -u${TRICKLE_UP} -d${TRICKLE_DOWN} -w${TRICKLE_WSIZE} -t${TRICKLE_STIME} -l${TRICKLE_SLENGTH} -f
Type=simple
User=nobody
Group=nobody

[Install]
WantedBy=network.target
/etc/conf.d/trickled_systemd
# Limit the upload bandwidth consumption to rate KB/s
TRICKLE_UP=

#  Limit the download bandwidth consumption to rate KB/s
TRICKLE_DOWN=

# Set peak detection window size to size KB. This determines
# how aggressive trickled is at eliminating bandwidth consump-
# tion peaks.  Lower values will be more aggressive, but may
# also result in over shaping.
TRICKLE_WSIZE=512

# Set smoothing time to seconds s.  The smoothing time deter-
# mines with what intervals trickled will try to let the ap-
# plication transcieve data.  Smaller values will result in a
# more continuous (smooth) session, while larger values may
# produce bursts in the sending and receiving data.  Smaller
# values (0.1 - 1 s) are ideal for interactive applications
# while slightly larger values (1 - 10 s) are better for ap-
# plications that need bulk transfer.  This parameter is cus-
# tomizable on a per-application basis via trickled.conf(5).
TRICKLE_STIME=5

# Set smoothing length to length KB.  The smoothing length is
# a fallback of the smoothing time.  If trickled cannot meet
# the requested smoothing time, it will instead fall back on
# sending length KB of data.  The default value is 10 KB.
TRICKLE_SLENGTH=10