# Is nginx able to work with multiple memcached servers?

**URL:** <https://www.ruby-forum.com/t/is-nginx-able-to-work-with-multiple-memcached-servers/148768>\
**Category:** NGINX\
**Created:** [September 16, 2008, 11:13pm UTC](https://www.ruby-forum.com/t/is-nginx-able-to-work-with-multiple-memcached-servers/148768 "2008-09-16T23:13:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![erazor](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/5e9695/32.png) [@erazor](https://www.ruby-forum.com/u/erazor)\
**Post date:** [September 16, 2008, 11:13pm UTC](https://www.ruby-forum.com/t/is-nginx-able-to-work-with-multiple-memcached-servers/148768/1 "2008-09-16T23:13:43Z")

</div>

Is nginx able to work with multiple memcached servers and therefore  
correctly hashes the key to pick a server from the cluster?

---

<div class="post-metadata">

**Author:** ![erazor](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/5e9695/32.png) [@erazor](https://www.ruby-forum.com/u/erazor)\
**Post date:** [September 16, 2008, 11:44pm UTC](https://www.ruby-forum.com/t/is-nginx-able-to-work-with-multiple-memcached-servers/148768/2 "2008-09-16T23:44:38Z")

</div>

I am running one instance of nginx with 18 memcached servers. Not  
using hashing though since my application doesnt distribute load that  
way.

Cheers  
Kon

---

<div class="post-metadata">

**Author:** ![erazor](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/5e9695/32.png) [@erazor](https://www.ruby-forum.com/u/erazor)\
**Post date:** [September 17, 2008, 2:38am UTC](https://www.ruby-forum.com/t/is-nginx-able-to-work-with-multiple-memcached-servers/148768/3 "2008-09-17T02:38:21Z")

</div>

Oliver Weichhold \<lists@…\> writes:

> Is nginx able to work with multiple memcached servers and therefore  
> correctly hashes the key to pick a server from the cluster?

By default, nginx will round-robin requests to multiple backend  
memcached  
servers - which is probably not the behavior you want.

Evan M. implemented an optional module which hashes the key to pick  
a server  
from the cluster. You can read about it here:

[http://wiki.codemongers.com/NginxHttpUpstreamRequestHashModule](http://wiki.codemongers.com/NginxHttpUpstreamRequestHashModule)

---

<div class="post-metadata">

**Author:** ![erazor](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/5e9695/32.png) [@erazor](https://www.ruby-forum.com/u/erazor)\
**Post date:** [September 17, 2008, 8:53am UTC](https://www.ruby-forum.com/t/is-nginx-able-to-work-with-multiple-memcached-servers/148768/4 "2008-09-17T08:53:41Z")

</div>

Tyler K. wrote:

> Oliver Weichhold \<lists@…\> writes:
> 
> > Is nginx able to work with multiple memcached servers and therefore  
> > correctly hashes the key to pick a server from the cluster?
> 
> By default, nginx will round-robin requests to multiple backend  
> memcached  
> servers - which is probably not the behavior you want.
> 
> Evan M. implemented an optional module which hashes the key to pick  
> a server  
> from the cluster. You can read about it here:
> 
> [http://wiki.codemongers.com/NginxHttpUpstreamRequestHashModule](http://wiki.codemongers.com/NginxHttpUpstreamRequestHashModule)

Exactly what I was looking for. Thanks.
