skip to Main Content

I am unable to understand how Redis works on multi-core CPUs? It is recommended that you can run multiple redis instances to use multi-core CPUs? Does this mean that we could host different caches for different purposes, for eg. one cache to host user information and another cache to host order information. Or is it so that one redis instance would be master and the others could be slaves for read operations but both would serve the same cache for eg. user_information. If Redis supports persistence why would anyone use NoSQL Databases like DynamoDB etc.? Technically if I don’t want to use Global Seconday Indexes and range queries then I could take the data in a DynamoDB table and put it in a Redis cache and persist it to disk.

2

Answers


  1. It is recommended that you can run multiple redis instances to use multi-core CPUs?

    First of all, redis is not designed for multi-core CPU.However, you can run multiple instances of redis in multi-core CPU.But it does not provide such guarantee.

    For example, if you launch six instances on hexa-core, there will be 6 different processes that the OS will have to get scheduled on the six cores. It is up to the OS to perform this load balancing, optimizing the performance of the system.If you want to enforce the process to be execute in specific cores you can go with modern OS.But it will seriously impact the performance of redis.

    If Redis supports persistence why would anyone use NoSQL Databases like DynamoDB etc.?

    Redis isn’t the best fit for persistent storage as it’s mainly performance focused.The major difference between redis and NOSQL databases is the way of writing data.Redis usually commits data in the periodic basis where NOSQL database like DynamoDB commits data for every transaction this makes DynamoDB to be slower than redis.

    However you can also make redis to commit for each query by changing their configuration.It will also decreases the performance of the redis.If you want DynamoDB like Persistence What they are saying.,

    The general indication is that you should use both persistence methods if you want a degree of data safety comparable to what PostgreSQL can provide you.

    If you care a lot about your data, but still can live with a few minutes of data loss in case of disasters, you can simply use RDB alone.

    There are many users using AOF alone, but we discourage it since to have an RDB snapshot from time to time is a great idea for doing database backups, for faster restarts, and in the event of bugs in the AOF engine.

    Note: for all these reasons we’ll likely end up unifying AOF and RDB into a single persistence model in the future (long term plan).
    Refer Redis Persistence

    Does this mean that we could host different caches for different purposes, for eg. one cache to host user information and another cache to host order information. Or is it so that one redis instance would be master and the others could be slaves for read operations but both would serve the same cache for eg. user_information.

    Both will work.It depends on your configuration, if you want to configure both master and slave in same machine for serving for single cache you can do that or else you want different instances of redis for serving different caches you can also do that.

    Login or Signup to reply.
  2. It is recommended that you give Redis at least 2 cores so that background operations like periodic AOF fsync don’t interrupt the hot execution path.

    Regarding DynamoDB, the durability guarantees are very different. DynamoDB is fsyncing every update to NVME SSDs on multiple partition replicas across availability zones within a region. Redis by default syncs to disc once every second. Hot replicas help reduce the occurrence of data loss but it is still possible for Redis to lose data unless appendfsync is set to always which is almost never the case since the primary value of a remote dictionary service like Redis is low latency access to ephemeral state.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search