I am running a cluster of squid 2.5 servers to accelerate many domainsand everything is working very well. I am currently going direct to the origin servers on cache misses.Will there be performance gains if I add the other squid servers as cache peers or will the endusers perceive latency while the squid checksits peers versus going direct.
I run a small LAN with similar issues. I have 4 desktops that run squid and check the other 3 before hitting the gateway which also runs Squid. I was having latency issues until I had all my users run a proxy.pac with the following:
function FindProxyForURL(url, host)
{
var hash=0;
if((position("127.0.0.1",url)>-1)
|| (position(".lan",url)>-1))
return "DIRECT";
hash=URLhash(url);
switch(hash)
{
case 0:
return "PROXY 10.0.0.10:3177; PROXY 10.0.0.11:3177; PROXY
10.0.0.12:3177; PROXY 10.0.0.13:3177; DIRECT";
break;
case 1:
return "PROXY 10.0.0.11:3177; PROXY 10.0.0.12:3177; PROXY
10.0.0.13:3177; PROXY 10.0.0.10:3177; DIRECT";
break;
case 2:
return "PROXY 10.0.0.12:3177; PROXY 10.0.0.13:3177; PROXY
10.0.0.10:3177; PROXY 10.0.0.11:3177; DIRECT";
break;
case 3:
return "PROXY 10.0.0.13:3177; PROXY 10.0.0.10:3177; PROXY
10.0.0.11:3177; PROXY 10.0.0.12:3177; DIRECT";
break;
}
}
function URLhash(name)
{
var now = new Date();
var cnt=0;
var hash=0;
var str=name.toLowerCase(name);
for(var i=0;i < str.length ; i++)
{
var ch=(str.substring(i,i+1));
var n=char2num(ch);
cnt=cnt+n;
}
hash=(Math.floor(now.getSeconds()+cnt)%4);
return(hash);
}
function char2num(ch)
{
var symbols=" !\"#$%&'()*+'-./0123456789:;<=>?@";
var loAZ="abcdefghijklmnopqrstuvwxyz";
var loc;
symbols+=loAZ.toUpperCase();
symbols+="[\\]^_`";
symbols+=loAZ;
symbols+="{|}~";
loc=symbols.indexOf(ch);
if(loc>-1)
return(32+loc);
else
return(0);
}
function position(srch,name)
{
var l=srch.length;
var t=name.length;
var e=t-l+1;
var done=-1;
for(var i=0;i<e && done<0;i++)
{
var sub=name.substring(i,i+l);
if(sub==srch)
done=i;
}
return(done);
}
This gives me good results even under extremely high load...
pgpGRWoOy3SA4.pgp
Description: PGP signature
