4 ms·
I don't like to admit but I still don't get it, could I use Redis as a main webapp backend?
by patkai 9y ago
I don't like to admit but I still don't get it, could I use Redis as a main webapp backend?
- znpy 9y agoLong story short, "ACID" is what a datastore has to provide in order to be eligible to be called a "proper database". So yeah, I guess you could use redis as main datastore.
- mayank 9y agoYou definitely could, with some pretty big caveats: * you can tolerate some data loss in case of system crashes/power failures/etc, because redis only flushes data to disk periodically [1] * your dataset can fit in RAM, since redis is an in-memory datastore [1] https://redis.io/topics/persistence https://redis.io/topics/persistence
- kristoff_it 9y agoUsing AOF you have better durability, you can read about it in the link you provided.
- mayank 9y agoAs far as I know, AOF is still not the default setting. It's important to point this out, or otherwise Redis will suffer the same fate as early MongoDB, which had a similar default persistence model which many users didn't fully understand.
- immad 9y agoRedis won't function till it has loaded all data from disk to memory. So if your webapp doesn't have too much data then possibly. Also since Redis is memory backed you need more RAM then data. This can get very costly. Another annoyance is that Redis is single process single threaded so you really have to avoid running long running queries unless you do extensive manual sharding. (Disclaimer: it's been a few years since I had to think about these constraints so maybe some are removed in more recent versions of Redis)
- yaaminu 9y agoRedis can now be multi threaded in custom modules
- dvirsky 9y agoSort of - the model it supports is not really multi-threaded. The modules can spawn threads, and acquire a "GIL" when they want to touch actual Redis data - thus only one thread at a time actually "owns" the entire Redis instance. This allows long running queries to do primitive cooperative multi-tasking, releasing the GIL and letting other queries have a chance; But there is no real parallel data access. You will only gain real parallelism if you have actual work to do that does not touch the data directly when a thread is not touching the GIL. There aren't many cases that this applies to - usually copying the data aside to do work on it is not worth the gain of parallelism.
- dvirsky 9y agoAs long as your data will fit in RAM in a cost-effective way, and you can scale your cluster when it exhausts its memory. AFAIK Netflix are using it as a "real database", but of course not for everything - https://medium.com/netflix-techblog/introducing-dynomite-making-non-distributed-databases-distributed-c7bce3d89404 https://medium.com/netflix-techblog/introducing-dynomite-mak...
- Yiftach 9y ago[disclosure I'm from Redis Labs] - around 50% of our 7K+ paying customers use Redis as a database. In general, you can setup an environment in which Redis is HA (replication + auto-failover) and persistent. Redis Enterprise does it by default + backup and DR + some enhancements to the Redis storage layer (as mentioned in this blog. These enhancements together with the high end storage device by Dell-EMC allowed us to reach this throughout & latency. BTW, this test ran on a single node, you can scale it by just adding node(s) to the cluster.