4

My application requires two use-cases for a cache:

  1. Redis as a cache. I plan to cache items (JSON blobs) by id using allkeys-lru memory policy. Average JSON item will take <1 Mb.
  2. Redis as a queue. I decided to build content social feed (similar to Instagram or Facebook) using Redis queue API. It will use same memory policy. Capacity of a queue will be ~1000 elements. Average queue (which represents a feed per user) will take ~10 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.

2 Answers 2

4

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.

Sign up to request clarification or add additional context in comments.

Comments

3

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.