aMule Forum
English => Feature requests => Topic started by: Axl_Mas on May 26, 2005, 12:48:49 PM
-
For me would be a great thing that amule change the upload speed automatically according to the network traffic!
Infact i have to decrese the upload speed manually in my linux server every time that i use skype in the windows client!
Please develop USS!!!!!
-
actually, if you use amule cvs u'll have a kind of USS .. amule uses UBT -> Upload Bandwidth Throttler
cheers
-
thank you!
I will try the cvs versione!!!
-
I have done the installation of cvs version........but where is the UBT???????
-
in amule itself, working all the time ;)
-
Originally posted by deltaHF
in amule itself, working all the time ;)
But where is??????
I don't find it either in amule 2.0.1 or today's CVS!!!!
-
why do you try to find it? there is no option to disable or enable it - it's there and working enabled always.
of course you can take a look at the source:
UploadBandwidthThrottler.cpp
UploadBandwidthThrottler.h
cheers
ps. there is no such function in 2.0.1
-
Jhea!!!!!!!!!
It works perfectly, best of emule's USS!!!!!!!!!!!!!!!!
Very compliments to the developers of amule!!!
-
Axl_Mas,
Just out of my curiosity as a developer, how did you test it? By using skype at the same time? What exactly did you notice before/after usign UBT enabled aMule?
Cheers!
-
phoenix: sounds nonsense - there's no way application will know congestion state of network. It comes worse - when connected to cable modem, even kernel have wrong idea about it. You can read more about it, http://www.lartc.org/ (http://www.lartc.org/)
The best we can do - is control traffic WE send more correctly (UploadBandwidthThrottler.cpp comes to mind)
-
and that's what we do lfroen. Your point is...?
-
Your point is...?
No point, just wanted to highlight it. It was seems that people think otherwize ;(
-
lol,
My point :) is, I would like to know why people think that aMule best responsiveness is due to UBT. What is the difference that people feel on aMule and on the other apps behaviour. I have read a message by Mr Faber, but he uses traffic control, that is something else.
Cheers!
-
My personal experience:
I have a 128/1024 line, so with our "good old 4k bug" and 10k upload to get the full download speed my line is somewhat at its limit. With the old amule this ended up that I had a ping to IRC servers ~3-5 seconds when amule was running and ssh was just unusable. Since UBT has been implemented the IRC ping went down to <1 second and ssh is still a little delayed but usable...
-
USS is good but traffic shaping is much more better. You can set the upload to zero and still have nearly normal ping delays.
Since aMule CVS (I don't know the reason unitil I read this thread) the upload is very stable even if you set no limit.
I used USS on my windows system in the past but it only can reacts after the ping goes high not before (isn't so good for online gaming etc.). Since tc aMule can upload as much as it can and my brother can skype with his friends an play online CS over one connection at the same time.
Another advantage is that he can't kill my connection and I can't kill his one.
cu
Mr Faber
-
Mr Faber,
I would like to invite you to write some lines about your experience with traffic shaping and aMule, and maybe explaining your configuration. We could put your essay in aMule wiki, and I believe we could all benefit from your experience.
thedude0001,
I think that the old 4K bug is saturating the uplink, and as most people don't know about it, it "seems" like the new aMule is performing better, but in most cases, setting the upload limit 4K below would have had the same results.
Cheers!
-
I can post my config but I think GonoszTopi and lfroen are the experts so they can it better I think (http://forum.amule.org/thread.php?threadid=5466&sid=).
I have used a part of Fairnat (http://www.metamorpher.de/fairnat/) and tweaked it to my needs.
I use four wondershaper classes but only two are needed for normal use. One for aMule and one for normal traffic. Both classes are seppareted through the wondershaper script in two classes. One for interactive and one for bulk traffic.
I have made some little changes to the wondershaper script but I am no expert so I don't know if this is needed for everyone.
By the way I have relativelly much upload (theoratically 64 KB but I used only 60 KB for the script because with it I have always a ping between 9-16 ms to my provider while aMule uploads as much as it can) so I don't know if it works as good for slower connections.
[EDIT]Hm, 61 KB/s seems to work as good as 60 but I haven't made a long test. Before I used tc I thought that my connection can only effort a little more than 50 KB (~55 maximum) because eMule couldn't upload more.
Now my system monitor shows always a changing upload of 58 KB to 61 KB so it seems to work. Linux and aMule rules :) [/EDIT]
If you really think that my configuration script is needed I can post it.
cu
Mr Faber
-
I will post my script here with some basic changes. I have removed two of the four classes because they aren't needed for most people. I have removed the download shaping too because it haven't any effect on aMule. To let the wondershaper function still work with nat I have made a dirty hack. I haven't the time to looking deeper into it and create two wondershaper functions. Maybe later but I think that experts can wrote it in some seconds :)
I use wondershaper classes in my script but I have changed some things. I removed the burst for the non interactive class because it could increase my ping from time to time as far as I know.
IMHO 90% is to low for the non interactive class so I replaced it. Since tc works nearly in real-time 99% shouldn't be to much for my connection but everyone can choose which percentage he wants.
The script isn't well designed and maybe has bugs but it works for me fine in the original version.
I am a newbie on linux and in traffic shaping so don't be to cruel :D . I hope that this will help someone.
# based on parts of Fairnat ([URL]http://www.metamorpher.de/fairnat/[/URL])
# and the wondershaper script ([URL]http://lartc.org/wondershaper/[/URL])
WAN_INF=eth0
percent=99 #percent of bandwith for non interactive classes
UPLOAD_LIMIT=488
UP_RATE_NORMAL=88
UP_RATE_AMULE=88
wondershaper()
{
# Make the positional parameters more readable.
# Use UC_ prefix to make sure that these variables belong to User_Class.
UC_DEV=$1
UC_PARENT=$2
UC_MARK=$3
UC_MARK1=$4
UC_MARK2=$5
UC_RATE=$6
UC_CEIL=$7
# Add HTB class:
tc class add dev $UC_DEV parent 1:$UC_PARENT classid 1:$UC_MARK \
htb rate ${UC_RATE}kbit ceil ${UC_CEIL}kbit
# Add filter for this user.
tc filter add dev $UC_DEV parent 1: protocol ip \
handle $UC_MARK fw flowid 1:$UC_MARK
# high prio class 1:10:
tc class add dev $UC_DEV parent 1:$UC_MARK classid 1:$UC_MARK1 \
htb rate ${UC_RATE}kbit ceil ${UC_CEIL}kbit burst 6k prio 1
tc class add dev $UC_DEV parent 1:$UC_MARK classid 1:$UC_MARK2 \
htb rate $(($UC_RATE*$percent/100))kbit ceil $(($UC_CEIL*$percent/100))kbit prio 2
# all get Stochastic Fairness:
tc qdisc add dev $UC_DEV parent 1:$UC_MARK1 handle $UC_MARK1: \
sfq perturb 10
tc qdisc add dev $UC_DEV parent 1:$UC_MARK2 handle $UC_MARK2: \
sfq perturb 10
# TOS Minimum Delay (ssh, NOT scp) in 1:10:
tc filter add dev $UC_DEV parent 1:$UC_MARK protocol ip prio 10 \
u32 match ip tos 0x10 0xff flowid 1:$UC_MARK1
# ICMP (ip protocol 1) in the interactive class 1:10 so we
# can do measurements & impress our friends:
tc filter add dev $UC_DEV parent 1:$UC_MARK protocol ip prio 10 \
u32 match ip protocol 1 0xff flowid 1:$UC_MARK1
# To speed up downloads while an upload is going on, put ACK packets in
# the interactive class:
tc filter add dev $UC_DEV parent 1:$UC_MARK protocol ip prio 10 \
u32 match ip protocol 6 0xff \
match u8 0x05 0x0f at 0 \
match u16 0x0000 0xffc0 at 2 \
match u8 0x10 0xff at 33 \
flowid 1:$UC_MARK1
# Default: Put stuff in class 2.
tc filter add dev $UC_DEV parent 1:$UC_MARK prio 100 \
protocol ip handle $UC_MARK fw flowid 1:$UC_MARK2
}
# removing old entries
tc qdisc del dev $WAN_INF root
################################################
##### WARNING - IT REMOVES EVERY MANGLE CLASS! IF YOU HAVE A FIREWALL IT CAN LACK SOME CLASSES! ####
################################################
iptables -F -t mangle
iptables -D -t mangle
# 1: Set TOS for several stuff.
iptables -t mangle -A PREROUTING -p icmp -j TOS --set-tos Minimize-Delay
iptables -t mangle -A PREROUTING -p tcp --sport telnet -j TOS --set-tos Minimize-Delay
iptables -t mangle -A PREROUTING -p tcp --sport ssh -j TOS --set-tos Minimize-Delay
iptables -t mangle -A PREROUTING -p tcp --sport ftp -j TOS --set-tos Minimize-Delay
iptables -t mangle -A PREROUTING -p tcp --sport ftp-data -j TOS --set-tos Maximize-Throughput
iptables -t mangle -A PREROUTING -p tcp --dport telnet -j TOS --set-tos Minimize-Delay
iptables -t mangle -A PREROUTING -p tcp --dport ssh -j TOS --set-tos Minimize-Delay
iptables -t mangle -A PREROUTING -p tcp --dport ftp -j TOS --set-tos Minimize-Delay
iptables -t mangle -A PREROUTING -p tcp --dport ftp-data -j TOS --set-tos Maximize-Throughput
# 3: Correcting TOS for large packets with Minimize-Delay-TOS
iptables -t mangle -N CHK_TOS
iptables -t mangle -A CHK_TOS -p tcp -m length --length 0:512 -j RETURN
iptables -t mangle -A CHK_TOS -p udp -m length --length 0:1024 -j RETURN
iptables -t mangle -A CHK_TOS -j TOS --set-tos Maximize-Throughput
iptables -t mangle -A CHK_TOS -j RETURN
iptables -t mangle -A PREROUTING -m tos --tos Minimize-Delay -j CHK_TOS
# 4: Modifying TOS for TCP control packets: (from [URL]www.docum.org[/URL] / Stef Coene)
iptables -t mangle -N ACK_TOS
iptables -t mangle -A ACK_TOS -m tos --tos ! Normal-Service -j RETURN
iptables -t mangle -A ACK_TOS -p tcp -m length --length 0:256 -j TOS --set-tos Minimize-Delay
iptables -t mangle -A ACK_TOS -p tcp -m length --length 256: -j TOS --set-tos Maximize-Throughput
iptables -t mangle -A ACK_TOS -j RETURN
iptables -t mangle -A PREROUTING -p tcp -m tcp --tcp-flags SYN,RST,ACK ACK -j ACK_TOS
# 5: Networks
#normal traffic
########dirty hack##########
#since my standard script uses four wondershaper classes I used always marked packets. Due to the fact that my wondershaper function only works with marking I made this dirty hack. It seems to work but if someone is interested he can create two wondershaper classes instead or made something different (I don't know).
iptables -t mangle -A OUTPUT -d 0.0.0.0/0 -j MARK --set-mark 11
iptables -t mangle -A PREROUTING -d 0.0.0.0/0 -j MARK --set-mark 11
############################
#amule traffic
iptables -t mangle -A OUTPUT -m owner --cmd-owner amule -d 0.0.0.0/0 -j MARK --set-mark 12
iptables -t mangle -A OUTPUT -m owner --cmd-owner amuled -d 0.0.0.0/0 -j MARK --set-mark 12
tc qdisc add dev $WAN_INF root handle 1: htb default 11
tc class add dev $WAN_INF parent 1: classid 1:1 htb rate ${UPLOAD_LIMIT}kbit ceil ${UPLOAD_LIMIT}kbit
#normal traffic
wondershaper $WAN_INF 1 11 111 112 $UP_RATE_NORMAL $UPLOAD_LIMIT
#amule traffic
wondershaper $WAN_INF 1 12 121 122 $UP_RATE_AMULE $UPLOAD_LIMIT
cu
Mr Faber
-
Hi.
What's the main benefit of UBT in comparison to the old method?
I never had problems with upload bandwidth with aMule.. ok, maybe I'm the wrong one to say that (old line was 512kbit up, aMule set to 50k, 7k per slot; new line is 2mbit up, aMule set to 200k, 10k per slot :])
-
Ok, I tried out recent CVS and now I know that it's a great addition! My average uploadrate is nearing my max setting even on the high setting of 200k smoothly. Thx alot for implementing it!
-
Don't get me wrong but if you use traffic shaping you can upload nearly 256 Kilobyte with your 2 MBit connection without having a bad ping. That would be at least four slots more :D And if you need nearly all the bandwith aMule uploads only 10 KB or what you have configured with tc.
cu
Mr Faber
-
WOOOOAAAAA~
Thx such alot, Mr Faber.
Just recompiled my kernel with netfilter and qos modules and used your script to setup the chains and all.. even after 5 minutes of webbrowsing it seems to do magic!
I set to UPLOAD_LIMIT=1920 in the script, you think it's a sane value for 2mbit?
Atm amule still runs with a fixed max of 220k, maybe I'll try something different (= higher) later today/tonight.
-
I am happy that my script helped someone :). But please consider that it is a really basic script and I am no expert.
2 MBit = 1024 Kbit * 2 = 2048 KBit
I don't know your real limits so I would start with 2040 (one Kbyte lower). You can test your connection through pinging your provider. I would at first ping without the script and without aMule. After that I would run the script and start aMule.
You have to wait some time until aMule reaches the maximum upload and ping your provider. If the ping is much higher, lower your upload limit and rerun the script and wait a moment. Repeat this until your ping is normal or at least nearly normal.
To test purposes I would use 100% instead of 99%t. If you find your limit set it back to 99 or the value you want.
According to your post you have all needed modules. To verify this I would use the command "tc -s class ls dev eth0" (replace eth0 with your internet interface).
You can check in expample that the aMule classes aren't zero or when you ping that the rate of interactive normal traffic class (the first one) increases.
cu
Mr Faber
-
I noticed that remote work on my comp is much slower now (ssh, scp). Guess I'll have to play a bit to get optimum settings/classes for me :)
Thx alot so far!
-
At first you should check that the separation in classes works fine (tc ...) and than use ping and not ssh or something like that to get the optimal value as I described. If your connection is stable you have nothing to change after finding the optimal value.
cu
Mr Faber