Re: [squid-users] Accelerator Cluster

From: Mar Matthias Darin <BDarin@dont-contact.us>
Date: Wed, 05 Apr 2006 23:13:27 -0500

Hello,

Jerry Thomas writes:

> I am running a cluster of squid 2.5 servers to accelerate many domains
> and 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 checks
> its 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...

---
In Memory of Major Douglas Craig Condit 
Let us not forget Major Douglas Craig Condit, casualty of the Vietnam 
War. As a member of the Air Force Reserve, MAJ Condit served our 
country until May 22nd, 1979 in North Vietnam. He was 37 years old and 
was married. Douglas died when his plane crashed into the land. his 
His body was recovered. Douglas was born on February 5th, 1942 in 
Forest Grove, Oregon. 
MAJ Condit is on panel 30E, line 089 of the Vietnam Memorial Wall in 
Washington D.C. 
--- [ tanaya.net/Exim/Antiviral/CBBB20F7 ] ---
This message has been scanned with ClamScan, BitDefender,  H+BEDV
AntiVir, and F-PROT antivirus software and has been determined to
be VIRUS FREE.
Received on Wed Apr 05 2006 - 22:17:11 MDT

This archive was generated by hypermail pre-2.1.9 : Mon May 01 2006 - 12:00:02 MDT