Configuring Squid to query other cache servers for content
Introduction
If there are more than one cache server available at the same place, there is a way for any server to query the others for cached content. An example of this would be if a company has two buildings each with its own cache, e.g. building1-cache and building2-cache, where both are configured as [cache siblings], a mean to share cached contents.
What is ICP
As RFC 2186 indicates:
“ICP is a lightweight message format used for communicating among Web caches. ICP is used to exchange hints about the existence of URLs in neighbor caches. Caches exchange ICP queries and replies to gather information to use in selecting the most appropriate location from which to retrieve an object.”
and
“ICP is a message format used for communicating between Web caches. Although Web caches use HTTP for the transfer of object data, caches benefit from a simpler, lighter communication protocol. ICP is primarily used in a cache mesh to locate specific Web objects in neighboring caches. One cache sends an ICP query to its neighbors. The neighbors send back ICP replies indicating a (HIT) or a (MISS)”
So, if the content is available at one of the cache siblings (HIT), it serves the requester directly instead of going to the origin server -on Internet- to download it.
Configuring Squid
Make sure that the following line exists in /etc/squid/squid.conf and is not commented:
icp_port 3130
As this line enables Squid’s ICP to serve other cache servers.
Next is to have the following line:
cache_host x.x.x.x sibling yyyy 3130 proxy-only
Where x.x.x.x is the other cache IP address, yyyy is the cache HTTP port (squid default is 3128), and proxy-only tells Squid to load content directly and not save it locally. If you have more servers, just list them accordingly.
Issue the Squid reload command to apply the updated config:
#/etc/init.d/squid reload
Do the same steps for the rest of servers.
Testing The Settings
If the service is reloaded, a new entry will be there in /var/log/squid/cache.log:
Configuring Sibling x.x.x.x/3128/3130
If after a while (ICP timeout), an entry like:
Detected DEAD Sibling: x.x.x.x
is there, double check for any network related problem as Squid service had failed to contact the other cache server, otherwise, cache exchange is working.

Comments