hotspare configuration

16 views
Skip to first unread message

ktechie

unread,
Jul 10, 2011, 1:42:24 AM7/10/11
to memcached
I want to setup memached servers with each having a hotspare.
So a memcached server running on a particular ip and port combination
and port will have another memcached
server running on same ip and port.
I tested this on windows xp.
I am able to able multiple memcached processes, but only one is active
at a time.
When the first process is killed, the other one gets active.

However I am unable to open two processes in the same way in linux. It
says the port is already in use.

Is this the correct way to setup hotspare & if so how do I set it up
in linux machine.

Please advise.

Thanks for the replies

Arjen van der Meijden

unread,
Jul 10, 2011, 4:36:31 AM7/10/11
to memc...@googlegroups.com
Am I reading you correctly, in that you want to set up a hot spare
memcached-daemon on the same machine?

To what purpose would you do that? Memcached is very stable (ours is
running for a year now), so it basically won't die by itself. I don't
really understand why you would want to kill it, but I'm assuming that's
a very rare occasion as well. You're normally better off by either
changing the key-names and let expiration times take care of the
deprecated keys or simply clearing the cache.

A restart is normally pretty quick, so I'd wager you won't need a hot
spare in that rare case you really needed to kill/restart it.

As for hot spare. You normally set that up in case your primary resource
goes out. And having an active and a hot spare instance on a single
machine won't ward you against machine failure.

Basically, if you don't need a cache larger than a single machine's
memory, I'd not try and set a hot spare up the way you do. But on a
separate machine... Unfortunately that's relatively complicated to do,
especially if you want to keep it transparent for the clients by taking
over the ip of the original machine.
If you don't want to allocate a machine for this, than don't bother
setting up a hot spare the way you intended any way. To my mind, that's
just wasting memory on it.

If your cache requirement is larger than a single machine's memory,
you're probably better off with a pool of machines without any hot
spare. Memcached's default sharding algorithm will just spread the keys
to other memcached daemons from the pool if one goes missing. So you
don't really need to have a hot spare ready to take over its share.

Best regards,

Arjen

On 10-7-2011 7:42 ktechie wrote:
> I want to setup memached servers with each having a hotspare.
> So a memcached server running on a particular ip and port combination
> and port will have another memcached
> server running on same ip and port.
> I tested this on windows xp.
> I am able to able multiple memcached processes, but only one is active
> at a time.
> When the first process is killed, the other one gets active.
>
> However I am unable to open two processes in the same way in linux. It
> says the port is already in use.
>

> Is this the correct way to setup hotspare& if so how do I set it up

ktechie

unread,
Jul 10, 2011, 7:31:29 AM7/10/11
to memcached
Thanks for the reply.
You are right ..I plan to have the hotspare on the same maching.

Let me explain what I understand by hotspare as I have tested on
windows.
I start two memcached servers having same host and port (from same
maching). I can check the task manager that two memcached instances
are running.

When I get/set to a memcached running on the above host & port, the
client talks to only the first memcached server.
The second is empty. I shut down the first memcached server & again
tried to get/set. Now the client talks to the second server
transparently.
Note : the second server is empty.


I am using xmemcached which is now providing failure mode, so a
particular key will be served only from one memcached server & if that
server is down then there will be a cache miss.
This will avoid key rehash when one server goes down & since I have a
hotspare it will start getting used (it will be empty though). This
will help me avoid serving stale data in case one server goes down and
comes up again.

Our configuration will be two memcached servers which will be on two
different machines. I plan to have a hotspare for each, which will not
use any memory,

I agree that in case the machine goes down both the primary and
hotspare will go down.

Henrik Schröder

unread,
Jul 10, 2011, 3:00:15 PM7/10/11
to memc...@googlegroups.com
With your solution, you still need to have some way of knowing when the first server process dies (btw, this never happens) and the second one has taken over so that you can start the first one again. But if you have all that, why not just skip having two processes, and have that same watchdog restart only the one process?


/Henrik
Reply all
Reply to author
Forward
0 new messages