Welcome! Log In Create A New Profile

Advanced

Re: Using memcache to set variables

Johan Bergstr
August 12, 2009 09:08AM
Hey,
On Aug 8, 2009, at 05:13 , Avleen Vig wrote:

> I started using the geo module to direct users by IP address, this
> week, and really like it!
>
> It got me thinking about another thing I've been wanting to do: Direct
> users to different machines based on some arbitrary data. I don't want
> to rely just on cookies, because those can be manipulated. Here's what
> I was thinking, and I'm wondering if it can be done some how in nginx?
>
> The sessionid is stored in a cookie. This can't be manipulated or the
> users ends up not being logged in.
> Store the sessionid in memcache, and have the value set to the name of
> a location.
> Have nginx fetch the value for 'sessionid' from memcache, and then
> redirect the user internally to that location.
>
> Is this even remotely possible? I think some hardware load balancers
> can do it, but I'm too poor to buy one of those :-)

We're doing something similar - through a FastCGI-app written in C -
which looks up a host as key in memcached (cookie would work just as
fine) and returns a backend (we have lots of different nginx backends)
that the frontends proxies to. The key here is to use X-Accel-
Redirect. So, in short: Yes, it's possible and delivers ~2k r/s per
frontend for us. A FastCGI/whatever app written in php/python would
probably work just as well, port to C when performance is needed.
Subject Author Posted

Using memcache to set variables

Avleen Vig August 07, 2009 11:13PM

Re: Using memcache to set variables

miradev August 12, 2009 08:50AM

Re: Using memcache to set variables

Johan Bergstr August 12, 2009 09:08AM

Re: Using memcache to set variables

Avleen Vig August 14, 2009 05:34AM

Re: Using memcache to set variables

Marcus Clyne August 14, 2009 08:42AM

Re: Using memcache to set variables

Valery Kholodkov August 14, 2009 11:22AM

Re: Using memcache to set variables

Johan Bergstr August 14, 2009 09:19AM

Re: Using memcache to set variables

Valery Kholodkov August 12, 2009 10:01AM

Re: Using memcache to set variables

Valery Kholodkov August 14, 2009 11:27AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 218
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready