Search squid archive

RE: parent request order

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I use

cache_peer pp01 parent 3128 0 name=dp round-robin weight=1000000
cache_peer pp02 parent 3128 0 name=p1 round-robin
cache_peer pp03 parent 3128 0 name=p2 round-robin

This puts the three parents into a round-robin pool, but weights "pp01"
much heavier.  "pp01" will be chosen over pp02 and pp03 unless
pp01 stops responding.

Squid resets the counters used for comparison every five minutes,
so you don't have to worry about "pp01" accumulating so many
requests that the other parents are used.

There is one problem with this.  The counters are reset to zero,
and the comparison is done by dividing the count by the weight.
Zero divided by a large number is still zero, same as the other
parents.  Every five minutes all the parents are equally preferred,
until each parent gets one request.

I have patched my version of squid so that it resets the counters to
one instead of zero.

The patch follows:

*** src/cache_cf.cc.orig        2013-04-26 23:07:29.000000000 -0400
--- src/cache_cf.cc     2013-05-03 16:41:03.000000000 -0400
***************
*** 2044,2049 ****
--- 2044,2050 ----
      p->icp.port = CACHE_ICP_PORT;
      p->weight = 1;
      p->basetime = 0;
+     p->rr_count = 1;
      p->stats.logged_state = PEER_ALIVE;
  
      if ((token = strtok(NULL, w_space)) == NULL)
*** src/neighbors.cc.orig       2013-04-26 23:07:29.000000000 -0400
--- src/neighbors.cc    2013-05-07 11:15:25.000000000 -0400
***************
*** 421,427 ****
  {
      peer *p = NULL;
      for (p = Config.peers; p; p = p->next) {
!         p->rr_count = 0;
      }
  }
  
--- 421,427 ----
  {
      peer *p = NULL;
      for (p = Config.peers; p; p = p->next) {
!         p->rr_count = 1;
      }
  }
  
Mike Mitchell

________________________________________
From: T Ls [tls@xxxxxxxxx]
Sent: Monday, June 24, 2013 4:15 PM
To: squid-users@xxxxxxxxxxxxxxx
Subject: Re:  parent request order

Am 24.06.2013 21:51, schrieb Marcus Kool:
>
> ... Can't you make a setup where S1 uses P2 if P1 fails?

No, this mapping is fix.

> In an old thread I read Squid has a configuration option FIRST_UP_PARENT
> so it can be configured to use P1 and only P2 if P1 is not available.

Yep, this kind of prioritization is exactly what I'm looking for, I'm
going to search for this FIRST_UP_PARENT-option tomorrow.


Thanks so far.

Thomas








[Index of Archives]     [Linux Audio Users]     [Samba]     [Big List of Linux Books]     [Linux USB]     [Yosemite News]

  Powered by Linux