Member of The Internet Defense League Últimos cambios
Últimos Cambios
Blog personal: El hilo del laberinto Geocaching

[BitTorrent] Global maximum upload rate for multiple simultaneous torrents

Última Actualización: 11 de Agosto de 2004 - Miércoles

When you launch several simultaneous torrents with the standard and official BitTorrent client, you can control the upload rate per torrent, but no the global upload rate. This situation has several problems:

  • You must change the "per torrent" upload rate when the number of simultaneous torrents change, to keep the bandwidth usage constant.

  • If a torrent underuses its allocated bandwidth, the spare capacity can't be used by other simultaneous torrents.

  • If you have many torrents and little bandwidth, rounding errors in the bandwidth calculation will give incorrect bandwidth usage.

So I wrote a patch to use a global bandwidth limiter for all torrents. That is, you set the maximum bandwidth to use globally and torrents will compete. You don't need to worry about the precise per torrent allocation. It is automatic.

In brief, if enough demand exists to saturate your indicated global upload rate, for all torrents published, per torrent share will be proportional to the "slice" size. If all clients use the same slice size (in standard BitTorrent, 16384 bytes), all bandwidth shares will be equal.

The number of clients, their bandwidth or their Round Trip Time (RTT) are not factors here.

The patch basically replace the per torrent bandwidth limiter with a global (multithread) version shared (with appropiate locking) by all the current torrents. The only issue is that each torrent must "recheck" the permission to send just before sending, because other torrent could had won the race. In this case, simply schedule another try, hoping better luck next time.

This patch is distributed AS IS (if it erases your harddisk is your fault, not mine ;-) ) using the original BitTorrent MIT License. I haven't removed the original code, so you can patch your client and enable/disable the new code at will.

  • Download the patch (20040811)

    Warning: this patch, currently, ignores the (usually unused) "max_rate_period" command line option. I don't need it. Feel free to patch my patch :-)

    Warning: This patch assumes that you have installed also my previous patch. If not, the patching will fail. You will need to patch "by hand". The patch is small, so the task is trivial.

Currently the patch implements the global maximum upload rate in "btlaunchmany.py" and "btlaunchmanycurses.py". You can add or remove torrents "on the fly", like the original client. If you wish to use this improvement in your our code/client, just do the following in the beginning of your source:

from BitTorrent import Connecter,CurrentRateMeasure
Connecter.Measure_Total=CurrentRateMeasure.Measure_Total(30)

This tiny change will activate my code.


Historia

  • 11/Ago/04: Primera versión de esta página.



Python Zope ©2004 jcea@jcea.es

Más información sobre los OpenBadges

Donación BitCoin: 19niBN42ac2pqDQFx6GJZxry2JQSFvwAfS