Volta
What is volta?
Volta is a high performance, low resource URI rewriter for use with the Squid caching proxy server (or alternatively Polipo!) With it, you can dynamically alter URI requests that pass through Squid based on various criteria.
It uses a state machine to parse URIs and rules, and a constant database to store and access those rules.
Why is it called "volta"?
It's a type of old Italian music written in triple-time. Quick!
How fast is it?
On a 2Ghz Xeon 5130, it can process a million squid requests against 10000 rules in less than 8 seconds, using about 800k of ram. On an 1.8Ghz Intel E4300, it can do it in 3 seconds.
Your mileage may vary, but for most all intents and purposes the answer is "definitely fast enough."
Configuring squid
You must enable url rewriting from within the squid.conf file.
url_rewrite_program /usr/local/bin/volta
... and that's it. You may need some additional customization, like where the volta database is stored on disk:
url_rewrite_program /usr/local/bin/volta -f /var/db/squid/volta.db
Busy servers:
Make sure rewrite_concurrency is disabled, volta is single threaded. Instead, just add more volta children. They are lightweight, so load em up. A proxy at my $DAYJOB is in use by around 450 people, and we get by nicely with 10 volta children.
url_rewrite_concurrency 0 url_rewrite_children 10
Usage
See the installation instructions for how to build volta.
Volta reads its rewrite rules from a local database. You can create the rules in a text editor, then convert it to the database like so:
% volta -c rules.txt
You'll be left with a "volta.db" file in the current directory. Put it wherever you please, and use the -f flag to point to it.
Rules file syntax can be found here.
