Topics on Caching: Summary & Final Comments

Topics on Caching: Summary & Final Comments

The last few weeks I’ve been writing about caching algorithms quite a bit. I’m going to use this note as a summary of the last few weeks’ work.

𝐍.𝐁\textbf{N.B} β€” I explain why this is the case in this note. Think of xkx_k as being on a random, exponential β€œtimer” which fires (on average) every Ξ»k\lambda_k periods.

E[Uk]=1|𝒳|βˆ«π’³f(Ξ»)λλk+Ξ»dΞ»E[Uk2]=1|𝒳|βˆ«π’³f(Ξ»)(λλk+Ξ»)2dΞ»;\begin{equation} E\Big[U_k] = \frac{1}{\Big|\mathcal{X}|} \int_\mathcal{X} f\big(\lambda) \frac{\lambda}{\lambda_k + \lambda} \ d\lambda \qquad E\Big[U_k^2] = \frac{1}{\Big|\mathcal{X}|} \int_\mathcal{X} f\big(\lambda) \left(\frac{\lambda}{\lambda_k + \lambda}\right)^2 \ d\lambda; \end{equation}

pohw(xk)=P(Uk>ΞΈE[Uk])β‰₯(1βˆ’ΞΈ)2E[Uk]2E[Uk2]\begin{equation} p_{ohw}\Big(x_k) = P\Big(U_k >\theta E\Big[U_k]) \geq \Big(1-\theta)^2 \frac{E\Big[U_k]^2}{E\Big[U_k^2]} \end{equation}

In this note I sketch out these assumptions that allow us to go from linear 𝑀.π‘Ÿ.𝑑\textit{w.r.t} the size of 𝒳\mathcal{X} to constant.

I didn’t have to do much work to get a wrapper around the Redis protocol, πšπš’πšπš πšŠπš•πš•/πš›πšŽπšπšŒπš˜πš—\texttt{tidwall/redcon} does all the work for me. Though the redcon layer brings my machine from ∼125,000\sim 125,000 to ∼86,000\sim 86,000 rps.