Estimating Distributed Cache Hits Based On Local Cache Hit Data

83 Views Asked by At

This needs a bit of an introduction. We have 6 servers with a local cache, in other words, we have 6 different systems of cache that do not speak to each other.

A request that comes through our system is assigned a concrete server in a "Round Robin" fashion, e.g. Req1 -> Server1, Req2 -> Server2 ... Req7 -> Server 1. You could think of it as Server assigned = Request number % number of servers.

Our cache works as follows: if one request is identical to another received in that server in the last 30 minutes, we return the previously cached response for that request.

We currently have a very low hit (i.e. statistically speaking, the chances of two identical request landing in the same sever is low). More specifically, the amount of repeated requests (based on real-world recollected data) ranges between 3% and 5%.

That hit probability is very low, so low that it makes no sense to maintain the code necessary to configure the cache.

We are thinking of using a distributed cached, i.e. one that is shared between all servers, so cache will be server-independent.

The problem is that building that system is expensive. I will like to know what is the hit probability that could be expected in order to take that step or not.

Now, to the maths
I am guessing that the new distributed system will have a hit probability ranging from 5% to 30%. 30% being: average hit amongst server multiplied by number of servers. However, I am not very sure of that upper limit and my statistics knowledge is a bit rusty.

Is there a way to calculate with proper confidence intervals what would the distributed cache hit be?


TL;DR

If the probability of a request being repeated on a given server in the last 30 minutes ranges between [0.03, 0.05]. Assuming that there are six servers and that a request is assigned to a server as follows: Server assigned = request number % number of servers (Round Robin).

What would the probability be if we replace all that six servers by just one which manages all the requests.