atom feed9 messages in ru.sysoev.nginxRe: Using memcache to set variables
FromSent OnAttachments
Avleen VigAug 7, 2009 8:13 pm 
miradevAug 12, 2009 5:49 am 
Johan BergströmAug 12, 2009 6:08 am 
Valery KholodkovAug 12, 2009 7:01 am 
Avleen VigAug 14, 2009 2:33 am 
Marcus ClyneAug 14, 2009 5:42 am 
Johan BergströmAug 14, 2009 6:19 am 
Valery KholodkovAug 14, 2009 8:22 am 
Valery KholodkovAug 14, 2009 8:27 am 
Subject:Re: Using memcache to set variables
From:Johan Bergström (joh@bergstroem.nu)
Date:Aug 14, 2009 6:19:16 am
List:ru.sysoev.nginx

Hey,

On Aug 14, 2009, at 11:34 , Avleen Vig wrote:

On Aug 12, 2009, at 6:08, Johan Bergström <joh@bergstroem.nu> wrote:

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.

Hi Johan!

Thus is exactly what I'm hoping to do! How do you use x-accel-redirect to get the name of a backend? I've never used it. Do ou have any code examples? This would be really perfect.

We return for instance /backend1/$old_request from our FastCGI and then have a couple of location matches in order to point the request properly backwards:

location ~ /backend1/ { proxy_set_header Host $host; # mangle $request_uri if needed proxy_pass http://1.2.3.4$new_request_uri; }

Should be rather straightforward. Good luck!

Regards, Johan