Discussion:
[libtorrent] Using multiple connections to mitigate latency
Sivachandran Paramasivam
2017-04-18 06:05:46 UTC
Permalink
I'm transferring files over high latency(>150ms) high speed(>100Mbps) link.
I found that libtorrent uses single connection per peer, torrent pair for
its data transfer. Because of this the transfer speed is slow(~30-40Mbps).
Whereas if I do the same transfer with low latency(<50ms) link then
libtorrent utilizes maximum usable bandwidth. I tried adjusting the send
and receive buffer sizes but not much improvement in download speed.

To confirm the issue I tried single connection HTTP download on this high
latency link and it resulted the same download speed of what libtorrent
achieved. But if I use multi connection HTTP download then it utilizes full
bandwidth.

Is there a way I can tell libtorrent to use multiple connections even for
same peer, torrent? I believe this would utilize the bandwidth to the max.

Thanks,
Sivachandran Paramasivam
Arvid Norberg
2017-04-18 23:14:50 UTC
Permalink
On Mon, Apr 17, 2017 at 11:05 PM, Sivachandran Paramasivam <
Post by Sivachandran Paramasivam
I'm transferring files over high latency(>150ms) high speed(>100Mbps) link.
I found that libtorrent uses single connection per peer, torrent pair for
its data transfer. Because of this the transfer speed is slow(~30-40Mbps).
Whereas if I do the same transfer with low latency(<50ms) link then
libtorrent utilizes maximum usable bandwidth. I tried adjusting the send
and receive buffer sizes but not much improvement in download speed.
You may need to bump some kernel parameters too, if you're using TCP.
Post by Sivachandran Paramasivam
To confirm the issue I tried single connection HTTP download on this high
latency link and it resulted the same download speed of what libtorrent
achieved. But if I use multi connection HTTP download then it utilizes full
bandwidth.
Using multiple connections effectively just makes your max send and receive
buffers some multiple larger.
Post by Sivachandran Paramasivam
Is there a way I can tell libtorrent to use multiple connections even for
same peer, torrent? I believe this would utilize the bandwidth to the max.
You can enable support for multiple connections to the same IP, but you
can't tell libtorrent to try to establish multiple connections.

I would discourage you to do so. Using multiple connections (as far as I
can tell) would be a hack to work-around the underlying configuration error
(i.e. receive window and congestion window caps set too low).

If you use uTP you have more direct control over the buffer sizes.

Additionally, the bottleneck could be at the application layer, take a look
at:

http://blog.libtorrent.org/2011/11/requesting-pieces/

and

http://blog.libtorrent.org/2015/07/slow-start/
--
Arvid Norberg
Continue reading on narkive:
Loading...