sharding with varnish: generating director identifier from an integer

Per Buer perbu at varnish-software.com
Thu Nov 15 16:22:54 CET 2012


Hi,

On Thu, Nov 15, 2012 at 3:52 PM, Enno van Amerongen <enno at tty.nl> wrote:

> **
> Hi List,
>
> My coworkers and I are working on a sharding VMOD and we got to the point
> it's actually working (woohoo!).
>
> Now, our implementation is pretty straightforward:
>
>  - get id from url
>  - do a "id mod n" to pick correct shard ( = director)
>  - set req.backend = shardN
>


Any particular reason you didn't use the client director? This is more or
less exactly what it does.

You would set client.identity to the ID you pick and Varnish will use a
hash algorithm to consistently pick a backend from the backends in the
director.


-- 
 <http://www.varnish-software.com/> *Per Buer*
CEO | Varnish Software AS
Phone: +47 958 39 117 | Skype: per.buer
We Make Websites Fly!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20121115/32e4b3c6/attachment.html>


More information about the varnish-misc mailing list