Forum: Ruby on Rails Question about running memcached on multiple servers

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Wes G. (Guest)
on 2007-03-05 19:07
All,

I have memcached running on two boxes and memcache-client installed and
am ready to integrate into my Rails app.

I see lots of references to running the memcached server daemon process
on several servers.  This implies that you would have completely
different caches on each machine, correct?  So you would just fire up as
many cache processes as you need to cache different items in hopes of
distributing the load.

There isn't any notion of some sort of distributed cache (cache that
lives on multiple servers), right?  That would seem to imply some sort
of replication or cache server affinity.

Thanks,
Wes
Philip H. (Guest)
on 2007-03-05 19:22
(Received via mailing list)
> lives on multiple servers), right?  That would seem to imply some sort
> of replication or cache server affinity.

Right... from the memcache page...

-------------

Now, what actually happens is that the API hashes your key to a unique
server. (You define all the available servers and their weightings when
initializing the API) Alternatively, the APIs also let you provide your
own hash value. A good hash value for user-related data is the user's ID
number. Then, the API maps that hash value onto a server (modulus number
of server buckets, one bucket for each server IP/port, but some can be
weighted heigher if they have more memory available).

If a host goes down, the API re-maps that dead host's requests onto the
servers that are available.

-------------
Wes G. (Guest)
on 2007-03-05 20:27
Very nice.  So it really is a distributed cache out of the box.
This topic is locked and can not be replied to.