0

Is there some sort of limitation/throttling logic at all? And if so, is it based on the tor client instance, connection or IP address?

What if I download a file over HTTP and download the first half and second half separately? Would this have an impact on my download speed? Would it make a difference if I used the same TOR client instance, same IP address or same tor connection?

E.g. download a file with two HTTP connections over a TOR client running on port 9050:

aria2c -x 2 --all-proxy=127.0.0.1:9050 https://i.imgur.com/z4d4kWk.jpg

Or one TOR client instance running on port 9050 and another one running on port 9051.
Then downloading the first half using the first instance:

curl -s --socks5-hostname 127.0.0.1:9050 https://i.imgur.com/z4d4kWk.jpg -i -H "Range: bytes=0-73257"

while simultaneously downloading the second file using the second TOR instance:

curl -s --socks5-hostname 127.0.0.1:9051 https://i.imgur.com/z4d4kWk.jpg -i -H "Range: bytes=73256-146514"

Would any of these have an advantage in terms of download speeds over a simple single-connection HTTP download:

curl -s --socks5-hostname 127.0.0.1:9051 https://i.imgur.com/z4d4kWk.jpg
2
  • 1
    I'll try to come back later to add a full answer, but something to get you started: Tor relays use EWMA circuit prioritization. This is intended to prioritize "bursty" circuits for interactive applications rather than large downloads.
    – Steve
    Nov 15 '20 at 19:09
  • Very intersting, I'd love to hear more.
    – Forivin
    Nov 15 '20 at 23:25
1

Tor doesn't use per-user prioritization because this is very difficult to do in an anonymity network. Instead each relay uses per-circuit prioritization. The main use-case for Tor is interactive web applications such as web browsing, so Tor uses EWMA circuit prioritization to prioritize "bursty" circuits for interactive applications rather than large downloads. This means that lower-use circuits are prioritized by relays over bulk downloads.

In addition to prioritization, Tor also uses flow control to limit the amount of in-flight data (the amount of data in the network at once). This flow control uses Relay{Sendme} cells. Tor limits circuits to 1000 in-flight cells (about 500 KiB), and streams to 500 in-flight cells (250 KiB). This means that the maximum throughput of a circuit/stream depends on its latency.

What if I download a file over HTTP and download the first half and second half separately? Would this have an impact on my download speed?

Yes, your download speed would increase since you're downloading these halves using two different streams (each would be able to have 250 KiB of in-flight data). If using more than two downloads, you would want to use different circuits since circuits are limited to 500 KiB of in-flight data.

Would it make a difference if I used the same TOR client instance, same IP address or same tor connection?

Using different Tor clients may make your total download speed worse since the second Tor client would be using a different guard relay. Since the total download speed will be limited by the slowest of the two halves, there is a possibility that your second Tor client will use a slower guard relay, increasing your download time. If your second Tor client uses a faster guard relay, it doesn't matter since you're still limited by the download speed of the first Tor client. The only time when two Tor clients might help is if you're using a really bad guard that becomes overwhelmed by a single download.

Would any of these have an advantage in terms of download speeds over a simple single-connection HTTP download:

Downloading chunks in parallel should improve the download speed. Running two Tor clients does not help, what's important is the number of circuits. Once you try to make 3 or more downloads through a single circuit, your total download speed will hit a ceiling. If you want to force downloads to use different circuits, use different SOCKS usernames so that Tor will isolate the streams.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.