Reputation: 438
My application requires two use-cases for a cache:
allkeys-lru
memory policy. Average JSON item will take <1 Mb.Can i use a single instance of Redis for both purposes without performance impact? Is it better to split them for better performance? Thank you.
Upvotes: 4
Views: 3425
Reputation: 7213
Redis is single-threaded, so you get more CPU power with 2 redis instead of one. Still you will need to manage 2 databases (can be great for scaling, but it will need more actions for backups etc).
If you don't need a lot of CPU power in redis (with functions that requires a lot of computations, like in LUA scripts) I don't think you will see a big difference by using 2 redis instead of one. Most of the time, it is I/O that is the slowest part that drives the performance and as Redis is an in-memory database, it won't have a big impact.
Upvotes: 3
Reputation: 46879
There is no reason not to try; I would recommend using two databases within the same redis instances however, so that if you ever want to up size to two separate instances, you can dump and relocate on db separate from the other.
Two instances would be faster than one, but no sense doubling the cost until you have some idea what your needs are - but keeping the db's separate will make that process a bit less painful if it comes to that.
Upvotes: 4