Bug 109343 - download and upload speeds in KTorrent are relatively low and jumpy, it seems to me
Summary: download and upload speeds in KTorrent are relatively low and jumpy, it seems...
Status: RESOLVED FIXED
Alias: None
Product: ktorrent
Classification: Applications
Component: general (other bugs)
Version First Reported In: unspecified
Platform: unspecified Linux
: NOR wishlist
Target Milestone: ---
Assignee: Joris Guisson
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-07-19 19:56 UTC by Alexander van Loon
Modified: 2005-08-26 12:56 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander van Loon 2005-07-19 19:56:10 UTC
Version:            (using KDE KDE 3.4.1)

I've been using KTorrent for some weeks now and downloaded around 5 torrents with it. It is my experience that KTorrent's up and download speeds are noticeably lower than for example Azureus, when downloading the same torrent, both clients having the available up/down bandwith of my connection capped at 45%, and when they are both connected to a lot of peers. Are other users having the same experience, or is this specific to the torrents I'm downloading?
This especially applies on the upload speed, when the download speed is reasonable, the upload speed can be 0 or very low, resulting in very low share ratio's.

If more users are experiencing this, is it possible to improve the performance of KTorrent in terms of download/upload speeds?

Another problem is that the download/upload speeds can vary greatly between seconds. For example, at one moment the download speed is 50 KB/s, then it can suddenly jump to 10 KB/s the next second.



BTW, this is a bit off-topic, but Joris Guisson, have you seen this: https://bugs.kde.org/weekly-bug-summary.cgi?tops=20&days=31 ? Your name is mentioned three times in the list of top 20 people who most quickly fixed a report in the last 31 days. I was astonished when you replied to my bug reports/wishes so fast. I wonder, are you working on KTorrent full-time ;) ?

Another question, I'm very happy with KTorrent and I would like to do something back. Are you interested in a small donation via PayPal?
Comment 1 Joris Guisson 2005-07-20 23:36:10 UTC
Fixing those bugs was less then 2 minutes work, it was just of matter of checking bugs.kde.org or my e-mail at the right moment.

I'm not working full-time, it's more 0.75 * full-time, I just graduated and am looking for a job, so aside from the time spend job hunting, I have time enough. 

I don't have a credit card, so I can't recieve PayPal donations. (Stupid bank, you have to pay extra to get one *).

Lets move on to the speed issues : 

- Download speed :
Download speeds are dependant on two things : how fast the peers upload and how many peers you are connected to. The first one, I can't change, the second I could increase by basicly not following the protocol and just trying every possible tracker for peers, but I don't like this.

There's allways a bit of luck involved in this, it really depends on the list of peers you get back from the tracker. If the tracker sends you a lot of slow peers, you get slower downloads. If the tracker sends you a list with fast peers, your downloads get faster.

- Upload speed :
As for the upload speeds, we can only upload stuff, when the other peers ask for it. The protocol only allows for a limited number of uploaders (this is called choking). I'm curious in Azureus : Options -> Transfers -> Default max upload slots per Torrent , what is it's default value ? The BitTorrent protocol says this should be 4, but seeing that it's configurable in AZ they probably use a higher default value.

- Jumpyness of download speeds :
I know the download cap, will create jumpy download speeds, and I need to tweak this further (I'm currently focusing on other stuff). It's on the TODO list, just not at the top spot.

Without download speed capping, it will allways fluctuate, you're dependant on somebody else for you're download speed. Really big jumps can be caused when you're downloading from 1 fast peer and lot's of slow ones, if the fast connection is lost you're speed will obviously go way down.

- To conclude :
Do other people have similar experiences ? Or do you have totally opposite experiences ? (I wouldn't have to do anything in this case :-) Please post them here.



Comment 2 Alexander van Loon 2005-07-22 23:32:06 UTC
Upload speeds are very jumpy for me as well, one moment it is 40 KB/sec then  it stays at 0 KB/sec for a few minutes. I understand your explanation, there are a lot of factors which influence the download/upload speeds, but with KTorrent it seems to be quite extreme to me. Just had another experiment, 2 torrents open with 50 peers connected for each torrent, no limits on download upload speeds. The download speeds remained at 0 KB/s for long periods of time, and when it did download, the total download speed never exceeded 40 KB/s, my ADSL connection can handle 160 KB/s though. I already had the torrents running for some hours, but there wasn't much speed improvement.

I almost suspect that the low speeds are caused by port forwarding problems, but in my router config I'm 100% sure that I've forwarded the port which KTorrent uses on TCP and UDP. However, I can't be sure if that could be the problem because KTorrent doesn't tell, unlike for example Azureus, if the port is forwarded or not.
Comment 3 Joris Guisson 2005-07-23 10:45:39 UTC
Can you send me the torrent in question ?

KTorrent will use different ports for each torrent (starting at the value in the configuration dialog, I really need to change this to a range of ports in the dialog). 

When you're capping the number of peers to say 50, once you are connected to 50 peers, no new connections will be made or accepted. Maybe I need to occasionaly get rid of some peers who have been choking us for a long time. So we can replace those with new ones. (hopefully faster ones)
Comment 4 Alexander van Loon 2005-07-23 11:35:50 UTC
Ah, so a port range is used, now that could explain the low speeds I'm getting. However, isn't it possible to use only one port, like other BT-clients (again Azureus, for example)? As far as I know it's only possible with my SpeedTouch 510 router to forward a single port, it's not possible to forward a port range.

Torrents I was downloading are:

From this website: http://www.gotwoot.net/
http://www.gotwoot.net/torrents/[AonE]_Naruto_142_[A96A4B42].avi.torrent

From this website: http://www.mahou.org/
http://tracker.mahou.org/torrents/[mahou]_Trinity_Blood_-_08_[145CA622].avi.torrent
http://tracker.mahou.org/torrents/[mahou]_Trinity_Blood_-_09_[8D2277B1].avi.torrent
Comment 5 Joris Guisson 2005-07-23 13:46:26 UTC
It's possible, it's easier for me to use 1 port per torrent. Note that the port(s) we're talking about here, are not used to send data over. They basicly just handle (TCP) connection requests. We just listen for incoming connections on this port.

Wether or not these port(s) are forwarded or not, will not have any impact on download or upload speeds.
Comment 6 Alexander van Loon 2005-07-23 16:29:46 UTC
"Wether or not these port(s) are forwarded or not, will not have any impact on download or upload speeds."

Oh ok, I thought they did because when I was using Azureus and ports were not forwarded, you would have the so-called "NAT-problem" and then the download/upload speeds would be crippled.

Off-topic: didn't you read my other e-mail? I was wondering if you are really sure that you need a credit card for receiving money via PayPal. I've checked the PayPal website, I haven't read anywhere that it's required to have a credit card to receive money. If it's all right you should be able to receive money on your PayPal account and then transfer the money from your PayPal account to your bank account?
Comment 7 Joris Guisson 2005-07-23 20:31:41 UTC
Actually my last post about port forwarding isn't quite accurate. If the ports aren't forwarded you can connect to others, but nobody can connect to you (because they would be trying to connect to port 6881 of your NAT-enabled router, which obviously has nothing listening on that port). 

So without port forwarding the speed might be slower because you're connected to less people. But it will not have an influence on the speed of individual peers.

Let me get back to you about the PayPal thing, I will look into that tomorrow. I think I misjudged your e-mail as one being sent by bugs.kde.org (the standard thing they send when somebody replies to a bug you own)
Comment 8 Alexander van Loon 2005-07-23 21:42:45 UTC
Ok, thanks for explaining. Your earlier post was a bit confusing for me, as it contradicted what I read on other websites about bittorrent and port forwarding.

Yes, you must have misjudged my e-mail as a bug reply. To sent you an e-mail I replied on one of your bug replies, and replaced the adress 109343@bugs.kde.org with your e-mail adress. But I forgot to change the subject, so it's my fault.

I've just read your e-mail and donated some money to you.
Comment 9 Joris Guisson 2005-08-07 14:23:40 UTC
KTorrent as of now only uses one port (allthough I still need to add some error checking)
Comment 10 Alexander van Loon 2005-08-09 11:16:38 UTC
I compiled the most recent SVN source and gave it a try. This time my download rate reached a maximum of 160 KB/s, nearly completely using up my bandwith. Thanks for implementing single port usage.

Only problem is that it completely ignored the download limit of 50 KB/s, which is a problem for me, because I'm behind a router with other PC's. If KTorrent uses all the bandwith, it's nearly impossible for them to use the Internet. Do you have any idea when you will be able to fix the download limiting?

BTW, concerning the UPnP bug, as far as I understand Thiago will have to implement support for UPnP in the KDE network library, so that you will be able to use UPnP in KTorrent? Any idea when this will happen, KDE 3.5 maybe?
Comment 11 Joris Guisson 2005-08-09 11:43:58 UTC
You will have to ask Thiago about that.

Speed issues dealt with, unless you have any objection, I'm gonna close this bug.
Comment 12 Thiago Macieira 2005-08-10 01:53:21 UTC
No, not for 3.5. I'll try to implement for 4.0.
Comment 13 Alexander van Loon 2005-08-20 00:55:39 UTC
I reopened this bug because there still seem to be some speed problems. I've experimented a bit more now. I tried downloading the OpenSUSE beta and the Fedora Core 4 torrents, they give me great download speeds of 160 KB/s, which is nearly the entire downstream bandwith of my ADSL connection. Other torrents also give good speeds, 50 KB/s or so, which is fine. However there is one website, http://www.mahou.org/, they release fansubs of anime series, which releases torrents which download very slow with KTorrent. I just tried download the Trinity Blood 11 torrent there, it gives me an average speed of under 10 KB/s, with a maximum of 20 KB/s. I tried downloading it with Azureus, and Azureus easily gives me 50 KB/s (with d/l speed limited at 50 KB/s).

So, what can be the problem? I don't think it's me, because I can download other torrents with good speeds. I don't think it is a lack of seeds/peers for that torrent, I just checked and it had 300 seeds and peers total and Azureus could do it without a problem. Am I the only one getting very low speeds with KTorrent on the Trinity Blood 11 torrent? To make this clear, torrents from http://www.mahou.org/ are the only ones so far which give very low download speeds, all the other torrents I've tried from other websites give good speeds.
Comment 14 Joris Guisson 2005-08-20 10:57:40 UTC
Sander I just tried this Trinity Blood 11, after 20 seconds or so I got download speeds > 500 KB/sec
Comment 15 Joris Guisson 2005-08-20 11:03:13 UTC
And it isn't an UDP tracker either so it can't be caused by http://bugs.kde.org/show_bug.cgi?id=111127
Comment 16 Alexander van Loon 2005-08-20 18:29:00 UTC
This is a very strange problem, I would suspect that it would have something to do with KTorrent and my router then because Azureus does give me a good D/L speed on that torrent, but on the other hand KTorrent did give good speeds on the OpenSuSE and Fedora Core 4 torrents I tried.

Is there anyway I/you can figure out what the cause of this problem is? 
Comment 17 Joris Guisson 2005-08-21 11:22:12 UTC
It can be pure bad luck, my +500 KB/sec speed was completely dependant upon one peer. If that peer fails for whatever reason (power failure, computer crash, natural disaster, angry parents who think son is using to much bandwidth, ...), there won't be much speed left.

Did you try it multiple times with AZ and KTorrent ? If it keeps happening with KTorrent and not with AZ, we can rule out bad luck or any of the above reasons.
Comment 18 Joris Guisson 2005-08-26 12:56:56 UTC
SVN commit 453499 by guisson:

Changes :
- Fixing of all speed issues (Bug 111050,Bug 109343)
- Bug 111427 (was actually fixed by previous commit, thanks to Ivan)

BUG: 111050
BUG: 109343
BUG: 111427



 M  +4 -4      choker.cpp  
 M  +3 -3      choker.h  
 M  +5 -5      chunkdownload.cpp  
 M  +1 -1      chunkdownload.h  
 M  +8 -5      peer.cpp  
 M  +4 -1      peer.h  
 M  +5 -13     peermanager.cpp  
 M  +4 -4      peermanager.h  
 M  +2 -2      peeruploader.cpp  
 M  +2 -2      peeruploader.h  
 M  +1 -1      piece.cpp  
 M  +1 -1      piece.h  
 M  +1 -1      request.cpp  
 M  +5 -5      request.h  
 M  +2 -2      torrentcontrol.cpp  
 M  +1 -1      uploader.cpp  
 M  +2 -2      uploader.h