0

I am developing the django-backend of a ios app. I will use cached-session using redis. Once a user logs in, I will save his session in the redis-cache (backed up by mysql), I just want to know (for the long run), can I use redis replication to keep copy of the cached session incase I scale the redis server in a master-slave format in the future. Or I should always access cache value from one particular redis server?

raffian
  • 31,267
  • 26
  • 103
  • 174

1 Answers1

0

It makes sense to keep copy with replication of redis in master/slave format since there isn't the possibility of sharding like in mongodb for redis yet (AFAIK). So you have to get your session from one particual redis server until if you dont want to control several redis-server manually.

hasan
  • 553
  • 1
  • 5
  • 19
  • "So you have to get your session from one particual redis server until if you dont want to control several redis-server manually". I get what you are saying, what I want to know is, if I keep sessions in several redis server (all copied from the master) and access them thorugh load balancing in the future, will it be alright? – user2372442 Jul 14 '13 at 18:28
  • i think it would be an abuse of the master/slave backup/pattern of the current redis implementation but if it fits your goals and it wont cause you much effort to rewrite it when redis has implemented sharding officially then nothing speaks against it – hasan Jul 14 '13 at 22:40
  • 1
    Well, I am going to use replication here. I will have a WRITE database+cache server and a read database+cache server. So all login logout and any kind of writing will be on the write server. Than, all sessions and every other thing will be in the replicated slave server. So, is this still abusing anything? – user2372442 Jul 15 '13 at 08:04
  • i see what you want to do now. You could discuss about if it is abusing or not because you use the replication of a redis-instance because of data-security. But what you want to do is a kind of load-balancing in form of: you redid A handle all write-operations and all others handle the read-operation. Consider that this structure does not have to work as well/fast/safe as a normal redis-instance since the backup will not guarantee real-time. If you ask for my personal opinion if i would do THAT... YES, i would until redis supports sharding. But i also would look at mongodb which can shard. – hasan Jul 15 '13 at 15:08