When you setup the client in your web app, you give it the same config on
both machines, for example that memcached exists on "web1" and "web2" in
your case. It's important that you name the servers in the same way and in
the same order on all machines, otherwise the clients will distribute your
keys differently, and you don't want that. (I know this is true for my .Net
client, BeITMemcached, and I think it's true for the other .Net clients as
well) Basically, you feed the memcached client an identical config in all
your web apps.

If you do that, then yes, requests for the same key will always end up at
the same server, no matter where the request originates. (This is kinda the
whole point of memcached. If it didn't, it would be useless. :) )


/Henrik Schröder

On Thu, Oct 30, 2008 at 6:58 PM, TheJonathan <[EMAIL PROTECTED]> wrote:

>
> Hi all,
>
> I'm really excited to start using memcached.  I'm currently using in-
> memory caches in my ASP.NET+IIS6 application on 2 load-balanced
> servers, but of course that isn't a shared memory between the 2
> servers.  So if key "test1" is cached on web1, web2 has no way of
> getting to it.  Enter memcached.
>
> One question I had, since I have those 2 servers (and 1 separate db) I
> want to install the memcached server on both of them since the
> database is the bottleneck, not the RAM on the servers.  If I do that,
> how does memcached figure out which server has the cache key
> efficiently?  I am missing something?  For example, say web1 is
> configured to use memcached on localhost+web2, and web2 is configured
> to use memcached on localhost+web1.  If a key is created on web1 or
> web2, will it always be stored in the same cache?
>
> Thanks for your help!
>
> --Jonathan

Reply via email to