Redis as substitution for Memcache

Posted by Boban P. on Server Fault See other posts from Server Fault or by Boban P.
Published on 2013-08-02T13:59:42Z Indexed on 2013/08/02 15:41 UTC
Read the original article Hit count: 285

Filed under:
|
|
|

We have distributed web app, and for now, as session handler, we use two separate instances of memcache in redundancy, so everything that is written in one memcache is also written in other.
Memcache is fairly easy to install, use, and maintain but we have one problem: if one memcache fail, everything is fine, php comunicate with other instance which has all data (although, half of connections have a delay because they try to use failed one, wait a little, and then contact other memcache). When failed instance comes back to life again, it starts up empty. If established session request data from that instance, session fails, and user logs out, and that happens to half of users.

So, we are thinking about to switch to redis for session handling, and maybe keep memcache for cache only. My questions are:

  1. If we setup redis instances as master-slave, and if master fails, can sentinel promote slave as new master and when old master comes back to life, will it stay as slave or not?

  2. Is redis call malloc at startup to allocate part of memory, like memcache or varnish, or it calls malloc for every key inserted? And what are pros and cons of that?

© Server Fault or respective owner

Related posts about php

Related posts about redis