Persistence + Round robin
Brian Moschel
brian.moschel at gmail.com
Thu Sep 25 12:43:24 MSD 2008
Grzegorz,
While your proposed solution provides a clever way to stick requests to the
same node, it doesn't provide a way to fulfill the first part of my
requirement: dispatching the first 100 requests with Referer=
www.somedomain.com to nodeA and the next 100 to nodeB. UPSTREAM_FAIR looks
great but it doesn't fill this need.
Maybe a little background would help. This is a comet application (hence
the need for sticky sessions) and its using a shared memory system
(Terracotta) for multiple nodes. Because of how we built it, the shared
memory works much faster when users from the same referer are grouped on the
same node, hence the need for this requirement.
Is there any way to do this second requirement without coding something?
Thanks,
Brian
On Thu, Sep 25, 2008 at 3:16 AM, Grzegorz Nosek <grzegorz.nosek at gmail.com>wrote:
> On Thu, Sep 25, 2008 at 03:56:36PM +0800, Jeffrey 'jf' Lim wrote:
> > uh... right - that's the magical "something" there... ;)
>
> :)
>
> How about embedding the upstream ID in the URL or query string and
> matching that using the rewrite module? Or as a part of cookies sent to
> the client (you could match that via $http_cookie, altough I seem to
> remeber that there was a special module for that). So a backend sets a
> cookie containing e.g. "backend=1" (along with any other data).
>
> I think you could match it like this:
>
> location / {
> if ($http_cookie ~ backend=1$) {
> proxy_pass http://up_1;
> }
> # etc.
> }
>
> Unfortunately you have to pass something to the client but a cookie will
> probably be the least ugly.
>
> Best regards,
> Grzegorz Nosek
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nginx.org/pipermail/nginx/attachments/20080925/7bc72a46/attachment.html>
More information about the nginx
mailing list