Discussion:
[libtorrent] Share mode mechanism
Ardhi Putra Pratama
2016-04-28 15:52:44 UTC
Permalink
Hello,



Exploring with share mode made me questioning, how it actually works?



In a simplest case, I only put 1 torrent in my session in share_mode. Left all
the settings, parameter, in their respective default value. I'm sure that the
swarm has some (if not a lot) of leechers. I confirmed this by looked at the
trackers and provided the data itself in another torrent client (so I seed
some of it).



However, my single-share-mode-torrent was not downloading anything. I already
have the list of peers, 'spam' the force_reannounce, and scrape regularly.



Is there any way to change the share mode algorithm?
I also wondering, is there any existing study proofing that share mode really
increase your ratio?



Thanks :D





Ardhi Putra Pratama Hartono / Msc Candidate in Computer Science
[***@ardhipoetra.web.id](mailto:***@ardhipoetra.web.id) / +31617324665

Technische Universiteit Delft - Distributed System lab
<http://www.ardhipoetra.web.id>

[ ![Twitter](Loading Image...)
](http://twitter.com/ardhipoetra) ![](https://s3.amazonaws.com/htmlsig-
assets/spacer.gif) [ ![Facebook](https://s3.amazonaws.com/htmlsig-
assets/round/facebook.png) ](https://fb.me/ardhipoetra)
![](Loading Image...) [
![LinkedIn](Loading Image...)
](https://linkedin.com/in/ardhipoetra) ![](https://s3.amazonaws.com/htmlsig-
assets/spacer.gif) [ ![Skype](https://s3.amazonaws.com/htmlsig-
assets/round/skype.png) ](https://htmlsig.com/t/0000001BSXX0E)
![](https://s3.amazonaws.com/htmlsig-assets/spacer.gif) [
![Flickr](Loading Image...)
](https://flickr.com/ardhipoetra) ![](https://s3.amazonaws.com/htmlsig-
assets/spacer.gif) [ ![Github](https://s3.amazonaws.com/htmlsig-
assets/round/github.png) ](https://github.com/ardhipoetra)
![](https://s3.amazonaws.com/htmlsig-assets/spacer.gif)
Arvid Norberg
2016-04-28 23:01:56 UTC
Permalink
Post by Ardhi Putra Pratama
Hello,
Exploring with share mode made me questioning, how it actually works?
There's a somewhat vague description here:

http://www.libtorrent.org/features.html#share-mode

and here:

http://www.rasterbar.com/products/libtorrent/reference-Settings.html#share_mode_target

In a simplest case, I only put 1 torrent in my session in share_mode. Left
Post by Ardhi Putra Pratama
all
the settings, parameter, in their respective default value. I'm sure that the
swarm has some (if not a lot) of leechers. I confirmed this by looked at the
trackers and provided the data itself in another torrent client (so I seed
some of it).
However, my single-share-mode-torrent was not downloading anything.
When you say "not downloading anything", do you mean literally 0 pieces, or
do you mean 3 pieces and then nothing more?

It's not hard to imagine scenarios where this happens. you can only upload
something if you have a piece that somebody else does not have. With a
share ratio of 3, there needs to be at least 3 peers that don't have a
piece for you to download it. If fewer peers need the piece, there's no way
to achieve the 3:1 ratio, and it won't be downloaded.

If you find a piece that lots of peers are in demand of, you may want to
download it, but you may not get unchoked by anyone who has it. and by the
time you do, perhaps the demand for it is gone. If you have low upload
capacity for instance, share mode will mostly make sure you don't download
much. because you can't compete with all the other peers that are uploading
fast.

I already
Post by Ardhi Putra Pratama
have the list of peers, 'spam' the force_reannounce, and scrape regularly.
I don't think that would make a difference.
Post by Ardhi Putra Pratama
Is there any way to change the share mode algorithm?
sure, if you can find improvements, patches are welcome!

More or less the whole algorithm is in implemented in this function:

https://github.com/arvidn/libtorrent/blob/master/src/torrent.cpp#L9724
Post by Ardhi Putra Pratama
I also wondering, is there any existing study proofing that share mode really
increase your ratio?
not other than discussion and reasoning about the logic. It's not that
complicated.
--
Arvid Norberg
Ardhi Putra Pratama
2016-04-29 13:46:44 UTC
Permalink
Yeah, I'm aware of the explanation in your link and in
torrent.cpp:recalc_share_mode(). The problem is, my project is in python. Now,
can I override this function with my function in python, I don't think so ;).
Now I'm thinking to build an algorithm on top of libtorrent library, what do
you think?

What I meant with not downloading anything, it really literally that. The
progress of that handle is 0. If I can simplify your explanation :

\- share mode try to find a piece that 3 peers doesn't have without
downloading it yet

\- if found : it will download it, and send it to those 3 peers immeadiately
(change its priority into 1)

\- if not, do nothing? Waiting for next interval?



With no download/upload activity, I guess the problem is within the share mode
that can't find suitable piece-peers. However, if I may speculate, this is
very unlikely in my case as I can confirm that there are a lot of leechers.
_upload_queue_length _also shows 0 whenever I call the peer info.



The funny thing is, after 600 seconds (10 minutes), it started to download
normally (like without turning share_mode on). The settings parameter with
default value 600 that I found is only _inactivity_timeout_. I tried to change
this parameter into another value, but it still wait till 600 secs before
downloading normally. Any clue about this?



Thanks!

Regards,

ardhi



Ardhi Putra Pratama Hartono / Msc Candidate in Computer Science
[***@ardhipoetra.web.id](mailto:***@ardhipoetra.web.id) / +31617324665

Technische Universiteit Delft - Distributed System lab
<http://www.ardhipoetra.web.id>

[ ![Twitter](https://s3.amazonaws.com/htmlsig-assets/round/twitter.png)
](http://twitter.com/ardhipoetra) ![](https://s3.amazonaws.com/htmlsig-
assets/spacer.gif) [ ![Facebook](https://s3.amazonaws.com/htmlsig-
assets/round/facebook.png) ](https://fb.me/ardhipoetra)
![](https://s3.amazonaws.com/htmlsig-assets/spacer.gif) [
![LinkedIn](https://s3.amazonaws.com/htmlsig-assets/round/linkedin.png)
](https://linkedin.com/in/ardhipoetra) ![](https://s3.amazonaws.com/htmlsig-
assets/spacer.gif) [ ![Skype](https://s3.amazonaws.com/htmlsig-
assets/round/skype.png) ](https://htmlsig.com/t/0000001BSXX0E)
![](https://s3.amazonaws.com/htmlsig-assets/spacer.gif) [
![Flickr](https://s3.amazonaws.com/htmlsig-assets/round/flickr.png)
](https://flickr.com/ardhipoetra) ![](https://s3.amazonaws.com/htmlsig-
assets/spacer.gif) [ ![Github](https://s3.amazonaws.com/htmlsig-
assets/round/github.png) ](https://github.com/ardhipoetra)
![](https://s3.amazonaws.com/htmlsig-assets/spacer.gif)
On Thu, Apr 28, 2016 at 11:52 AM, Ardhi Putra Pratama
&gt; Hello,
&gt;
&gt; Exploring with share mode made me questioning, how it actually works?
&gt;
<http://www.libtorrent.org/features.html#share-mode>
<http://www.rasterbar.com/products/libtorrent/reference-
Settings.html#share_mode_target>
In a simplest case, I only put 1 torrent in my session in share_mode. Left
&gt; all
&gt; the settings, parameter, in their respective default value. I'm sure that
&gt; the
&gt; swarm has some (if not a lot) of leechers. I confirmed this by looked at
&gt; the
&gt; trackers and provided the data itself in another torrent client (so I
seed
&gt; some of it).
&gt;
&gt; However, my single-share-mode-torrent was not downloading anything.
When you say "not downloading anything", do you mean literally 0 pieces, or
do you mean 3 pieces and then nothing more?
It's not hard to imagine scenarios where this happens. you can only upload
something if you have a piece that somebody else does not have. With a
share ratio of 3, there needs to be at least 3 peers that don't have a
piece for you to download it. If fewer peers need the piece, there's no way
to achieve the 3:1 ratio, and it won't be downloaded.
If you find a piece that lots of peers are in demand of, you may want to
download it, but you may not get unchoked by anyone who has it. and by the
time you do, perhaps the demand for it is gone. If you have low upload
capacity for instance, share mode will mostly make sure you don't download
much. because you can't compete with all the other peers that are uploading
fast.
I already
&gt; have the list of peers, 'spam' the force_reannounce, and scrape
regularly.
&gt;
I don't think that would make a difference.
&gt; Is there any way to change the share mode algorithm?
&gt;
sure, if you can find improvements, patches are welcome!
https://github.com/arvidn/libtorrent/blob/master/src/torrent.cpp#L9724
&gt; I also wondering, is there any existing study proofing that share mode
&gt; really
&gt; increase your ratio?
&gt;
not other than discussion and reasoning about the logic. It's not that
complicated.
\--
Arvid Norberg
\-----------------------------------------------------------------------------
-
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
Libtorrent-discuss mailing list
Libtorrent-***@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libtorrent-discuss

Loading...