User talk:Trinity Dejavu

From Catznip
Jump to navigation Jump to search




Are you reading the correct page for you operating system? Windows - OSX - Linux

The Second Life viewer can download a significant amount of data for every location you visit (easily hundreds of MB). In order to save on repeatedly fetching the same data and to speed up the rendering of places you visit frequently the viewer has a local cache that can be up to 10GB in size.

The viewer cache is less than ideal and while it tries very hard to be smart, doesn't get it right nearly as often as it should and can not be shared between different computers / viewers. How often have you teleported home after exploring only to find you have to wait while it downloads again.

A squid proxy cache acts as an intermediary between the viewer and Linden Lab. It fetches the data requested by the viewer and stores it; should it be requested again, it provides the copy it has already downloaded almost instantly.

This makes up for the viewer cache's tendency to forget all the things you would rather it didn't and allows you to run with a much smaller local cache. It can easily be shared by multiple computers in the same household.

The size of a squid proxy cache is only limited by the amount of disk space you can spare, and it can run quite happily on older / recycled hardware. The software is free open source.

This guide based on one first published on the Phoenix / Firestorm Wiki and requires some technical ability, It will work with any recent Second Life viewer.


  • Caches textures, mesh, materials and web content (profiles, search images etc).
  • Faster more consistent loading when visiting locations repeatedly.
  • Smaller local cache (perhaps even a RAMDisk).
  • Reduced bandwidth (useful if you are on a metered service).
  • More responsive experience following teleports.
  • May enable HTTP texture usage in situations where it has caused problems previously.
  • Makes up for viewer cache shortcomings.
  • Easily shared by multiple computers, different viewers and other local Second Life users.
  • Recycle an older computer and give it a new lease of life!


  • This solution is entirely unsupported by the Catznip viewer team, while we would be interested to know if you have problems getting it to work, we wont be able to help you.
  • The first time a texture / sculpt loads may feel a little slower, it will however load in at a higher resolution.
  • Some technical ability is required.

Second Life Squid Proxy for Linux

Use the terminal for all the instructions in this guide. You will need root (sudo) access and your password.

Install build tools

First step is to install GCC and buildtools

sudo apt-get update
sudo apt-get install build-essential gcc

Download and Extract Squid 2.7

The source code is available from here, we want the 2.7 version.


Extract ...

tar xvf squid-2.7.STABLE9.tar.bz2 && cd squid-2.7.STABLE9

Compile and Install Squid 2.7

Compilation is pretty straight forward and doesn't require any special tinkering. Takes a couple of minutes on an i5. Squid will be installed into /usr/local...

sudo make install

===Create store_url_rewrite===
We need to create a little script to handle the fetching. 
sudo nano /usr/local/squid/etc/store_url_rewrite

Copy and paste the following :

$| = 1;
while (<>) {
        if (m/sim(.*?)\.agni\.lindenlab\.com(.*?)\/cap\/(.*?)\/\?

texture_id=(.*)/) {
                print "" . $4 . "\n";
        } else {
                print $_ . "\n";

Then press CTRL+X to exit nano and save the changes.

When back at the console, make the file executable with :

chmod +x /usr/local/squid/etc/store_url_rewrite

Editing squid.conf

This is a bit of a pain as the config file is very long.

In nano you can press CTRL+_ to go to a specific line number. Line numbers quoted are correct at time of writing.

sudo nano /usr/local/squid/etc/squid.conf

Go to line 653 and comment out the following two entries.

http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports

So it looks like

#http_access deny !Safe_ports
#http_access deny CONNECT !SSL_ports

Scroll down a few lines and to where it says

http_access allow localnet

and add the following line

http_access allow localhost

Go to the refresh pattern section, roughly line 2754 and add "refresh_pattern /cap/ 259200 20% 302400" so it looks like

#Suggested default:
refresh_pattern /cap/ 259200 20% 302400
refresh_pattern ^ftp:           1440    20%     10080
refresh_pattern ^gopher:        1440    0%      1440
refresh_pattern -i (/cgi-bin/|\?) 0     0%      0
refresh_pattern .               0       20%     4320

Almost done, now go to the very end of the file (press page down a lot) and paste the following

# 32 GB cache size, can make larger later.
cache_dir ufs /usr/local/squid/var/cache/ 32000 16 256

# disable range requests due to LL fail. No Last Modify header.
range_offset_limit -1

# this is a local cache, prevent possible error
visible_hostname MyBigCache

# this is the magic, convert the URL into something more static.
storeurl_rewrite_program /usr/local/squid/etc/store_url_rewrite

storeurl_rewrite_children 32

# what domains to apply the store url rewrite too.
acl store_rewrite_list dstdomain
storeurl_access allow store_rewrite_list
storeurl_access deny all

This creates a 32GB cache with the files stored in /usr/local/squid/var/cache, you can make the cache as large as you like.

Complete file can be seen on Pastebin.

Install Squid 3

We wont be using this

Create Cache & Start up Script

sudo mkdir /usr/local/squid/var/cache

Start Squid

To start Squid and have it run when the computer starts

sudo port load squid

Configure the viewer & Final Steps

The following instructions are Catznip specific, for other viewers please refer to their documentation. These steps are required. Once completed relog.

Proxy Settings

In Catznip, open the preferences (CTRL+P), select the 'Setup' tab and press the 'Adjust proxy settings' button. Enter the network address of the machine now running squid, in this case it's named 'MiniMac', If you are running the proxy on the same machine as you use for secondlife it will be 'localhost'. Make sure the port is '3128', and most importantly then at the bottom set 'Other HTTP traffic..' to use the proxy.

Catznip proxy cache.png

Setting the Viewer Cache

You can now reduce the viewer cache. Preferences, 'Advanced tab, move the slider to the desired amount. We do not recommend you set this smaller than 1GB. While here, press the clear cache button.

Catznip cache prefs.png

Enabling HTTP Textures

Catznip ships with HTTP textures disabled by default due to some long standing issues with some domestic routers.

Enable the 'Developer menu' by pressing CTRL+ALT+Q or via preferences.

From the top menu check Develop > HTTP Texures.

Menu develop http textures.png

Relog the viewer

Go on .. it wont take a moment :)