educative.io

Memory size for the cache: size based on read/s?

Naive question: in the solution, the size of the cache is based on the amount of read query. A read query does not increase the cache size. The size of the data in the cache is defined only by write queries. Because of the read/write ratio, the cache size in memory could be 100 smaller? Am I missing something?

I am thinking the same. I thought the memory size should be number of the URL generated/day * 20% * 500 bytes.

I believe you are right. doesn’t make sense to base cache on read requests

I now understand more about this calculation. What it meant is it puts the top 20% URL queries in cache. So this cache is designed for quick query that is why it uses Read query. We do not need to cache write since write is a lot less than read.

Hi @Marc_Segura-Devillec, how are you?

This design is read intensive (100:1 ratio), which means that we need to worry, first, in increasing the response time for this kind of operation. The author could go deeper in the cache solution (i.e. using a Cache Aside or Read Through strategy), but the idea here is to worry with read requests firstly.

Hope This Helps.

Regards,
Artur Baruchi