agentzh
April 18, 2011 01:16AM
On Sat, Apr 16, 2011 at 2:09 AM, Andy <nginx-forum@nginx.us> wrote:
> Hi,
>
> I want to use Nginx as a caching reverse proxy to a Django website that
> runs behind Nginx over uWSGI.
>

You can try out ngx_srcache + ngx_memc to do such caching.

> Is it possible for Nginx to use multiple memcached servers to cache the
> dynamic pages generated by Django?

Sure, see these two slide pages for an example:

http://agentzh.org/misc/slides/nginx-state-of-the-art/#25
http://agentzh.org/misc/slides/nginx-state-of-the-art/#26

> If so can you share some example
> config? All the examples I've seen only uses one local memcached
> server.

See above.

>
> And if it's possible to use multiple memcached servers, who will be
> doing the storing and invalidation of cached pages - Nginx or Django?

If ngx_srcache is used, nginx is doing caching completely.

> And if it's Django, how do i make sure that given the same key, both
> Django and Nginx will hash to the same memcached server?
>

If you want your python app to access memcached as well, the
recommended approach is to pass the nginx variable holding the hashed
memcached upstream name back to your fastcgi app.

When caching does not even reach your python app, your server will
easily reach 10k ~ 20k req/sec for a simple machine when a cache hit
happens ;)

Cheers,
-agentzh

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx
Subject Author Posted

How to make Nginx work with distributed/multiple memcached servers?

Andy April 15, 2011 02:09PM

Re: How to make Nginx work with distributed/multiple memcached servers?

Akins, Brian April 15, 2011 02:30PM

Re: How to make Nginx work with distributed/multiple memcached servers?

agentzh April 18, 2011 01:16AM

Re: How to make Nginx work with distributed/multiple memcached servers?

agentzh April 18, 2011 01:18AM

Re: How to make Nginx work with distributed/multiple memcached servers?

杨显功 April 18, 2011 01:56AM

Re: How to make Nginx work with distributed/multiple memcached servers?

agentzh April 18, 2011 02:24AM

Re: How to make Nginx work with distributed/multiple memcached servers?

杨显功 April 18, 2011 02:42AM

Re: How to make Nginx work with distributed/multiple memcached servers?

Andy April 19, 2011 10:09PM

Re: How to make Nginx work with distributed/multiple memcached servers?

agentzh April 20, 2011 12:12AM

Re: How to make Nginx work with distributed/multiple memcached servers?

agentzh April 20, 2011 12:16AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 284
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