In the case of serving web content, caching is important as most of the content tend to be similar. However, for dynamic website such as amazon, netflix the website have archive personalization. The goal here is to reduce computation power.
Imagine 100 identical request incoming to server. Since at time=0
there is nothing cached yet. Hence this 100 requests will be directly processed by server which proceed to crash itself.
The solution is elect 1 request as sentry
while the rest go into sleep
. sentry
will cache the result into disk and return to the client. The rest 99 request is awake and return with cached content.
If no contents found after awoken, error can be promptly returned.
pre-cache
)lock
, for every request
there is two key. miss
cache, it will obtain the lock
and designated as sentry
sleep
in the case of miss
and failure to obtain lock.