Cache Hit Ratio
cacheHitCount / (cacheHitCount + cacheMissCount)
Relative performance
relativePerformance = 1 / (cacheHitCost * cacheHitRatio + cacheMissCost * (1 - cacheHitRatio))
Factors which affect cache hit ratio
Static files headers

Non cachable objects HTTP headers

Private files cache headers


public

private

CDN
CDN Self Hosted App

CDN AWS

Every shard is responsible for the part of data which is lockated in shards range:

When the new shard is added - adjust key range a little bit

Cache High Up the Call Stack

Reuse cache among users - for example we build an app for restraunt recomendataion based on user location.
# Bad URL
GET /restaurants/search?lat=-11.11111&lon=22.2222
# Good URL
GET /restaurants/search?lat=-11.11&lon=22.22
To decide what to cache evaluate Aggregated Time Spent
aggregated time spent = time spent per request * number of requests