educative.io

Checking the cache size

You calculate cache size as 20% of the number of reads in a given day, multiplied by the size of a row. Given the pareto principle that 80% of the traffic is for 20% of URLs, shouldn’t the calculation be 20% of the data at rest?

2 Likes

I’m wondering this as well. The Pastebin example uses the same kind of math. @Design_Gurus?

The cache is supposed to contain active data that is accessed or created recently. Only plausible way to find that is by seeing the active traffic (and not all the data which would be mostly stale specially when our service grows).

Having said that, mostly cache is limited by economy as it is not cheap to have bigger cache, otherwise who stops us to put all the data in memory/cache. Secondly, we have to see the need and how our service is behaving, is it too slow? Will it help to increase the cache size? We have to try and see the results. 20% is just a number, a ballpark, to get us started specially in an interview setting.

1 Like

Why are we calculating the cache size for a day? Is it a norm? What is the criteria behind that? Why not 12 hours?

1 Like