Speed up Privoxy

Just a quick tip on Privoxy and improving performance (speed).

Privoxy is a popular proxy server that can both increase privacy and block unwanted advertisements and pop-ups (although I still use NoScript ).

Many people complain that Privoxy is slow. Part of the reason it seems slow is that Privoxy will download an entire web page, then perform filtering, then server the web page to the browser. Some people notice this delay (web pages appear blank, there is a delay, then the page loads).

Privoxy settings

In addition, IMO, the “keep-alive” feature seems to slow privoxy down quite a bit. If you read the configuration file you will see the default has been reduced from 300 (seconds) to 5 (seconds). I find Privoxy performs much better if keep-alive is completely disabled.

To disable, using any editor, simply comment out the keep-alive-timeout line in the configuration file,
/etc/privoxy/config :

Change these lines (use your editors search function to find them):

keep-alive-timeout 300
default-server-timeout 60
socket-timeout 300

To (add a # at the front of the line):

#keep-alive-timeout 300
keep-alive-timeout 600

#default-server-timeout 60
default-server-timeout 600

#socket-timeout 300
socket-timeout 600

Save your changes and restart Privoxy to apply the changes.

For additional information, see the configuration file as it is well commented.

For some discussion of keep-alive see :

Nice discussion, see the first response

This link was referenced from the first link. It is a bit dated, but a nice discussion.

Here is another more technical review. Again it feels a bit dated, but IMO is relevant reading.

Firefox settings

In the address (url) bar enter “about:config” without quotes.

In the “Filter”” box enter “network.http” and try these values:

network.http.keep-alive true
network.http.keep-alive.timeout 600
network.http.max-connections 30
network.http.max-connections-per-server 15
network.http.max-persistent-connections-per-proxy 16
network.http.max-persistent-connections-per-server 6
network.http.pipelining true
network.http.pipelining.maxrequests 8
network.http.pipelining.ssl true
network.http.proxy.keep-alive true
network.http.proxy.pipelining true

Reference : Hacking Firefox for Maximum Performance with Tor

You can try tweaking those values a bit but they seem to work on most systems. Yes this is somewhat Voodoo and I found by trial and error that these settings are fastest.

Tweaking these settings is counterintuitive and using too high a setting for “max-connections” degrades performance as does a value that is too small.

This entry was posted in Linux and tagged . Bookmark the permalink.

6 Responses to Speed up Privoxy

  1. Jason says:

    hey… your # appears in both before and after examples..
    and is there a way to stop privoxy from downloading the whole page first?

  2. bodhi.zazen says:

    @ Jason – oooops , sorry about that, fixed now.

    I do not know how to prevent privoxy from downloading the entire page first.

    If this behavior bothers you, try polipo

    Polipo is nice, and has a few features, but does not have adblocking built in. It (adblock) can be added, see my TOR page for how to do this:

    http://bodhizazen.net/Tutorials/tor

  3. Josh Surber says:

    To keep Privoxy from downloading the whole page first you need to turn off ALL of the FILTER actions. Unfortunately this may allow some ads through, but it still is the same effect that you get on all HTTPS pages. Source: http://www.privoxy.org/faq/misc.html#AEN728

  4. bodhi.zazen says:

    @Josh Surber : Thank you for the tip.

    Personally I do not mind the delay and I use the filter (which is why I prefer Privoxy to Polipo) but I am sure others will benefit.

  5. Guest says:

    Your intentions of whether you actually want to disable keep-alive or not are unclear. You first say to completely disable it yet turn all timeouts up to ridiculously high numbers. This does NOT turn off keep-alive at all. Adding to that you instruct to turn pipelining on in Firefox which is something Privoxy doesn’t even support.
    So what started off as the attempt to “speed up” Privoxy ends up being a good way to make things worse.

    Firefox has since increased their network.http.max-connections default to 256. A limit of 30 will be a constant bottle-neck.

    Yes, this post is rather old but I felt it should be made clear that those so called tweaks won’t make anything better, for anyone who might consider applying them.

    To sum it up, increasing or turning off keep-alive both are not ideal solutions. Firefox has currently a default of 115 seconds, which can be set to the same number in Privoxy. A good summary of different timeouts can be found here: http://blog.fastmail.fm/2011/06/28/http-keep-alive-connection-timeouts/
    The only real tweaking can be made with the “default-server-timeout” because that is the value Privoxy will use when the server doesn’t send a keep-alive timeout.

    If you still want to turn keep-alive off, either comment the line or set the value to 0.

  6. Pingback: Come proteggere la propria privacy, aggirare la censura e navigare piĆ¹ velocemente usando software liberi (Tor + Polipo + Privoxy + pdnsd) « Il neurone proteso

Add Comment Register



Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>