Changes between Version 12 and Version 13 of doc/FireFoxTorPerf

Apr 23, 2010, 4:47:54 AM (10 years ago)



  • doc/FireFoxTorPerf

    v12 v13  
    33== Introduction ==
    54Tor is known for being secure but slow. If you want to improve browsing speed a bit, please follow the following simple instructions for tweaking the Firefox web browser's settings:
     6== Table of contents ==
     7 * Procedure 1
     8 * Advanced Tuning of Tor
     9 * Advanced Tuning of Polipo
     10 * Advanced Tuning of Privoxy
     11 * Advanced Tuning of Windows
     12 * The proof is in the pudding, results
    714== Procedure 1 ==
    915First, open Firefox's advanced settings menu by running ''about:config'' from the address bar. Upon entering this address, you will see a long list of internal settings. Modify the following ones and set them to the suggested values shown here for maximum performance:
    11 {{{ network.http.keep-alive.timeout:600 (300ms default is OK usually, but 600 is better.)
     18network.http.keep-alive.timeout:600 (300ms default is OK usually, but 600 is better.)
    1219network.http.max-persistent-connections-per-proxy:16 (Default is 4)
    1320network.http.pipelining:true (Default- false. Some old HTTP/1.0 servers can't handle it.)
    1421network.http.pipelining.maxrequests:8 (No default)
    1522network.http.proxy.keep-alive:true (Default- true, but double check)
    16 network.http.proxy.pipelining:true (Default- false) }}}
     23network.http.proxy.pipelining:true (Default- false) - See NOTE1 below.}}}
    18 Afterwards, just restart the browser and experience the difference! For some automated additional performance hacks, check out [ FireTune]. Currently, Fire``Tune is only for Win32, but you can do the same tweaks manually with the help of [ this page]. Additionally, there is the [ FasterFox extension] that is easy to install, and is also '''platform independent'''!
     25Afterwards, just restart the browser and experience the difference! For some automated additional performance hacks, check out the [[|FasterFox extension]]. You also can do the same tweaks manually with the help of [[|this page]].
    20 == Procedure 2 - an update and addendum to 1 ==
     27NOTE1: Proxy pipelining may not be well supported by Privoxy. For this reason, you may want to install [[|Polipo]] and use that instead of Privoxy to get the performance benefits of pipelining. If you use [[|Torbutton]] (which you should, if you want [[|any anonymity at all]]), all of the Tor-relevant privacy scrubbing features of Privoxy are no longer necessary.
    22 You will need the following tools...
    23  * [ Tor Button]
    24  * [ FasterFox]
     29NOTE2: Do not use page prefetching. Disable this if it is enabled. Prefetching is a speculative feature, which assumes that you will read the pages referenced by the links in the current page you are viewing. This places undue load on the Tor network and clog your circuits with unnecessary traffic. Its unlikely you will read all the pages referenced by the current page, especially in the case of search engines results.
    26 == Tor Button ==
    27 This provides an optional button or text in the bottom right of the browser window in Firefox. This allows you to switch TOR on and off.
     31=== Using Polipo Proxy (example assumes Windows - adjust accordingly) ===
     32Polipo as a proxy instead of Privoxy has been discussed in some places online, with reports that it is more performant.
     33To use this proxy:
     34 * Install Polipo to the default location
     35 * Set Vidalia's Proxy application to:
     36    'C:\Program Files\Polipo\polipo.exe' - without quotes.
     37 * Set Vidalia's Proxy application arguments to:
     38    -c "C:\Program Files\Polipo\config"
    29 == FasterFox ==
    30 This plugin modifies the networking and cache settings for Firefox. The following settings need to be modified.
    31  * Initially you need to select 'Custom' in the FasterFox Options. This allows you to use your own detailed options, rather than the default schemes supplied.
    32  * Select the Cache tab.
    33   * Enter a Memory Cache Capacity of >= 8mb
    34   * Enter a Disk Cache Capacity of >= 8mb
    35  * Select the Connection tab
    36   * Enter Max Connection >= 16
    37   * Enter Max Connection Per Server >=16
    38   * Enter Max Persistent Connection Per Server >= 16
    39   * Enter Max Persistent Connection Per Proxy >= 16
    40  * Select the Pipelining tab
    41   * Ensure all 3 tick options are enabled
    42   * Enter Max pipelining requests >= 16
     40You will not see a shell window for Polipo, but the process will be created and visible in the Task Manager. Check the process exists to assure it is working correctly.
    44 == DNS ==
    45 For faster DNS performance generally and especially useful for TOR (on win32 only i'm afraid) see...
    46  * [ AnalogX - FastCache]
     42== Advanced Tuning of Tor  ==
     43If you follow the previous authors work you should have well performing access. To go that bit further lets consider the ideal behaviour of our Tor client.
    48 Also for all OS'es see...
    49  * [ OpenDNS]
     45You will need: [[|The on-line reference to Tor properties, that can be placed in torrc.]] Always back up this file before editing.
    51 == Increase TOR process Priority (win32) ==
    52 You will also realise a substantial increase in performance by increasing the process priority for the TOR process. You can do this in Task Manager after you identify tor.exe. If you want to persist the process priority you will need a Task Manager addon. An effective tool for doing this is [ Prio]. This tool can only be used in a non-commercial setting, unless you license it.
     47=== A Tor Non-Functional Requirement (NFR) ===
     48Lets think of a Non-Functional Requirement we might like to place on our Tor client.
     50 * we want it to establish circuits as quickly as possible. If it takes too long to do this ignore them, by timing out the building of circuits quickly.
     51 * now we have circuit build time-outs occuring more frequently, we need to encourage Tor to try to generate circuits more often.
     52 * Once we have established a circuit, we are assuming its a good one and we dont want it being timed out by firewalls or anything else. We need to make sure a ping occurs on the circuit to prevent this.
     53Given this NFR, lets come up with some properties that may help satisfy it.
     55 * CircuitBuildTimeout NUM
     56  . Try for at most NUM seconds when building circuits. If the circuit isn't open in that time, give up on it. (Default: 1 minute.) Force circuits that are quick to establish and thus likely to push traffic more quickly. Values as low as 2 seconds have been tried with good results, although this can cause severe damage to the Tor network if your network connection is simply not fast enough to establish any circuits in this time. The effect is a smaller 'Topological Radius' of servers used for Tor, ie the network connections available from your connection. Unfortunately, the smaller you make this number, the smaller the number of paths your client will use, and the less your anonymity.
     57  As of Tor v0.2.1.9-alpha, the CircuitBuildTimeout has been clipped to 30 seconds, which affects some of the tuning recommendations here. From the release notes:"
     58  ''Clip the CircuitBuildTimeout to a minimum of 30 seconds.
     59  Warn the user if lower values are given in the configuration.
     60  Bugfix on
     61 Patch by Sebastian.''"
     62 * NumEntryGuards NUM
     63  . If we are going to be decreasing the CircuitBuildTimeout, you want to increase the likelihood you have a guard node fast enough to build these fast circuits for you. NUM=5 to 8 are good choices here.
     64 * KeepalivePeriod NUM
     65  . To keep firewalls from expiring connections, send a padding keepalive cell every NUM seconds on open connections that are in use. If the connection has no open circuits, it will instead be closed after NUM seconds of idleness. (Default: 5 minutes)
     66 * NewCircuitPeriod NUM
     67  . Every NUM seconds consider whether to build a new circuit. (Default: 30 seconds) Lets make Tor ready to establish a new circuit more readily.
     69Settings that you may append to the end of the torrc configuration file are as follows:
     71# Try for at most NUM seconds when building circuits. If the circuit
     72# isn't open in that time, give up on it. (Default: 1 minute.)
     73CircuitBuildTimeout 5
     75# Increase the number of guards to increase the likelihood that
     76# you will have a few guards fast enoiugh to build these circuits.
     77NumEntryGuards 6
     79# Send a padding cell every N seconds to keep firewalls from closing
     80# our connections while Tor is not in use. (Default: 5 minutes)
     81KeepalivePeriod 60
     83# Force Tor to consider whether to build a new circuit every NUM
     84# seconds. (Default: 30 seconds)
     85NewCircuitPeriod 15
     88As an added bonus, with these settings the "New Identity" button in Vidalia also effectively becomes a "This circuit is WAY too slow" button that you can mash to get a faster, more responsive circuit if Tor ever starts choking up on you. This is necessary because sometimes circuits will start out fast, but then get overloaded as traffic from other clients bursts and overwhelms the slowest node in the path.
     91== Advanced Tuning of Polipo ==
     92The settings here assume plenty of memory on the machine hosting this stack.
     94Within Polipo's config file, add the following parameters at the top:
     96pmmFirstSize = 8192
     97pmmSize = 2048
     112chunkHighMark = 50331648
     113objectHighMark = 16384
     116The settings above enable Polipo to replace Privoxy, but still enables the Tor toggle button to operate, if you are using the Tor FireFox plugin.
     119== Advanced Tuning of Privoxy ==
     120Privoxy is set to be a 'straight-through' proxy server, with the toggle switch. Its buffer is reduced to below that of RWIN. This is because RWIN represents the largest TCP receive window. Its value is chosen to be above Tor default socks size = 252KB
     122|| -- || -- ||
     123||Privoxy:buffer || 265 (KB)||
     124||toggle || 0||
     126== Advanced Tuning of Windows ==
     127This section has been included last for those who are technically capable.
     129=== Processor Scheduling (win32) ===
     130Windows enables the program running in the foreground to have heightened processor resources. If this option is switched to 'Background Processes', Tor appears to return consistently higher performance. This option can be found in 'My Computer | Right click | Properties | Advanced Tab | Performance Settings | Advanced tab again.
     132=== TCPOptimizer -  2K/XP's throughput (win32) ===
     133Windows XP has a self-tuning IP stack, but it can still benefit from a little help. Using the TCP Optimiser tool from above you can tune the MTU, RWIN, SACK OPTS (rfc 2038), and tcp1323opts controlling window scaling. The tool has one button optimise. This setting is sufficient to benefit from immediate increases to Tor throughput. To increase throughput further you can try experimenting with lower values of the IP TTL (Time To Live). Values as low as 32 will work and result in improved performance. Also try experimenting with smaller TCPWindowSizes. This setting is automatically adjusted when you move the slider marked 'Connection Speed' of the TCPOptimizer  tool.
     135||Windows||in TCP Optimizer||
     136|| -- ||-- ||
     137||RWIN|| TCPOptimizer max setting||
     138||MTU|| 576, 1500 or 1492 - try all 3 settings||
     139||Window Scaling|| On||
     140||TcpIP TTL || 128 (hops)||
     141||LANBufferSize || 65535 (bytes)||
     143You can view your connection parameters and their effects on your connections, both with Tor and without Tor, at [[|DSLReports]]
     145=== Event ID 4226 Patcher - Remove the limit on TCP connection attempts XP SP2 (win32) ===
     146[[|Remove the limit on TCP connection attempts]] has an interesting article detailing this restriction introduced in XP SP2. Microsoft have restricted the amount of half-open TCP/IP connections with the proviso that it would reduce the pace that worms spread. As noted by SpeedGuide, internet worms spread isotropically (multi-directionally) and so their infecton rate is exponential. As such, placing a constant (limit) on the rate of connection creation for every computer running XP SP2 will slow the rate of worms spreading (for that group of computers) but not by much. Consider the population of humans on the planet. Its over ~6 billion.
     148Supposing all these people are running Windows XP SP2, with rate limited half-open connections. Rate limiting is set to 10 half-open connections per second. To infect the entire population of computers would take: We are assuming optimum forward infection here. In the first second we have infected 10 machines. The 2nd second to elapse will cause (10 x 10) + 10 = 110 computers to be infected. The 3rd second to elapse would cause:
     150 . ( (10 x 10) x 10 ) + (10 * 10) + 10 =  1110 computers to be infected. So the number of computers infected for every second that elapses is : computers infected = ~ 10 ^ elapsedSeconds
     151In 12 seconds, we would have 10 ^ 12 = 1 billion computers infected. Full infection occurs before 13 seconds have elapsed !
     153This is all skewed by network topologies and routing algorithms, but they would affect a non-limited network in an identical manner. So the affect is a theoretical maximum of 13 seconds of additional notice to act against the worm. To all intents and purposes, this is useless.
     155Of much more interest is the effect on ANY network that relies on many open connections, such as Tor and a host of P2P applications. The effect here is a slow down of communications, with the limit acting as the catalyst.
     157Use the Event ID 4226 Patcher to mitigate against this.
     159=== DNS Catching time ===
     160Reducing DNS caching time reduces the risk of an invalid DNS resolve, given Tor servers may be operating in a DHCP environment that updates the IP each time the network connects.
     161||Windows||registry:TCPIP service||
     162|| -- || -- ||
     163||DNS Cache || 36000(seconds (10 hours)) set in registry by hand, HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters||
     165== The proof is in the pudding, results ==
     166With the changes made from Procedure 1 and 2, and a 2Mb connection, you can realise a sustained throughput of >100k, peaking at ~256k or more, with a ping response time of between 250 and 900ms. In other words, experimentation away from default settings, should enable you to saturate your internet connection (depending on Tor node capacity), which is the ideal result. All results tested under Tor v0.1.2.7-alpha(r17216)
     168These figures were arrived at by using [[|]]