메뉴 닫기

Trickle – 어플리케이션별 bandwidth 설정

trickle을 이용해 어플리케이션별로 트래픽에 송/수신값을 조절하는 방법으로 적절히 이용하면 시스템 관리하는데 도움이 될거 같습니다.
설치및 설정은 상당히 심플합니다.
본문에서는 ftp, wget을 통해 테스트 진행하였습니다.


참고 URL

http://www.tuxradar.com/content/control-your-bandwidth-trickle
http://monkey.org/~marius/trickle/trickle.pdf

 

INSTALL
CentOS (Enable EPEL Repository)
# wget http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
# rpm -ivh epel-release-6-8.noarch.rpm
# yum install trickle

Ubuntu
# apt-get install aptitude
# apt-get install trickle

 

Trickle이 원하는 바이너리 파일과의 작동 여부 확인
# ldd $(which ncftp) | grep libc.so
libc.so.6 => /lib64/libc.so.6 (0x00007fa499fa5000)

# ldd $(which wget ) |grep libc.so
libc.so.6 => /lib64/libc.so.6 (0x0000003620c00000)

 

Bandwidth 테스트
:: 본문에서 체크할 어플리케이션은 ftp , wget


Standalone Mode

WGET 제한없이 사용
# wget http://ftp.daumkakao.com/cygwin/x86_64/setup.ini
1

WGET 다운로드 속도제한 100KB/S
# trickle -s -d 100 wget http://ftp.daumkakao.com/cygwin/x86_64/setup.ini
2

FTP 제한없이 사용
# ncftpput -u mojily -p xxxxxxxxx chonnom.com /home/mojily setup.ini
3

FTP 업로드 속도제한 200KB/S
# trickle -s -u 200 ncftpput -u mojily -p xxxxxxxxx chonnom.com /home/mojily setup.ini
4


※ trickle Usage

Usage: trickle [-hvVs] [-d <rate>] [-u <rate>] [-w <length>] [-t <seconds>]
[-l <length>] [-n <path>] command …
-h Help (this)
-v Increase verbosity level
-V Print trickle version
-s Run trickle in standalone mode independent of trickled
-d <rate> Set maximum cumulative download rate to <rate> KB/s
-u <rate> Set maximum cumulative upload rate to <rate> KB/s
-w <length> Set window length to <length> KB
-t <seconds> Set default smoothing time to <seconds> s
-l <length> Set default smoothing length to <length> KB
-n <path> Use trickled socket name <path>
-L <ms> Set latency to <ms> milliseconds
-P <path> Preload the specified .so instead of the default one

 

Supervised [unmanaged] Mode
# trickled -d 1000 -u 1000
# ps -ef |grep trickled |grep -v grep
root 29719 1 0 18:19 ? 00:00:00 trickled -d 1000 -u 1000

속도제한이 걸리긴 하지만….Upload / Download 값이 제대로 반영은 안되는듯;;;
좀더 확인요망 (OS : CentOS 6.X X86_64, Ubuntu 14.04 LTS)
# trickle wget http://ftp.daumkakao.com/cygwin/x86_64/setup.ini
# trickle ncftpput -u mojily -p xxxxxxxxx chonnom.com /home/mojily setup.ini


※ trickled Usage

Usage: trickled [-hvVfs] [-d <rate>] [-u <rate>] [-t <seconds>] [-l <length>]
[-p <priority>] [-c <file>] [-n <path>] [-N <seconds>]
[-w <length>]
-h Help (this)
-v Increase verbosity level
-V Print trickled version
-f Run trickled in the foreground
-s Use syslog instead of stderr to print messages
-d <rate> Set maximum cumulative download rate to <rate> KB/s
-u <rate> Set maximum cumulative upload rate to <rate> KB/s
-t <seconds> Set default smoothing time to <seconds> s
-l <length> Set default smoothing length to <length> KB
-p <priority> Set default priority to <priority>
-c <file> Use configuration file <file>
-n <path> Set socket name to <path>
-N <seconds> Notify of bandwidth usage every <seconds> s
-w <length> Set window size to <length> s

/etc/trickled.conf 설정정의
[service] : 사용하고자 하는 어플리케이션 이름
Priority : 우선순위
Time-Smoothing [초]
Length-Smoothing [KB] : default 10KB

example)
# cat /etc/trickled.conf
[ssh]
Priority = 1
Time-Smoothing = 0.1
Length-Smoothing = 2

[ftp]
Priority = 2
Time-Smoothing = 1
Length-Smoothing = 3

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x