-3

[Have restructured the question]

We have a lot of DB readers and few writers where writers may perform longer operations. This is a real-time system so the read has to be performed as efficiently as possible. Actually there is a hard limit otherwise the call is considered as failed. THe one solution that is discussed is to have a Redis cache which is updated whenever the database is altered and all the reads are served from it instead of the database. Since the joins and other related stuff has already been performed therefore from the Redis, we only need to find and return the data. My questions are rather theoretical that

  1. Since Redis is a separate service, using it in the system as Cache serves the purpose or the static structures would be better. The amount of data we are talking about is probably in 1-1.5 GB.
  2. The structures we need in Redis to be able to have the dataset in which individual elements could be found easily and can be returned as sorted. Is it a correct decision to store the data in Redis just to be performant which incurring more development?
  • 2
    This is not answerable for "outsiders" like us in a sensible manner. One has to know a lot of the details of the system in stake, do some profiling where the bottlenecks are and then may run some tests, maybe with Redis as a cache, to see if that will help. And even then, the outcome may depend on how the Redis cache is implemented in detail. – Doc Brown Sep 21 '19 at 5:31
0

You dont provide any reason for using redis.

99% of the time there is no need for an additional database cache. Modern databases implement their own caches and are highly optimised for data retreival.

What you may want to cache is the processed data. ie after you have retieved data from the db, applied some logic and produced some sort of response.

If the same method is being called faster than the data changes. Then cache the response.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.