Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Varnish: Misc

How client.identity works?

 

 

Varnish misc RSS feed   Index | Next | Previous | View Threaded


hugo.cisneiros at gmail

Jul 19, 2013, 4:29 PM

Post #1 of 2 (79 views)
Permalink
How client.identity works?

Hau,

I'm testing some configurations with the client director and cookie-based
sticky sessions and want to know:

How client.identity decides which backend to use?

For example, if I have two servers with exactly the *same* backends, *same*
VCLs, and a request is sent with client.identity = "ABCDEF1234567890" on
BOTH servers, does both requests on both servers go to the same backend
server? It could be true if using some sort of hash table.

Or the client director first picks a random backend and associates its
value to the client.identity, remembering for the future? This could be
true if using some sort of a key:value table. This way, first scenario
won't work reliably.

Many thanks,

--
[]'s
Hugo
www.devin.com.br


ksorensen at nordija

Jul 20, 2013, 5:10 AM

Post #2 of 2 (68 views)
Permalink
Re: How client.identity works? [In reply to]

On Fri, 2013-07-19 at 20:29 -0300, Hugo Cisneiros (Eitch) wrote:
> Hau,
>
>
> I'm testing some configurations with the client director and
> cookie-based sticky sessions and want to know:
>
>
> How client.identity decides which backend to use?
>
>
> For example, if I have two servers with exactly the *same* backends,
> *same* VCLs, and a request is sent with client.identity =
> "ABCDEF1234567890" on BOTH servers, does both requests on both servers
> go to the same backend server? It could be true if using some sort of
> hash table.

It is my experience that this is the case, and I'm relying on this
behaviour in a couple of installations. IIRC, the director is an array
of backends, and the hashing ultimately returns an array index, so as
long as your director

* has the same number of backends
* has its backends defined in the same order
* has the same weights
* has the same view of backend health

on each Varnish instance, the same client.identity string will cause the
same backend to be chosen. So if one of your backends become sick as
seen only from the one of your Varnishes, then requests for that backend
will be routed differently between the two Varnishes.

>
> Or the client director first picks a random backend and associates its
> value to the client.identity, remembering for the future? This could
> be true if using some sort of a key:value table. This way, first
> scenario won't work reliably.

The client director does not save any state between requests.

/Kristian



_______________________________________________
varnish-misc mailing list
varnish-misc [at] varnish-cache
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc

Varnish misc RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.