Abstract 1 Introduction 2 An 𝑶(𝐥𝐨𝐠𝒌)-competitive algorithm 3 Analysis of OBA 4 OBADC with Predictions 5 Future Work References

Online Balanced Allocation of Dynamic Components

Rajmohan Rajaraman Northeastern University, Boston, MA, USA Omer Wasim ORCID Northeastern University, Boston, MA, USA
Abstract

We introduce Online Balanced Allocation of Dynamic Components (OBADC), a problem motivated by the practical challenge of dynamic resource allocation for large-scale distributed applications. In OBADC, we need to allocate a dynamic set of at most k vertices (representing processes) in >0 clusters. We consider an over-provisioned setup in which each cluster can hold at most k(1+ε) vertices, for an arbitrary constant ε>0. The communication requirements among the vertices are modeled by the notion of a dynamically changing component, which is a subset of vertices that need to be co-located in the same cluster. At each time t, a request rt of one of the following types arrives:

  1. 1.

    insertion of a vertex v forming a singleton component {v} at unit cost.

  2. 2.

    merge of (u,v) requiring that the components containing u and v be merged and co-located thereafter.

  3. 3.

    deletion of an existing vertex v at zero cost.

Before serving any request, an algorithm can migrate vertices from one cluster to another, at a unit migration cost per vertex. We seek an online algorithm to minimize the total migration cost incurred for an arbitrary request sequence σ=(rt)t>0, while simultaneously minimizing the number of clusters utilized. We analyze competitiveness with respect to an optimal clairvoyant offline algorithm with identical (over-provisioned) capacity constraints.

We give an O(logk)-competitive algorithm for OBADC, and a matching lower-bound. The number of clusters utilized by our algorithm is always within a (2+ε) factor of the minimum. Furthermore, in a resource augmented setting where the optimal offline algorithm is constrained to capacity k per cluster, our algorithm obtains O(logk) competitiveness and utilizes a number of clusters within (1+ε) factor of the minimum.

We also consider OBADC in the context of machine-learned predictions, where for each newly inserted vertex v at time t: i) with probability η>0, the set of vertices (that exist at time t) in the component of v is revealed and, ii) with probability 1η, no information is revealed. For OBADC with predictions, we give a O(1)-consistent and O(min(log1η,logk))-robust algorithm.

Keywords and phrases:
online algorithms, competitive ratio, algorithms with predictions
Copyright and License:
[Uncaptioned image] © Rajmohan Rajaraman and Omer Wasim; licensed under Creative Commons License CC-BY 4.0
2012 ACM Subject Classification:
Theory of computation Online algorithms
Acknowledgements:
This work was partially supported by NSF award CCF-2335187.
Editors:
Raghu Meka

1 Introduction

Modern large-scale applications are distributed over multiple physical machines or computing clusters in data centers, generating a considerable amount of network traffic. In a typical setting, a cloud service provider provisions computational resources (such as CPU, memory, storage) in the form of virtual machines (VMs) to users who pay a cost proportional to their resource requirements which varies over time. However, operating and allocating these resources in a “demand-aware” manner to minimize cost, and optimize performance and energy utilization while fulfilling service-level agreements (SLAs) for various users is technically challenging. This has garnered a surging interest in resource allocation strategies in cloud computing frameworks in recent years [7, 9, 1, 31].

Consider the setting where a massively distributed application attributed to a single cloud user may be spread across multiple VMs, necessitating inter-VM communication. If such VM’s are allocated in the same cluster, inter-VM communication consumes little network bandwidth, leading to low communication cost and potential energy savings [31, 32]. However if inter-VM communication happens over physically separated clusters, this may compromise quality of service, responsiveness, and incur a large consumption of network resources. Almost all virtualization systems support “live-migration” of VMs between various clusters with the aim of reducing latency, improving resource-allocation and energy savings [12, 16, 17]. However, VM migration must be performed sparingly, as it creates network overhead and may compromise the responsiveness of the VM being migrated.

In addition to inter-process communication patterns that evolve over time, another challenge is to provision resources dynamically to users under varying resource requirements. This leads to the removal of existing virtual machines and the insertion of new virtual machines [6]. Thereafter, new communication patterns emerge between newly re-allocated VMs. Such re-allocations also incur a cost for the cloud service provider which is inevitable, in addition to future defragmentation of resources caused by multiple re-allocations over time [30].

Finally, energy consumption of data centers due to an ever-increasing need for large-scale cloud computing is well documented [19]. In practice, migration of VMs together with other load-balancing strategies have been exploited to reduce the number of “active” physical machines to save energy [16, 19, 17]. For example, VMs on under-loaded clusters are migrated so that such clusters can save energy by moving to an idle state. Thus, it is highly desirable to ensure that the number of “active” clusters dynamically scales with the workload.

In this paper, we address the challenges posed by unknown communication patterns, dynamic resource requirements, and energy consumption by introducing the problem of Online Balanced Allocation of Dynamic Components (OBADC). We model the scenario where clusters and VMs are homogeneous, and migration and inter-VM communication costs are uniform across different clusters, while the communication patterns and dynamic allocation requests are unknown.

1.1 Problem Formulation and Main Results

Our problem formulation is inspired by the online balanced graph partitioning (OBGR) problem, introduced by Avin, Bienkowski, Loukas, Pacut and Schmid [2], and considers additional technical aspects including the dynamics of VMs, and a secondary goal of minimizing the number of active clusters. In OBADC, we have a set V of at most nk vertices (representing VMs) at any given point in time, and >0 clusters denoted by S1,S2,,S, each with capacity k. Initially V= and Si for all i[] is empty. We model the communication requirements among the vertices using the notion of a dynamically changing component, which is a subset of vertices that need to be co-located in the same cluster. The request sequence σ={rt}t1 is revealed online, such that each request rt is of the following type:

  1. 1.

    Insertion of a vertex v: Insert v (and a corresponding singleton component {v}) at unit cost, to any cluster which can accommodate it. The cost of insertion models a one-time “startup” cost to initialize a VM in a cluster.

  2. 2.

    Deletion of a vertex v: Delete existing vertex v from its component C. The cost of deletion is zero; all vertices in C\{v} are still required to be co-located.

  3. 3.

    Merge vertices u and v : Merge the components containing u and v into a single component so that vertices in the resulting component are co-located thereafter.

Insertions and deletions of vertices model VM allocation and de-allocation, while merge requests model the scenario when frequently communicating VM’s dedicated to a single application or a customer are consolidated for efficiency or energy savings [28].

The request sequence σ induces a unique set of components denoted by 𝒞, over time. The migration cost of a single vertex is unit. All vertices of a single component are required to be assigned to the same cluster. Thus, we assume that the size of any component C𝒞 is most k at all times, and that there exists a component assignment to clusters such that each cluster is assigned a maximum of k vertices.

Competitive Analysis.

We adopt the competitive analysis framework to analyze OBADC algorithms. A deterministic (resp. randomized) online algorithm 𝒜 is said to be ρ-competitive (alternatively, ρ is the competitive ratio of 𝒜) if for any input sequence σ, the cost (resp. expected cost) c(𝒜,σ) incurred by 𝒜 in σ satisfies c(𝒜,σ)ρOPT(σ)+γ where γ is a constant independent of the length of σ and OPT(σ) is the cost of an optimal offline algorithm denoted by OPT, which has complete information about the request sequence σ in advance. Abusing notation slightly, we refer to OPT(σ) as OPT when σ is clear from context.

Resource Competitiveness.

To capture the practical objective of utilizing a number of clusters proportional to the total resource requirement (which varies over time), we seek algorithms which are also competitive with respect to the number of clusters utilized by OPT. Let nt denote the number of vertices at any time t, and let αt,βt denote the number of clusters used to assign all nt vertices at time t by OPT and an online algorithm 𝒜. We say that 𝒜 is μ-resource competitive if for all time t, βtμαt.

OBADC with Over-Provisioning.

For the sake of obtaining polynomial-time online algorithms, we consider an overprovisioned setting, similar to the one considered in a recent work [23]. Here, each cluster Ci for i[] has capacity (1+ε)k for some ε(0,1). While seemingly similar to a (1+ε) resource-augmented model, we emphasize that in the over-provisioned setup, both the online algorithm and the optimal offline algorithm OPT are constrained to an identical cluster capacity of (1+ε)k for any cluster Ci. As a result, competitiveness is analyzed on a stricter benchmark, in that the optimal offline and online algorithm have access to the same amount of resources, in strong contrast to resource augmentation where competitiveness is analyzed with respect to an unaugmented offline algorithm (see Chapter 4 of [25]).

Our main result is a O(logk)-competitive algorithm for OBADC in the over-provisioned setting. We show that the competitive ratio of our algorithm is asymptotically optimal by establishing a lower bound. Furthermore, our algorithm is (2+ε)-resource competitive.

Theorem 1.

Consider any instance of OBADC with clusters each of capacity (1+ε) and arbitrary sequence of insertion, deletion, and merge requests such that at any time the resulting components can be allocated to the clusters using capacity at most k. There exists an online algorithm that achieves cost at most O(logk) times the optimal, while utilizing at most (2+ε) times more clusters than the minimum required at each time step.

Furthermore, every online algorithm incurs cost Ω(logk) times the optimal for the worst-case instance.

In a resource augmented setting where the optimal offline algorithm is constrained to capacity k per cluster, our algorithm obtains O(logk) competitiveness, while utilizing a number of clusters within (1+ε) factor of the minimum. The proof of resource-competitiveness is deferred to the full version of the paper.

OBADC with Machine-Learned Predictions.

We next investigate OBADC in the context of “algorithms with predictions” which is a growing research area [25, 15] with the over-arching goal of circumventing pessimistic limitations of lower and upper bounds for various problems in online, dynamic and approximation algorithms.
Prediction Model: At any time step t when a vertex v is inserted, with probability η0, we also receive a set Pv consisting of all vertices in Vt that lie in the same component as v, where Vt denotes the set of vertices at the beginning of time step t. Note that with probability 1η, we do not receive any information on the component of v. Furthermore, Pv only consists of vertices in v’s component which exist at time t, and contains no information about future vertices in v’s component which may arrive after time t.

Our “prediction error” is quantified by the confidence η>0 of the predictions, similar to [11] and we analyze the performance of a learning-augmented online algorithm for OBADC in a standard consistency-robustness framework [11, 15, 24]. An algorithm 𝒜 for OBADC with predictions is said to be α-consistent and β-robust if it is α-competitive when η=1, and β-competitive where β is a non-increasing function of η. Roughly speaking if η=1, and we have perfect predictions, then one would desire constant-factor competitiveness. On the other hand, as η approaches 0, the performance of the algorithm should gracefully degrade to the competitive ratio obtained by the best-known online algorithm for the problem. Our second result provides a near-tight consistency-robustness tradeoff for OBADC.

Theorem 2.

There exists an O(1)-consistent and O(min(log1η,logk))-robust algorithm for OBADC with predictions in the over-provisioned setting.

1.2 Technical Overview

In this section, we present a high level overview of our techniques towards obtaining our algorithms. We ignore several intricacies in the following discussion.

1.2.1 Overview of the Algorithms

Our algorithm for OBADC classifies components in terms of their volume (which refers to their size). A component is said to be small if it has volume at most Dk where D=Ω(ε), and large otherwise. Let 𝒞S,𝒞L denote the set of small and large components maintained at all times. Component volumes are rounded up to the nearest power of (1+ε4), such that components whose size is in the interval [(1+ε4)i1,(1+ε4)i) belong to component class i. Thus, the total number of small component classes is O(logk) while the number of large component classes is O(1). Our algorithm assigns volume to each component C on a cluster such that the assigned volume is upper bounded by (1+ε4)|C|. The precise volume assigned by our algorithm is more fine-grained to further distinguish components within the same component class.

The assignment of large components is accomplished by solving an integer linear program (ILP) whose objective function seeks to minimize the number of clusters utilized. We remark that large components are assigned independently of small components. Since the number of large component classes is O(1), the ILP can be solved in polynomial time. Invoking a result from [26] allows us to limit the total “change” in large component assignments after component merges (resp. vertex deletions), which lead to increase (resp. decrease) in a component’s class. Small components are assigned in a first-fit fashion. Our algorithm maintains a “tight” assignment of components throughout time which guarantees (2+ε)-resource competitiveness.

The main challenge arises in maintaining these assignments dynamically, while simultaneously minimizing the total migration cost and clusters utilized. To accomplish this, our algorithm maintains several invariants. We give an overview of our algorithm as follows.

Insertion of singleton components are handled by provisioning volume on a cluster, with sufficient residual volume whenever possible. For a merge request (u,v), if u,v are in the same component C, the algorithm does nothing; else distinct components Ci,Cj containing u and v respectively, are merged into a new component Cm where w.l.o.g. |Ci||Cj|.

When Cm is small and the volume assigned to Ci is at least |Cm|, the smaller component Cj is migrated (unless it is assigned on the same cluster as Ci). Otherwise, if there is sufficient residual volume on the cluster to which Ci is assigned, Cm is assigned volume and vertices in Cj are migrated (if necessary). If the residual volume is insufficient, this implies that at least k vertices are assigned to this cluster. Thereafter, vertices in Ci and Cj are migrated to another cluster with sufficient residual volume. This may lead to a reduction in the assigned volume of Cj’s cluster. Whenever the residual volume of a cluster decreases below a certain threshold, our algorithm migrates small components as necessary from other clusters to ensure resource-competitiveness.

On the other hand, if Cm is large such that Cm belongs to a higher component class than Ci, our algorithm solves an ILP; otherwise, vertices in Cj are migrated (if necessary). If the ILP is solved, this may lead to multiple components (both large and small) being reassigned and migrated. We give a greedy procedure to assign large components, which together with the sensitivity analysis result from [26], allows us to bound the total migration cost by O(f(ε)k). If the request sequence consists of only vertex insertions and component merges (i.e. only monotonic increases in component sizes), we can establish O(logk)-competitiveness by a relatively elegant charging argument (see Section 3).

However, for non-monotonic changes in component sizes a major challenge arises towards ensuring resource-competitiveness, since vertex deletions in one component may necessitate migration of other unrelated components to maintain a tight packing. To this end, our algorithm always maintains the property that the assigned volume of any component C is within a (1+ε4) factor of |C| under both component merges and vertex deletions. For small components undergoing vertex deletions, volume reassignment can be done after a constant fraction of vertices in C are deleted. This may require migration of small components to C’s cluster. On the other hand, if vertex deletions in C lead to a drop in C’s component class we solve an ILP to reassign large components. This may be prohibitive in general because repeated vertex insertions and deletions can lead to a cost of O(f(ε)k) every time an ILP is solved. To circumvent this, our algorithm works with a relaxed volume threshold (and component class categorization) when “deciding” whether to re-solve an ILP under vertex deletions. Thus, for example, certain large components may be treated as class i components by our algorithm even when their volume is less than (1+ε4)i1. However, once at least Ω(ε2k) vertices are deleted from such components, our algorithm re-solves the ILP. We show that treating certain components in this manner does not violate resource competitiveness, since the total number of large components which can be assigned to any cluster is O(1ε).

For the learning-augmented model, we enhance our algorithm of Theorem 1 by executing the merges indicated by the predictions at the time of insertion. That is, on the insertion of a vertex v whose predicted set P(v) is non-empty, our algorithm issues merge requests of the form (v,u) for all uP(v). This allows us to inherit several desirable properties of our algorithm of Theorem 1 while minimizing the total migration cost when augmented with predictions. The resulting algorithm also yields a smooth interpolation between our algorithm without predictions and one with full predictions.

We present an overview of our analyses in Section 3 and Section 4 for our O(logk)-competitive algorithm and learning-augmented algorithm, respectively.

1.3 Related Work

Online graph partitioning problems.

At a high-level, OBADC is related to previous work on online partitioning of dynamically changing graphs. Related problems include variants of online graph coloring and the OBGR problem. In recent work, Azar et al. [3] introduce an online graph recoloring problem in which edges of a graph arrive online and an algorithm needs to distribute the vertices among clusters such that for any edge, the two endpoints must be in different clusters. Subsequent work [23] considers a capacitated variant of online recoloring. A key distinction between such coloring problems and OBADC is that while an edge in the former requires the endpoints to be separated, an edge in the latter requires the endpoints to be co-located, leading to different technical considerations.

OBADC is perhaps most closely related to OBGR [2], in which there is a static set V of n=kl vertices and a set of l>0 clusters each holding k vertices initially. An online sequence σ={(ut,vt)}t>0 of communication requests arrives over time. The cost of serving request (ut,vt) is 1 if ut and vt are in distinct clusters and 0 otherwise. Prior to serving any request, a vertex can be migrated at a cost of α>0. The cost incurred by an online algorithm is the total communication and migration cost to serve all requests in σ. OBGR has a O(k2l2)-competitive algorithm [2] in the non-augmented setting while a lower bound of Ω(kl) is known. In recent work, a O(kl2O(k))-competitive algorithm was given in [4], which is optimal for constant k. In the resource augmented setting, with (2+ε)-augmented cluster capacity an O(klogk)-competitive deterministic algorithm was given in [2]. For the same setting, a polynomial time algorithm was recently presented in [10]. A lower bound of Ω(l) holds even in the (1+ε)-augmented setting where ε<1/3 [20].

In [14], Henzinger et al. introduced the learning model of the problem in which the vertex set of the graph Gσ induced by the request sequence σ can be partitioned into V1,.Vl such that |Vi|=k for all i and there are no inter-cluster requests (u,v) where uVi.vVj for ji. For the learning model, the lower bound of Ω(kl) holds in the non-augmented setting. Allowing (1+ε)-augmentation, the best deterministic and randomized algorithms are Θ(llogk) and Θ(logk+logl)-competitive respectively which are shown to be tight[13].

OBADC vs. OBGR.

We describe the similarities and differences between OBADC and OBGR. OBADC resembles a “fully dynamic” version of OBGR in the learning model, but differs as follows. In OBADC, vertices arrive and depart over time, and hence the online algorithm has to adapt to communication patterns which evolve over time between both existing vertices and new vertices. The migration costs are identical between the two models; however in OBADC, an insertion of a new vertex incurs a cost of 1 and we aim to have the total number of clusters utilized by an online algorithm to adapt with the number of vertices. This may incur strategic migrations of vertices to satisfy this additional objective, in contrast to OBGR where migrations are performed to solely minimize communication overhead.

Resource-augmentation and over-provisioning.

To circumvent pessimistic lower-bounds and obtain polyonomial time algorithms, many online algorithmic problems have been studied in the resource-augmented model (e.g., see [21, 33, 34]), going back as far as the earliest work on caching [29]. OBGR has also been studied in the resource-augmentation model [13, 22, 10, 2], where OPT is constrained to a capacity of k on each cluster, while an online algorithm can utilize capacity (1+ε)k for some ε>0. In contrast, we study OBADC in an over-provisioned setting, which yields stronger guarantees than resource-augmentation since the algorithm and the optimal have the same resources. Any competitive ratio in the over-provisioned model immediately implies the same bound in the resource augmented model; for the measure of number of clusters utilized, we are able to get stronger bounds in the resource-augmentation model (see the remark after Theorem 1 in Section 1.1).

Learning-augmented algorithms.

Another approach toward addressing pessimistic bounds in online and approximation algorithms is to incorporate the growing availability of machine-learned predictions in the design of algorithms [11, 18, 15, 5]. A central theme in this area is the following: given access to an imperfect machine-learned oracle which can “predict” characteristics of future request sequences or actions (in the context of online algorithms [24, 15]), edge updates (in the context of dynamic algorithms [5]) or optimal solutions (in the context of approximation algorithms [8]), can improved competitive ratios, running/update times, or approximation ratios be obtained? The imperfection of predictions is quantified by prediction error, which is problem and instance dependent, or a confidence parameter [11]. There is a great variation in terms of various prediction models and prediction errors which have been utilized and there is no singular notion of either, which can be useful or applicable to wide variety of problems.

Our study of online OBADC with predictions is also inspired from prior empirical work in VM allocation and migration, in which various predictions on resource utilization in clusters [17], future VM requests and migrations [19], and communication traffic from historically collected data have been utilized towards efficient provisioning of resources.

1.4 Outline and Preliminaries

Section 2 presents our main algorithm for OBADC. In Section 3, we give a proof sketch of the competitive ratio of our algorithm. The proofs of resource competitiveness and correctness are deferred to the full version of the paper. Finally, Section 4 presents a learning-augmented algorithm for OBADC with predictions, together with a proof sketch of Theorem 2.

We present some useful notation. Let Vt denote the set of vertices at any given point in time t such that nt=|Vt|kl. We use the notation [i] for any i+ to refer to the set {1,2,,i}. The volume of a component C is simply its size, and denoted by |C|.

Our algorithms maintain a set of components 𝒞={C1,C2,} induced on Vt for all time t. We use 𝒮={S1,S2,,S} to denote the set of all clusters. When there is merge a request (u,v) between distinct components Ci and Cj, our algorithms merge Ci and Cj into Cm. A merge is viewed as deletion of components Ci and Cj from 𝒞 and an insertion of Cm to 𝒞.

2 An 𝑶(𝐥𝐨𝐠𝒌)-competitive algorithm

In this section, we present an asymptotically optimal deterministic O(logk)-competitive algorithm for OBADC. We begin by giving some definitions and invariants that our algorithm maintains.

2.1 Definitions and Invariants

Component Classes.

Our algorithm classifies components according to their size. For a component C𝒞, we say that C is in class i if |C|[(1+ε4)i1,(1+ε4)i), where 1iln(1+ε4)k. We say that a component is small if it is in class i where ics where csln(1+ε4)εk4. Thus, any small component has size at most Dk where ε5Dε4. All the other components are said to be large.

A large component is understood to be in class i if it is in class i+cs. By the above definitions, it follows that a large component of class i has size in [Dk(1+ε4)i1,Dk(1+ε4)i). The following lemma bounds the number of large component classes.

Lemma 3.

The number of large component classes is cl26ε2=O(1).

Proof.

Note that a large component has volume at least εk5 and at most k. Thus, clln(5ε)ln(1+ε4)+1. Since 11xlnxx1 for any x0, it follows that cl(5/ε)1/(1+ε/4)4+εε5ε+126ε2 since ε<1.

Assigned Volume.

For every component C𝒞, our algorithm provisions volume on some cluster Si𝒮 to which it is assigned, which we refer to as the assigned volume and denote it by A(C).

For any cluster Si𝒮 let A(Si) denote the total assigned volume for all components assigned to Si. Let Ri denote the residual unassigned volume of Si, where Ri=(1+ε)kA(Si). We present a fine-grained scheme to assign volumes to components as follows.

Let Aij=(1+jε16)(1+ε4)i1, for j{0,1,2,3,4}. Thus, Ai0=(1+ε4)i1 and Ai4=(1+ε4)i. Our algorithm maintains the following invariant for assigned volumes at all times.

Invariant 1 (Assigned Volume).

For all classes i, and any class i component such that |C|[(1+ε4)i1,(1+ε4)i), one of the following statements holds:

  1. 1.

    if Ai0|C|<Ai1, then |C|A(C)Ai3.

  2. 2.

    if Ai1|C|<Ai2, then |C|A(C)Ai4.

  3. 3.

    if Ai2|C|<Ai3, then |C|A(C)(1+ε16)(1+ε4)i=Ai+1,1.

  4. 4.

    if Ai3|C|<Ai4, then |C|A(C)(1+ε8)(1+ε4)i=Ai+1,2.

The following lemma is immediate based on the invariant above.

Lemma 4.

If Invariant 1 is maintained, then for any component C, |C|A(C)(1+ε4)|C|.

Active Clusters.

A cluster is said to be active if there is at least one component assigned to it. The set of all active clusters is denoted by 𝒮A.

Marked Clusters.

Our algorithm marks and un-marks active clusters over time. If a cluster is marked, then its residual volume is small. We denote the set of marked clusters by 𝒮M, where 𝒮M𝒮A. Initially, all clusters are unmarked, i.e. 𝒮M=. Our algorithm maintains the following invariant at all times.

Invariant 2.

For a cluster Sj𝒮M, Rjεk3.

Furthermore, let 𝒮S denote the set of clusters on which only small components (and no large components) are assigned and let 𝒮L denote the set of clusters to which at least one large component is assigned. To ensure that the number of active clusters is at most (2+ε) times the minimum needed, our algorithm maintains the following invariant.

Invariant 3.

At any time t, if |𝒮S|>0 then both of the following hold: i) either 𝒮L= or 𝒮L𝒮M (i.e. all clusters in 𝒮L are marked) and, ii) exactly one cluster in 𝒮S is unmarked.

Marked Components.

Our algorithm marks and un-marks certain components when their component class decreases due to vertex deletions. If a large component of class i[cl1], (resp. a small component of class cs) is marked, then it is treated as a large component of class i+1 (resp. a large component of class 1). Intuitively, we mark a component to ensure that the ILP is not solved too frequently if its volume shrinks only slightly due to deletions. The set of marked components at any time is denoted by 𝒞M. Note that all marked components are treated as large components by our algorithm, thus 𝒞M𝒞L. Our algorithm maintains the following invariant for marked components.

Invariant 4.

At any point in time, a marked component C𝒞L satisfies one of the following conditions:

  1. 1.

    C is a small component of class cs, such that |C|Dkε2k100.

  2. 2.

    C is a large component of class i[cl1], such that |C|Dk(1+ε4)iε2k100.

Data Structures.

Our algorithms maintain the sets 𝒞S and 𝒞L of small and large components, respectively, together with the set 𝒞M of marked components. For a component C, the assigned volume A(C) is maintained, and for all Si𝒮, A(Si) and Ri are maintained. Furthermore, the sets of clusters 𝒮A,𝒮M,𝒮S and 𝒮L are maintained.

In the following section, we outline our approach for assigning large components which is completely independent of the assignment of small components.

2.2 An Approach to Assign Large Components

We first define the notion of a signature, similar to [22, 13]. Intuitively, a signature encodes the number of large components of each component class that can be assigned to a single cluster while respecting cluster capacity.

Definition 5.

A signature τ=(τ1,τ2,,τcl) is a non-negative vector of dimension cl where τi denotes the number of large components of class i such that i=1cl(Dk(1+ε4)i1ε2k100)τik.

Let 𝒯={T1,T2,} denote the set of all possible signatures. The following lemma bounds the size of 𝒯.

Lemma 6.

The total number of signatures, |𝒯| is bounded by (6ε)26ε2=O(1).

Proof.

We first note that Dk(1+ε4)i1ε2k100Dkε2k100εk5ε2k100εk6 for any i>0. Thus, any entry τi is upper bounded by kεk/6=6ε. Since the number of large component classes is 26ε2 by Lemma 3, the total number of signatures is at most (6ε)26ε2=O(1).

We solve an integer linear program (ILP) in polynomial time, and obtain signatures which guide the placement of large components. Let Tij denote the jth entry of a signature Ti𝒯. For each signature Ti, we let xi[0,] denote the number of clusters which are assigned signature Ti. Let σj denote the number of class j large components at any given point in time. Our ILP is as follows.

ILP.
mini=1|𝒯|xis.t.i=1|𝒯|Tijxi=σjj[cl],xi[0,]i[𝒯].

In matrix form, our ILP has nr=O(cl)=O(1) rows and nc=O(|𝒯|)=O(1) columns. Thus, the ILP can be solved in polynomial time.

Our algorithm solves this ILP whenever σj changes for any j[cl]. This could be after components are merged leading to a larger component with a higher component class or, vertex deletions from a component leading to a decrease in its component class. In both cases, at most three components in 𝒞 change, and as a result, at most three component classes change. We invoke a well-known result in sensitivity analysis from [27], which quantifies the change in optimal solutions of the ILP.

Theorem 7 ([27]).

Let A be an integral nr×nc matrix, such that each subdeterminant of A is at most Δ in absolute value; let b and b′′ be column nr-vectors, and let c be a row nc-vector. Suppose max{cx|Axb:xintegral} and max{cx|Axb′′:xintegral} are finite. Then for each optimum solution z of the first maximum there exists an optimum solution z′′ of the second maximum such that zz′′ncΔ(bb′′+2).

We prove the following lemma.

Lemma 8.

After a merge request or deletion request, the number of signatures which change in the optimal solution to the ILP is f(ε)=|𝒯|2+|𝒯|ε|𝒯|=O(1) for constant ε>0.

Proof.

Whenever two components are merged or a deletion causes a large component’s size class to decrease, the RHS vector in our ILP changes by at most 1 in the infinity norm. To bound the sub-determinant, we use the Hadamard inequality to derive that Δ(ncAmax)nc/2 where Amax denotes the maximum entry (in absolute value) of the constraint matrix A. Each entry in the constraint matrix of our ILP has value either 1 or Tij so that AmaxkDk=O(1ε). As a result, Δ=O((|𝒯|ε)|𝒯|). Thus, the optimal solution to the ILP changes by O(|𝒯|Δ) in the infinity norm. Since x has dimension |𝒯|, the number of signatures which change between any two optimal solutions is O(|𝒯|2Δ)=O(1).

Greedy Assignment of Signatures to Clusters.

Given the solution x=(x1,x2,,x|𝒯|) from the ILP, we perform a greedy assignment of signatures to clusters which minimizes the number of clusters whose assigned signatures change. Let x=(x1,x2,,x|𝒯|) denote the current signature, such that there are exactly xi clusters which are assigned signature Ti. Our algorithm for greedy assignment, Assign-Signatures works as follows.

Let zi=xi for all i[|𝒯|] and 𝒮𝒮A denote the set of active clusters. We iterate over all i[|𝒯|]: while zi>0, if there exists an active cluster Sj in 𝒮 which is currently assigned signature Ti, zi is decremented, Sj is removed from 𝒮 and we continue. Else if no cluster in 𝒮 is assigned signature Ti, we pick an arbitrary active cluster Sj in 𝒮A and assigns Ti to S. If 𝒮=, our algorithm picks an arbitrary inactive cluster Sj𝒮\𝒮A, adds Sj to 𝒮A and assigns Ti to S.

Algorithm 1 Assign-Signatures.
1:Let x=(x1,x2,,x|𝒯|) denote the current signature.
2:𝒮𝒮A, 𝒮N, 𝒮I.
3:Solve the ILP and let x=(x1,x2,,x|𝒯|) denote the obtained signature
4:for i[|𝒯|] do
5:  zi=xi.
6:  while zi>0 do
7:    if there exists Sj𝒮 assigned a signature Ti then
8:    zizi1, 𝒮𝒮\{Sj}, 𝒮I𝒮I{Sj}.
9:    else
10:    if 𝒮= then
11:      Pick an arbitrary cluster Sj𝒮\𝒮A, and assign Ti to Sj.
12:      𝒮N𝒮N{Sj}.
13:    else
14:      Pick an arbitrary active cluster Sj in 𝒮 and assign Ti to Sj.
15:      𝒮N𝒮N{Sj}, 𝒮𝒮\{Sj}.           
16:𝒮O𝒮L\(𝒮I𝒮N)).
17:𝒮L𝒮N𝒮I.
18:Return (𝒮N,𝒮O,𝒮I).

Let 𝒮N𝒮A denote the set of clusters which are assigned a new signature after the call to Assign-Signatures. Any cluster S𝒮N satisfies one of the following conditions prior to the call to Assign-Signatures: i) S was inactive, ii) S was active but its signature changed after the call to Assign-Signatures or iii) S was active and was not assigned any signature prior to the call to Assign-Signatures.

Let 𝒮O𝒮 denote the set of clusters which were assigned a signature prior to solving the ILP, and are no longer assigned a signature. Finally, let 𝒮I denote the set of clusters whose assigned signatures are identical before and after the call to Assign-Signatures. Our algorithm returns sets 𝒮N,𝒮O and 𝒮I. Clearly, the assigned signatures change only for clusters which are in 𝒮N𝒮O.

By virtue of subroutine Assign-Signatures and Lemma 8, the following lemma is immediate.

Lemma 9.

After a call to Assign-Signatures, |𝒮N𝒮O|=f(ε)=O(1).

For all clusters Si𝒮I whose assigned signatures do not change, our algorithm does not modify the assignment of large components. Let 𝒞L denote the set of all large components in 𝒞L which are not assigned to any cluster in 𝒮I. It follows from Lemma 9 that the total volume of all large components in 𝒞L is O(kf(ε)).

Components in 𝒞L are assigned to clusters in 𝒮N, corresponding to the newly assigned signatures. Let 𝒞S denote the set of all small components previously assigned to 𝒮N𝒮O. From Lemma 9, it follows that the total volume of all components in 𝒞S is O(kf(ε)). Our algorithm re-assigns small components in 𝒞S in a first-fit fashion, explained in the next section. The following Lemma is immediate from Lemma 8, Lemma 9 and our preceding discussion.

Lemma 10.

The total volume of components in 𝒞L𝒞S is bounded by O(kf(ε)=O(k).

2.3 The Full Algorithm

In this section, we present our algorithm which takes as input a request rt at time t, and maintains an assignment of components to clusters while satisfying Invariants 1 through 4. Our algorithm relies on various subroutines, which we present in the following.

Subroutine Assign-Volume.

This subroutine takes as input a component C, and a cluster Sj𝒮A and assigns volume for C on Sj. In the case when C is a class i1 marked component, it is treated as a class i component and assigned volume Ai2.

Algorithm 2 Assign-Volume(C,Sj).
1:if C𝒞M then
2:  Let i>0 s.t. |C|[(1+ε4)i1,(1+ε4)i).
3:  A(C)0.
4:  if Ai0|C|<Ai1 then
5:   A(C)Ai2.
6:  else if Ai1|C|<Ai2 then
7:   A(C)Ai3.
8:  else if Ai2|C|<Ai3 then
9:   A(C)Ai,4.
10:  else
11:   A(C)Ai+1,1.   
12:  A(Sj)A(Sj)+A(C), RjRjA(C).
13:else If C is marked.
14:  Let i0 s.t. |C|[Dk(1+ε4)i1ε2k100,Dk).
15:  A(C)Ai2.

Observe that Invariant 1 is satisfied for any component C after a call to Assign-Volume.

Subroutine Assign-Small.

The subroutine Assign-Small is invoked whenever a small component C needs to be assigned volume on a cluster. We iterate over active unmarked clusters Sj𝒮A\𝒮M, and if Rj(1+ε4)|C|, C is assigned to Sj. Else, Sj is marked and added to 𝒮M.

If all clusters are marked, i.e. 𝒮M=𝒮A we add an arbitrary cluster in 𝒮\𝒮A to 𝒮A and assign volume for C.

Algorithm 3 Assign-Small(C).
1:is-assigned=false.
2:for all Sj𝒮A\𝒮M do
3:  if Rj(1+ε4)|C| then
4:   Assign-Volume(C,Sj).
5:   is-assigned=true.
6:   break
7:  else
8:   𝒮M𝒮M{Sj}.   
9:if is-assigned=false then
10:  Pick an arbitrary cluster Sj𝒮\𝒮A.
11:  𝒮A𝒮A{Sj}.
12:  Assign-Volume(C,Sj).
13:  𝒮S𝒮S{Sj}.
Subroutine Handle-Insertion.

The subroutine Handle-Insertion is called whenever a request rt at time t corresponds to a vertex insertion v. Subroutine Assign-Small is invoked to assign the singleton component {v}.

Algorithm 4 Handle-Insertion(v).
1:C{v}.
2:𝒞S𝒞S{C},𝒞𝒞{C}.
3:Assign-Small(C).
Subroutine Unassign-Volume.

This subroutine takes as input a component C which is currently assigned to a cluster Si. The quantity A(Si) is decremented by A(C) and A(C) is set to 0. If Si𝒮M and Riεk3, Si is unmarked. The reason why Si is unmarked is that if Riεk2, a small component can be assigned volume on Si, since the assigned volume for a small component is bounded by εk4(1+ε4)<εk3 by Invariant 1. The pseudo-code is given as follows.

Algorithm 5 Unassign-Volume(C,Si).
1:A(Si)A(Si)A(C), RiRi+A(C).
2:A(C)0.
3:if Si𝒮M and Riεk2 then
4:  𝒮M𝒮M\{Si}.
Subroutine Handle-Unmarked.

This subroutine takes as input a newly unmarked cluster Si. If the assigned volume A(Si)=0, then Si is removed from the sets 𝒮A and 𝒮S. If |𝒮S|>0, an arbitrary cluster S𝒮S is chosen and unmarked.

Else, if A(Si)>0, Invariant 3 is restored as follows. Note that if Si𝒮L and 𝒮S= or Si𝒮S and |𝒮S|=1, nothing needs to be done since Invariant 3 is already maintained. Else, let S𝒮S denote an unmarked cluster where SSi. While the residual volume of Si is sufficient (and Si is unmarked and |𝒮S|>0) small components from S are migrated to Si. If the residual volume of Si is insufficient, Si is marked and added to 𝒮M. If at any point A(S)=0, S is removed from 𝒮A and 𝒮S. Thereafter, if Si𝒮L, and |𝒮S|>0, an arbitrary cluster S in 𝒮S is unmarked. If Si𝒮S, and |𝒮S|>1, an arbitrary cluster in 𝒮S is unmarked. The procedure continues while the residual volume of Si is sufficient. On the other hand, if Si is the only cluster in 𝒮S it is unmarked and the process terminates.

Algorithm 6 Handle-Unmarked(Si).
1:if A(Si)=0 then
2:  𝒮A𝒮A\{Si},𝒮S𝒮S\{Si}.
3:  if |𝒮S|>0 then Pick an arbitrary cluster S𝒮S, 𝒮M𝒮M\{S}.   
4:else
5:  if (Si𝒮L and 𝒮S) or (Si𝒮S and |𝒮S|>1then
6:   Let SSi be an unmarked cluster in 𝒮S.
7:   while Si𝒮M and 𝒮S do
8:     Let C be an arbitrary small component assigned to S.
9:     if Ri(1+ε4)|C| then
10:      Assign-Volume(C,Si).
11:      Unassign-Volume(C,S).
12:     else
13:      𝒮M𝒮M{Si}. Si is marked      
14:     if A(S)=0 then
15:      𝒮A𝒮A\{S}, 𝒮S𝒮S\{S}. S is made inactive.
16:      if Si𝒮L and |𝒮S|>0 then
17:        Let S be an arbitrary cluster in 𝒮S.
18:        𝒮M𝒮M\{𝒮}. S is unmarked.       
19:      if Si𝒮S then
20:        if |𝒮S|>1 then
21:         Let SSi be an arbitrary cluster in 𝒮S.
22:         𝒮M𝒮M\{S}. S is unmarked.
23:        else
24:         break. Si is the only unmarked cluster in 𝒮S in this case.                         
Subroutine Reassign-Large.

We give a subroutine Reassign-Large which is invoked whenever the number of large components σi of any class i[cl] change. In Reassign-Large, the subroutine Assign-Signatures is invoked which returns the sets 𝒮N,𝒮O and 𝒮I of clusters (see Section 2.2).

Let 𝒞S denote the set of all small components assigned to clusters in 𝒮O𝒮N. Small components currently assigned to clusters in 𝒮O𝒮N are unassigned. Clusters in 𝒮O𝒮N are unmarked and the set of active clusters 𝒮A is updated by removing clusters in 𝒮O and adding clusters in 𝒮N.

Next, let 𝒞L denote the set of large components which are not assigned to any cluster in 𝒞I. For all clusters S𝒮N, let Ts be the signature assigned to cluster S. For all non-zero Tsa where a[cl], a class a large component C is chosen from 𝒞L, and Assign-Volume(S,C) is invoked, concluding the the assignment of large components.

For small components C𝒞S, Assign-Small(C) is invoked. Finally, for all unmarked clusters S in 𝒮N𝒮M, Handle-Unmarked(S) is invoked. The pseudo code of Reassign-Large is deferred to the full version of the paper.

Subroutine Handle-Deletion.

We present a subroutine Handle-Deletion which takes as input a vertex v to be deleted. We assume that Invariant 1 holds prior to the deletion request. Let C denote the component containing v prior to v’s deletion s.t. |C|[(1+ε4)i1,(1+ε4)i) and Sj denote the cluster to which C is assigned. We consider two cases.

  1. 1.

    C is small and unmarked: Vertex v is removed from C. There are five sub-cases to consider.

    1. (a)

      If A(C)=Ai+1,2 and |C|<Ai3, then A(C) is set to Ai+1,1.

    2. (b)

      If A(C)=Ai+1,1 and |C|<Ai2, then A(C) is set to Ai4.

    3. (c)

      If A(C)=Ai4 and |C|<Ai1, then A(C) is set to Ai3.

    4. (d)

      If A(C)=Ai3 and |C|<Ai0=(1+ε4)i1, then C has become a class i1 component. A(C) is set to Ai2.

    5. (e)

      If C=, A(C) is set to 0.

    In all of the above cases, A(Sj) and Rj are updated. If Sj𝒮M and Rjεk2, Sj is removed from 𝒮M and Handle-Unmarked(Sj) is invoked.

  2. 2.

    C is large or marked: We first remove v from C. We consider the following cases.

    1. (a)

      C is large and unmarked (i.e. C𝒞L\𝒞M): Our algorithm considers the following cases.

      1. i.

        If A(C)=Ai+1,2 and |C|<Ai3, then A(C) is set to Ai+1,1.

      2. ii.

        If A(C)=Ai+1,1 and |C|<Ai2, then A(C) is set to Ai4.

      3. iii.

        If A(C)=Ai4 and |C|<Ai1, then A(C) is set to Ai3.

      4. iv.

        If |C|<Ai0, C is marked. If A(C)=Ai3 then A(C) is set to Ai2.

      In the above cases, if Sj𝒮M and Rjεk2, Sj is removed from 𝒮M and Handle-Unmarked(Sj) is invoked.

    2. (b)

      C is marked: There are two cases to consider depending on whether C is large or small (after the deletion of v).

      1. i.

        Let C be a marked large component of class c where c=ics, such that c[cl1]. If |C|Dk(1+ε4)cε2k100, there is nothing to be done. Else, if |C|<Dk(1+ε4)cε2k100, C is unmarked. The counter σc+1 is decremented since C is now considered a class c component, and σc is incremented. Then, the subroutine Reassign-Large is invoked.

      2. ii.

        Let C be a marked small component of class cs. If |C|Dkε2k100, nothing is done. Else, if |C|<Dkε2k100, C is first unmarked. Then, C is removed from 𝒞L and added to 𝒞S. The counter σ1 is decremented. Then, the subroutine Reassign-Large is invoked.

The pseudo-code of Handle-Deletion is deferred to the full version of the paper.

Merge-Components.

The subroutine Merge-Components is invoked by our algorithm to handle a merge request (u,v). Let Ci, Cj denote the components of u and v respectively. If Ci=Cj, nothing needs to be done. Otherwise, w.l.o.g., let |Cj||Ci| and Si and Sj denote the clusters on which Ci and Cj are currently assigned. Let Cm=CiCj.

  1. 1.

    Cm is small: The subroutine Handle-Small is called and considers two cases.

    1. (a)

      Ci is marked: We note that Cj cannot be a marked component since this would contradict that Cm is small. This is because if Cj is marked, then |Cm|2(Dkε2k100)=Dk+Dkε2k50>Dk since Dkε2k50>εk5εk50>0. Thus, the only possibility is that Ci is marked. Since any marked small component must have volume at least Dkε2k100, and Cm is small it follows that |Cm|Dk. In this case we note that A(Ci)=Ai2Dk so that A(Cm) can be set to A(Ci). Ci is removed from 𝒞M and Cm is added to 𝒞M. If |Cm|<Dk, Cm is added to 𝒞M. As such, Cm is still treated by our algorithm as a large marked component. If Si=Sj nothing needs to be done. Else, vertices in Cj are migrated to Si, and Unassign-Volume(Cj,Sj) is invoked. Subroutine Handle-Unmarked(Sj) is invoked to handle the case when Sj becomes unmarked.

    2. (b)

      Ci and Cj are not marked: In this case, there are two cases to consider.

      1. i.

        If A(Ci)|Cm|, we set A(Cm) to A(Ci) and A(Ci),A(Cj) to 0. If Sj=Si, nothing needs to be done. If SjSi, vertices in Cj are migrated to Si, and Unassign-Volume(Cj) is invoked. Subroutine Handle-Unmarked(Sj) is invoked to handle the case if Sj becomes unmarked.

      2. ii.

        If A(Ci)<|Cm|, we invoke Unassign-Volume(Ci,Si) and Unassign-Volume(Cj,Sj). If Ri(1+ε4)|Cm|, we call Assign-Volume(Cm,Si). If SiSj, we migrate vertices in Cj to Si. We invoke Handle-Unmarked(Sj) and Handle-Unmarked(Si).

        On the other hand, if Ri<(1+ε4)|C|, Si is marked and Assign-Small(Cm) is invoked.

  2. 2.

    Cm is large: The subroutine Handle-Large is invoked which adds Cm to the set of large components.

    Let m[cl] be an integer such that |Cm|[Dk(1+ε4)m1,Dk(1+ε4)m). If Ci is marked, i.e. Ci𝒞M, let ia+1 be the integer where a is an integer such that |Ci|[Dk(1+ε4)aε2k100,Dk(1+ε4)a), else we let ia be the integer where a is an integer such that |Ci|[Dk(1+ε4)a1,Dk(1+ε4)a). We consider the following cases.

    1. (a)

      Cj is large or Cj is marked or m>i: If Cj is marked, we let ja+1 be the integer where a is an integer such that |Cj|[Dk(1+ε4)aε2k100,Dk(1+ε4)a). Else if Cj is unmarked, we let ja be the integer where a is an integer such that |Cj|[Dk(1+ε4)a1,Dk(1+ε4)a). We decrement σj and σi by 1, and increment σm by 1. We remove Ci,Cj from 𝒞M to make sure that the set of marked components is updated. Thereafter, we update the component sets 𝒞S,𝒞L and call subroutine Reassign-Large to handle the assignment of large components.

    2. (b)

      Cj is small and Cj is unmarked and mi: In this case, we note that σi,σm do not change. Thus, the ILP is not solved. We assign volume for the merged component as follows.

      In the case when A(Ci)A(Cm), vertices in Cj are migrated to Si if SiSj. We invoke Unassign-Volume(Cj,Sj), and Handle-Unmarked(Sj). Else, nothing needs to be done. The assigned volumes A(Ci),A(Cj) are set to 0. If Ci is marked and |Cm|<Dk(1+εk4)i1, then Ci is removed from 𝒞M and Cm is added to 𝒞M. We note that in this case, A(Ci)=Ai2A(Cm).

      If A(Ci)<|Cm|, then we invoke Unassign-Volume(Ci,Si) and Unassign-Volume(Cj,Sj).

      If Ri(1+ε4)|Cm|, we assign volume for Cm on Si by invoking Assign-Volume(Cm,Si). If A(Sj)=0, we call Handle-Unmarked(Sj). Next, we call Handle-Unmarked(Si). In the case when A(Sj)0 (and Sj𝒮A as a result), we invoke Handle-Unmarked(Sj).

      If Ri<(1+ε4)|Cm|, we do the following. While Ri<(1+ε4)|Cm|, we call Unassign-Volume(C,Si) where C is an arbitrary small component assigned on Si, and add it to a set 𝒞S. Once Ri(1+ε4)|Cm|, we invoke Assign-Volume(Cm,Si) and migrate vertices in Cj to Si if needed (in the case when SiSj) together with a call to Unassign-Volume(Cj,Sj). Next, we assign components in 𝒞S to Si as long as there is sufficient volume and Si is not marked. If all components in 𝒞S have been assigned and Si is unmarked, we call Handle-Unmarked(Si).

      If Sj is unmarked, we invoke Handle-Unmarked(Sj). All remaining unassigned components C in 𝒞S (if any) are assigned by invoking Assign-Small(C). Finally, the component sets 𝒞S,𝒞L are updated.

The pseudo-code of subroutines Merge-Components, Handle-Small and Handle-Large are deferred to the full version of the paper.

We present the pseudo-code of our final online algorithm OBA that utilizes the aforementioned subroutines as follows.

Algorithm 7 OBA.
1:𝒞S,𝒞L,𝒞M,𝒞C.
2:for all Si𝒮 do A(Si)0,Ri=(1+ε)k
3:𝒮S,𝒮L,𝒮M,𝒮A.
4:for rt at time t do
5:  if rt is an insertion request for vertex v then
6:   Handle-Insertion(v).
7:  else if rt is a deletion request for vertex v then
8:   Handle-Deletion(v).
9:  else
10:   Let rt be a merge request between vertices (u,v).
11:   Merge-Components(u,v).   

3 Analysis of OBA

In this section, we give a proof sketch towards O(logk)-competitiveness of our algorithm. Technical details of our proof, together with proofs of correctness and resource competitiveness are deferred to the full version of the paper.

Our analysis is intricate and relies on various charging arguments. At a high level, we show that a vertex can be assigned sufficient credit on insertion such that the total amount of credit on it at any point in time is sufficient to pay for the cost charged against it. The total credit on a vertex is the sum of its direct and indirect credits. Direct credit is a one-time credit assigned to v on its insertion. Indirect credit on v is credit passed on to it by other vertices which get deleted from v’s component.

Warm up: An insertions-only case.

Let us first consider a (finite) request sequence σ which only consists of insertion and merge requests. For this sequence, the assigned volume of any component containing a vertex v monotonically increases over time, and no components are ever marked. We show that it suffices to charge each vertex an amount O(logk+f(ε)ε3) on its insertion. On v’s insertion, our algorithm assigns {v} to an active cluster in 𝒮A, or makes a new cluster active and assigns {v} to it. On a merge request between components Ci and Cj which are merged into a small component Cm, where w.l.o.g., |Ci||Cj| our algorithm always migrates vertices in Cj to Ci (in the case when SiSj) as long as the cluster Si containing Ci has sufficient residual volume. The first key observation is that for such a merge, all vertices in Cj are now part of a component (i.e. Cm) with a larger component class. Thus, if A(Ci)|Cm| or Ri(1+ε4)|Cm|, only vertices in Cj are migrated. Potentially some other vertices may be migrated to Sj if Sj becomes unmarked after volume is un-assigned due to the migration of Cj (we ignore these costs for now). For any vertex v, and the component C containing v, note that C’s component class increases monotonically over time due to merge requests. The number of component classes, which is O(cs+cl)=O(logk+1ε2) bounds the number of times the component class can increase.

On the other hand, if Ri is insufficient to accommodate vertices in Cj (i.e. in the case when A(Ci)<|Cm| and Ri<(1+ε4)k), vertices in both Ci and Cj are migrated to another cluster. Note that in this case, A(Cm)>A(Ci). Since there are at most 4(cs+cl)=O(logk+1ε2)=O(logk) possible values that assigned volumes can take, and assigned volume increases monotonically for any component, each vertex v can migrate only O(logk+1ε2) times in this manner.

Crucially, we note that if the component C containing v becomes large (or C is large and its component class increases), a total of O(f(ε)k) migration cost may be incurred, by Lemma 10. This migration cost can be incurred a total of cl=O(1ε2) times. By definition, a C has size at least Dkεk5; we charge the migration cost to all Ω(εk) vertices in C. Thus, each vertex in C contributes at least O(f(ε)ε) credit a total of O(1ε2) times. Therefore, a credit of O(f(ε)ε3) on a vertex is sufficient to pay for migrations of this type.

We now analyze the potential migration costs incurred when a component C migrates from one cluster (say Si) to Sj, which may lead to a call to Handle-Unmarked(Si) leading to components migrations to Si. To account for these costs, a cluster credit Θ(|C|) is left on Si when C migrates to Sj, and each vertex in C is charged an amount O(1). As a result, each time the residual volume of a cluster increases, there is enough cluster credit to pay for successive migrations (as part of Handle-Unmarked). Note that in subroutine Handle-Unmarked, only small components are migrated from an unmarked cluster, and the total amount of migrated components is proportional to the increase in residual volume. Thus, a vertex is charged for cluster credit each time its component is promoted to a higher class or its assigned volume increases. Since the number of choices for assigned volumes (and component classes) is O(logk+1ε2), any vertex is charged O(logk+1ε2) in this manner.

By the above, it follows that assigning a one-time direct credit of O(1ε3f(ε)+logk) on each vertex v on its insertion is sufficient. Since OPT is lower bounded by the number of vertex insertions, this yields O(logk) competitiveness.

The General Case.

Let us consider the case when the request sequence consists of insertions, merges and deletions. In this case, the component class of any component C and its assigned volume A(C) do not necessarily increase over time, in general. Thus, direct credit on v is insufficient, and our analysis crucially relies on indirect credit. Indirect credit is assigned to any vertex in the following manner: whenever a vertex u is deleted from v’s component C, an amount of indirect credit is distributed to all remaining vertices in C. Some credit is also left as cluster credit on the cluster containing C on u’s deletion. Cluster credit is used to pay for re-balancing and migrating components as in the previous case. The total indirect credit assigned to vertices in C, together with cluster credit that is left on u’s deletion is charged against vertex u. On the other hand, the total credit assigned to a vertex is the sum of the direct credit and indirect credit distributed to it by other vertices. Let C denote the component containing v. We show that even in the case of deletions, it suffices to assign a direct credit of O(1ε3f(ε)+logk) to vertex v upon insertion, which is used to pay for:

  1. 1.

    the unit migration cost incurred each time C is promoted to a component class for the first time, or the assigned volume of C increases for the first time as in the previous case.

  2. 2.

    indirect credit assigned to vertices in C upon the deletion of v.

  3. 3.

    cluster credit assigned to the cluster containing C, upon v’s deletion.

  4. 4.

    cluster credit assigned to the cluster containing C, before C is migrated to another cluster as a result of C being promoted to either a component class for the first time, or an increase in its assigned volume for the first time.

Consider a vertex v and let C denote an (unmarked) component containing v with assigned volume A(C). Upon vertex deletions from C, A(C) may decrease. Suppose A(C)=Aij for some j{1,2,3,4}. Consider a set of deleted vertices CD which lead to a reduction in C’s assigned volume to Ai,j1. For this to happen, |CD|ε16(1+ε4)i1. On the other hand, |C|(1+j116ε)(1+ε4)i1(1+3ε16)(1+ε4)i1, after vertices in CD are deleted. For each vertex u in CD, we distribute a total indirect credit of O(1ε2f(ε)) uniformly to all remaining vertices in C. As a result, the total indirect credit gained by each remaining vertex in C\CD is at least O(|CD|O(f(ε)ε2)(1+3ε16)(1+ε4)i1)=O(f(ε)ε) after all vertices in CD are deleted. The indirect credit gained by any vertex v in C\CD is used to pay for: i) a single future migration of a vertex vC\CD which leads to an increase in either the assigned volume of v’s component or the component class of v’s component and ii) leave O(1) cluster credit when the aforementioned migration happens.

Next, consider the time when a component C is marked, such that |C|<Dk(1+ε4)i1 where i1. Once |C|<Dk(1+ε4)i1ε2k100, this leads to either a call to Reassign-Large (if C is large) or C is treated as a small component thereafter (see Handle-Deletion). Since C has size at most k, this implies that at least ε2100=Ω(ε2) fraction of vertices in C are deleted before either of these events happen. The total migration and reassignment cost incurred due to Reassign-Large is O(f(ε)k) by Lemma 10. To pay for this cost, leave an indirect credit of O(f(ε)ε) on each remaining vertex in C, and assign a cluster credit of O(1), it suffices to charge each deleted vertex from C an amount O(1ε3f(ε)). The cluster credit is used to pay for the migration cost of vertices to Si if Si becomes unmarked. The amount charged against a deleted vertex u is paid by the direct credit assigned to u upon its insertion.

By the above, it follows that assigning a direct credit of O(logk+f(ε)ε3) to a vertex upon its insertion is sufficient. Since OPT is lower bounded by the number of vertices inserted over all time, this yields O(logk) competitiveness for constant ε>0.

4 OBADC with Predictions

In this section, we present our algorithm for OBADC which is augmented with machine learned predictions. The problem formulation and objectives are identical as in the standard un-augmented setup. At each time step t, a request rt which corresponds to either a vertex insertion, deletion or a merge between two components is issued. At any given point in time, an online algorithm is required to maintain an assignment of components to clusters, while respecting the over-provisioned cluster capacity of (1+ε)k, such that all vertices in any component are assigned to the same cluster. In light of the Ω(logk) lower bound on the competitiveness of any randomized algorithm, it is natural to ask whether this barrier can be circumvented given oracle access to machine-learned predictions to guide the assignment of components. To this end, we recap our prediction model.

Prediction Model.

Let Vt1 denote the set of vertices at the beginning of time t1. For a request rt at time t which corresponds to an insertion of vertex v, we obtain:

  1. 1.

    with probability η>0, a predicted set P(v) of all vertices in Vt1 which will be in the same component as v.

  2. 2.

    with probability 1η, a null prediction, i.e. P(v)=. Thus no information is revealed on the insertion of v.

We present an algorithm Predicted-OBA which is O(1)-consistent and min{log1η,logk}-robust. This algorithm is similar in many ways to our O(logk) competitive algorithm OBA. We utilize identical data structures, definitions and subroutines as detailed in Section 2. We also maintain Invariants 1 through 4 as in Section 2.

Our algorithm Predicted-OBA is as follows.

Algorithm 8 Predicted-OBA.
1:𝒞S,𝒞L,𝒞M,𝒞C.
2:for all Si𝒮 do A(Si)0,Ri=(1+ε)k
3:𝒮S,𝒮L,𝒮M,𝒮A.
4:for rt at time t do
5:  if rt is an insertion request for vertex v then
6:   Predicted-Insertion(v,P(v)).
7:  else if rt is a deletion request for vertex v then
8:   Handle-Deletion(v).
9:  else
10:   Let rt be a merge request between components Ci and Cj.
11:   Merge-Components(Ci,Cj).   

We give an additional subroutine, Predicted-Insertion as follows.

Subroutine Predicted-Insertion.

This subroutine takes as input a vertex v inserted at time t and a predicted set P(v) consisting of vertices at time t that will be in the same component as v. If P(v)=, the subroutine Handle-Insertion(v) is invoked. Else, a set σI of merge requests is created where σI={(u,v)|uP(v)}. For each merge request in σI, the subroutine Merge-Components(u,v) is invoked.

The following lemma bounds the competitive ratio of Algorithm Predicted-OBA.

Lemma 11.

Algorithm Predicted-OBA is O(min{log(1/η),logk})-competitive.

We build towards a proof of Lemma 11 in the following. We first analyze the probability of a merge request being incident to vertices in distinct components Ci, Cj as a function of component sizes.

Lemma 12.

Let rt be a merge request between components C and C at time t, such that s=|C||C| without loss of generality. Then, the probability that CC is bounded by eηs.

Proof.

We note that if CC, then for at least s=|C| insertions of vertices w, P(w)=. Since the probability that P(w)= for any w is (1η), it follows that for s vertex insertions, the probability that all predicted sets are empty is bounded by (1η)seηs.

We define monotonic merges as follows.

Definition 13 (Monotonic Merge).

Let C be the component containing vertex v at any point in time throughout v’s lifetime. Let t1 and t2 be time-steps s.t. v is inserted at time t1 and deleted at time t2. A merge request involving components C and C at time t[t1,t2) is said to be a monotonic merge for v if |C||C| and one of the following holds:

  1. 1.

    The assigned volume of C is set to Aij by our algorithm where i[cs+cl],j{1,2,3,4} for the first time during time interval [t1,t2).

  2. 2.

    The component class of C is set to i[cs+cl] by our algorithm for the first time during time interval [t1,t2).

A merge request for v is non-monotonic if it is not monotonic.

Lemma 14.

The expected number of monotonic merge requests for any vertex v including merge requests created by Subroutine Predicted-Insertion is bounded by O(log(1η)).

Proof.

Let C denote the component of v, such that v is inserted at time t1 and deleted at time t2. Let d=(1+ε4), so that a class i component has volume in [di1,di). By Lemma 12, the probability that a merge request involving C where C is the smaller of the two components and belongs to class i, is bounded by eηdi1. Thus, the expected number of monotonic merge requests for v is bounded by

i=0logkediη =i=0log(1/η)ediη+i=log(1/η)+1logkediηlog(1/η)+O(1)=O(log(1/η)).

Proof Sketch of Lemma 11.

Let us recall the analysis of O(logk)-competitiveness of our algorithm OBA. We argued that it suffices to leave a direct credit of O(logk+f(ε)ε3) on any vertex v upon its insertion, which is sufficient to pay for: i) migration costs and cluster credits charged against v for both monotonic and non-monotonic merges and, ii) cluster and indirect credits charged against v upon its deletion. The O(logk) term comes from the fact a vertex v can be part of monotonic merges for a total of cs+cl=O(logk) times, and is charged O(logk) times for merges while C is small. On the other hand, for a non-monotonic merge, v is charged an amount O(1) to pay for its migration cost and leave cluster credit if the residual volume of the cluster C is assigned to, is no longer sufficient to accommodate an increase in A(C). Since the number of choices for assigned volumes is O(cs+cl)=O(logk+1ε2), the total cost charged against v for non-monotonic merges is O(logk+1ε2).

We modify our charging argument for non-monotonic merges as follows. Ignoring the reassignment of components that takes place as a result of subroutine Handle-Unmarked for the sake of clarity, we crucially observe that whenever the residual volume of C’s cluster (denoted by Si) decreases, it is due to either: i) vertices in a smaller component involved in a merge request migrate to Si, or ii) new vertices are inserted to Si’s cluster. We modify our charging argument such that the migrated or inserted vertex in the above cases leaves O(1) extra cluster credit on Si. Thus, whenever the residual volume of Si decreases by Ω(k), these extra cluster credits can be used to pay for non-monotonic merges involving vertices already assigned on Si. As a result, we focus on the cost charged for monotonic merges in the remainder of the analysis.

By Lemma 14, it follows that the expected number of monotonic merges for a vertex is bounded by O(log(1η)). By our analysis of OBA, it follows that the expected cost charged to a vertex for monotonic merges is O(f(ε)ε). Thus, an expected credit of O(log(1/η)f(ε)ε) is sufficient for monotonic merges. On the other hand, when a vertex v is deleted, we charge an amount O(f(ε)ε3) to it which is assigned as indirect credit and cluster credit. As a result, it follows that a total direct credit of O(log(1/η)f(ε)ε+f(ε)ε3) in expectation, is sufficient to pay for all costs charged against v throughout its lifetime.

This yields O(log(1/η))-competitiveness. On the other hand, as η0, the behavior of algorithm Predicted-OBA resembles the behavior of algorithm OBA, and thus, the competitiveness of Predicted-OBA is bounded by O(logk) in the worst-case. This yields O(min(log(1/η),logk))-competitiveness. The following lemma establishes O(1) competitiveness when η=1. The proof is deferred to the full version of the paper.

Lemma 15.

Algorithm Predicted-OBA is O(1) consistent.

Theorem 2 follows from Lemmas 11 and 15.

5 Future Work

Our model for OBADC is restrictive in the sense that component sizes decrease only as a result of vertex deletions; in particular, our model does not allow for splitting of existing components. We believe that such a model will be much more challenging to handle; indeed, it could be considered as a generalization of the general model of OBGR, for which there is a significant gap between the upper and lower bounds for the best competitive ratio achievable.

In this work, we introduced the OBADC and studied it in the context of machine-learned predictions. It would be interesting to extend our prediction model to the case when predictions are always available but may be erroneous. Other prediction models for online balanced allocation problems would be worth exploring.

References

  • [1] Khaled Almi’ani, Young Choon Lee, and Bernard Mans. Resource demand aware scheduling for workflows in clouds. In 2017 IEEE 16th International Symposium on Network Computing and Applications (NCA), pages 1–5. IEEE, 2017.
  • [2] Chen Avin, Marcin Bienkowski, Andreas Loukas, Maciej Pacut, and Stefan Schmid. Dynamic balanced graph partitioning. SIAM Journal on Discrete Mathematics, 34(3):1791–1812, 2020. doi:10.1137/17M1158513.
  • [3] Yossi Azar, Chay Machluf, Boaz Patt-Shamir, and Noam Touitou. Competitive Vertex Recoloring. In Mikołaj Bojańczyk, Emanuela Merelli, and David P. Woodruff, editors, 49th International Colloquium on Automata, Languages, and Programming (ICALP 2022), volume 229 of Leibniz International Proceedings in Informatics (LIPIcs), pages 13:1–13:20, Dagstuhl, Germany, 2022. Schloss Dagstuhl – Leibniz-Zentrum für Informatik. doi:10.4230/LIPIcs.ICALP.2022.13.
  • [4] Marcin Bienkowski, Martin Böhm, Martin Koutecký, Thomas Rothvoß, Jiří Sgall, and Pavel Veselý. Improved analysis of online balanced clustering. In Approximation and Online Algorithms: 19th International Workshop, WAOA 2021, Lisbon, Portugal, September 6–10, 2021, Revised Selected Papers, pages 224–233, Berlin, Heidelberg, 2021. Springer-Verlag. doi:10.1007/978-3-030-92702-8_14.
  • [5] Jan van den Brand, Sebastian Forster, Yasamin Nazari, and Adam Polak. On dynamic graph algorithms with predictions. In Proceedings of the 2024 Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 3534–3557. SIAM, 2024. doi:10.1137/1.9781611977912.126.
  • [6] Prasad Calyam, Sripriya Seetharam, Baisravan Homchaudhuri, and Manish Kumar. Resource defragmentation using market-driven allocation in virtual desktop clouds. In 2015 IEEE International Conference on Cloud Engineering, pages 246–255. IEEE, 2015. doi:10.1109/IC2E.2015.37.
  • [7] Jiuxin Cao, Zhuo Ma, Jue Xie, Xiangying Zhu, Fang Dong, and Bo Liu. Towards tenant demand-aware bandwidth allocation strategy in cloud datacenter. Future Generation Computer Systems, 105:904–915, 2020. doi:10.1016/J.FUTURE.2017.06.005.
  • [8] Vincent Cohen-Addad, Tommaso d’Orsi, Anupam Gupta, Euiwoong Lee, and Debmalya Panigrahi. Max-cut with epsilon-accurate predictions. arXiv preprint arXiv:2402.18263, 2024.
  • [9] Hancong Duan, Chao Chen, Geyong Min, and Yu Wu. Energy-aware scheduling of virtual machines in heterogeneous cloud computing systems. Future Generation Computer Systems, 74:142–150, 2017. doi:10.1016/J.FUTURE.2016.02.016.
  • [10] Tobias Forner, Harald Räcke, and Stefan Schmid. Online balanced repartitioning of dynamic communication patterns in polynomial time. In Symposium on Algorithmic Principles of Computer Systems (APOCS), pages 40–54, 2021. doi:10.1137/1.9781611976489.4.
  • [11] Anupam Gupta, Debmalya Panigrahi, Bernardo Subercaseaux, and Kevin Sun. Augmenting online algorithms with ε-accurate predictions. Advances in neural information processing systems, 35:2115–2127, 2022.
  • [12] Sijin He, Li Guo, and Yike Guo. Real time elastic cloud management for limited resources. In 2011 IEEE 4th International Conference on Cloud Computing, pages 622–629. IEEE, 2011. doi:10.1109/CLOUD.2011.47.
  • [13] Monika Henzinger, Stefan Neumann, Harald Räcke, and Stefan Schmid. Tight Bounds for Online Graph Partitioning, pages 2799–2818. Society for Industrial and Applied Mathematics, USA, 2021.
  • [14] Monika Henzinger, Stefan Neumann, and Stefan Schmid. Efficient distributed workload (re-)embedding. In Abstracts of the 2019 SIGMETRICS/Performance Joint International Conference on Measurement and Modeling of Computer Systems, SIGMETRICS ’19, pages 43–44, New York, NY, USA, 2019. Association for Computing Machinery. doi:10.1145/3309697.3331503.
  • [15] Thodoris Lykouris and Sergei Vassilvitskii. Competitive caching with machine learned advice. Journal of the ACM (JACM), 68(4):1–25, 2021. doi:10.1145/3447579.
  • [16] Zoltán Ádám Mann. Allocation of virtual machines in cloud data centers—a survey of problem models and optimization algorithms. Acm Computing Surveys (CSUR), 48(1):1–34, 2015. doi:10.1145/2797211.
  • [17] Suhib Bani Melhem, Anjali Agarwal, Nishith Goel, and Marzia Zaman. Markov prediction model for host load detection and vm placement in live migration. IEEE Access, 6:7190–7205, 2017. doi:10.1109/ACCESS.2017.2785280.
  • [18] Michael Mitzenmacher and Sergei Vassilvitskii. Algorithms with predictions. Communications of the ACM, 65(7):33–35, 2022. doi:10.1145/3528087.
  • [19] Saloua El Motaki, Ali Yahyaouy, and Hamid Gualous. A prediction-based model for virtual machine live migration monitoring in a cloud datacenter. Computing, 103(11):2711–2735, 2021. doi:10.1007/S00607-021-00981-3.
  • [20] Maciej Pacut, Mahmoud Parham, and Stefan Schmid. Optimal online balanced partitioning. In INFOCOM 2021, 2021.
  • [21] Cynthia A. Phillips, Cliff Stein, Eric Torng, and Joel Wein. Optimal time-critical scheduling via resource augmentation (extended abstract). In Proceedings of the Twenty-Ninth Annual ACM Symposium on Theory of Computing, STOC ’97, pages 140–149, New York, NY, USA, 1997. Association for Computing Machinery. doi:10.1145/258533.258570.
  • [22] Rajmohan Rajaraman and Omer Wasim. Improved bounds for online balanced graph re-partitioning. In 30th Annual European Symposium on Algorithms (ESA 2022), 2022. doi:10.4230/LIPIcs.ESA.2022.83.
  • [23] Rajmohan Rajaraman and Omer Wasim. Competitive capacitated online recoloring. In 32nd Annual European Symposium on Algorithms (ESA 2024), 2024. doi:10.4230/LIPIcs.ESA.2024.95.
  • [24] Dhruv Rohatgi. Near-optimal bounds for online caching with machine learned advice. In Proceedings of the Fourteenth Annual ACM-SIAM Symposium on Discrete Algorithms, pages 1834–1845. SIAM, 2020. doi:10.1137/1.9781611975994.112.
  • [25] Tim Roughgarden. Beyond the worst-case analysis of algorithms. Cambridge University Press, 2021.
  • [26] A. Schrijver. Theory of linear and integer programming. In Wiley-Interscience series in discrete mathematics and optimization, 1999.
  • [27] Alexander Schrijver. Theory of linear and integer programming. John Wiley & Sons, 1998.
  • [28] Jaspreet Singh and Navpreet Kaur Walia. A comprehensive review of cloud computing virtual machine consolidation. IEEE Access, 11:106190–106209, 2023. doi:10.1109/ACCESS.2023.3314613.
  • [29] Daniel D. Sleator and Robert E. Tarjan. Amortized efficiency of list update and paging rules. Commun. ACM, 28(2):202–208, February 1985. doi:10.1145/2786.2793.
  • [30] Mukundan Sridharan, Prasad Calyam, Aishwarya Venkataraman, and Alex Berryman. Defragmentation of resources in virtual desktop clouds for cost-aware utility-optimal allocation. In 2011 Fourth IEEE International Conference on Utility and Cloud Computing, pages 253–260. IEEE, 2011. doi:10.1109/UCC.2011.41.
  • [31] Ruitao Xie, Xiaohua Jia, Kan Yang, and Bo Zhang. Energy saving virtual machine allocation in cloud computing. In 2013 IEEE 33rd International Conference on Distributed Computing Systems Workshops, pages 132–137. IEEE, 2013. doi:10.1109/ICDCSW.2013.37.
  • [32] Hiroki Yanagisawa, Takayuki Osogami, and Rudy Raymond. Dependable virtual machine allocation. In 2013 Proceedings IEEE INFOCOM, pages 629–637. IEEE, 2013. doi:10.1109/INFCOM.2013.6566848.
  • [33] N. Young. The k-server dual and loose competitiveness for paging. Algorithmica, 11(6):525–541, June 1994. doi:10.1007/BF01189992.
  • [34] Neal E. Young. On-line file caching. In Proceedings of the Ninth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA ’98, pages 82–86, USA, 1998. Society for Industrial and Applied Mathematics. URL: http://dl.acm.org/citation.cfm?id=314613.314658.