This paper was converted on www.awesomepapers.org from LaTeX by an anonymous user.
Want to know more? Visit the Converter page.

\hideLIPIcs

Department of Mathematics, London School of Economics and Political Science, [email protected] funding from the following sources: NSERC grant 327620-09 and an NSERC DAS Award, European Research Council (ERC) under the European Union’s Horizon 2020 research and innovation programme (grant agreement no. ScaleOpt–757481), and Dutch Research Council NWO Vidi Grant 016.Vidi.189.087. Google Research, [email protected] Google Research, USA Google Research, [email protected] Google Research, [email protected] \CopyrightSharat Ibrahimpur, Manish Purohit, Zoya Svitkina, Erik Vee, and Joshua R. Wang \ccsdescTheory of computation Caching and paging algorithms \relatedversion \EventEditorsKousha Etessami, Uriel Feige, and Gabriele Puppis \EventNoEds3 \EventLongTitle50th International Colloquium on Automata, Languages, and Programming (ICALP 2023) \EventShortTitleICALP 2023 \EventAcronymICALP \EventYear2023 \EventDateJuly 10–14, 2023 \EventLocationPaderborn, Germany \EventLogo \SeriesVolume261 \ArticleNo91

Efficient Caching with Reserves via Marking111An extended abstract is to appear in the Proceedings of the 50th ICALP, 2023.

Sharat Ibrahimpur    Manish Purohit    Zoya Svitkina    Erik Vee    Joshua R. Wang
Abstract

Online caching is among the most fundamental and well-studied problems in the area of online algorithms. Innovative algorithmic ideas and analysis — including potential functions and primal-dual techniques — give insight into this still-growing area. Here, we introduce a new analysis technique that first uses a potential function to upper bound the cost of an online algorithm and then pairs that with a new dual-fitting strategy to lower bound the cost of an offline optimal algorithm. We apply these techniques to the Caching with Reserves problem recently introduced by Ibrahimpur et al. [10] and give an O(logk)O(\log k)-competitive fractional online algorithm via a marking strategy, where kk denotes the size of the cache. We also design a new online rounding algorithm that runs in polynomial time to obtain an O(logk)O(\log k)-competitive randomized integral algorithm. Additionally, we provide a new, simple proof for randomized marking for the classical unweighted paging problem.

keywords:
Approximation Algorithms, Online Algorithms, Caching
category:

1 Introduction

Caching is a critical component in many computer systems, including computer networks, distributed systems, and web applications. The idea behind caching is simple: store frequently used data items in a cache so that subsequent requests can be served directly from the cache to reduce the resources required for data retrieval. In the classical unweighted caching problem, a sequence of page requests arrives one-by-one and an algorithm is required to maintain a small set of pages to hold in the cache so that the number of requests not served from the cache is minimized.

Traditional caching algorithms, both in theory and practice, are designed to optimize the global efficiency of the system and aim to maximize the hit rate, i.e., fraction of requests that are served from the cache. However, such a viewpoint is not particularly suitable for cache management in a multi-user or multi-processor environment. Many cloud computing services allow multiple users to share the same physical workstations and thereby share the caching system. In such multi-user environments, traditional caching policies can lead to undesirable outcomes as some users may not be able to reap any benefits of the cache at all. Recently, Ibrahimpur et al. [10] introduced the Caching with Reserves model that ensures certain user-level fairness guarantees while still attempting to maximize the global efficiency of the system. In this formulation, a cache of size kk is shared among mm agents and each agent ii is guaranteed a reserved cache size of kik_{i}. An algorithm then attempts to minimize the total number of requests that are not served from the cache while guaranteeing that any time step, each agent ii holds at least kik_{i} pages in the cache. Unlike the classical paging problem, Caching with Reserves is NP-complete even in the offline setting when the algorithm knows the entire page request sequence ahead of time and Ibrahimpur et al. [10] gave a 2-approximation algorithm. They also gave an O(logk)O(\log k)-competitive online fractional algorithm for Caching with Reserves via a primal-dual technique and then design a rounding scheme to obtain an O(logk)O(\log k)-competitive online randomized algorithm. Unfortunately, the rounding scheme presented in [10] does not run in polynomial time and the fractional primal-dual algorithm, while simple to state, also does not yield itself to easy implementation.

Caching and its many variants have been among the most well-studied problems in theoretical computer science. It has long been a testbed for novel algorithmic and analysis techniques and it has been investigated via general techniques such as potential function analysis, primal-dual algorithms, and even learning-augmented algorithms. For the classical unweighted caching problem, a particularly simple algorithm, randomized marking [9], is known to yield the optimal competitive ratio (up to constant factors). At any point in time, the randomized marking algorithm partitions the set of pages in cache into marked and unmarked pages and upon a cache miss, it evicts an unmarked page chosen uniformly at random. Cache hits and pages brought into the cache are marked. When a cache miss occurs, but there are no more unmarked pages, a new phase begins, and all pages in the cache become unmarked. In this paper, we build upon this algorithm, adapting it to caching with reserves.

Our Contributions

We study the Caching with Reserves model of Ibrahimpur et al. [10] in the online setting and improve upon those results. Our first main result is a simpler fractional algorithm that is a generalization of randomized marking for classical caching.

Theorem 1.1.

There is an O(logk)O(\log k)-competitive fractional marking algorithm for online Caching with Reserves. The competitive guarantee holds even when the optimal offline algorithm is allowed to hold fractional pages in the cache.

We remark that our algorithm in Theorem 1.1 and its analysis are more involved than those of the classical randomized marking algorithm. One complication is that due to the reserve constraints, a marking-style algorithm for the caching with reserves setting cannot evict an arbitrary unmarked page. Another key difficulty comes from the fact that even the notion of a phase is non-trivial to define in our setting. In particular, unlike in classical caching, it can happen that the cache still contains unmarked pages, but none of them can be evicted to make space for a new page, because of the reserve constraints. Thus, we need a rule to isolate agents whose reserve constraints prevent the algorithm from having a clean end of a phase, while also ensuring that the already marked pages of such isolated agents are not erased prematurely. To this end, we introduce the notion of global and local phases to effectively model the state of each agent. We elaborate on this in Section 3.1.

Our analysis of the fractional marking algorithm introduces two novel components that may be of independent interest. First, we upper-bound the total cost incurred by our fractional marking algorithm using a new potential function. This potential function, introduced in Section 3.3, depends only on the decisions of the algorithm and is independent of the optimal solution. To the best of our knowledge, all previous potential function based analyses of (variants of) caching [4, 5, 6, 10] define a potential function that depends on the optimal solution. Second, we introduce a new lower bound for the cost of the optimal solution via the dual-fitting method. Our techniques also yield a new simple proof that the classical randomized marking [9] for unweighted paging is O(logk)O(\log k)-competitive (see Appendix A).

We also design a new online rounding algorithm that converts a deterministic, fractional algorithm into a randomized, integral algorithm while only incurring a constant factor loss in the competitive ratio. Via a careful discretization technique (inspired by Adamaszek et al. [2]), the new rounding algorithm runs in polynomial time and only uses limited randomization. Our fractional marking algorithm (Algorithm 1) maintains that at any point in time, a particular page pp is either completely in the cache or at least 1/k1/k fraction of the page has been evicted. We exploit this key property to show that the fractional solution at any time tt can be discretized so that the fraction of any page that is evicted is an integral multiple of 1/k31/k^{3}. This discretization allows us to maintain a distribution over feasible integer cache states with bounded support.

Theorem 1.2.

There is a polynomial-time O(logk)O(\log k)-competitive randomized integral algorithm for online caching with reserves.

Other Related Work

The unweighted caching (also known as paging) problem has been widely studied and its optimal competitive ratio is well-understood even up to constant factors. Tight algorithms [1, 13] are known that yield a competitive ratio of exactly HkH_{k}, where HkH_{k} is the kkth harmonic number. Recently, Agrawal et al. [3] consider the parallel paging model where a common cache is shared among pp agents – each agent is presented with a request sequence of pages and the algorithm must decide how to partition the cache among agents at any time. It allows the pp processors to make progress simultaneously, i.e., incur cache hits and misses concurrently. Multi-agent paging has also been extensively studied in the systems community [7, 15, 16] often in the context of caching in multi-core systems. Closely related to the Caching with Reserves setting, motivated by fairness constraints in multi-agent settings, a number of recent systems  [11, 12, 14, 17] aim to provide isolation guarantees to each user, i.e., guarantee that the cache hit rate for each user is at least as much as what it would be if each user is allocated its own isolated cache. Also motivated by fairness constraints, Chiplunkar et al. [8] consider the Min-Max paging problem where the goal is to minimize the maximum number of page faults incurred by any agent.

2 Preliminaries and Notation

Formally, an instance of the Caching with Reserves problem consists of the following. We are given a number of agents mm and a total (integer) cache capacity kk. Let [m][m] denote the set {1,,m}\{1,\ldots,m\}. Each agent i[m]i\in[m] owns a set of pages 𝒫(i)\mathcal{P}(i) (referred to as ii-pages) and has a reserved cache size ki0k_{i}\geq 0. Pages have a unique owner, i.e. 𝒫(i)𝒫(j)=\mathcal{P}(i)\cap\mathcal{P}(j)=\varnothing for all iji\neq j, and we use 𝒫i[m]𝒫(i)\mathcal{P}\triangleq\cup_{i\in[m]}\mathcal{P}(i) to refer to the universe of all pages. For any page p𝒫p\in\mathcal{P}, let ag(p)ag(p) be the unique agent that owns pp. We assume without loss of generality that at least one unit of cache is not reserved: i[m]ki<k\sum_{i\in[m]}k_{i}<k.222If all of cache is reserved, the problem decomposes over agents into the standard caching task. At each timestep tt, a page pt𝒫p_{t}\in\mathcal{P} is requested. We can wrap all these into an instance tuple: σ=(m,k,{𝒫(i)},{ki},{pt})\sigma=\left(m,k,\{\mathcal{P}(i)\},\{k_{i}\},\{p_{t}\}\right).

An integral algorithm for the Caching with Reserves problem maintains a set of kk pages in the cache such that for each agent ii, the cache always contains at least kik_{i} pages from 𝒫(i)\mathcal{P}(i). At time tt, the page request ptp_{t} is revealed to the algorithm. If this page is not currently in the cache, then the algorithm is said to incur a cache miss and it must fetch ptp_{t} into the cache by possibly evicting another page qtq_{t}. For any (integral) algorithm 𝒜\mathcal{A} we write its total cache misses on instance σ\sigma as cost𝒜(σ)\mathrm{cost}_{\mathcal{A}}(\sigma).

A fractional algorithm for the Caching with Reserves problem maintains a fraction xp[0,1]x_{p}\in[0,1] for how much each page p𝒫p\in\mathcal{P} is in the cache such that the total size of pages in the cache is at most kk, i.e, p𝒫xpk\sum_{p\in\mathcal{P}}x_{p}\leq k, and the total size of ii-pages is at least kik_{i}, i.e., p𝒫(i)xpki\sum_{p\in\mathcal{P}(i)}x_{p}\geq k_{i}. At time tt, the page request ptp_{t} is revealed to the algorithm, which incurs a fractional cache miss of size 1xpt1-x_{p_{t}}. The algorithm must then fully fetch ptp_{t} into cache (xpt1x_{p_{t}}\leftarrow 1) by possibly evicting other pages. For any (fractional) algorithm 𝒜\mathcal{A} we again write its total size of cache misses on instance σ\sigma as cost𝒜(σ)\mathrm{cost}_{\mathcal{A}}(\sigma).

Let costOPT(σ)\mathrm{cost}_{OPT}(\sigma) be the cost of the optimal offline algorithm on instance σ\sigma.

Definition 2.1 (Competitive Ratio).

An online algorithm 𝒜\mathcal{A} for Caching with Reserves is said to be cc-competitive, if for any instance σ\sigma, 𝔼[cost𝒜(σ)]ccostOPT(σ)+b\mathbb{E}[\mathrm{cost}_{\mathcal{A}}(\sigma)]\leq c\cdot\mathrm{cost}_{OPT}(\sigma)+b, where bb is a constant independent of the number of page requests in σ\sigma. The expectation is taken over all the random choices made by the algorithm (if any).

3 Fractional 𝑶(𝐥𝐨𝐠𝒌)O(\log k)-Competitive Algorithm for Caching with Reserves

For any time tt and page p𝒫p\in\mathcal{P}, the algorithm maintains a variable ypt[0,1]y_{p}^{t}\in[0,1] representing the portion of page pp that is outside the cache. Then xpt1yptx_{p}^{t}\triangleq 1-y_{p}^{t} represents the portion of pp that is in cache. Algorithm 1 ensures feasibility at all times tt: the total of all yy values is exactly the complementary cache size |𝒫|k|\mathcal{P}|-k, i.e., p𝒫ypt=|𝒫|k\sum_{p\in\mathcal{P}}y_{p}^{t}=|\mathcal{P}|-k; and the total yy value for pages of any agent ii is within its respective complementary reserve size, p𝒫(i)ypt|𝒫(i)|ki\sum_{p\in\mathcal{P}(i)}y_{p}^{t}\leq|\mathcal{P}(i)|-k_{i}. When a request for page ptp_{t} arrives at time tt, the algorithm fully fetches ptp_{t} into the cache by paying a fetch-cost of yptty_{p_{t}}^{t} while simultaneously evicting a total of yptty_{p_{t}}^{t} amount of other suitably chosen pages.

3.1 Fractional Algorithm

The complete algorithm (referred to as Algorithm 𝒜\mathcal{A} in the proofs) is presented in Algorithm 1. We present a high-level discussion here. At any time tt, we say that an agent ii is tight if p𝒫(i)xpt=ki\sum_{p\in\mathcal{P}(i)}x_{p}^{t}=k_{i}, i.e., the algorithm is not allowed to further evict any pages (even fractionally) of agent ii. Conversely, an agent ii is non-tight if p𝒫(i)xpt>ki\sum_{p\in\mathcal{P}(i)}x_{p}^{t}>k_{i}.

The algorithm is a fractional marking algorithm and runs in phases where each phase corresponds to a maximal sequence of page requests that can be served while maintaining feasibility and ensuring that no “marked” pages are evicted. Within each phase, the currently requested page ptp_{t} is fully fetched into cache by continuously evicting an infinitesimal amount of an “available” (described below) unmarked page qq with the smallest yqy_{q} value; if there are multiple choices of qq, then all of them are simultaneously evicted at the same rate. Page ptp_{t} gets marked after it has been served and this mark may only be erased at the end of a phase.

At the end of a phase, an agent ii is designated as isolated if strictly fewer than kik_{i} ii-pages are marked in the cache at this time point. This designation changes to non-isolated as soon as kik_{i} ii-pages get marked at some point in the future. An isolated agent essentially runs a separate instance of caching on its own pages and in its own reserved space. At the end of a phase, the marks of pages owned by non-isolated agents (i.e., agents with at least kik_{i} marked ii-pages) are erased.

It remains to describe when a page qq is considered available for eviction. Clearly, yqt<1y^{t}_{q}<1 must hold, since otherwise page qq is already fully outside the cache. Moreover, ag(q)ag(q) must be non-tight, i.e., evicting page qq must not violate the reserve constraint of the agent that owns it. The last condition for qq to be considered available for eviction depends on whether the agent it:=ag(pt)i_{t}:=ag(p_{t}) is isolated or not: (i) if agent iti_{t} is isolated, then ag(q)=itag(q)=i_{t} should hold, i.e., only unmarked iti_{t}-pages are available for eviction; and (ii) if agent iti_{t} is not isolated, then ag(q)ag(q) should also be non-isolated. We recall again that among all available pages for eviction, pages with the smallest yqty^{t}_{q} value are evicted first.

1 /* Initialization */
r01r_{0}\leftarrow 1
  /* global phase counter */
ri1,i[m]r_{i}\leftarrow 1,\ \forall i\in[m]
  /* local phase counters */
2 Let P(i,0)𝒫(i)P(i,0)\subset\mathcal{P}(i) be set of ii-pages in the initial cache (assume |P(i,0)|ki|P(i,0)|\geq k_{i})i[m]\ \forall i\in[m]
3 All agents i[m]i\in[m] are non-isolated and all pages pp in the cache are 𝑢𝑛𝑚𝑎𝑟𝑘𝑒𝑑\mathit{unmarked}
4
5for each page request ptp_{t} of agent iti_{t} do
6       if ypt=0y_{p_{t}}=0, i.e., xpt=1x_{p_{t}}=1, then
7            Mark page ptp_{t} and serve the request.
8       else if agent iti_{t} is isolated, then
9             /* Continuously fetch page ptp_{t} while uniformly evicting all unmarked iti_{t}-pages. */
10             Set ypt0y_{p_{t}}\leftarrow 0, mark page ptp_{t} and serve the request.
11             Increase yqy_{q} at the same rate for all unmarked iti_{t}-pages in the cache until the cache becomes feasible, i.e. p𝒫yp|𝒫|k\sum_{p\in\mathcal{P}}y_{p}\geq|\mathcal{P}|-k holds.
12             if agent iti_{t} now has kik_{i} marked pages then
13                   Designate iti_{t} as non-isolated
14                  
15            
16       else if \exists page qq owned by some non-tight  agent333Agent iti_{t} is considered non-tight here because fetching ptp_{t} while evicting other q𝒫(it)ptq\in\mathcal{P}(i_{t})\setminus p_{t} does not violate reserve feasibility.and satisfying yq<1y_{q}<1, then
17             /* Continuously fetch page ptp_{t} while uniformly evicting all unmarked pages (belonging to any non-tight agent) with the least yy-value. */
18             Set ypt0y_{p_{t}}\leftarrow 0, mark page ptp_{t} and serve the request.
19             Increase yqy_{q} at the same rate for all unmarked pages of non-tight agents with the smallest yy values until the cache becomes feasible, i.e. p𝒫yp|𝒫|k\sum_{p\in\mathcal{P}}y_{p}\geq|\mathcal{P}|-k holds.
20            
21       else
22             /* End of phase */
23             for each agent i[m]i\in[m] do
24                   if ii has strictly fewer than kik_{i} marked pages, then
25                        Designate ii as isolated.
26                   else
27                         /* ii is non-isolated and undergoes a phase reset */
28                         Set P(i,ri)P(i,r_{i})\leftarrow collection of all (integral and marked) ii-pages in cache.
29                         Set riri+1r_{i}\leftarrow r_{i}+1
30                         All marked ii-pages are now 𝑢𝑛𝑚𝑎𝑟𝑘𝑒𝑑\mathit{unmarked}
31                        
32                  
33            Set r0r0+1r_{0}\leftarrow r_{0}+1
34             Re-process the current page request ptp_{t} in the new phase
35            
36      
Algorithm 1 Fractional Marking Algorithm for Caching with Reserves
Notation

Let (t)[m]\mathcal{I}(t)\subsetneq[m] denote the set of isolated agents at time tt. For a global phase r0r_{0}, we use (r0)\mathcal{I}(r_{0}) to denote the set of isolated agents at the end of phase r0r_{0}. Let 𝒯(t)\mathcal{T}(t) denote the set of tight agents at time tt. At any time tt, let ritr_{i}^{t} denote the value of the local phase counter rir_{i} for agent ii, and let Ri=riTR_{i}=r_{i}^{T} be the total number of local phases for agent ii. By definition, for any agent i[m]i\in[m], P(i,ri1)P(i,r_{i}-1) and P(i,ri)P(i,r_{i}) denote the set of ii-pages in the cache (integrally) at the beginning of the rir_{i}th local phase and the end of the rir_{i}th local phase for agent ii, respectively. For any agent i[m]i\in[m], let M(i,t)𝒫(i)M(i,t)\subseteq\mathcal{P}(i) denote the set of marked ii-pages in the cache and U(i,t)=P(i,rit1)M(i,t)U(i,t)=P(i,r_{i}^{t}-1)\setminus M(i,t) denote the set of unmarked ii-pages.

We emphasize that the notion of 𝑢𝑛𝑚𝑎𝑟𝑘𝑒𝑑\mathit{unmarked} pages will only be relevant while referring to pages in P(i,rit1)P(i,r^{t}_{i}-1) for some i,ti,t; in particular, every ii-page q𝒫(i)(P(i,rit1)M(i,t))q\in\mathcal{P}(i)\setminus(P(i,r^{t}_{i}-1)\cup M(i,t)) is not 𝑚𝑎𝑟𝑘𝑒𝑑\mathit{marked}, but we do not refer to it as 𝑢𝑛𝑚𝑎𝑟𝑘𝑒𝑑\mathit{unmarked}. Analogous to the notion of clean and stale pages used by the randomized marking algorithm [9], we define clean, pseudo-clean and stale pages as follows. Fix an agent ii and let rir_{i} be its local phase counter at time tt. Any ii-page qP(i,ri1)q\in P(i,r_{i}-1) is considered stale. The currently requested page ptp_{t} is said to be clean if ptP(i,ri1)p_{t}\notin P(i,r_{i}-1). Next, we say that the currently requested page ptp_{t} is pseudo-clean if ptP(i,ri1)p_{t}\in P(i,r_{i}-1) and yptt=1y^{t}_{p_{t}}=1 holds right before Algorithm 𝒜\mathcal{A} starts to fetch ptp_{t} into the cache. Lemmas 3.6 and 3.8 show that a pseudo-clean page necessarily belongs to an agent who was isolated at the start of (global) phase r0r_{0} but is non-isolated at time tt. To simplify notation, we drop the superscript tt from all notation whenever the time index is clear from the context.

The following lemma compiles a list of key invariants that are maintained throughout the execution of the algorithm that follow directly from an examination of Algorithm 1.

Lemma 3.1.

Algorithm 1 maintains the following invariants.

  1. (i)

    When a new phase begins, all marked pages belong to isolated agents.

  2. (ii)

    At any time tt, all isolated agents are tight.

  3. (iii)

    At any time tt and for any agent ii, all unmarked pages of agent ii have the same yy value.

  4. (iv)

    Any page belonging to an isolated agent is (fractionally) evicted only in those timesteps when a different page of the same agent has been requested.

The following lemmas show that the algorithm is well-defined and that the operations in Lines 1 and 1 of Algorithm 1 are always feasible.

Lemma 3.2.

If the requested page ptp_{t} has xptt[0,1)x_{p_{t}}^{t}\in[0,1) and agent iti_{t} is isolated, then ptp_{t} can be fetched fully by evicting unmarked pages of agent iti_{t}.

Proof 3.3.

As agent iti_{t} is isolated when page ptp_{t} is requested, p𝒫(i)xpt=ki\sum_{p\in\mathcal{P}(i)}x_{p}^{t}=k_{i} (by invariant (ii) in Lemma 3.1) and iti_{t} has fewer than kik_{i} marked pages in cache. Hence pU(i,t)xpt1\sum_{p\in U(i,t)}x_{p}^{t}\geq 1 and pU(i,t){pt}xpt1xptt\sum_{p\in U(i,t)\setminus\{p_{t}\}}x_{p}^{t}\geq 1-x_{p_{t}}^{t}.

Lemma 3.4.

If the requested page ptp_{t} has 0<xptt<10<x^{t}_{p_{t}}<1 and its owner iti_{t} is non-isolated, then there is always enough fractional mass of pages belonging to non-tight agents that can be evicted to fully fetch page ptp_{t}. In particular, line 1 of Algorithm 1 is well-defined.

Proof 3.5.

Suppose page ptp_{t} is fetched in a continuous manner. To show that page ptp_{t} can be fetched fully, it suffices to show that at any instantaneous time tt when xptt<1x_{p_{t}}^{t}<1, there always exists an unmarked page qq belonging to a non-tight agent ii such that xqt>0x_{q}^{t}>0, i.e. page qq can be evicted. Observe that k=q𝒫xqt=i𝒯(t)ki+i𝒯(t)q𝒫(i)xqtk=\sum_{q\in\mathcal{P}}x_{q}^{t}=\sum_{i\in\mathcal{T}(t)}k_{i}+\sum_{i\notin\mathcal{T}(t)}\sum_{q\in\mathcal{P}(i)}x_{q}^{t}. Due to integrality of kk and {ki}i[m]\{k_{i}\}_{i\in[m]}, we must have i𝒯(t)q𝒫(i)xqt\sum_{i\notin\mathcal{T}(t)}\sum_{q\in\mathcal{P}(i)}x_{q}^{t} is an integer. Since any marked page qq always has xqt=1x_{q}^{t}=1, μ:=i𝒯(t)qU(i,t)xqt\mu:=\sum_{i\notin\mathcal{T}(t)}\sum_{q\in U(i,t)}x_{q}^{t} is also an integer. Further, since it𝒯(t)i_{t}\notin\mathcal{T}(t) and xptt>0x_{p_{t}}^{t}>0, we must have μ1\mu\geq 1 and hence there exists a page qq belonging to some non-tight agent ii with xqt>0x_{q}^{t}>0 as desired.

Since we always evict an available page with the least yy value, at any time step tt, all available pages (i.e., unmarked pages qq belonging to non-tight agents and satisfying yq<1y_{q}<1) have the same yy value at all times. We denote this common yy-value by hh^{*} and refer to the corresponding set of evictable pages (with yy-value hh^{*}) as the frontier. The following two key structural lemmas formalize this property.

Lemma 3.6.

At any time tt, let ii be an agent that was isolated at the beginning of the current phase, and let qq be one of its unmarked pages. Then yqt<1y^{t}_{q}<1 if and only if ii is still isolated at time tt.

Proof 3.7.

For the if direction, suppose that ii is still isolated. By invariant (ii), it is also tight. By invariant (iii), all its unmarked pages have the same xx-value and in total they occupy ki|M(i,t)|>0k_{i}-|M(i,t)|>0 units of cache space. Thus, xqt>0x_{q}^{t}>0 and yqt<1y^{t}_{q}<1.

For the only if direction, suppose that ii is no longer isolated. Just before the kik_{i}th ii-page to be marked was requested, (ki1)(k_{i}-1) ii-pages were marked. Since ii was tight, the total xx value of all its unmarked pages must have been 1. Then the algorithm replaced all of them with the kik_{i}th marked page, and the xx-value of all remaining unmarked pages became 0. Thus, the property holds for a newly non-isolated agent ii. This property continues to hold for the rest of the phase since yqy_{q} never decreases for an unmarked page.

Lemma 3.8.

At any time tt, there is a value ht[0,1]h^{*}_{t}\in[0,1] such that: for any agent ii that was non-isolated at the beginning of the current phase and any unmarked ii-page qq, yqhty_{q}\leq h^{*}_{t} holds and yq=hty_{q}=h^{*}_{t} holds whenever ii is non-tight.

Proof 3.9.

We prove the lemma by induction. Clearly, the lemma holds at the start of the phase: all unmarked pages belonging to non-isolated agents have yy-value 0. Now consider a time tt during phase rr such that the lemma holds for all timepoints before tt in this phase. We may also assume that ypt>0y_{p_{t}}>0, since otherwise none of the variables are modified in this timestep.

By induction hypothesis, any unmarked ii-page qq satisfies yqht1y_{q}\leq h^{*}_{t-1}, and this inequality is tight whenever ii is non-tight. If agent iti_{t} is non-tight, then its unmarked pages are already part of the frontier. Otherwise, Algorithm 𝒜\mathcal{A} fetches ptp_{t} fully into the cache by increasing the yy-value of other unmarked iti_{t}-pages until one of the following happens: (a) ptp_{t} is fully fetched. In this case, iti_{t} continues to remain tight; or (b) The yy-value of unmarked iti_{t}-pages becomes equal to the frontier’s yy-value, ht1h^{*}_{t-1}. In the latter case, unmarked iti_{t}-pages become part of the frontier and the yy-value of the frontier is uniformly increased until ptp_{t} gets fully fetched into the cache. If some agent ii^{\prime} becomes tight before the fetch operation is completed, then its unmarked pages get excluded from the frontier and the corresponding yy-values remain unchanged for the rest of this timestep. In all cases, the lemma continues to hold since the yy-value of the frontier is never decreased and only tight agents get dropped from the frontier.

Remark 3.10.

Within any phase, hth^{*}_{t} is non-decreasing over time and takes values 0 and 11 at the endpoints. This follows from the fact that 𝒜\mathcal{A} never decreases yqy_{q} for an unmarked page qptq\neq p_{t}.

The following lemma shows that any page that is not completely in Algorithm 𝒜\mathcal{A}’s cache must be evicted to at least a 1/k1/k portion. This property will be useful to us in Sections 3.3 and 4.

Lemma 3.11.

At the end of any time step tt, for any page p𝒫p\in\mathcal{P}, we have ypt=0y_{p}^{t}=0 or ypt1/ky_{p}^{t}\geq 1/k.

Proof 3.12.

First, note that for all marked pages, we have ypt=1xpt=0y_{p}^{t}=1-x_{p}^{t}=0. Let i𝒯(t)i\in\mathcal{T}(t) be any tight agent. Then we have ki=p𝒫(i)xpt=|M(i,t)|+pU(i,t)xptk_{i}=\sum_{p\in\mathcal{P}(i)}x_{p}^{t}=|M(i,t)|+\sum_{p\in U(i,t)}x_{p}^{t}. By Lemma 3.1 (part iii), all unmarked pages of agent ii have the same yy value: ypt=1xpt=hiy_{p}^{t}=1-x_{p}^{t}=h_{i} (say). Since kik_{i} is integral, we have either hi=0h_{i}=0 or hih_{i}. Rearranging, we have |U(i,t)|hi=|M(i,t)|+|U(i,t)|ki|U(i,t)|h_{i}=|M(i,t)|+|U(i,t)|-k_{i}. Since all terms on the RHS are integral, we have either hi=0h_{i}=0 or hi1/|U(i,t)|1/kh_{i}\geq 1/|U(i,t)|\geq 1/k.

By Lemma 3.8, all unmarked pages pp belonging to non-tight agents satisfy ypt=hty_{p}^{t}=h_{t}^{*}. Let U(t)U(t) be the set of all unmarked pages belonging to all non-tight agents that were also non-isolated at the beginning of the phase. Recall that by definition, we have |U(t)|k|U(t)|\leq k since all pages in U(t)U(t) must have been fully in the cache at the beginning of the current phase. Since we have k=i𝒯(t)ki+i𝒯(t)p𝒫(i)xptk=\sum_{i\in\mathcal{T}(t)}k_{i}+\sum_{i\notin\mathcal{T}(t)}\sum_{p\in\mathcal{P}(i)}x_{p}^{t}, once again by integrality of kk and {ki}\{k_{i}\}, we must have that pU(t)ypt=pU(t)ht\sum_{p\in U(t)}y_{p}^{t}=\sum_{p\in U(t)}h_{t}^{*} is an integer. Hence, either ht=0h_{t}^{*}=0 or ht1/|U(t)|1/kh_{t}^{*}\geq 1/|U(t)|\geq 1/k.

3.2 Analysis Overview

At any time tt, we consider the set of yy values of pages in i[m]P(i,ri1)\bigcup_{i\in[m]}P(i,r_{i}-1) as the state of the system. We define a non-negative potential function Ψ\Psi that is purely a function of this state. For any page request ptp_{t}, we attempt to bound the algorithm’s cost by an increase in the potential function, thereby bounding the total cost incurred by the algorithm by the final value of the potential function. There are two difficulties with this approach: (i) when a phase ends, the potential function abruptly drops since all the unmarked pages that were fully evicted no longer contribute to the state, and (ii) when the agent iti_{t} was isolated at the beginning of the phase but is now non-isolated, the change in potential is not sufficient to cover the fetch cost. In both these situations we charge the cost incurred by the online algorithm to a new quantity that is a function of the sets {P(i,ri)}\{P(i,r_{i})\}. To complete the analysis, we show that this quantity is upper-bounded by the cost of the optimal solution.

3.3 Potential Function Analysis

Consider the function ϕ:[0,1]0\phi:[0,1]\to\mathbb{R}_{\geq 0} defined as:

ϕ(h)2hln(1+kh)\phi(h)\triangleq 2h\cdot\ln(1+kh) (1)

As hh goes from 0 to 11, ϕ(h)\phi(h) increases from 0 to 2ln(1+k)2\ln(1+k).

The potential at any time tt is defined as follows:

Ψ(t)i=1mpU(i,t)ϕ(ypt)\Psi(t)\triangleq\sum_{i=1}^{m}\sum_{p\in U(i,t)}\phi(y_{p}^{t}) (2)

Note that only unmarked pages at any time tt contribute to the potential. So when page ptp_{t} is fetched at time tt and marked, it stops contributing to the potential. But since ϕ\phi is monotone, the newly evicted pages increase their contribution to the potential. We remark that the potential is purely a function of the state of the system as defined by the yy values of unmarked pages in the cache and is thus always bounded by a quantity independent of the length of the page request sequence.

Lemma 3.13.

For any h1/kh\geq 1/k, we have ϕ(h)h\phi(h)\geq h and ϕ(h)1+2ln(1+kh)\phi^{\prime}(h)\geq 1+2\ln(1+kh).

Proof 3.14.

The first conclusion follows from the logarithmic inequality ln(1+x)x/(1+x)\ln(1+x)\geq x/(1+x) which holds for any nonnegative xx: we have ϕ(h)=2hln(1+kh)h2kh/(1+kh)h\phi(h)=2h\ln(1+kh)\geq h\cdot 2kh/(1+kh)\geq h whenever kh1kh\geq 1. Next, ϕ(h)=dϕdh=2(11/(1+kh)+ln(1+kh))\phi^{\prime}(h)=\frac{d\phi}{dh}=2(1-1/(1+kh)+\ln(1+kh)). So, for any h1/kh\geq 1/k we have 1/21/(1+kh)1/2\geq 1/(1+kh), which gives the other conclusion.

The rest of this section is devoted to proving the following theorem where we bound the total cost incurred by the algorithm in terms of the sets {P(i,ri)}\{P(i,r_{i})\} and the number of requests to pseudo-clean pages.

Theorem 3.15.

The following bound holds on the cost incurred by 𝒜\mathcal{A} to process the first TT page requests:

cost𝒜(σ)2ln(1+k)(mk+t=1T𝟙pt is pseudo-clean+i[m]ri=1Ri|P(i,ri1)P(i,ri)|).\mathrm{cost}_{\mathcal{A}}(\sigma)\leq 2\ln(1+k)\cdot\left(mk+\sum_{t=1}^{T}\mathbb{1}_{{p_{t}}\text{ is pseudo-clean}}+\sum_{i\in[m]}\sum_{r_{i}=1}^{R_{i}}|P(i,r_{i}-1)\setminus P(i,r_{i})|\right).

Recall that the algorithm incurs a cost of yptty_{p_{t}}^{t} to fetch page ptp_{t} at time tt. So the total cost incurred by the algorithm is simply cost𝒜(σ)=typtt\mathrm{cost}_{\mathcal{A}}(\sigma)=\sum_{t}y_{p_{t}}^{t}. We first bound this cost for time steps when the requested page ptp_{t} is at least partially in the cache, i.e., yptt<1y_{p_{t}}^{t}<1. Recall by Lemmas 3.2 and 3.4, the algorithm does not undergo a phase transition in this time step.

Lemma 3.16.

Consider any time step tt such that yptt<1y_{p_{t}}^{t}<1 for the currently requested (unmarked) page ptp_{t}. Let ΔΨ(t)\Delta\Psi(t) denote the change in the potential function during time step tt. Then ypttΔΨ(t)y_{p_{t}}^{t}\leq\Delta\Psi(t).

Proof 3.17.

We assume that yptt1ky_{p_{t}}^{t}\geq\frac{1}{k}, since otherwise by Lemma 3.11, we must have yptt=0y_{p_{t}}^{t}=0 and the lemma follows trivially. Since yptt<1y_{p_{t}}^{t}<1, by Lemma 3.8, either agent iti_{t} is tight or we have yqt=yptty_{q}^{t}=y_{p_{t}}^{t} for every unmarked page qq owned by any non-tight agent ii that was non-isolated at the start of this phase. In either case, the pages that get evicted to make space for ptp_{t} have their initial yy values at least yptt1/ky_{p_{t}}^{t}\geq 1/k. The potential function Ψ\Psi changes in this step due to two factors: (i) Ψ\Psi drops as page ptp_{t} stops contributing to the potential as soon as it gets marked; and (ii) Ψ\Psi increases as the yy-value of (fractionally) evicted pages increases in this step.

Let hyptth\triangleq y^{t}_{p_{t}}. At the beginning to time tt, page ptp_{t} contributed exactly ϕ(h)=2hln(1+kh)\phi(h)=2h\ln(1+kh) to the potential; This contribution is lost as soon as ptp_{t} gets marked. To prove the lemma, it suffices to show that the rate of increase in the potential function (without including ptp_{t}’s contribution) is at least 1+2ln(1+kh)1+2\ln(1+kh) throughout the eviction of an hh amount of unmarked pages belonging to non-tight agents: the 11 term in total pays for the fetch-cost of hh and the 2ln(1+kh)2\ln(1+kh) term in total pays for the 2hln(1+kh)2h\ln(1+kh) loss in potential. This directly follows from Lemma 3.13 from the fact that the yy-values of pages that are fractionally evicted in this timestep were already at least h1/kh\geq 1/k. Here, we also use the monotonicity of the function hln(1+kh)h^{\prime}\mapsto\ln(1+kh^{\prime}).

We still need to bound the cost incurred by the algorithm when the incoming request is to a page that is fully outside the cache. Note that the algorithm incurs exactly unit cost for all such time steps. The following lemma shows that the total cost incurred by the algorithm can be bounded by the drop in potential function at the end of a phase and by a term that depends only on the change in the potential function while processing a request to a page fully outside the cache.

Lemma 3.18.

For any global phase r0r_{0}, let ΔΨ(r0)\Delta\Psi(r_{0}) denote the change in the potential function at the end of phase r0r_{0} (line 1 in Algorithm 1). Let R0R_{0} denote the total number of global phases and TT denote the time at the end of phase R0R_{0}. Then we have the following upper bound on the cost incurred by 𝒜\mathcal{A} for processing the first TT page requests:

cost𝒜(σ)2mkln(1+k)+t[T]:yptt=1(1ΔΨ(t))r0=1R0ΔΨ(r0)\mathrm{cost}_{\mathcal{A}}(\sigma)\leq 2mk\ln(1+k)+\sum_{t\in[T]:y_{p_{t}}^{t}=1}(1-\Delta\Psi(t))-\sum_{r_{0}=1}^{R_{0}}\Delta\Psi(r_{0})
Proof 3.19.

We have:

cost𝒜(σ)\displaystyle\mathrm{cost}_{\mathcal{A}}(\sigma) =t[T]yptt=t[T]:yptt<1yptt+|{t[T]:yptt=1}|\displaystyle=\sum_{t\in[T]}y_{p_{t}}^{t}=\sum_{t\in[T]:y_{p_{t}}^{t}<1}y_{p_{t}}^{t}+|\{t\in[T]:y_{p_{t}}^{t}=1\}|
t:yptt<1ΔΨ(t)+|{t:yptt=1}|\displaystyle\leq\sum_{t:y_{p_{t}}^{t}<1}\Delta\Psi(t)+|\{t:y_{p_{t}}^{t}=1\}| (Using Lemma 3.16)
=Ψ(T)Ψ(0)t:yptt=1ΔΨ(t)r0=1R0ΔΨ(r0)+|{t:yptt=1}|.\displaystyle=\Psi(T)-\Psi(0)-\sum_{t:y_{p_{t}}^{t}=1}\Delta\Psi(t)-\sum_{r_{0}=1}^{R_{0}}\Delta\Psi(r_{0})+|\{t:y_{p_{t}}^{t}=1\}|.

The lemma follows since Ψ(T)2mkln(1+k)\Psi(T)\leq 2mk\ln(1+k) and Ψ(0)=0\Psi(0)=0. The bound on Ψ(T)\Psi(T) is because we have mm agents each with |P(i,ri1)|k|P(i,r_{i}-1)|\leq k, and ϕ(1)=2ln(1+k)\phi(1)=2\ln(1+k).

So, it is enough to bound the total cost and drop in potential for time steps when the requested page is fully outside the cache and also to bound the drop in potential when the phase changes.

Proof 3.20 (Proof of Theorem 3.15).

Consider any time step tt such that the currently requested page ptp_{t} is fully outside the cache, i.e. yptt=1y_{p_{t}}^{t}=1. We differentiate such requests into two cases depending on whether the page ptp_{t} is in the set P(it,rit1)P(i_{t},r_{i_{t}}-1) at the time or not. In other words, we do a case analysis on ptp_{t} being clean or pseudo-clean. (Recall that only unmarked pages in P(it,rit1)P(i_{t},r_{i_{t}}-1) contribute to the potential).

Case 1: ptP(it,rit1)p_{t}\notin P(i_{t},r_{i_{t}}-1), i.e, ptp_{t} is clean. Since page ptU(i,t)p_{t}\notin U(i,t), it does not contribute to the potential before (or after) the request has been served. Consider any page qq that is evicted (fractionally) by the algorithm in this step. By Lemma 3.1, before the eviction, we have yq=0y_{q}=0 or yq1/ky_{q}\geq 1/k. In either case, by Lemma 3.13, we have Δϕ(yq)Δyq\Delta\phi(y_{q})\geq\Delta y_{q} where Δyq\Delta y_{q} denotes the change in yy-value of page qq in this step. Since we have qΔyq=yptt=1\sum_{q}\Delta y_{q}=y_{p_{t}}^{t}=1, we have ΔΨ(t)=qΔϕ(yq)1\Delta\Psi(t)=\sum_{q}\Delta\phi(y_{q})\geq 1.

Case 2: ptP(it,rit1)p_{t}\in P(i_{t},r_{i_{t}}-1), i.e., ptp_{t} is pseudo-clean. By the same reasoning as above, we have qptΔϕ(yq)1\sum_{q\neq p_{t}}\Delta\phi(y_{q})\geq 1. However, in this case, page ptp_{t} also contributed exactly 2ln(1+k)2\ln(1+k) to the potential at the beginning of the time step. So we have ΔΨ(t)=qptΔϕ(yq)2ln(1+k)12ln(1+k)\Delta\Psi(t)=\sum_{q\neq p_{t}}\Delta\phi(y_{q})-2\ln(1+k)\geq 1-2\ln(1+k).

Combining the two cases we get:

t:yptt=1(1ΔΨ(t))2ln(1+k)|{t:ypt=1 and ptP(it,rit1)}|\sum_{t:y_{p_{t}}^{t}=1}(1-\Delta\Psi(t))\leq 2\ln(1+k)\cdot|\{t:y_{p_{t}}=1\text{ and }p_{t}\in P(i_{t},r_{i_{t}}-1)\}| (3)

Consider the end of some phase r0r_{0} and let ii be a non-isolated agent. Let rir_{i} denote the current local phase of agent ii that must also end along with the global phase r0r_{0}. Consider any unmarked page qq in U(i,t)U(i,t). As the phase r0r_{0} is ending, page qq must be fully evicted and thus contributes ϕ(1)\phi(1) to the potential. Once phase r0r_{0} ends and phase r0+1r_{0}+1 begins, page qq no longer contributes to the potential. Note that the set of such unmarked pages is exactly P(i,ri1)P(i,ri)P(i,r_{i}-1)\setminus P(i,r_{i}). Hence, the change in potential at the end of (global) phase r0r_{0} is given by:

ΔΨ(r0)=2ln(1+k)i(r0)|P(i,ri1)P(i,ri)|\Delta\Psi(r_{0})=-2\ln(1+k)\cdot\sum_{i\notin\mathcal{I}(r_{0})}|P(i,r_{i}-1)\setminus P(i,r_{i})|

Since an agent only changes its local phase when it is non-isolated at the end of a global phase, we have:

r0=1R0ΔΨ(r0)=2ln(1+k)i[m]ri=1Ri|P(i,ri1)P(i,ri)|.\sum_{r_{0}=1}^{R_{0}}\Delta\Psi(r_{0})=-2\ln(1+k)\cdot\sum_{i\in[m]}\sum_{r_{i}=1}^{R_{i}}|P(i,r_{i}-1)\setminus P(i,r_{i})|. (4)

The theorem now follows from Lemma 3.18.

3.4 A Lower Bound on 𝐎𝐏𝐓\mathrm{OPT} through Dual Fitting

In this section, we give a novel LP-based lower bound on the cost of any offline algorithm for caching with reserves via dual-fitting. This lower bound analysis is new even for the classical unweighted paging setting. Crucially, the lower bound derived here perfectly matches the two terms used to bound the cost of the fractional algorithm 𝒜\mathcal{A} in Theorem 3.15, thereby completing the proof of our main result (Theorem 1.1).

We now describe the linear relaxation of the caching with reserves problem and its dual program. The following notation will be useful. For any page q𝒫q\in\mathcal{P}, let tq,1<tq,2<t_{q,1}<t_{q,2}<... denote the time steps when qq is requested in the online sequence. For an integer a0a\geq 0, define I(q,a)={tq,a+1,,tq,a+11}I(q,a)=\{t_{q,a}+1,\ldots,t_{q,a+1}-1\} to be the time interval between the aath and (a+1)(a+1)th requests for qq. We define tq,00t_{q,0}\triangleq 0 for all pages. Let a(q,t)a(q,t) denote the number of requests to page qq that have been seen until time tt (inclusive). Hence, by definition, for any time tt and page q𝒫{pt}q\in\mathcal{P}\setminus\{p_{t}\}, we have tI(q,a(q,t))t\in I(q,a(q,t)). The primal LP has variables y(q,a)[0,1]y(q,a)\in[0,1] which denote the portion of page qq that is evicted between its aath and (a+1)(a+1)th requests, i.e., 1y(q,a)1-y(q,a) portion of qq is held in the cache during the time-interval I(q,a)I(q,a). For convenience, we define n|𝒫|n\triangleq|\mathcal{P}| and ni|𝒫(i)|n_{i}\triangleq|\mathcal{P}(i)| for any i[m]i\in[m]. The first and second set of primal constraints encode the cache size constraint and the agent-level reserve constraints for all times. The dual LP has variables α(t)\alpha(t) and β(t,i)\beta(t,i) corresponding to these primal constraints. We also have dual variables γ(q,a)\gamma(q,a) corresponding to the primal constraint encoding y(q,a)1y(q,a)\leq 1. Besides nonnegativity, the dual has a single constraint for each interval I(q,a)I(q,a). The primal and dual LPs are stated below. We emphasize that we use these linear programs purely for analysis and the algorithm itself does not need to solve any linear program.

Primal LP

minq𝒫a1y(q,a)\displaystyle\min\quad\sum_{q\in\mathcal{P}}\sum_{\begin{subarray}{c}a\geq 1\end{subarray}}y(q,a)
subject to:
q𝒫,qpty(q,a(q,t))nk\displaystyle\quad\sum_{q\in\mathcal{P},q\neq p_{t}}y(q,a(q,t))\geq n-k t\displaystyle\forall t (5)
q𝒫(i),qpty(q,a(q,t))niki\displaystyle\sum_{q\in\mathcal{P}(i),q\neq p_{t}}y(q,a(q,t))\leq n_{i}-k_{i} t,i\displaystyle\forall t,\forall i (6)
y(q,a)1\displaystyle\hskip 56.0001pty(q,a)\leq 1 q,a\displaystyle\forall q,\forall a (7)
y0\displaystyle\hskip 72.00014pt\ y\geq 0 (8)

Dual LP

maxt(nk)α(t)t,i(niki)β(t,i)\displaystyle\max\sum_{t}(n-k)\alpha(t)-\sum_{t,i}(n_{i}-k_{i})\beta(t,i)
q,aγ(q,a)\displaystyle\hskip 72.00014pt-\sum_{q,a}\gamma(q,a)
subject to:
tI(q,a)(α(t)β(t,ag(q)))γ(q,a)\displaystyle\sum_{t\in I(q,a)}\bigl{(}\alpha(t)-\beta(t,ag(q))\bigr{)}-\gamma(q,a)
1q,a\displaystyle\hskip 100.0pt\quad\leq 1\,\,\forall q,\forall a (9)
α,β,γ0\displaystyle\hskip 72.00014pt\ \alpha,\beta,\gamma\geq 0 (10)

Consider time TT that marks the end of a global phase R0R_{0} for some integer R0R_{0}. Let OPT=costOPT(σ)\mathrm{OPT}=\mathrm{cost}_{\mathrm{OPT}}(\sigma) denote the total cost incurred by an optimal offline algorithm. By weak LP duality, the objective function of the Dual LP yields a lower bound on OPT\mathrm{OPT} for any feasible dual solution. We now construct an explicit dual solution (α,β,γ)(\alpha,\beta,\gamma) whose objective value is roughly equal to the total number of clean and pseudo-clean pages seen by the algorithm. See Section 3.1 to recall relevant notation and terminology. The dual solution is updated at the end of each (global) phase in two stages. Updates in the first stage, denoted 𝗎𝗉𝖽𝖺𝗍𝖾(r0,1)\mathsf{update}(r_{0},1), are simple and account for stale pages belonging to non-isolated agents that got evicted in the most recent local phase for that agent. Updates in the second stage, denoted 𝗎𝗉𝖽𝖺𝗍𝖾(r0,2)\mathsf{update}(r_{0},2), are more involved and account for the pseudo-clean pages of agents who lost their isolated status in the current phase. The dual solution that we maintain will always be approximately feasible up to O(1)O(1) factors, so the objective value of this dual solution serves as a lower bound on OPT(T)\mathrm{OPT}(T) within a constant factor. We remark that the assumption that TT marks the end of a phase is without loss of generality since it can lead to at most an additive O(k)O(k) loss in the lower bound. Formally, we show the following.

Theorem 3.21.

Let TT denote the timepoint when global phase R0R_{0} ends, and let (Ri)i[m](R_{i})_{i\in[m]} denote the corresponding local phase counters. Let (α,β,γ)(\alpha,\beta,\gamma) denote the dual solution that is constructed by the end of time TT, i.e., the solution that arises from a sequential application of dual updates in the order 𝗎𝗉𝖽𝖺𝗍𝖾(1,1),𝗎𝗉𝖽𝖺𝗍𝖾(1,2),𝗎𝗉𝖽𝖺𝗍𝖾(2,1),𝗎𝗉𝖽𝖺𝗍𝖾(2,2),,𝗎𝗉𝖽𝖺𝗍𝖾(R0,1)\mathsf{update}(1,1),\mathsf{update}(1,2),\mathsf{update}(2,1),\mathsf{update}(2,2),\dots,\mathsf{update}(R_{0},1), and 𝗎𝗉𝖽𝖺𝗍𝖾(R0,2)\mathsf{update}(R_{0},2). We have:

  1. (a)

    The dual solution is approximately feasible: for any ii-page qq and an integer a0a\geq 0, tI(q,a)(α(t)β(t,i))γ(q,a)5\sum_{t\in I(q,a)}(\alpha(t)-\beta(t,i))-\gamma(q,a)\leq 5 holds.

  2. (b)

    The dual objective value of (α,β,γ)(\alpha,\beta,\gamma) is:

    dual(R0)t=1T(nk)α(t)t=1Ti[m](niki)β(t,i)q𝒫a=1a(q,T)γ(q,a)=i[m]ri=1Ri|P(i,ri1)P(i,ri)|+r0=1R0i(r01)(r0)(|P(i,ri1)P(i,ri)|ki).\mathrm{dual}(R_{0})\triangleq\sum_{t=1}^{T}(n-k)\alpha(t)-\sum_{t=1}^{T}\sum_{i\in[m]}(n_{i}-k_{i})\beta(t,i)-\sum_{q\in\mathcal{P}}\sum_{a=1}^{a(q,T)}\gamma(q,a)\\ =\sum_{i\in[m]}\sum_{r_{i}=1}^{R_{i}}|P(i,r_{i}-1)\setminus P(i,r_{i})|+\sum_{r_{0}=1}^{R_{0}}\sum_{i\in\mathcal{I}(r_{0}-1)\setminus\mathcal{I}(r_{0})}(|P(i,r_{i}-1)\cup P(i,r_{i})|-k_{i}).

We first show how Theorem 3.21 implies that our fractional algorithm 𝒜\mathcal{A} is O(logk)O(\log k)-competitive.

Proof 3.22 (Proof of Theorem 1.1).

In Theorem 3.15 we proved the following upper bound on the cost incurred by 𝒜\mathcal{A} for processing the first TT page requests:

cost𝒜(σ)2ln(1+k)(mk+t=1T𝟙pt is pseudo-clean+i[m]ri=1Ri|P(i,ri1)P(i,ri)|).\mathrm{cost}_{\mathcal{A}}(\sigma)\leq 2\ln(1+k)\cdot\Bigl{(}mk+\sum_{t=1}^{T}\mathbb{1}_{{p_{t}}\text{ is pseudo-clean}}+\sum_{i\in[m]}\sum_{r_{i}=1}^{R_{i}}|P(i,r_{i}-1)\setminus P(i,r_{i})|\Bigr{)}.

Clearly, the second nontrivial term in the above cost-expression matches the first term in the expression for dual(R0)\mathrm{dual}(R_{0}). Now consider an arbitrary global phase r0{1,,R0}r_{0}\in\{1,\dots,R_{0}\} and a timestep tt in this phase. By definition, a pseudo-clean page ptp_{t} is necessarily stale, i.e., ptP(it,rit1)p_{t}\in P(i_{t},r_{i_{t}}-1) holds, and it must be that agent iti_{t} was isolated at the start of phase r0r_{0} but is non-isolated by time tt. Therefore, it(r01)(r0)i_{t}\in\mathcal{I}(r_{0}-1)\setminus\mathcal{I}(r_{0}) and the following holds:

|P(i,ri1)P(i,ri)|ki|P(i,ri)|ki|{tphase r0:pt is pseudo-clean}|.|P(i,r_{i}-1)\cup P(i,r_{i})|-k_{i}\geq|P(i,r_{i})|-k_{i}\geq|\{t\in\text{phase }r_{0}:p_{t}\text{ is pseudo-clean}\}|.

In the above, the final inequality is because among all pages in P(i,ri)P(i,r_{i}) (w.r.t. the order in which they were marked by 𝒜\mathcal{A}), the first kik_{i} pages are not pseudo-clean. Thus, the first nontrivial term in the cost-expression for 𝒜\mathcal{A} can be bounded by the second term in dual(R0)\mathrm{dual}(R_{0}).

Overall, we have shown that cost𝒜(σ)2ln(1+k)(mk+dual(R0))\mathrm{cost}_{\mathcal{A}}(\sigma)\leq 2\ln(1+k)\cdot\bigl{(}mk+\mathrm{dual}(R_{0})\bigr{)} holds. Since the dual solution is O(1)O(1)-feasible, we get that 𝒜\mathcal{A} is O(logk)O(\log k)-competitive.

We now furnish the details of our dual updates. Initially, all our dual variables {α(t)}\{\alpha(t)\}, {β(i,t)}\{\beta(i,t)\}, {γ(q,a)}\{\gamma(q,a)\} with t[T],i[m],q𝒫,a[a(q,T)]t\in[T],i\in[m],q\in\mathcal{P},a\in[a(q,T)] are set to zero. We assume that the dual updates are applied in the sequence given in Theorem 3.21. That is, the set of updates in {𝗎𝗉𝖽𝖺𝗍𝖾(r0,s)}r0[R0],s{1,2}\{\mathsf{update}(r_{0},s)\}_{r_{0}\in[R_{0}],s\in\{1,2\}} are applied in increasing order of r0r_{0} and within each phase first stage updates are applied first. With a slight abuse of notation, let dual(r0,s)\mathrm{dual}(r_{0},s) denote the objective value of the dual solution right after updates until 𝗎𝗉𝖽𝖺𝗍𝖾(r0,s)\mathsf{update}(r_{0},s) (inclusive) have been applied where r0[R0],s{1,2}r_{0}\in[R_{0}],s\in\{1,2\}. Note that dual(R0)=dual(R0,2)\mathrm{dual}(R_{0})=\mathrm{dual}(R_{0},2). We also define dual(0,1)=dual(0,2):=0\mathrm{dual}(0,1)=\mathrm{dual}(0,2):=0. Throughout our updates, we ensure that the dual objective value never decreases, i.e., 0dual(1,1)dual(1,2)dual(R0,1)dual(R0,2)0\leq\mathrm{dual}(1,1)\leq\mathrm{dual}(1,2)\leq\dots\leq\mathrm{dual}(R_{0},1)\leq\mathrm{dual}(R_{0},2) holds. We remark that β\beta variables may decrease and this only happens in the second stage; However, the α\alpha and γ\gamma variables never decrease.

In Section 3.4, we describe the first stage of updates and show that the gain in the dual objective corresponds to the first term in Theorem 3.21(b). In Section 3.4, we describe the second stage of updates and show that the gain in the dual objective corresponds to the second term in Theorem 3.21(b). Lastly, in Section 3.4, we show that the dual solution that we maintain is always feasible up to constant factors and thus complete the proof of Theorem 3.21.

First Stage of Dual Updates

Fix a phase r0[R0]r_{0}\in[R_{0}] and consider the set (r0)[m]\mathcal{I}(r_{0})\subsetneq[m] of agents that are designated as isolated at the end of phase r0r_{0}. Let C(r0)C(r_{0}) denote the set of timesteps tt (in this phase) when the following two conditions hold: (a) yptt=1y^{t}_{p_{t}}=1 in the fractional algorithm 𝒜\mathcal{A} just before ptp_{t} is requested; and (b) iti_{t} is not isolated at time tt. Define (r0)|C(r0)|\ell^{(r_{0})}\triangleq|C(r_{0})|. It is not hard to see that the following is an equivalent expression for (r0)\ell^{(r_{0})}.

(r0):=i(r01)(r0)|P(i,ri)P(i,ri1)|+i(r01)(r0)(|P(i,ri)|ki).\ell^{(r_{0})}:=\sum_{i\notin\mathcal{I}(r_{0}-1)\cup\mathcal{I}(r_{0})}|P(i,r_{i})\setminus P(i,r_{i}-1)|+\sum_{i\in\mathcal{I}(r_{0}-1)\setminus\mathcal{I}(r_{0})}(|P(i,r_{i})|-k_{i}). (11)

Observe that for agents who are non-isolated both at the start and end of phase r0r_{0}, (r0)\ell^{(r_{0})} counts all their clean pages. However, for agents who were isolated at the start of this phase but are no longer isolated by the end, (r0)\ell^{(r_{0})} only counts clean and pseudo-clean pages that are requested after the agent has become non-isolated. Roughly speaking, the motivation for the definition of (r0)\ell^{(r_{0})} comes from the intuition that an offline algorithm should incur, on an average, a cost of Ω((r0))\Omega(\ell^{(r_{0})}) to serve page requests in phase r0r_{0}.

Description of 𝘂𝗽𝗱𝗮𝘁𝗲(𝒓𝟎,𝟏)\mathsf{update}(r_{0},1):

For each time tC(r0)t\in C(r_{0}), we separately apply the following updates. First, we increase α(t)\alpha(t) by 1/(r0)1/\ell^{(r_{0})}. Next, we increase β(t,i)\beta(t,i) by 1/(r0)1/\ell^{(r_{0})} for every agent i(r0)i\in\mathcal{I}(r_{0}). Last, for each agent i(r0)i\notin\mathcal{I}(r_{0}), we increase γ(q,a(q,t))\gamma(q,a(q,t)) by 1/(r0)1/\ell^{(r_{0})} for every ii-page q𝒫(i)(P(i,ri1)P(i,ri))q\in\mathcal{P}(i)\setminus(P(i,r_{i}-1)\cup P(i,r_{i})).

It will be clear from the description of our updates that the α\alpha and β\beta variables that were modified in 𝗎𝗉𝖽𝖺𝗍𝖾(r0,1)\mathsf{update}(r_{0},1) were previously at 0. However, no such guarantee holds for the affected γ\gamma variables. We also remark that the same γ(q,a)\gamma(q,a) variable can be increased more than once during 𝗎𝗉𝖽𝖺𝗍𝖾(r0,1)\mathsf{update}(r_{0},1); this happens when there are multiple times tC(r0)t\in C(r_{0}) with the same a(q,t)a(q,t) value. In fact, since the γ(q,a)\gamma(q,a) variables arise from intervals I(q,a)I(q,a) that can possibly span across multiple phases, it is possible that the same γ\gamma variable is increased by different 1/(r0)1/\ell^{(r_{0})} amounts across different 𝗎𝗉𝖽𝖺𝗍𝖾(r0,1)\mathsf{update}(r_{0},1) steps.

For convenience, let tphase r0t\in\text{phase }r_{0} be a shorthand for all timepoints in phase r0r_{0}. The following result will be useful to us.

Lemma 3.23.

Let (α,β,γ)(\alpha,\beta,\gamma) denote the dual solution that is obtained right after 𝗎𝗉𝖽𝖺𝗍𝖾(r0,1)\mathsf{update}(r_{0},1) has been applied. We have: (a) tphase r0α(t)=1\sum_{t\in\text{phase }r_{0}}\alpha(t)=1; and (b) tphase r0β(t,i)=1\sum_{t\in\text{phase }r_{0}}\beta(t,i)=1 for any agent i(r0)i\in\mathcal{I}(r_{0}).

Proof 3.24.

Follows directly from our choice of (r0)=|C(r0)|\ell^{(r_{0})}=|C(r_{0})|.

Our key technical result in this section is that the gain in the dual objective value that comes from 𝗎𝗉𝖽𝖺𝗍𝖾(r0,1)\mathsf{update}(r_{0},1) is equal to the number of stale pages owned by non-isolated agents that were not requested in their most recent local phases. For convenience, we use the prefix Δ\Delta to refer to changes that occured during 𝗎𝗉𝖽𝖺𝗍𝖾(r0,1)\mathsf{update}(r_{0},1).

Lemma 3.25.

We have Δdual(r0,1)=i(r0)|P(i,ri1)P(i,ri)|\Delta\mathrm{dual}(r_{0},1)=\sum_{i\notin\mathcal{I}(r_{0})}|P(i,r_{i}-1)\setminus P(i,r_{i})|, where Δdual(r0,1)dual(r0,1)dual(r01,2)\Delta\mathrm{dual}(r_{0},1)\triangleq\mathrm{dual}(r_{0},1)-\mathrm{dual}(r_{0}-1,2) is the change in the dual objective after 𝗎𝗉𝖽𝖺𝗍𝖾(r0,1)\mathsf{update}(r_{0},1).

Proof 3.26.

Since the only affected α(t)\alpha(t) and β(t,i)\beta(t,i) variables have are those with tC(r0)t\in C(r_{0}) and they are all increased by exactly 1/|C(r0)|1/|C(r_{0})|, we get:

Δdual(r0,1)\displaystyle\Delta\mathrm{dual}(r_{0},1) =t(nk)Δα(t)t,i(niki)Δβ(t,i)q,aΔγ(q,a)\displaystyle=\sum_{t}(n-k)\Delta\alpha(t)-\sum_{t,i}(n_{i}-k_{i})\Delta\beta(t,i)-\sum_{q,a}\Delta\gamma(q,a)
=(nk)i(r0)(niki)q,aΔγ(q,a)\displaystyle=(n-k)-\sum_{i\in\mathcal{I}(r_{0})}(n_{i}-k_{i})-\sum_{q,a}\Delta\gamma(q,a)
=(i(r0)ni)k+(i(r0)ki)q,aΔγ(q,a)\displaystyle=\Bigl{(}\sum_{i\notin\mathcal{I}(r_{0})}n_{i}\Bigr{)}-k+\Bigl{(}\sum_{i\in\mathcal{I}(r_{0})}k_{i}\Bigr{)}-\sum_{q,a}\Delta\gamma(q,a)

Now observe that for every tC(r0)t\in C(r_{0}) and i(r0)i\notin\mathcal{I}(r_{0}), the 𝗎𝗉𝖽𝖺𝗍𝖾(r0,1)\mathsf{update}(r_{0},1) step increases the γ(q,a)\gamma(q,a) variable corresponding to exactly ni|P(i,ri1)P(i,ri)|n_{i}-|P(i,r_{i}-1)\cup P(i,r_{i})| unique ii-pages, each by an amount 1/(r0)1/\ell^{(r_{0})}. So we have q,aΔγ(q,a)=(1/(r0))tC(r0)i(r0)(ni|P(i,ri1)P(i,ri)|)=i(r0)(ni|P(i,ri1)P(i,ri)|)\sum_{q,a}\Delta\gamma(q,a)=(1/\ell^{(r_{0})})\cdot\sum_{t\in C(r_{0})}\sum_{i\notin\mathcal{I}(r_{0})}(n_{i}-|P(i,r_{i}-1)\cup P(i,r_{i})|)=\sum_{i\notin\mathcal{I}(r_{0})}(n_{i}-|P(i,r_{i}-1)\cup P(i,r_{i})|). Substituting back into the equation above, we get:

Δdual(r0,1)\displaystyle\Delta\mathrm{dual}(r_{0},1) =(i(r0)ni)k+(i(r0)ki)i(r0)(ni|P(i,ri1)P(i,ri)|)\displaystyle=\Bigl{(}\sum_{i\notin\mathcal{I}(r_{0})}n_{i}\Bigr{)}-k+\Bigl{(}\sum_{i\in\mathcal{I}(r_{0})}k_{i}\Bigr{)}-\sum_{i\notin\mathcal{I}(r_{0})}(n_{i}-|P(i,r_{i}-1)\cup P(i,r_{i})|)
=(k+i(r0)ki+i(r0)|P(i,ri)|)+i(r0)|P(i,ri1)P(i,ri)|\displaystyle=\Bigl{(}-k+\sum_{i\in\mathcal{I}(r_{0})}k_{i}+\sum_{i\notin\mathcal{I}(r_{0})}|P(i,r_{i})|\Bigr{)}+\sum_{i\notin\mathcal{I}(r_{0})}|P(i,r_{i}-1)\setminus P(i,r_{i})|

The lemma follows from observing that the above group of terms within the parentheses is 0: this is because the cache (of size kk) at the end of phase r0r_{0} consists exactly kik_{i} (fractional) pages for isolated agents i(r0)i\in\mathcal{I}(r_{0}) and exactly |P(i,ri)||P(i,r_{i})| (integral) pages for non-isolated agents i(r0)i\notin\mathcal{I}(r_{0}).

Second Stage of Dual Updates

We now describe the second stage of dual updates that are carried out at the end of each phase r0[R0]r_{0}\in[R_{0}]. Unlike the first stage, where we only increased the α\alpha and β\beta variables of time steps in phase r0r_{0}, in the second stage we decrease the β\beta variables of time steps in the previous phase r01r_{0}-1.

Description of 𝘂𝗽𝗱𝗮𝘁𝗲(𝒓𝟎,𝟐)\mathsf{update}(r_{0},2):

These dual updates correspond to agents that were isolated at the end of phase r01r_{0}-1 but are no longer isolated at the end of phase r0r_{0}. Consider an agent i(r01)(r0)i\in\mathcal{I}(r_{0}-1)\setminus\mathcal{I}(r_{0}). For every time tt in phase r01r_{0}-1 with β(t,i)>0\beta(t,i)>0 (i.e., tC(r01)t\in C(r_{0}-1)), we do the following: we increase γ(q,a(q,t))\gamma(q,a(q,t)) by β(t,i)\beta(t,i) for all ii-pages q𝒫(i)(P(i,ri1)P(i,ri))q\in\mathcal{P}(i)\setminus\bigl{(}P(i,r_{i}-1)\cup P(i,r_{i})\bigr{)} followed by resetting β(t,i)\beta(t,i) to 0.

For clarity, we note the following: (i) resetting β(t,i)\beta(t,i) to zero is the only dual update when a variable is decreased; (ii) the β(t,i)\beta(t,i) updates are applied to timepoints in phase r01r_{0}-1 (i.e., the previous phase); and (iii) the γ(q,a(q,t))\gamma(q,a(q,t)) variables that we updated above were unchanged while applying 𝗎𝗉𝖽𝖺𝗍𝖾(r01,1)\mathsf{update}(r_{0}-1,1) at the end of phase r01r_{0}-1 because their owner ii was designated as isolated at that time. The reason for decreasing the β(t,i)\beta(t,i) variables is that it leads to an increase in the dual objective, which will be needed to pay for costs associated with pseudo-clean pages. We formalize this in the following lemma.

Lemma 3.27.

We have Δdual(r0,2)=i(r01)(r0)(|P(i,ri1)P(i,ri)|ki)\Delta\mathrm{dual}(r_{0},2)=\sum_{i\in\mathcal{I}(r_{0}-1)\setminus\mathcal{I}(r_{0})}\left(|P(i,r_{i}-1)\cup P(i,r_{i})|-k_{i}\right) where Δdual(r0,2)dual(r0,2)dual(r0,1)\Delta\mathrm{dual}(r_{0},2)\triangleq\mathrm{dual}(r_{0},2)-\mathrm{dual}(r_{0},1) is the change in the dual objective after 𝗎𝗉𝖽𝖺𝗍𝖾(r0,2)\mathsf{update}(r_{0},2).

Proof 3.28.

Fix an agent i(r01)(r0)i\in\mathcal{I}(r_{0}-1)\setminus\mathcal{I}(r_{0}). In Lemma 3.23 we showed that after 𝗎𝗉𝖽𝖺𝗍𝖾(r01,1)\mathsf{update}(r_{0}-1,1), tphase r01β(t,i)\sum_{t\in\text{phase }r_{0}-1}\beta(t,i) = 1 and β(t,i){0,1/(r01)}\beta(t,i)\in\{0,1/\ell^{(r_{0}-1)}\}. Consider any time tt in phase r01r_{0}-1 with β(t,i)>0\beta(t,i)>0. By the definition of 𝗎𝗉𝖽𝖺𝗍𝖾(r0,2)\mathsf{update}(r_{0},2), we decrease β(t,i)\beta(t,i) by 1/(r01)1/\ell^{(r_{0}-1)} while increasing γ(q,a(q,t))\gamma(q,a(q,t)) by the same amount for all pages q𝒫(i)(P(i,ri1)P(i,ri))q\in\mathcal{P}(i)\setminus\bigl{(}P(i,r_{i}-1)\cup P(i,r_{i})\bigr{)}. Recalling the coefficients in the dual objective function, we see that the updates corresponding to agent ii increases the dual objective by exactly:

(niki)|𝒫(i)(P(i,ri)P(i,ri1))|=|(P(i,ri)P(i,ri1))|ki.(n_{i}-k_{i})-|\mathcal{P}(i)\setminus(P(i,r_{i})\cup P(i,r_{i}-1))|=|(P(i,r_{i})\cup P(i,r_{i}-1))|-k_{i}.

Approximate Dual Feasibility

We finish this section by showing that the dual solution is always approximately feasible.

Lemma 3.29.

Let (α,β,γ)(\alpha,\beta,\gamma) denote the dual solution that is obtained right after 𝗎𝗉𝖽𝖺𝗍𝖾(r0,s)\mathsf{update}(r_{0},s) has been applied for some r0[R0]r_{0}\in[R_{0}] and s{0,1}s\in\{0,1\}. For any ii-page qq and an integer a1a\geq 1 satisfying aa(q,T)a\leq a(q,T), we have tI(q,a)(α(t)β(t,i))γ(q,a)5\sum_{t\in I(q,a)}(\alpha(t)-\beta(t,i))-\gamma(q,a)\leq 5.

Proof 3.30.

First of all, for the purposes of this proof, the specific values of r0r_{0} and ss are irrelevant, so we ignore them. Fix some ii-page qq and an integer aa satisfying aa(q,T)a\leq a(q,T). Recall that I(q,a)={tq,a+1,,tq,a+11}I(q,a)=\{t_{q,a}+1,\dots,t_{q,a+1}-1\}, where tq,at_{q,a^{\prime}} denotes the time when qq is requested for the aa^{\prime}th time; We redefine tq,a+1t_{q,a+1} to be T+1T+1 if tq,a+1>Tt_{q,a+1}>T holds.

The lemma holds trivially if I(q,a)I(q,a) is empty, so we assume otherwise. Let r0b,r0e[R0]r^{b}_{0},r^{e}_{0}\in[R_{0}] denote the global phases that contain timesteps tq,a+1t_{q,a}+1 and tq,a+11t_{q,a+1}-1, respectively. Clearly, r0br0er^{b}_{0}\leq r^{e}_{0}. Another easy case of the lemma is when r0er0b+1r^{e}_{0}\leq r^{b}_{0}+1 holds. The desired conclusion follows easily because all the dual variables are nonnegative and the sum of all α(t)\alpha(t) variables in any phase is at most 11 (by Lemma 3.23). Formally,

tI(q,a)(α(t)β(t,i))γ(q,a)tphase r0bα(t)+tphase r0eα(t)2.\sum_{t\in I(q,a)}\bigl{(}\alpha(t)-\beta(t,i)\bigr{)}-\gamma(q,a)\leq\sum_{t\in\text{phase }r^{b}_{0}}\alpha(t)+\sum_{t\in\text{phase }r^{e}_{0}}\alpha(t)\leq 2.

Now suppose that r0b+2r0er^{b}_{0}+2\leq r^{e}_{0} holds. Define Z:={r0b+1,,r0e1}Z:=\{r^{b}_{0}+1,\dots,r^{e}_{0}-1\}. Repeating the above calculation, we get:

tI(q,a)(α(t)β(t,i))γ(q,a)2+{r0Ztphase r0(α(t)β(t,i))}γ(q,a),\sum_{t\in I(q,a)}(\alpha(t)-\beta(t,i))-\gamma(q,a)\leq 2+\left\{\sum_{r_{0}\in Z}\sum_{t\in\text{phase }r_{0}}\bigl{(}\alpha(t)-\beta(t,i)\bigr{)}\right\}-\gamma(q,a),

so the crux of the lemma is to show that the sum of δ(t)α(t)β(t,i)\delta(t)\triangleq\alpha(t)-\beta(t,i) over timepoints spanning phases in ZZ is not much larger than γ(q,a)\gamma(q,a). For a phase r0Zr_{0}\in Z, we overload the notation δ(r0)\delta(r_{0}) to mean tphase r0δ(t)\sum_{t\in\text{phase }r_{0}}\delta(t). Note that by nonnegativity of β\beta variables and Lemma 3.25, δ(r0)1\delta(r_{0})\leq 1 for every r0Zr_{0}\in Z. We do a case analysis on phase r0Zr_{0}\in Z to get a better handle on the changes that happens during our dual update procedures.

  1. (a)

    Suppose that i(r0)(r0+1)i\in\mathcal{I}(r_{0})\cap\mathcal{I}(r_{0}+1) holds. Since ii is isolated by the end of phase r0r_{0}, we know that any increase in α(t)\alpha(t) (as part of 𝗎𝗉𝖽𝖺𝗍𝖾(r0,1)\mathsf{update}(r_{0},1)) for some tC(r0)t\in C(r_{0}) is accompanied with the same increase in β(t,i)\beta(t,i). Since i(r0+1)i\in\mathcal{I}(r_{0}+1) holds, 𝗎𝗉𝖽𝖺𝗍𝖾(r0+1,2)\mathsf{update}(r_{0}+1,2) does not decrease/reset any of the {β(t,i)}tphase r0\{\beta(t,i)\}_{t\in\text{phase }r_{0}} variables to 0. Thus, δ(r0)=0\delta(r_{0})=0 holds. Note that there can be an arbitrary number of phases r0r_{0} that fall under this case, but this is not a problem for us since δ(r0)=0\delta(r_{0})=0.

  2. (b)

    Suppose that i(r0)(r0+1)i\in\mathcal{I}(r_{0})\setminus\mathcal{I}(r_{0}+1) and qP(i,ri1)P(i,ri)q\in P(i,r_{i}-1)\cup P(i,r_{i}) hold. We rely on the trivial bound δ(r0)1\delta(r_{0})\leq 1 for this case. Since ii is isolated by the end of phase r0r_{0} but is non-isolated by the end of phase r0+1r_{0}+1, the local phase counter rir_{i} goes up by 11 at the end of phase r0+1r_{0}+1, and subsequently the P(i,)P(i,\cdot) set gets updated with some new collection of marked ii-pages. By definition of I(q,a)I(q,a), there are no page-requests for qq during any of the phases in ZZ. Thus, there can be at most 22 local phase increments for agent ii before qq gets dropped from the P(i,)P(i,\cdot) set; By the design of 𝒜\mathcal{A}, page qq cannot enter any of the future P(i,ri)P(i,r_{i}) until the next time it is requested, which does not happen during any of the phases in ZZ.

  3. (c)

    Suppose that i(r0)(r0+1)i\in\mathcal{I}(r_{0})\setminus\mathcal{I}(r_{0}+1) and qP(i,ri1)P(i,ri)q\notin P(i,r_{i}-1)\cup P(i,r_{i}) hold. Similar to case (a) above, we know that any increase in α(t)\alpha(t) (as part of 𝗎𝗉𝖽𝖺𝗍𝖾(r0,1)\mathsf{update}(r_{0},1)) for some tC(r0)t\in C(r_{0}) is accompanied with the same increase in β(t,i)\beta(t,i). Now, although 𝗎𝗉𝖽𝖺𝗍𝖾(r0+1,2)\mathsf{update}(r_{0}+1,2) decreases/resets all the {β(t,i)}tC(r0)\{\beta(t,i)\}_{t\in C(r_{0})} variables to 0, it also increases γ(q,a)\gamma(q,a) by the same amount since qP(i,ri1)P(i,ri)q\notin P(i,r_{i}-1)\cup P(i,r_{i}). Thus, tphase r0α(t)\sum_{t\in\text{phase }r_{0}}\alpha(t) equals the increase in γ(q,a)\gamma(q,a) due to 𝗎𝗉𝖽𝖺𝗍𝖾(r0+1,2)\mathsf{update}(r_{0}+1,2). So, the difference is essentially 0.

  4. (d)

    Suppose i(r0)i\notin\mathcal{I}(r_{0}) and qP(i,ri1)P(i,ri)q\in P(i,r_{i}-1)\cup P(i,r_{i}) hold. We rely on the trivial bound δ(r0)1\delta(r_{0})\leq 1 for this case. Since ii is non-isolated by the end of phase r0r_{0}, the local phase counter rir_{i} goes up by 11 at the end of phase r0r_{0}. Repeating the argument from case (c), there can be at most 11 more local phase increment for agent ii before qq gets dropped from the P(i,)P(i,\cdot) set for the rest of the phases in ZZ.

  5. (e)

    Suppose i(r0)i\notin\mathcal{I}(r_{0}) and qP(i,ri1)P(i,ri)q\notin P(i,r_{i}-1)\cup P(i,r_{i}) hold. Since ii is non-isolated by the end of phase r0r_{0} and qq is not in P(i,ri1)P(i,ri)P(i,r_{i}-1)\cup P(i,r_{i}), we know that any increase in α(t)\alpha(t) (as part of 𝗎𝗉𝖽𝖺𝗍𝖾(r0,1)\mathsf{update}(r_{0},1)) for some tC(r0)t\in C(r_{0}) is accompanied with the same increase in γ(q,a)\gamma(q,a). Thus, tphase r0α(t)\sum_{t\in\text{phase }r_{0}}\alpha(t) equals the increase in γ(q,a)\gamma(q,a) due to 𝗎𝗉𝖽𝖺𝗍𝖾(r0,1)\mathsf{update}(r_{0},1). So, the difference is essentially 0.

From the above case analysis, it follows that {r0Ztphase r0(α(t)β(t,i))}γ(q,a)\{\sum_{r_{0}\in Z}\sum_{t\in\text{phase }r_{0}}\bigl{(}\alpha(t)-\beta(t,i)\bigr{)}\}-\gamma(q,a) is bounded by the number of phases r0Zr_{0}\in Z for which case (b) or (d) hold. Since we argued that there can be at most 33 such occurences, tI(q,a)(α(t)β(t,i))γ(q,a)2+3=5\sum_{t\in I(q,a)}(\alpha(t)-\beta(t,i))-\gamma(q,a)\leq 2+3=5 holds.

We now prove the main theorem in this section by combining the above lemmas.

Proof 3.31 (Proof of Theorem 3.21).

The first part of the theorem follows from Lemma 3.29. The second part follows directly from Lemmas 3.25 and 3.27 since we have dual(R0)=r0=1R0(Δdual(r0,1)+Δdual(r0,2))\mathrm{dual}(R_{0})=\sum_{r_{0}=1}^{R_{0}}\bigl{(}\Delta\mathrm{dual}(r_{0},1)+\Delta\mathrm{dual}(r_{0},2)\bigr{)}

4 Rounding

In this section we show how to convert the fractional Algorithm 1 into a randomized integral online algorithm for Caching with Reserves, each step of which runs in polynomial time.

The algorithm maintains a uniform distribution on N=k3N=k^{3} valid cache states. In each step, these states are updated based on the actions of the fractional algorithm. The randomized algorithm selects one of these states uniformly at random in the beginning, and then follows it throughout the run.

Initially, all NN cache states in the distribution are the same as the initial cache state in Algorithm 1. Given the fractional algorithm values xptx^{t}_{p} after each page request, the distribution is updated in two steps. First, we produce a discretized version of these fractions, x~pt\tilde{x}^{t}_{p}, which are also a feasible fractional solution. This is based on the technique in [2]. Second, we update the NN cache states so that all of them remain valid, and for each page pp, exactly Nx~ptN\cdot\tilde{x}^{t}_{p} of the states contain pp. This is based on the technique in [10]. We note that the rounding procedure can be done online, as it does not need the knowledge of any future page requests.

4.1 Discretization Procedure

In this subsection, we explain how to perform the first step: discretizing the fractional algorithm’s values xptx^{t}_{p} into x~pt\tilde{x}^{t}_{p} which are multiples of 1N\frac{1}{N}. Our procedure is quite simple: we iterate over the pages in any order π\pi that arranges all pages belonging to the same agent consecutively (i.e., order the agents arbitrarily and order each agent’s pages arbitrarily, but do not interleave pages from different agents). Then for i[|𝒫|]i\in[|\mathcal{P}|], set:

x~π(i)t\displaystyle\tilde{x}^{t}_{\pi(i)} j=1ixπ(j)t1/Nj=1i1xπ(j)t1/N\displaystyle\triangleq\left\lfloor\sum_{j=1}^{i}x^{t}_{\pi(j)}\right\rfloor_{1/N}-\left\lfloor\sum_{j=1}^{i-1}x^{t}_{\pi(j)}\right\rfloor_{1/N}

where ab\left\lfloor a\right\rfloor_{b} denotes rounding aa down to the nearest multiple of bb; formally: abba/b\left\lfloor a\right\rfloor_{b}\triangleq b\left\lfloor a/b\right\rfloor.

Lemma 4.1.

Discretization satisfies the following guarantees:

  1. 1.

    x~pt\tilde{x}^{t}_{p} is a multiple of 1/N1/N

  2. 2.

    |x~ptxpt|<1/N\left|\tilde{x}^{t}_{p}-x^{t}_{p}\right|<1/N

  3. 3.

    for each agent ii, |p𝒫(i)x~ptp𝒫(i)xpt|<1/N\left|\sum_{p\in\mathcal{P}(i)}\tilde{x}^{t}_{p}-\sum_{p\in\mathcal{P}(i)}x^{t}_{p}\right|<1/N

  4. 4.

    if xpt{0,1}x^{t}_{p}\in\{0,1\}, then x~pt=xpt\tilde{x}^{t}_{p}=x^{t}_{p}

Proof 4.2.

The first guarantee, x~pt\tilde{x}^{t}_{p} is a multiple of 1/N1/N, follows from 1/N\left\lfloor\cdot\right\rfloor_{1/N} being a multiple of 1/N1/N by definition.

We now prove the second guarantee, |x~ptxpt|<1/N\left|\tilde{x}^{t}_{p}-x^{t}_{p}\right|<1/N. Let ii be π1(p)\pi^{-1}(p), and we get:

aab\displaystyle a-\left\lfloor a\right\rfloor_{b} =aba/b\displaystyle=a-b\left\lfloor a/b\right\rfloor
[ab(a/b),ab(a/b1))\displaystyle\in\bigl{[}a-b(a/b),a-b(a/b-1)\bigr{)}
=[0,b)\displaystyle=[0,b)
x~ptxpt\displaystyle\tilde{x}^{t}_{p}-x^{t}_{p} =x~π(i)txπ(i)t\displaystyle=\tilde{x}^{t}_{\pi(i)}-x^{t}_{\pi(i)}
=[j=1ixπ(j)t1/Nj=1i1xπ(j)t1/N]x~π(i)t[j=1ixπ(j)tj=1i1xπ(j)t]xπ(i)t\displaystyle=\underbrace{\left[\left\lfloor\sum_{j=1}^{i}x^{t}_{\pi(j)}\right\rfloor_{1/N}-\left\lfloor\sum_{j=1}^{i-1}x^{t}_{\pi(j)}\right\rfloor_{1/N}\right]}_{\tilde{x}^{t}_{\pi(i)}}-\underbrace{\left[\sum_{j=1}^{i}x^{t}_{\pi(j)}-\sum_{j=1}^{i-1}x^{t}_{\pi(j)}\right]}_{x^{t}_{\pi(i)}}
=[j=1i1xπ(j)tj=1i1xπ(j)t1/N][j=1ixπ(j)tj=1ixπ(j)t1/N]\displaystyle=\left[\sum_{j=1}^{i-1}x^{t}_{\pi(j)}-\left\lfloor\sum_{j=1}^{i-1}x^{t}_{\pi(j)}\right\rfloor_{1/N}\right]-\left[\sum_{j=1}^{i}x^{t}_{\pi(j)}-\left\lfloor\sum_{j=1}^{i}x^{t}_{\pi(j)}\right\rfloor_{1/N}\right]
(1N,1N)\displaystyle\in\left(-\frac{1}{N},\frac{1}{N}\right)
|x~ptxpt|\displaystyle\left|\tilde{x}^{t}_{p}-x^{t}_{p}\right| <1N\displaystyle<\frac{1}{N}

The proof of the third guarantee is essentially the same. It is here we use the fact that each agent’s pages are consecutive in π\pi. Suppose our agent’s pages are {π(),,π(h)}\{\pi(\ell),...,\pi(h)\}:

p𝒫(i)x~ptp𝒫(i)xpt\displaystyle\sum_{p\in\mathcal{P}(i)}\tilde{x}^{t}_{p}-\sum_{p\in\mathcal{P}(i)}x^{t}_{p} =i=hx~π(i)ti=hxπ(i)t\displaystyle=\sum_{i=\ell}^{h}\tilde{x}^{t}_{\pi(i)}-\sum_{i=\ell}^{h}x^{t}_{\pi(i)}
=[j=1hxπ(j)t1/Nj=11xπ(j)t1/N][j=1hxπ(j)tj=11xπ(j)t]\displaystyle=\left[\left\lfloor\sum_{j=1}^{h}x^{t}_{\pi(j)}\right\rfloor_{1/N}-\left\lfloor\sum_{j=1}^{\ell-1}x^{t}_{\pi(j)}\right\rfloor_{1/N}\right]-\left[\sum_{j=1}^{h}x^{t}_{\pi(j)}-\sum_{j=1}^{\ell-1}x^{t}_{\pi(j)}\right]
=[j=11xπ(j)tj=11xπ(j)t1/N][j=1hxπ(j)tj=1hxπ(j)t1/N]\displaystyle=\left[\sum_{j=1}^{\ell-1}x^{t}_{\pi(j)}-\left\lfloor\sum_{j=1}^{\ell-1}x^{t}_{\pi(j)}\right\rfloor_{1/N}\right]-\left[\sum_{j=1}^{h}x^{t}_{\pi(j)}-\left\lfloor\sum_{j=1}^{h}x^{t}_{\pi(j)}\right\rfloor_{1/N}\right]
(1N,1N)\displaystyle\in\left(-\frac{1}{N},\frac{1}{N}\right)
|p𝒫(i)x~ptp𝒫(i)xpt|\displaystyle\left|\sum_{p\in\mathcal{P}(i)}\tilde{x}^{t}_{p}-\sum_{p\in\mathcal{P}(i)}x^{t}_{p}\right| <1N\displaystyle<\frac{1}{N}

The fourth guarantee follows by noting that if xπ(i)tx^{t}_{\pi(i)} is an integer, then the 1/N\left\lfloor\cdot\right\rfloor_{1/N} operator decreases j=1ixπ(j)t\sum_{j=1}^{i}x^{t}_{\pi(j)} as much as it decreases j=1i1xπ(j)t\sum_{j=1}^{i-1}x^{t}_{\pi(j)}.

Corollary 4.3.

If {xpt}\{x^{t}_{p}\} satisfy total cache capacity (p𝒫xptk\sum_{p\in\mathcal{P}}x^{t}_{p}\leq k) and reserve requirements (p𝒫(i)xptki\sum_{p\in\mathcal{P}(i)}x^{t}_{p}\geq k_{i}), then so do {x~pt}\{\tilde{x}^{t}_{p}\}.

Proof 4.4.

The total cache capacity constraint continues to hold due to a telescoping argument:

p𝒫x~pt\displaystyle\sum_{p\in\mathcal{P}}\tilde{x}^{t}_{p} =i[|𝒫|]x~π(i)t=i[|𝒫|][j=1ixπ(j)t1/Nj=1i1xπ(j)t1/N]\displaystyle=\sum_{i\in[|\mathcal{P}|]}\tilde{x}^{t}_{\pi(i)}=\sum_{i\in[|\mathcal{P}|]}\left[\left\lfloor\sum_{j=1}^{i}x^{t}_{\pi(j)}\right\rfloor_{1/N}-\left\lfloor\sum_{j=1}^{i-1}x^{t}_{\pi(j)}\right\rfloor_{1/N}\right]
=j=1|𝒫|xπ(j)t1/Nj=1|𝒫|xπ(j)tk\displaystyle=\left\lfloor\sum_{j=1}^{|\mathcal{P}|}x^{t}_{\pi(j)}\right\rfloor_{1/N}\leq\sum_{j=1}^{|\mathcal{P}|}x^{t}_{\pi(j)}\leq k

Next, we will prove that reserve cache sizes are satisfied. For the sake of contradiction, suppose that for some agent ii, p𝒫(i)x~pt<ki\sum_{p\in\mathcal{P}(i)}\tilde{x}^{t}_{p}<k_{i}. Since the right-hand side of this inequality is an integer and therefore a multiple of 1/N1/N, the left-hand side, which is also a multiple of 1/N1/N due to being a sum of multiples of 1/N1/N (by Lemma 4.1’s first guarantee), must be at least a full multiple of 1/N1/N less than the right-hand side: p𝒫(i)x~ptki1/N\sum_{p\in\mathcal{P}(i)}\tilde{x}^{t}_{p}\leq k_{i}-1/N. But this contradicts Lemma 4.1’s third guarantee, |p𝒫(i)x~ptp𝒫(i)xpt|<1/N\left|\sum_{p\in\mathcal{P}(i)}\tilde{x}^{t}_{p}-\sum_{p\in\mathcal{P}(i)}x^{t}_{p}\right|<1/N. Therefore for all agents ii, p𝒫(i)x~ptki\sum_{p\in\mathcal{P}(i)}\tilde{x}^{t}_{p}\geq k_{i}, completing the proof.

Corollary 4.5.

p|x~ptxpt|k2/N\sum_{p}\left|\tilde{x}^{t}_{p}-x^{t}_{p}\right|\leq k^{2}/N

Proof 4.6.

Without loss of generality, there are at most kk agents since we can combine all agents that do not have any reserve. Each agent ii has at most kk fractional pages by the algorithm (the ii-pages that were in cache when ii’s local phase began). The xx value of each fractional page is distorted by at most 1/N1/N by Lemma 4.1’s second guarantee, while not being distorted for non-fractional pages by the fourth guarantee. This completes the proof.

Lemma 4.7.

Let xptx^{t}_{p} and xpt+1x^{t+1}_{p} be the amounts of each page pp in cache in the fractional algorithm for two consecutive time steps, and x~pt\tilde{x}^{t}_{p} and x~pt+1\tilde{x}^{t+1}_{p} be the corresponding discretized values. Then the cost of cache update from x~t\tilde{x}^{t} to x~t+1\tilde{x}^{t+1} (call it c~\tilde{c}) is at most twice the cost of cache update from xtx^{t} to xt+1x^{t+1} (call it cc).

Proof 4.8.

Lemma 3.11 implies that either c=0c=0 (i.e., the requested page was already in cache and there is no change to the cache state), or c1/kc\geq 1/k. In the first case, there is no change to the discretized cache state either, so c~=0\tilde{c}=0. So we focus on the second case. By triangle inequality, for any page pp,

|x~ptx~pt+1||x~ptxpt|+|xptxpt+1|+|xpt+1x~pt+1|.|\tilde{x}^{t}_{p}-\tilde{x}^{t+1}_{p}|\leq|\tilde{x}^{t}_{p}-x^{t}_{p}|+|x^{t}_{p}-x^{t+1}_{p}|+|x^{t+1}_{p}-\tilde{x}^{t+1}_{p}|.

We note that since cost is incurred for adding pages to cache, and both the original fractional solution and the discretized one add as much page mass to cache as they evict, 2c=p|xptxpt+1|2c=\sum_{p}|x^{t}_{p}-x^{t+1}_{p}|, and similarly for c~\tilde{c}. Summing the above inequality over pp, we get

2c~=p|x~ptx~pt+1|p|xptxpt+1|+2k2/N=2c+2/k4c,2\tilde{c}=\sum_{p}|\tilde{x}^{t}_{p}-\tilde{x}^{t+1}_{p}|\leq\sum_{p}|x^{t}_{p}-x^{t+1}_{p}|+2k^{2}/N=2c+2/k\leq 4c,

where we used p(|x~ptxpt|+|xpt+1x~pt+1|)2k2/N\sum_{p}(|\tilde{x}^{t}_{p}-x^{t}_{p}|+|x^{t+1}_{p}-\tilde{x}^{t+1}_{p}|)\leq 2k^{2}/N by Corollary 4.5, then N=k3N=k^{3}, then c1/kc\geq 1/k.

4.2 Updating the Distribution of Cache States

In this subsection, we explain how to perform the second step: updating the NN cache states. We would like (i) all cache states to be valid, (ii) exactly Nx~ptN\cdot\tilde{x}^{t}_{p} (integral due to our discretization step) of the states to contain page pp, and (iii) to not use too many evictions.

Formally, let 𝒳\mathcal{X} be a set of NN cache states with kk pages each, which corresponds to the discretized values x~pt\tilde{x}^{t}_{p} for time step tt. Given the discretized values x~pt+1\tilde{x}^{t+1}_{p} for time step t+1t+1, we show how to transform 𝒳\mathcal{X} into 𝒳\mathcal{X}^{\prime}, in which each page pp appears in exactly Nx~pt+1N\cdot\tilde{x}^{t+1}_{p} cache states and such that each cache state satisfies all the reserve requirements.

Let PP be a multiset of pages whose fraction in the cache increased from time tt to t+1t+1, with each page pp appearing max(0,(x~pt+1x~pt)N)\max(0,(\tilde{x}^{t+1}_{p}-\tilde{x}^{t}_{p})N) times. Let QQ be an analagous multiset for decreases, with each page appearing max(0,(x~ptx~pt+1)N)\max(0,(\tilde{x}^{t}_{p}-\tilde{x}^{t+1}_{p})N) times. Since the total amount of pages in the cache is unchanged, |P|=|Q||P|=|Q|. We find a matching between pages in PP and QQ and use it to transform 𝒳\mathcal{X} into 𝒳\mathcal{X}^{\prime} gradually, one pair at a time. The matching is constructed as follows. First, any pages from PP and QQ that belong to the same agent are matched up. Then, the remaining pages in PP and QQ are matched up arbitrarily.

Lemma 4.9.

Let (p1,q1),(p2,q2),(p_{1},q_{1}),(p_{2},q_{2}),... be the matching between PP and QQ described above. Then for any jj, the fractional solution that adds 1/N1/N fraction of pages p1,,pjp_{1},...,p_{j} to x~t\tilde{x}^{t} and removes 1/N1/N fraction of pages q1,,qjq_{1},...,q_{j} from it satisfies all the reserve requirements.

Proof 4.10.

As the pairs are applied, the fractional solution transforms from x~t\tilde{x}^{t} to x~t+1\tilde{x}^{t+1}, both of which satisfy the reserve requirements (by Corollary 4.3). Inductively, assume that when pairs up to (pj1,qj1)(p_{j-1},q_{j-1}) have been applied, the reserved requirements are still satisfied. If pjp_{j} and qjq_{j} belong to the same agent ii, then amount of ii-pages in the cache doesn’t change, thus still satisfying the requirement. If pjp_{j} and qjq_{j} belong to different agents, then we must be in the second phase of our matching construction. This means that there are no more pages in PP belonging to ag(qj)ag(q_{j}), so the amount of ag(qj)ag(q_{j})-pages in cache does not increase while applying the remainder of the matching pairs. This means that after applying (pj,qj)(p_{j},q_{j}), the amount of ag(qj)ag(q_{j})-pages in the cache is somewhere between what it has in x~t\tilde{x}^{t} and in x~t+1\tilde{x}^{t+1}. Since both of those satisfy the reserve requirements, so does the intermediate solution.

We now show how to modify 𝒳\mathcal{X} with the next pair (p,q)(p,q) from the matching. This follows the procedure in [10], with the difference that we work on a limited number of NN sets, and the amount of increase in pp and decrease in qq is fixed at 1/N1/N.

Let 𝒳\mathcal{X} be the current set of cache states (possibly modified by the previous page pairs). If there is a cache state S𝒳S\in\mathcal{X} such that pSp\notin S and qSq\in S, add pp to SS and remove qq from SS. Otherwise, find cache states S𝒳S\in\mathcal{X} and T𝒳T\in\mathcal{X} with pSp\notin S and qTq\in T, add pp to SS and remove qq from TT. Next, move some page rSTr\in S\setminus T from SS to TT to adjust the set sizes back to kk.

At this point, each page is in the correct number of cache states. However, reserve requirements could be violated by one page for ag(q)ag(q) or ag(r)ag(r) in the cache states from which the corresponding pages were removed. In such a case, suppose the requirement is violated for agent ii in a cache state V𝒳V\in\mathcal{X}. Since, by Lemma 4.9, each reserve requirement is satisfied on average, there must be another set W𝒳W\in\mathcal{X} which has strictly more than kik_{i} pages belonging to agent ii. We move one such page from WW to VV. Now VV has k+1k+1 pages, so there must be an agent jj which has more than kjk_{j} pages in VV. We move one of jj’s pages from VV to WW to restore the sizes. This completes the update, resulting in new valid sets corresponding to the fractions x~t+1\tilde{x}^{t+1}.

We conclude by bounding the cost of update to 𝒳\mathcal{X}, and thus the expected cost of the randomized algorithm, relative to the cost of the fractional algorithm.

Lemma 4.11.

The cost of update to 𝒳\mathcal{X} is at most 6 times the cost of fractional cache update from x~t\tilde{x}^{t} to x~t+1\tilde{x}^{t+1}.

Proof 4.12.

Each pair (p,q)(p,q) in the matching corresponds to a cost of 1/N1/N incurred by the discretized fractional solution. In the updates to sets in 𝒳\mathcal{X}, each time a page is removed from one of the cache states incurs a cost of 1/N1/N to the randomized algorithm. At most, the following six removals are done: remove qq from TT; remove rr from SS; two pages each are swapped to fix the reserve requirements for ag(q)ag(q) and ag(r)ag(r).

The proof of Theorem 1.2 follows by combining Lemmas 4.7 and 4.11.

References

  • [1] Dimitris Achlioptas, Marek Chrobak, and John Noga. Competitive Analysis of Randomized Paging Algorithms. Theoretical Computer Science, 234(1):203–218, 2000. doi:10.1016/S0304-3975(98)00116-9.
  • [2] Anna Adamaszek, Artur Czumaj, Matthias Englert, and Harald Räcke. An O(logk)O(\log k)-Competitive Algorithm for Generalized Caching. ACM Transactions on Algorithms, 15(1):6:1–6:18, 2018. doi:10.1145/3280826.
  • [3] Kunal Agrawal, Michael A. Bender, Rathish Das, William Kuszmaul, Enoch Peserico, and Michele Scquizzato. Tight Bounds for Parallel Paging and Green Paging. In Proceedings of the 32nd Symposium on Discrete Algorithms, pages 3022–3041, 2021. doi:10.1137/1.9781611976465.180.
  • [4] Nikhil Bansal, Niv Buchbinder, and Joseph Seffi Naor. A Simple Analysis for Randomized Online Weighted Paging. Unpublished Manuscript, 2010.
  • [5] Nikhil Bansal, Niv Buchbinder, and Joseph (Seffi) Naor. Towards the Randomized kk-Server Conjecture: A Primal-Dual Approach: (Extended Abstract). In Proceedings of the 21st Symposium on Discrete Algorithms, pages 40–55, 2010. doi:10.1137/1.9781611973075.5.
  • [6] Nikhil Bansal, Christian Coester, Ravi Kumar, Manish Purohit, and Erik Vee. Learning-Augmented Weighted Paging. In Proceedings of the 33rd Symposium on Discrete Algorithms, pages 67–89, 2022. doi:10.1137/1.9781611977073.4.
  • [7] Jichuan Chang and Gurindar S Sohi. Cooperative Cache Partitioning for Chip Multiprocessors. In Proceedings of the 21st ACM International Conference on Supercomputing, pages 242–252, 2007. doi:10.1145/1274971.1275005.
  • [8] Ashish Chiplunkar, Monika Henzinger, Sagar Sudhir Kale, and Maximilian Vötsch. Online Min-Max Paging. In Proceedings of the 34th Symposium on Discrete Algorithms, pages 1545–1565, 2023. doi:10.1137/1.9781611977554.ch57.
  • [9] Amos Fiat, Richard M. Karp, Michael Luby, Lyle A. McGeoch, Daniel D. Sleator, and Neal E. Young. Competitive Paging Algorithms. Journal of Algorithms, 12(4):685–699, 1991. doi:10.1016/0196-6774(91)90041-V.
  • [10] Sharat Ibrahimpur, Manish Purohit, Zoya Svitkina, Erik Vee, and Joshua R. Wang. Caching with Reserves. In Proceedings of the 25th International Conference on Approximation Algorithms for Combinatorial Optimization Problems (APPROX), volume 245, pages 52:1–52:16, 2022. doi:10.4230/LIPIcs.APPROX/RANDOM.2022.52.
  • [11] Wu Kan, Tu Kaiwei, Patel Yuvraj, Sen Rathijit, Park Kwanghyun, Arpaci-Dusseau Andrea, and Remzi Arpaci-Dusseau. NyxCache: Flexible and Efficient Multi-tenant Persistent Memory Caching. In Proceedings of the 20th USENIX Conference on File and Storage Technologies (FAST), pages 1–16, 2022. URL: https://www.usenix.org/conference/fast22/presentation/wu.
  • [12] Mayuresh Kunjir, Brandon Fain, Kamesh Munagala, and Shivnath Babu. ROBUS: Fair Cache Allocation for Data-parallel Workloads. In Proceedings of the 2017 ACM International Conference on Management of Data (SIGMOD), pages 219–234, 2017. doi:10.1145/3035918.3064018.
  • [13] Lyle A. McGeoch and Daniel D. Sleator. A Strongly Competitive Randomized Paging Algorithm. Algorithmica, 6:816–825, 1991. doi:10.1007/BF01759073.
  • [14] Qifan Pu, Haoyuan Li, Matei Zaharia, Ali Ghodsi, and Ion Stoica. FairRide: Near-Optimal, Fair Cache Sharing. In Proceedings of the 13th USENIX Symposium on Networked Systems Design and Implementation (NSDI), pages 393–406, 2016. URL: https://www.usenix.org/conference/nsdi16/technical-sessions/presentation/pu.
  • [15] Harold S. Stone, John Turek, and Joel L. Wolf. Optimal Partitioning of Cache Memory. IEEE Transactions on Computers, 41(9):1054–1068, 1992. doi:10.1109/12.165388.
  • [16] G Edward Suh, Larry Rudolph, and Srinivas Devadas. Dynamic Partitioning of Shared Cache Memory. The Journal of Supercomputing, 28(1):7–26, 2004. doi:10.1023/B:SUPE.0000014800.27383.8f.
  • [17] Yinghao Yu, Wei Wang, Jun Zhang, and Khaled Ben Letaief. LACS: Load-Aware Cache Sharing with Isolation Guarantee. In Proceedings of the 39th IEEE International Conference on Distributed Computing Systems (ICDCS), pages 207–217. IEEE, 2019. doi:10.1109/ICDCS.2019.00029.

Appendix A Analysis of Randomized Marking for Unweighted Paging

In this section, we consider the classical unweighted paging problem and provide a new proof that the randomized marking [9] algorithm is O(logk)O(\log k)-competitive.

Recall that the randomized marking algorithm works in phases as follows. Initially all pages in the cache are unmarked. When a page ptp_{t} is requested at time tt, if ptp_{t} is already in the cache then it is marked and no other change occurs. If ptp_{t} is not in the cache, then a page qq is chosen uniformly at random from the set of unmarked pages currently in the cache and evicted. Page ptp_{t} is then brought into the cache and marked. Once there are no more unmarked pages left for eviction, the current phase ends — all pages in the cache are unmarked and a new phase begins.

Let RM denote the above randomized marking algorithm and let costRM(σ)\mathrm{cost}_{\textrm{RM}}(\sigma) be the total cost incurred on an instance σ\sigma. For analysis, we consider the following fractional version of the marking algorithm: The algorithm maintains a set of marked and unmarked pages as before. At any time tt, let xptx_{p}^{t} denote the fraction of page pp in the cache and ypt1xpty_{p}^{t}\triangleq 1-x_{p}^{t} denote the fraction of page pp outside the cache. When a page ptp_{t} is requested, the fractional marking algorithm sets xpt=1x_{p_{t}}=1 and uniformly increases yqy_{q} for all unmarked pages qq in the cache. As in the randomized marking algorithm, a phase ends when all unmarked pages have been fully evicted from the cache. Observe that for any page pp and time tt, the value ypty_{p}^{t} in the fractional marking algorithm exactly equals the marginal probability that page pp has been evicted from the cache by the randomized marking algorithm. Let FM denote the fractional marking algorithm, then we have: 𝔼[costRM(σ)]=costFM(σ)\mathbb{E}[\mathrm{cost}_{\textrm{RM}}(\sigma)]=\mathrm{cost}_{\textrm{FM}}(\sigma). In the rest of this section, we focus on bounding the total cost incurred by the fractional marking algorithm.

Potential Function

Consider any phase rr of the fractional marking algorithm and let Pr1P^{r-1} denote the set of exactly kk pages in the cache at the beginning of the phase and PrP^{r} denote the set of kk pages in cache at the end of the phase. By definition, PrP^{r} is exactly the set of kk distinct pages that are requested during phase rr. Following standard terminology, we say a page pPrp\in P^{r} is stale if pPr1p\in P^{r-1} and call pp as clean otherwise. Let (r)=|PrPr1|\ell^{(r)}=|P^{r}\setminus P^{r-1}| denote the total number of clean pages in phase rr. At any time tt, let U(t)U(t) be the set of unmarked pages at time tt. Consider the following potential function:

Ψ(t)=pU(t)ϕ(ypt)\Psi(t)=\sum_{p\in U(t)}\phi(y_{p}^{t})

where ϕ(h)=2hln(1+kh)\phi(h)=2h\ln(1+kh) as earlier. At any time step tt, let ΔΨ(t)\Delta\Psi(t) be the total change in potential while processing the requested page ptp_{t}444In particular, ΔΨ(t)\Delta\Psi(t) does not include any change in potential due to a phase change.. Let ΔΨ(r)\Delta\Psi(r) denote the change in potential due to end of a phase rr.

Lemma A.1.

At any time tt, if yptt<1y_{p_{t}}^{t}<1, then ΔΨ(t)yptt\Delta\Psi(t)\geq y_{p_{t}}^{t}.

Proof A.2.

At any time tt, all unmarked pages in the cache have been evicted the same amount fractionally, i.e. ypt=yqt=h,pqU(t)y_{p}^{t}=y_{q}^{t}=h^{*},\forall p\neq q\in U(t). While serving the requested page ptp_{t}, the potential decreases as page ptp_{t} stops contributing to the potential while the potential increases due to the eviction of all other unmarked pages. Page ptp_{t} contributed exactly ϕ(h)=2hln(1+kh)\phi(h^{*})=2h^{*}\ln(1+kh^{*}) to the potential at the beginning of this step. On the other hand, to fetch page ptp_{t}, the other unmarked pages are evicted by a total amount of hh^{*}. By Lemma 3.13, the potential increases at a rate of at least (1+2ln(1+kh))(1+2\ln(1+kh^{*})) throughout this eviction process. Summing up both the contributions, we get:

ΔΨ(t)2hlog(1+kh)+h(1+2ln(1+kh))=yptt.\Delta\Psi(t)\geq-2h^{*}\log(1+kh^{*})+h^{*}(1+2\ln(1+kh^{*}))=y_{p_{t}}^{t}.
Lemma A.3.

At the end of any phase rr, the potential drops by ΔΨ(r)=2(r)ln(1+k)\Delta\Psi(r)=-2\ell^{(r)}\ln(1+k).

Proof A.4.

At the end of phase rr, all pages in Pr1PrP^{r-1}\setminus P^{r} are unmarked and have been fully evicted from the cache. Each such page contributed exactly ϕ(1)=2ln(1+k)\phi(1)=2\ln(1+k) to the potential just before the phase ended. Once phase rr ends (and phase r+1r+1 begins), all these pages stop contributing to the potential. The claim follows by noting that |Pr1Pr|=|PrPr1|=(r)|P^{r-1}\setminus P^{r}|=|P^{r}\setminus P^{r-1}|=\ell^{(r)}.

The previous two lemmas allow us to bound the total cost incurred by the fractional marking algorithm purely in terms of the total number of clean pages.

Lemma A.5.

We have costFM(σ)2kln(1+k)+(1+2ln(1+k))r=1R(r)\mathrm{cost}_{\textrm{FM}}(\sigma)\leq 2k\ln(1+k)+\left(1+2\ln(1+k)\right)\sum_{r=1}^{R}\ell^{(r)}.

Proof A.6.

We have the following chain of equations and inequalities:

costFM(σ)\displaystyle\mathrm{cost}_{\textrm{FM}}(\sigma) =t[T]yptt=t[T]:yptt<1yptt+|{t[T]:ypt1=1}|\displaystyle=\sum_{t\in[T]}y_{p_{t}}^{t}=\sum_{t\in[T]:y_{p_{t}}^{t}<1}y_{p_{t}}^{t}+|\{t\in[T]:y_{p_{t}}^{1}=1\}|
=t[T]:yptt<1yptt+r=1R(r)\displaystyle=\sum_{t\in[T]:y_{p_{t}}^{t}<1}y_{p_{t}}^{t}+\sum_{r=1}^{R}\ell^{(r)}
t[T]:yptt<1ΔΨ(t)+r=1R(r)\displaystyle\leq\sum_{t\in[T]:y_{p_{t}}^{t}<1}\Delta\Psi(t)+\sum_{r=1}^{R}\ell^{(r)}
=Ψ(T)Ψ(0)r=1RΔΨ(r)+r=1R(r)\displaystyle=\Psi(T)-\Psi(0)-\sum_{r=1}^{R}\Delta\Psi(r)+\sum_{r=1}^{R}\ell^{(r)}
2kln(1+k)+(1+2ln(1+k))r=1R(r).\displaystyle\leq 2k\ln(1+k)+\left(1+2\ln(1+k)\right)\sum_{r=1}^{R}\ell^{(r)}.
Theorem A.7.

The randomized marking algorithm is O(logk)O(\log k)-competitive.

Proof A.8.

On any instance σ\sigma, we have 𝔼[costRM(σ)]=costFM(σ)\mathbb{E}[\mathrm{cost}_{\textrm{RM}}(\sigma)]=\mathrm{cost}_{\textrm{FM}}(\sigma). The desired bound on the competitive ratio follows by noting that costOPT(σ)(1/2)r=1R(r)\mathrm{cost}_{OPT}(\sigma)\geq(1/2)\cdot\sum_{r=1}^{R}\ell^{(r)} as shown by [9]. We can also use the dual-fitting argument presented in Section 3.4 to show that even the fractional optimal solution is at least (1/2)r=1R(r)(1/2)\cdot\sum_{r=1}^{R}\ell^{(r)} but we skip the details for brevity.