J Anselmi

N Walton
email: neil.walton@manchester.ac.uk

Stability and Optimization of Speculative Queueing Networks

We provide a queueing-theoretic framework for job replication schemes based on the principle "replicate a job as soon as the system detects it as a straggler". This is called job speculation. Recent works have analyzed replication on arrival, which we refer to as replication. Replication is motivated by its implementation in Google's BigTable. However, systems such as Apache Spark and Hadoop MapReduce implement speculative job execution. The performance and optimization of speculative job execution is not well understood. To this end, we propose a queueing network model for load balancing where each server can speculate on the execution time of a job. Specifically, each job is initially assigned to a single server by a frontend dispatcher. Then, when its execution begins, the server sets a timeout. If the job completes before the timeout, it leaves the network, otherwise the job is terminated and relaunched or resumed at another server where it will complete. We provide a necessary and sufficient condition for the stability of speculative queueing networks with heterogeneous servers, general job sizes and scheduling disciplines. We find that speculation can increase the stability region of the network when compared with standard load balancing models and replication schemes. We provide general conditions under which timeouts increase the size of the stability region and derive a formula for the optimal speculation time, i.e., the timeout that minimizes the load induced through speculation. We compare speculation with redundant-d and redundant-to-idle-queue-d rules under an S&X model. For light loaded systems, redundancy schemes provide better response times. However, for moderate to heavy loadings, redundancy schemes can lose capacity and have markedly worse response times when compared with the proposed speculative scheme.

Introduction

Jobs taking longer than expected to complete, so-called stragglers, severely impact the performance of computer systems. Initial work on MapReduce note that stragglers have a significant impact on performance and occur for reasons that do not necessarily depend on the magnitude of the job's computational requirements but instead on the configuration and runtime of the underlying platform [START_REF] Dean | Mapreduce: simplified data processing on large clusters[END_REF]. Causes for straggling jobs include run-time contention phenomena among CPU cores, processor caches, memory bandwidth, network bandwidth [START_REF] Xu | Small is better: Avoiding latency traps in virtualized data centers[END_REF][START_REF] Ananthanarayanan | Why let resources idle? aggressive cloning of jobs with dolly[END_REF]; bugs and errors in code [START_REF] Dean | Mapreduce: simplified data processing on large clusters[END_REF]; unfortunate disk seek times or head locations [START_REF] Huang | Fs2: Dynamic data replication in free disk space for improving disk performance and energy consumption[END_REF]; or, energy requirements, power and temperature constraints, and maintenance activities [START_REF] Dean | The tail at scale[END_REF]. All of which can cause a job to straggle significantly beyond its inherent computational requirement.

To mitigate the effect of stragglers on system-wide performance, researchers are currently proposing redundant, or hedged, requests [START_REF] Ananthanarayanan | Reining in the outliers in map-reduce clusters using mantri[END_REF][START_REF] Dean | The tail at scale[END_REF][START_REF] Huang | Fs2: Dynamic data replication in free disk space for improving disk performance and energy consumption[END_REF][START_REF] Vulimiri | Low latency via redundancy[END_REF][START_REF] Ren | Hopper: Decentralized speculation-aware cluster scheduling at scale[END_REF][START_REF] Ananthanarayanan | Effective straggler mitigation: Attack of the clones[END_REF]. In this respect, there are two underlying principles: either replicate "replicate a job upon its arrival and use the results from whichever replica responds first", [START_REF] Dean | The tail at scale[END_REF]; or speculate "replicate a job as soon as the system detects it as a straggler ", [START_REF] Ananthanarayanan | Reining in the outliers in map-reduce clusters using mantri[END_REF].

The former is referred to as job replication, and here all redundant replicas are usually canceled as soon as one completes or starts service. The latter is referred to as job speculation [START_REF] Zaharia | Improving mapreduce performance in heterogeneous environments[END_REF], and here long jobs are usually killed after some time and replicated elsewhere. Clearly, the straggler detection monitor, or timeout rule, needs to be smart enough to distinguish between jobs whose intrinsic size is large and jobs that are taking longer than expected to complete because of some unfortunate runtime phenomenon. There is increased interest in replication as it is employed by Google's BigTable, while the speculation principle is used in Apache Spark and Hadoop MapReduce. 1 For instance, it was reported in [START_REF] Ren | Hopper: Decentralized speculation-aware cluster scheduling at scale[END_REF] that speculative tasks account for 25% of all tasks in Facebook's Hadoop cluster.

Both principles provide effective mitigation techniques for the straggler problem but which one is preferable is not currently clear. Replication may lead to significant additional resource costs while speculation may increase latency. One advantage of speculation is that only the long jobs are replicated, though this may come at the cost of an increased latency because a cloned job is executed after the system detected it as a straggler. Our objective is to provide the first theoretical framework for speculation in a stochastic and dynamic setting. We then use this to understand the impact of speculation and how to optimize its performance.

Recently, a number of theoretical works appeared in the literature for evaluating the performance of replication-based schemes in a stochastic and dynamic setting; see Section 2 for a review. These consider systems that replicate on arrival. Speculation, however, has received far less attention.

Model, Results and Contributions

In this paper, we develop the first theoretical framework for evaluating the delay performance achieved by the speculation principle in a queueing network. We consider a stochastic system of parallel queues, each with its own server. Upon arrival, each job is dispatched to a random queue and, when a job's service is first initiated, a timeout is set. If the timeout is reached and the job is not completed, then the job is killed and re-routed to another randomly selected queue where it must be completed.

Our first result, Theorem 1, characterizes the stability region induced by speculation. We show that speculative queueing networks are stable (positive Harris recurrent2 ) under the usual stability condition: that is, the nominal load at each queue is less than one. This result is non-trivial because: i) our network includes feedback mechanisms with mixture of different job size distributions; ii) we consider a general class of work-conserving scheduling disciplines and service time distributions; and iii) the stability region found differs from the one achieved by standard load balancing schemes such as join-the-shortest-queue. It is well known that under i) and ii) the "usual" stability condition may not be sufficient for positive recurrence [START_REF] Bramson | Instability of fifo queueing networks[END_REF][START_REF] Seidman | first come, first served" can be unstable![END_REF][START_REF] Gamarnik | Instability in stochastic and fluid queueing networks[END_REF].

Since timeouts induce a controllable constraint on the processing time of each job, we then consider the problem of optimal timeout design. First, we note that speculation can increase the system load and thus decrease the stability region, because part of the job is effectively served twice. Therefore, in Theorem 2, we derive criteria for speculation to increase the stability region and show that these criteria are satisfied in realistic scenarios. Then, we investigate optimal design and characterize the timeout that maximizes the size of the stability region in terms of a non-linear one-dimensional equation given in Theorem 4. This optimal timeout can be easily solved numerically and in some cases also analytically.

Overall, we use our results to investigate the advantage of speculation by performing two comparisons:

• First, we compare speculative and standard load balancing in the stationary regime; "standard" means no replication and no speculation, though dynamic information between servers and dispatcher(s) can be exchanged, as in power-of-d. We establish when it is advantageous to introduce timeouts as means to improve performance in an existing standard load balancing system. An immediate consequence of Theorem 1 is that a timeout increases the stability region if and only if the expected remaining time of the current execution is greater than the conditional expected service time at the second queue. We find large sets of timeouts having this property for important classes of service time distributions; e.g., Pareto, hyper-exponential and bimodal, see Section 5.1. We can then refine this analysis to give the optimal timeout for a given distribution in Theorem 4.

• Second, we compare speculation and replication in the stationary regime. This comparison is difficult to perform analytically because a satisfactory characterization of the stability region induced by replication is currently unknown even when considering homogeneous servers, outside special cases; see [START_REF] Raaijmakers | Achievable stability in redundancy systems[END_REF][START_REF] Mendelson | A lower bound on the stability region of redundancy-d with fifo service discipline[END_REF][START_REF] Raaijmakers | Redundancy scheduling with scaled bernoulli service requirements[END_REF][START_REF] Anton | On the stability of redundancy models[END_REF] and Section 2 for further details. However, we can provide reasoning and scenarios where speculation will improve response times when compared with replication. In particular, replication is bad when the shortest replica is stuck in queue, and instead service is completed by serving one or more larger replicas. The reasoning bears out in numerical simulations. Although replication provides better average response times in a light-load regime, which is to be expected, a large number of simulations indicate that speculative load balancing with the optimal timeout yields an increased stability region and short response times over a wide range of loads.

Our work is the first developing either of the above comparisons. Concisely, in terms of stability we find that speculative load balancing can be more advantageous than standard load balancing and replication.

Organization

The remainder of the paper is organized as follows. In Section 2, we review the relevant literature. In Section 3, we introduce speculative queueing networks. In Section 4, we present our stability theorem. In Section 5, we address the problem of designing optimal timeouts and compare the stability region achieved within our approach with standard load balancing and existing replication schemes. In Section 6, we present a conjecture about the mean waiting time obtained when servers are homogeneous. Finally, Section 7 draws the conclusions of this work and outlines further research.

Literature Review

Over the last decade there has been interest in the performance analysis of policies that dispatch to the shortest among a set of queues, for instance, power-of-two-choices and join-the-idle-queue; see [START_REF] Van Der Boor | Scalable load balancing in networked systems: A survey of recent advances[END_REF] for a survey. However, more recently there has been an increased focus on job replication and in the following, we review existing replication approaches; for further details, we refer the reader to the recent survey [START_REF] Gardner | Product forms for fcfs queueing models with arbitrary server-job compatibilities: An overview[END_REF].

Within replication, multiple replicas of a job are placed at different servers and redundant replicas are canceled, either when the first replica completes service (cancel-on-completion) or when the first replica initiates service (cancel-on-start). It is striking that both cancel-on-start and cancel-on-complete redundancy models are analytically tractable under independent exponentially distributed job sizes. This is first shown for cancel-on-complete in [START_REF] Gardner | Queueing with redundant requests: exact analysis[END_REF], where the reversibility results of the order-independent queue [START_REF] Berezner | Quasi-reversible multiclass queues with order independent departure rates[END_REF] are applied. The stationary distribution for cancel-on-start is found in [START_REF] Ayesta | On redundancy-d with cancel-on-start aka join-shortest-work (d)[END_REF], which applies results from [START_REF] Visschers | A product form solution to a system with multi-type jobs and multi-type servers[END_REF]. The paper [START_REF] Joshi | Efficient redundancy techniques for latency reduction in cloud systems[END_REF] is the first to analyze the latency and computing cost of the cancel-on-start and cancel-on-finish redundancy strategies. Subsequent works expand these results and thus our understanding of redundancy models [START_REF] Gardner | Redundancy-d: The power of d choices for redundancy[END_REF]. The stationary distributions found are fully explicit; however, it is often hard to derive tractable formulas for key performance metrics. For this reason, existing works develop diffusion limits and mean field approximations for these models [START_REF] Cardinaels | Redundancy scheduling with locally stable compatibility graphs[END_REF][START_REF] Hellemans | Heavy traffic analysis of the mean response time for load balancing policies in the mean field regime[END_REF]. Under i.i.d. exponential replica sizes, it is noted that there is neither loss nor gain of capacity due to redundancy job replication [START_REF] Bonald | Balanced fair resource sharing in computer clusters[END_REF]. However, it is also noted in [START_REF] Gardner | A better model for job redundancy: Decoupling server slowdown and job size[END_REF] that the independent exponential distributed job sizes is not a reasonable assumption, as job sizes will be correlated and slow service tends to result in heavy tailed service times. For this reason, works investigate the impact of replication under a variety of job size distributions and service disciplines [START_REF] Hellemans | Performance of redundancy (d) with identical/independent replicas[END_REF]. The results in [START_REF] Raaijmakers | Achievable stability in redundancy systems[END_REF][START_REF] Anton | On the stability of redundancy models[END_REF] find that in general capacity is lost due to increased utilization of redundant jobs, though a full understanding of the stability region induced by cancel-on-completion schemes is currently unclear; see also [START_REF] Mendelson | A lower bound on the stability region of redundancy-d with fifo service discipline[END_REF].

Another similar approach is delayed replication. Here, each job is sent to an arbitrary server and if the server has not finished service of this job within some fixed time that includes both waiting and service, the job is replicated elsewhere. From the point of view of a single queue, this approach is somewhat equivalent to a queueing system with abandonments or reneging [START_REF] Haight | Queueing with reneging[END_REF]. Delayed replication is investigated in [START_REF] Hellemans | Performance analysis of workload dependent load balancing policies[END_REF] for homogeneous servers and under the assumption of "asymptotic independence", though the structure of the resulting stability region is not explicited.

While several recent works investigate replication, studies of speculation are largely empirical and analyze the performance and dependencies of specific platform implementations [START_REF] Ananthanarayanan | Reining in the outliers in map-reduce clusters using mantri[END_REF][START_REF] Dean | The tail at scale[END_REF][START_REF] Huang | Fs2: Dynamic data replication in free disk space for improving disk performance and energy consumption[END_REF][START_REF] Vulimiri | Low latency via redundancy[END_REF][START_REF] Ren | Hopper: Decentralized speculation-aware cluster scheduling at scale[END_REF][START_REF] Ananthanarayanan | Effective straggler mitigation: Attack of the clones[END_REF][START_REF] Ren | Hopper: Decentralized speculation-aware cluster scheduling at scale[END_REF]. An early analysis of timeouts in queueing is given by [START_REF] Harchol-Balter | Task assignment with unknown duration[END_REF], where all jobs initially join a single queue and then jobs that timeout are sequentially sent along a line of further queues. Some existing theoretical works focus on static settings with a finite number of jobs and no queueing [START_REF] Akta | Straggler mitigation at scale[END_REF][START_REF] Wang | Efficient straggler replication in large-scale parallel computing[END_REF][START_REF] Aktas | Straggler mitigation by delayed relaunch of tasks[END_REF].

The queueing and stability behavior of job speculation is not well-understood and we investigate its impact. We investigate stability using the fluid limit approach of Dai [START_REF] Dai | On positive harris recurrence of multiclass queueing networks: a unified approach via fluid limit models[END_REF][START_REF] Bramson | Stability of queueing networks[END_REF]. We note that job sizes at different queues change due to both timeouts and correlations between jobs. In general, such networks can exhibit non-standard stability behavior; see, for instance, Bramson [START_REF] Bramson | Instability of fifo queueing networks[END_REF]. Although stability is non-trivial for these networks, we find that stability still holds when the nominal load is below one. This is important as the nominal load can be reduced through the use of speculation.

Further, we characterize the optimal timeout for a speculative load-balancing network. Again there are few works that investigate optimal timeouts, though we note that the paper [START_REF] Xu | Optimization for speculative execution in big data processing clusters[END_REF] provide upper and lower bounds for a constrained utility optimization. This is then approximated for a timeout optimization under independent task-based service time distributions and in the presence of idle servers. In contrast, we consider a queueing framework under an S&X model where the optimal timeout minimizes load and thus maximizes stability. The use of Markov decision processes and optimal stopping theory [START_REF] Peskir | Optimal stopping and free-boundary problems[END_REF] analysis appears to be somewhat new to this line of literature. We note the contemporaneous work of [START_REF] Joshi | Synergy via redundancy: Adaptive replication strategies and fundamental limits[END_REF] consider a discrete time MDP formulation of optimal replication. This approach (along with associated implications for reinforcement learning and load balancing) would seem an important area of future investigation.

Speculative Queueing Network

We consider a network composed of N queues working in parallel. Queues have an infinite buffer, are workconserving and are heterogeneous, in the sense that they process jobs at possibly different rates. Specifically, queue i processes jobs with rate µ i > 0, i = 1, . . . , N , and without loss of generality we assume that N i=1 µ i = d. Jobs join the network via an exogenous Poisson process with rate λN and are initially dispatched to queue i independently with probability p 0,i . When a job starts its execution on its designated queue, say i, a clock is initialized and a timeout, τ i , is set. If the timeout is reached and the job has not completed, then it is killed and re-routed independently to another queue where it is either resumed or re-executed from scratch. At this second queue, the job is then served until complete and leaves the network afterwards.

Dynamics and Assumptions

Let τ := (τ 1 , . . . , τ N ) ∈ R d + denote the timeout vector. The n-th job that joins the network has associated the random variables: ξ(n) ∈ R + , the interarrival time between the n-th and (n -1)-th jobs; η(n) := (η 1 (n), η 2 (n)), the service requirements of job n where η j (n) ∈ R + represents the service time associated to its j-th execution if processed at unit rate; (n) := ( 1 (n), 2 (n)), where j (n) ∈ {1, . . . , N } denotes the queue associated to the j-th visit performed by job n; and τ (n) := τ 1(n) , the timeout of job n.

On the event

η 1 (n) µ 1(n) ≤ τ (n),
job n completes service at 1 (n) before the timeout τ (n) is reached and it leaves the network. In this case, the random variables η 2 (n) and 2 (n) are not used. On the complementary event, job n is re-routed to queue 2 (n) where it receives service for η2(n) µ 2 (n) time units and leaves the network afterwards. Within this notation, the primitive sequences driving the dynamics of the stochastic network under investigation are {ξ(n), n ≥ 1}, {η(n), n ≥ 1} and { (n), n ≥ 1}, all defined on a common probability space. We assume that these sequences are i.i.d. and mutually independent. We note however that, for fixed n, η 1 (n) and η 2 (n) may have arbitrary dependency. For simplicity of notation, we will refer to η 1 (1) and η 2 (1) simply as η 1 and η 2 , respectively. Because η 1 and η 2 may be dependent and have a possibly different distribution, this allows us to models two different scenarios:

• η 1 and η 2 are equal in distribution: upon re-routing, the job is killed and then re-started from scratch • η 2 is stochastically smaller than η 1 : upon re-routing, the job is stopped and then resumed.

The case of identical replicas, i.e., η 1 = η 2 (ω-per-ω) is permitted but it should be clear that in this case speculation does not help because the amount of work to be done does not change after re-routing. We remark that speculation is motivated by the fact that something can go wrong on the servers' runtimes, i.e., a given job may have different service times if executed on different machines. This rules out the case of identical replicas. We also require that E[η 1 (n) + η 2 (n)] < ∞ and that P( η1 µi ≤ τ i ) > 0 for all i, which means that jobs complete and have a chance of completing before the timeout.

We assume that each ξ(n) is exponentially distributed with mean (λN ) -1 , so that arrivals occur according to a Poisson process of rate λN . For all i, j ∈ {1, . . . , N }, let p i,j := P( 2 (n) = j | 1 (n) = i). We assume that p i,j = p 1,j for all i, i.e., the internal routing probabilities depend on the destination j but not on the source i. This assumption makes all jobs 'homogeneous in terms of re-routing' and is required in the proof of Theorem 2; without this assumption, the proposed queueing network may be unstable even under the usual stability condition, as in [START_REF] Bramson | Instability of fifo queueing networks[END_REF].

Since queues speculate on service times, we refer to the proposed model as a speculative queueing network.

Scheduling Disciplines

Each queue operates under a work-conserving head-of-the-line scheduling discipline. We recall that a service discipline is head-of-the-line if within each class at the queue jobs are served in order their arrival [START_REF] Bramson | Stability of queueing networks[END_REF]. This includes First-come first-served (FCFS), Head-of-the-line processor-sharing (HLPS) or class-based priority disciplines. On the other hand, Processor-Sharing (PS) is excluded, though we believe that the results presented in this paper apply by a separate argument [START_REF] Kelly | Reversibility and Stochastic Networks[END_REF]Section 3.3]; due to page constraints, we do not discuss this. In our framework, the class of a job refers to the queue that the job is at and whether the job has been timed-out or not; see Section 4.1 for further details. With a class-based priority discipline, jobs are ranked according to their class. The higher the rank, the higher the priority. Depending on whether the discipline is preemptive or not, the job in execution may be stopped if a job with higher priority arrives. For instance, within a given queue, a job that has been re-routed may be given higher (or lower) priority than job that have currently visited only one queue. We observe that some scheduling disciplines may process more than one job at a time. In this case, the clock associated to the execution of each job does not increase linearly over time, but in relation to the processing capacity devoted to the execution of the job itself.

Further Notation

We use the convention that products (resp. sums) over empty sets are one (resp. zero). The set of non-negative real numbers is denoted by R + . The indicator function of A is denoted by I A . We use | • | to denote set cardinality and • to denote the L 1 norm. We let p 0 := (p 0,i : i = 1, ..., N ) and p 1 := (p 1,i : i = 1, ..., N ) denote the routing probability vectors upon job arrival in the network and rerouting, respectively. Unless specified otherwise, indices i and j will range over {1, . . . , N }. For a, b ∈ R, (a) + = max{a, 0}, a ∧ b = min{a, b} and a ∨ b = max{a, b}. For a differentiable function t → f (t), f (t) denotes its derivative in t.

Stability

In this section, we first provide a multiclass representation of the speculative queueing network introduced in previous section and show that this representation belongs to the family of queueing networks investigated in [START_REF] Dai | On positive harris recurrence of multiclass queueing networks: a unified approach via fluid limit models[END_REF]. This will allow us to use Theorem 4.2 of [START_REF] Dai | On positive harris recurrence of multiclass queueing networks: a unified approach via fluid limit models[END_REF], which provides a criterion to establish the stability (positive Harris recurrence) of the Markov process, say X, describing the dynamics of the network under investigation. This criterion is expressed in terms of an associated fluid model, which we define below.

Multiclass Representation

We now provide a multiclass representation of our queueing network described in Section 3.1 where classes are used to distinguish between jobs that have timeout or not. The advantage of this is that we can directly represent jobs within the framework of Dai [START_REF] Dai | On positive harris recurrence of multiclass queueing networks: a unified approach via fluid limit models[END_REF] and Bramson [START_REF] Bramson | Stability of queueing networks[END_REF]. Thus we can analyze our fluid model as a fluid limit as expressed within that framework.

Let us consider the set of classes

K := K 1 ∪ K 2 where K 1 := {(k, i) : k ∈ {c, u}, 1 ≤ i ≤ N } and K 2 := {(i, j) : 1 ≤ i, j ≤ N } represent
the set of exogenous and endogenous classes, respectively. Further, we use 'c' for jobs that will complete service at their first queue, and 'u' for jobs that will receive uncompleted service at their first queue (and thus will timeout). On the same probability space used to define the speculative queueing network above, we now construct a queueing network composed of such classes.

Jobs enter the network through class (c, i) ∈ K 1 or (u, i) ∈ K 1 for i = 1, ..., N . These jobs join queue i and, after processing at i, a class-(c, i) job leaves the network, while a class-(u, i) job is re-routed and joins queue j as a class (i, j) ∈ K 2 job with probability p i,j .

The inter-arrival times of jobs in class (c, i) ∈ K 1 follow a Poisson process that is obtained by thinning the Poisson process associated to {ξ(n), n ≥ 1} with respect to the Bernoulli process {B c,i n , n ≥ 1} where

B c,i n := I 1(n)=i, η1(n) µi ≤τi
.

Under the Poisson thinning (aka splitting) property, the set of service times of class-(c, i) jobs can be equivalently obtained by sampling independently from the distribution of ( η1 µi | η1 µi ≤ τ i ). Similarly, the interarrival times of jobs in class (u, i) ∈ K 1 follow a Poisson process that is obtained by thinning the Poisson process associated to {ξ(n), n ≥ 1} with respect to the Bernoulli process {B u,i n , n ≥ 1} where

B u,i n := I 1(n)=i, η1(n) µi >τi
and they have deterministic service times equal to τ i . Under the Poisson thinning property, the set of service times of class-(i, j) jobs can be equivalently obtained by sampling independently from the distribution of ( η2 µj | η1 µi > τ i ). The dynamics (routing decisions, arrival and service times) of the multiclass network above are equivalent to the dynamics of the speculative queueing network introduced in Section 3. Equivalences of this type are commonly applied in the analysis of queueing networks; for instance, see Section 2.7 of [START_REF] Dai | Processing Networks: Fluid Models and Stability[END_REF].

Markov and Fluid Model

We now define a continuous-time Markov process X(t) that describes the dynamics of the multiclass queueing network described above. Specifically, taken to be right continuous, consider the pair

X(t) := (Q(t), V (t)). (1)
Here,

Q(t) = (Q 1 (t), . . . , Q N (t)) and Q i (t) = (k i,1 , k i,2 , ..., k i,Qi(t) )
where k i,n ∈ K gives the class of the n-th job in queue i and Q i (t) is the total number of jobs at queue i. This captures how jobs are lined up in queue i. Also

V (t) = (V k (t) : k ∈ K) with V k (t)
denoting the remaining service time of the class-k job in execution and with the convention that V k (t) = 0 if such job does not exist.

The process X = {X(t), t ≥ 0}, living on state space X , is a piecewise deterministic Markov process (PDMP) and satisfies the strong Markov property; see page 362 in [START_REF] Davis | Piecewise-deterministic markov processes: A general class of non-diffusion stochastic models[END_REF]. If X is positive Harris recurrent, we recall that a unique ergodic stationary distribution π exists and

lim t→∞ 1 t t 0 Q i (s) ds = X q i (x) π(dx) (2)
almost surely, for any initial configuration, where Q i (t) is the queue length of server i at time t and q i (x) is the queue length of server i for network state x ∈ X . Now, we define a fluid model for the dynamics of the queueing network under investigation. For

t ∈ R + , let Q(t) = (Q k (t), k ∈ K), T (t) = (T k (t), k ∈ K) and I(t) = (I i (t), i = 1, . . .

, N ) and consider the following conditions

Q c,i (t) = Q c,i (0) + λdp 0,i P(η 1 ≤ τ i µ i ) t - (T c,i (t) -V c,i ) + E[ η1 µi | η1 µi ≤ τ i ] ≥ 0 (3) Q u,i (t) = Q u,i (0) + λdp 0,i P(η 1 > τ i µ i ) t - (T u,i (t) -V u,i ) + τ i ≥ 0 (4) Q j,i (t) = Q j,i (0) - (T j,i (t) -V j,i ) + E[ η2 µi | η1 µj > τ j ] + p j,i τ j (T u,j (t) -V u,j ) + ≥ 0, ∀(j, i) ∈ K 2 (5)
T k (t) is nondecreasing and starts from zero, ∀k ∈ K (6)

I i (t) = t -T c,i (t) -Tu,i (t) - j =i T j,i (t) is nondecreasing (7) ∞ 0 Q c,i (t) + Q u,i (t) + j =i Q j,i (t) dI i (t) = 0 (8)
for all i ∈ {1, . . . , N } where (x) + = max(x, 0) and V ∈ R |K| + is interpreted as the remaining service time vector. These conditions define our fluid solutions. A fluid solution is any solution (Q(•), T (•)) to ( 3)- [START_REF] Barroso | The Datacenter as a Computer: An Introduction to the Design of Warehouse-Scale Machines[END_REF]. The quantities in (3)-( 7) have the following interpretation: at the fluid scale, Q k (t) is the amount of jobs of class k at time t, T k (t) is the cumulative time dedicated to the processing of class k jobs by time t, and I i (t) is the cumulative idle time of queue i by time t. For instance, Equation (4) says that the fluid amount of class-(u, i) jobs increases with rate λdp 0,i P(η 1 > τ i µ i ) due to external arrivals and decreases by

(T u,i (t)-V u,i ) + τi
as these jobs stay in queue i for τ i time units. Similar interpretations are easily obtained for Q c,i (t) and Q j,i (t). Equation ( 8) is therefore interpreted as the work-conserving condition.

Remark 1. The set of fluid solutions associated to a speculative queueing network is identical to the set of fluid solutions associated to its corresponding multiclass queueing network where the routing and service processes are independent; see Formulas (4.17)-(4.21) in [START_REF] Dai | On positive harris recurrence of multiclass queueing networks: a unified approach via fluid limit models[END_REF].

From the above remark and from Theorem 4.1 of [START_REF] Dai | On positive harris recurrence of multiclass queueing networks: a unified approach via fluid limit models[END_REF], it follows that the fluid model equations are the limit equations satisfied by a speculative queueing network. We refer the reader to Theorem 4.1 for a formal statement and proof of this fluid limit argument, from which our stated fluid model follows as a direct consequence.

We now define stability for the fluid model.

Definition 1. We say that the fluid model is stable if there exists a constant δ > 0 such that for any fluid solution with Q(0) + U + V = 1, it holds that Q(t + δ) = 0 for all t > 0.

The constant δ above may depend on all model parameters but not on the initial state.

The following theorem connects fluid model stability with X(t) being positive Harris recurrent and was first proved in [START_REF] Dai | On positive harris recurrence of multiclass queueing networks: a unified approach via fluid limit models[END_REF]. Proposition 1 (Dai [START_REF] Dai | On positive harris recurrence of multiclass queueing networks: a unified approach via fluid limit models[END_REF]; Bramson [START_REF] Bramson | Stability of queueing networks[END_REF]). Assume that (3)-( 8) hold. If the fluid model solutions is stable, then X(t) is positive Harris recurrent.

The proposition follows from Theorem 4.16 of Bramson [START_REF] Bramson | Stability of queueing networks[END_REF]. In the Appendix, we give a proof that essentially explains how our model fits within the framework in [START_REF] Bramson | Stability of queueing networks[END_REF]. We note that there are some aspects of our model that are non-standard within the usual fluid stability framework: i) jobs are routed according to their size rather than according to an independent mechanism, and ii) the size of jobs within a queue can have a different probability distribution (jobs having non-identical distributions within a multi-class queue can impact stability, see the well-known counter-example of Bramson [START_REF] Bramson | Instability of fifo queueing networks[END_REF]). However, in our case, it is possible to segment arrivals into an extended set of job classes as described in Section 4.1. This yields the required independence properties for routing probabilities for jobs within each class. This deals with part i) above. For part ii), we note that fluid stability remains sufficient for positive recurrence so long as we have a Markovian state description and head-of-the-line service within each class. Each of these apply to our model and therefore what remains is to prove the stability of the fluid model. This result is stated below.

Fluid Stability and Positive Harris Recurrence

We now state our main result on stability. Let

ρ i := λN p 0,i E η 1 µ i ∧ τ i + λN N j=1 p 0,j p 1,i P(η 1 > µ j τ j )E η 2 µ i η 1 µ j > τ j (9)
be the nominal load of queue i, for all i. This accounts for the work from both speculative and non-speculative jobs.

The following result shows that the Markov process of interest is stable under the condition that ρ i < 1 for all i. Our proof is based on Proposition 1 and on a Lyapunov argument; see the Appendix. Theorem 1. For all i, assume that ρ i < 1. Then, X is positive Harris recurrent.

Within the proposed queueing network, the mean service time of a job depends on the number of visits currently performed in the network and that the network topology is not feedforward. In these cases, it is well known that the usual stability condition is in general not sufficient to make the underlying Markov process positive Harris recurrent. A counterexample with Poisson arrivals, exponentially distributed service times and two FCFS queues is the reentrant line developed in [START_REF] Bramson | Instability of fifo queueing networks[END_REF]; see also [START_REF] Seidman | first come, first served" can be unstable![END_REF][START_REF] Gamarnik | Instability in stochastic and fluid queueing networks[END_REF].

We note that the stability condition in Theorem 1 differs from the "usual" condition λN p 0,i /µ i < 1, which is the nominal stability condition when no timeout is set (no speculation). It is thus natural to investigate which approach yields the largest stability region. This is one of the objectives of the following section.

Timeout Design

In this section, we rely on Theorem 1 to perform some optimization and understand the advantages of speculative load balancing. Specifically, since timeouts and routing probabilities are under the control of the network manager, we investigate whether or not it is possible to design them in a manner such that the resulting stability region is larger than the stability region achieved by i) standard load balancing; i.e., no replication and no speculation, though servers and dispatcher(s) can exchange dynamic control messages as in join-the-shortest-queue;

ii) other replication schemes based on the principle "replicate upon job arrivals".

Remark 2. We will address the question above when servers are homogeneous, that is µ i = 1 for all i. The heterogeneous case can be handled as well but at the cost of complicating the exposition unnecessarily. For this reason, we limit this application of Theorem 1 to the homogeneous case only.

Given τ ∈ R + , let us define ρ(τ ) := λE[η 1 ∧ τ ] + λP(η 1 > τ )E[η 2 | η 1 > τ ] (10)
and note that ρ(τ ) = ρ i if the routing probabilities are identical and all timeouts are equal to τ .

The following proposition says that if servers are homogeneous, then it is optimal to choose identical timeouts and routing probabilities; see the Appendix for a proof.

Proposition 2. If µ i = 1 for all i, then inf τ ∈R+ ρ(τ ) = inf max i ρ i ( 11
)
where ρ(τ ) is defined in [START_REF] Bertsekas | Dynamic programming and optimal control 3rd edition, volume ii[END_REF] and the second inf is taken over all stochastic routing vectors p 0 , p 1 ∈ R N + and timeout vectors τ ∈ R N + . In view of Proposition 2, in the analysis that follows we will require the following assumption, which implies that the speculative queueing network is symmetric.

Assumption 1 (Symmetric network). For all i, µ i = 1, p 0,i = p 1,i = 1 N and τ i = τ , for some τ ∈ R + . In the following, we first investigate scenarios where timeouts help to increase the stability region with respect to standard load balancing. Then, we characterize an optimal timeout and provide numerical simulations to compare the performance of speculation with existing replication schemes.

Speculation vs Standard Load Balancing

Under Assumption 1, we investigate when the proposed approach yields an increased stability region with respect to standard load balancing. In the latter case, it is well known that λE[η 1 ] < 1 is the necessary and sufficient stability condition for the Markov process that models the dynamics induced by several dispatching algorithms such as join-the-shortest-queue. Therefore, given Theorem 1, we aim at finding τ ∈ R + such that

ρ(τ ) < λE[η 1 ]. ( 12
)
This problem can be easily addressed at least numerically once probability distributions for the η i 's are known. Nonetheless, in this section our aim is to find insights and general conditions ensuring that (12) holds.

We have the first general condition; see the Appendix for a proof.

Theorem 2. Let Assumption 1 hold. Then, ρ(τ

) < λE[η 1 ] if and only if E[η 2 | η 1 > τ ] < E[η 1 -τ | η 1 > τ ]. ( 13
)
The inequality (13) admits a simple interpretation because the RHS term is the expected remaining service time of the job in progress after age τ and the LHS term is the expected service time of a second execution if the job would timeout at τ .

We now derive a further condition introducing some structure on the service time random variables η i , i = 1, 2. In the following, S, S 1 , S 2 and X are four auxiliary nonnegative random variables each independent of all else and such that S, S 1 and S 2 are equal in distribution.

Assumption 2 (The "S&X" model).

For i = 1, 2, η i = S i X.
The service time structure in Assumption 2 was first introduced in [START_REF] Gardner | A better model for job redundancy: Decoupling server slowdown and job size[END_REF]: X is interpreted as a job's intrinsic size and S i represents the server slowdown incurred by a job's i-th execution. An important special case is obtained when X is deterministic, which models systems where the service time variability is only due to server runtime phenomena. Here, the service times associated to the execution of a job are independent; a line of papers investigate this case, e.g., [START_REF] Gardner | Redundancy-d: The power of d choices for redundancy[END_REF][START_REF] Raaijmakers | Redundancy scheduling with scaled bernoulli service requirements[END_REF].

Remark 3. Assumption 2 models the case where jobs are re-executed from scratch after re-routing and rules out the possibility that they may be resumed. This is a worst case in our respect because speculation (and our model) allows jobs to be resumed after re-routing, and the stability region obtained by resuming jobs is clearly increased.

We will also make use of the following assumption.

Assumption 3. For some z ∈ R + , E [Sx ∧ z] < P (Sx ≤ z) E[S] x, ∀x ∈ support(X). ( 14
)
The following result, proven in the Appendix, provides a sufficient condition for which speculation yields an increased stability region with respect to standard load balancing. Theorem 3. Let Assumptions 1 and 2 hold. Then, ρ(z) < λE[η 1 ] for all z ∈ R + that satisfy Assumption 3. Furthermore, if X is deterministic, then Assumption 3 is also necessary to have ρ(z) < λE[η 1 ].

Theorem 3 shows that Assumption 3 is almost the requirement for speculation to increase the size of the stability region and we now briefly discuss it. Towards this purpose, let T S,X be the set of z ∈ R + such that (14) holds. Assuming that X = 1, it is not difficult to show that:

1. If S is s m with probability p and s M > s m with probability 1 -p (a bimodal distribution), then T S,X = (s m , (s M -s m )p); typically, s M s m and p ≈ 0.99 [8, Section 2.6.4], and therefore T S,X is not empty in practice.

2. If S follows a nondegenerate hyperexponential distribution, then T S,X = (0, ∞); 15), under a number of S&X models.

3. If S ∼ Pareto(α, s m ), where α > 1 and s m respectively denote the shape and scale parameters, then T S,X = (αs m , ∞).

On the other hand, if X = 1 and S follows the "more deterministic" Erlang distribution, then one can show that T S,X is empty and in this case Theorem 3 implies that speculation loses capacity. Now, let

L(τ ) := ρ(τ ) λE[η 1 ] . (15)
If L(τ ) < 1, then L(τ ) can be interpreted as the load reduction with respect to standard load balancing when adopting timeout τ . As in Section 2.6.4 of [START_REF] Barroso | The Datacenter as a Computer: An Introduction to the Design of Warehouse-Scale Machines[END_REF], let us assume that S = 10 w.p. 0.99 10 3 w.p. 0.01, [START_REF] Dai | Processing Networks: Fluid Models and Stability[END_REF] i.e., S follows a bimodal distribution. By increasing the timeout τ , Figure 1 plots L(τ ) under a number of combinations on the distributions of S and X. For the Pareto distribution, we have chosen s m = 1 and α ∈ {1.1, 1.5}; it is known that α ∈ [1, 1.5] is the most common range [START_REF] Ananthanarayanan | Effective straggler mitigation: Attack of the clones[END_REF][START_REF] Ananthanarayanan | Why let resources idle? aggressive cloning of jobs with dolly[END_REF][START_REF] Harchol-Balter | Surprising results on task assignment in server farms with high-variability workloads[END_REF]. For the hyperexponential distribution, we have chosen two phases with balanced means, as in [START_REF] Harchol-Balter | Surprising results on task assignment in server farms with high-variability workloads[END_REF]. Specifically, the probability and rate vectors are [0.99, 0.01] and [1, 1/99], respectively. If timeouts are too small, Figure 1 shows that speculation may loose capacity (L(τ ) > 1), and this is to be expected because jobs have almost no chance of completing before the timeout. If timeouts are large enough, however, they increase the size of the stability region (L(τ ) < 1). We notice that the timeouts that minimize the load can double the size of the stability region achieved by standard load balancing because within such timeouts L ≈ 0.5. When S has the bimodal form given in ( 16), this benefit is obtained whenever τ ∈ [10, 10 3 ) (if

X = 1), τ ∈ [13, 2 × 10 3 ) (if X ∼ Uniform([0,2])), and τ ∈ [13.5, ∞) (if X ∼ Exponential(1)
). When S is Pareto, we observe that L(τ ) decreases when α decreases for any given τ , i.e., timeouts are particularly helpful when the service time variability increases. When S is hyperexponential, we also observe that all timeouts reduces the load. This is in agreement with the statement in point 2) above. Since the set of τ 's ensuring that L(τ ) < 1 is somewhat large, we conclude that replication by speculation is robust with respect to small errors in service time distributions and thus that the system manager has some flexibility when designing a proper timeout rule.

An Optimal Timeout

Our stability result, Theorem 1, demonstrates that the load, ρ(τ ), is the key first order performance indicator for a speculative network. Theorems 2 and 3 show that timeouts can reduce load and thus increase capacity. Now, we investigate the minimizers of the load function τ → ρ(τ ), i.e., we characterize the optimal timeout. We address this problem under the following assumption. Assumption 4. We assume that η 1 has a probability density function f 1 (t) with a decreasing hazard function, i.e.,

t → f 1 (t) ∞ t f 1 (s)ds (17)
is decreasing. Further, we assume that η2 (t

) := E[η 2 |η 1 > t] is such that t → 1 + η 2 (t) η2 (t) (18)
is non-decreasing.

The function [START_REF] Dai | Stability and instability of fluid models for reentrant lines[END_REF] is the hazard function of a probability distribution and it is well-known that a decreasing hazard function is a characteristic of a heavy-tailed probability distribution. A trivial condition for ( 18) to be non-decreasing is that η 2 is independent of η 1 . This corresponds to the case where job sizes are fixed but variability in service occurs due to independent random events at each server. In this case, we note that [START_REF] Dai | Stability and instability of fluid models for reentrant lines[END_REF] states that the complementary CDF of η 1 is log-convex. This complements with the findings of [START_REF] Joshi | Efficient redundancy techniques for latency reduction in cloud systems[END_REF] where it is found that independent log-convex distributions service time distributions benefit from cancel-on-complete replication.

Let us define the optimal timeout as follows.

Definition 2 (Optimal Timeout). The optimal time τ is the smallest time such that

f 1 (τ ) ∞ τ f 1 (s)ds ≤ 1 + η 2 (τ ) η2 (τ ) . ( 19
)
If we assume that η 2 is independent of η 1 , then we notice that the optimal timeout rule reduces to the condition

f 1 (τ ) ∞ τ f 1 (s)ds = 1 E[η 2 ] . ( 20
)
Definition 2 provides a practical rule for speculation because it allows one to apply reinforcement learning or statistical estimation techniques to learn the optimal timeout when the service time distributions are not known in advance.

The following is our main result on optimal timeout design; see the Appendix for a proof.

Theorem 4. Let Assumptions 1 and 4 hold. Finite optimal timeouts (see Definition 2) exist and minimize the load ρ(τ ) induced on a speculative queueing network. Moreover, if, in addition, the service requirements η 1 and η 2 are independent, then any value of τ satisfying (20) minimizes the load.

Speculation vs Replication

We now compare the performance achieved by Speculative Load Balancing (SLB) with the performance achieved by strategies that replicate jobs at the time of their arrival in the network. We perform such comparison within the S&X model in Assumption 2, that is a worst case scenario for speculation in view of Remark 3. First, let us consider a setting where each incoming job is replicated to d queues selected uniformly at random and independently of anything else. Here, redundant replicas are canceled as soon as one either completes (Cancel-on-Complete) or starts (Cancel-on-Start) service. We refer to the former resp. latter scheme as CoC-d resp. CoS-d.

It is known that CoS-d is equivalent to the Least-Left-Workload-d (LLW-d) dispatching algorithm. We recall that LLW-d sends each incoming job to a queue having the shortest remaining workload among d selected uniformly at random, with ties broken randomly. Since stability for CoS-d is obtained if and only if λE[η 1 ] < 1, i.e., as in standard load balancing, we have the following remark. On the other hand, it is difficult to perform a comparison with CoC-d because a satisfactory characterization of the resulting stability region is currently unclear [START_REF] Raaijmakers | Achievable stability in redundancy systems[END_REF][START_REF] Mendelson | A lower bound on the stability region of redundancy-d with fifo service discipline[END_REF][START_REF] Raaijmakers | Redundancy scheduling with scaled bernoulli service requirements[END_REF]. However, depending on the load regime, we can argue intuitively as follows:

• Assume the network is lightly loaded, or over-provisioned. Then, the time spent in the system by a job with CoC-d is min(η 1 , . . . , η d ), where η c represents the service time of copy c = 1, . . . , d. This should be compared to η 1 ∧ τ + η 2 I {η1>τ } , the time spent by a job in a speculative queueing network within the same load condition. For any d ≥ 2, it is not difficult to show that3 min(η 1 , . . . , η d ) ≤ η 1 ∧τ +η 2 I {η1>τ } , which means that, in a lightly loaded regime, it is better to replicate upon job arrivals rather than speculate upon straggler detection. This claim should also be intuitive.

• Assume the network is moderately loaded. Then, within CoC-d it may happen that the first copy that completes is not the minimum and that the fast copy gets stuck in its queue. For instance, for a given job n, let us assume that η 2 (n) ≥ η 1 (n) and that the copy that completes first when applying CoC-d is the one of size η 2 (n). On the event η 1 (n) ≤ τ , speculation on that job induces a lower load and no price is paid for the extra copies.

• Assume the network is heavily loaded. When λ increases, the scenario depicted in the moderate load regime amplifies, potentially leading CoC-d to be unstable. Here, it is not intuitive which approach is better than the other.

To support the intuition above, we present the results obtained by running a large set of numerical simulations. In our tests, we assume the service time structure given in Assumption 2. Figure 2 plots the average response time (time spent in the system) obtained within SLB, CoC-d and CoS-d, for d = 2, 4 by increasing λE[η 1 ] while keeping E[η 1 ] constant and under a number of S&X models where E[X] = 1 and the random variable S is given by ( 16) (bimodal distribution) or follows a Pareto distribution with shape parameter α ∈ {1.1, 1.5, 2} over the support [1, 10 3 ]. For SLB, we have chosen the timeouts τ * specified in the respective subfigures. Each point ( * ) in each curve refers to an average of 50 simulations and each simulation executes 10 7 jobs. We also assume N = 50 FCFS queues.

The plots in Figure 2 confirm the intuition above. CoC-d provides the best results in light load conditions (as expected) and it also increases the stability region achieved by CoS-d, that is the stability region of standard join-the-shortest-queue-like algorithms (λE[η 1 ] < 1). However, in most cases, SLB goes further and is able to accommodate more traffic than CoC-d. For the most extreme heavy tailed distribution, Pareto with α = 1.1, CoC-2 eventually provides the best results, though within CoC-d is not clear how to well choose d a priori.

We now compare SLB with Redundant-to-Idle-Queue-d (RIQ-d), a replication scheme that works as CoC-d but replicas are only made to those servers which are idle, and if no idle server is found then the job is sent to a random one of the d selected; see [START_REF] Gardner | A better model for job redundancy: Decoupling server slowdown and job size[END_REF]. RIQ-d was introduced to avoid the potential loss of capacity of CoC-d, though at the same time we observe that it can ban its potential gain. We also notice that comparing SLB and RIQ-d is not completely fair because the latter scheme is dynamic in the sense that it needs dispatcher(s) and queues to continuously exchange information about servers' status. No feedback mechanisms to dispatcher(s) are assumed in SLB, though they could clearly be integrated to further reduce delays; we do not discuss this in this paper. Within the same setting described above, Figure 2 plots the average response time obtained within SLB and RIQ-d, for d = 2, 4 by increasing λE[η 1 ] while keeping E[η 1 ] constant. RIQ-4 provides slightly better results in light load conditions, which is to be expected because as λ ↓ 0 it behaves as CoC-4. As the load increases, however, it is less and less likely to find idle queues and the dynamics of RIQ-d get closer and closer to the dynamics of Random (RND), which sends each job to a single server selected independently at random. For the latter, the stability condition λE[η 1 ] < 1 applies, while SLB preserves stability much further.

Finally, we conclude this section with the following remark about the communication overhead induced by SLB, CoC-d, CoS-d and RIQ-d. SLB requires 1 + P(η 1 > τ ) < 2 control messages per job in average. On the other hand, CoC-d and CoS-d require, for each job, d dispatch messages plus d -1 cancellation messages.

S~Bimodal, X~Exponential

Response Time for Large Systems

In this section, we consider a symmetric (see Assumption 1) speculative queueing network composed of FCFS queues. Within these assumptions, let R N,n (τ ) be the overall time spent by the n-arriving job in the system and let

R N (τ ) := lim sup m→∞ 1 m m n=1 E[R N,n ] (21)
be the average response time experienced by jobs. In this section, our goal is to investigate R N (τ ). First, we observe that R N (∞) corresponds to the mean response time of an M/GI/1 queue. When τ < ∞, the feedback speculation mechanism significantly complicates the analysis and our aim is to develop an approximation. We focus on the large system limiting regime where N → ∞ and ρ(τ ) is constant. Defining where η2 is an auxiliary random variable equal in distribution to η 2 | η 1 > τ , we claim that the following conjecture holds true.

W := λ 2 (1 + P(η 1 ≥ τ )) M 1 -ρ(τ ) (22)
M := E[(η 1 ∧ τ ) 2 ] + E[η 2 2 ] P(η 1 > τ ) 1 + P(η 1 > τ ) (23)
Conjecture 1. Provided that ρ(τ ) < 1, lim N →∞ R N (τ ) = (1 + P(η 1 > τ ))W + ρ(τ ) λ . (24)
The underlying justification behind Conjecture 1 lies in postulating that queues become "asymptotically independent" in the limit N → ∞. In this case, the arrival process at each queue i is the superposition of an exogenous rate-λ Poisson process and N independent feedback processes each with rate λ P(η 1 > τ )/N . Given that the intensity of each of the feeback processes approaches zero as N → ∞, we may assume that their superposition is "approximately" a Poisson process with rate λ P(η 1 > τ ), provided that N is "large". This is justified by the Palm-Khinchine theorem, which ensures that the superposition of several independent sparse point processes converges weakly to a Poisson process on R + ; see [START_REF] Daniel | Stochastic Models in Operations Research: Stochastic Processes and Operating Characteristics[END_REF]Chapter 5.8]. Therefore, we conjecture that the arrival process at each queue i is the independent superposition of 1) a rate-λ Poisson process carrying jobs of sizes equal in distribution to η 1 and 2) a rate-λ P(η 1 > τ ) Poisson process carrying jobs of sizes equal in distribution to η 2 |η 1 ≥ τ . This queue can be interpreted as an M/G/1 queue where the arrival rate is λ + λ P(η 1 > τ ) and the service times are equal in distribution to H, where

H = η 1 ∧ τ w.p. 1 1+P(η1>τ ) η 2 | η 1 ≥ τ otherwise (25)
with η 1 equal in distribution to η 1 but independent of all else. Note that E[H 2 ] = M . Furthermore, the traffic intensity at this M/G/1 queue is (λ + λP(η 1 > τ ))E[H] = ρ(τ ) and the mean workload observed at arrival times is W , which follows by applying the Pollaczek-Khinchine formula. Conditioning on η 1 ≤ τ , the mean response time of a job is

W + E[η 1 | η 1 ≤ τ ], (26)
and conditioning on η 1 > τ , the mean response time of a job is

W + τ + W + E[η 1 | η 1 ≤ τ ], (27)
that is the time spent during the first visit, W + τ , plus the time spent during the second visit, [START_REF] Gardner | Queueing with redundant requests: exact analysis[END_REF] and ( 27) together, we get

W + E[η 1 | η 1 ≤ τ ]. Putting
P(η 1 ≤ τ )(W + E[η 1 | η 1 ≤ τ ]) + P(η 1 > τ )(2W + τ + E[η 2 |η 1 ≥ τ ]),
0.1 0.3 0.5 0.7 0.9 1 1. which after some algebra boils down to [START_REF] Gardner | Redundancy-d: The power of d choices for redundancy[END_REF]. Figure 4 plots the average time spent by a job in a speculative queueing network obtained by simulation (N = 50) and by the conjectured Formula [START_REF] Gardner | Redundancy-d: The power of d choices for redundancy[END_REF]. Each point ( * ) of each plot refers to an average of 50 simulations and each simulation was based on 10 7 jobs. As in the plots of Section 5.3, we assume η 1 = S 1 X and η 2 = S 2 X where S is as in [START_REF] Dai | Processing Networks: Fluid Models and Stability[END_REF]. For X, we distinguish the cases X = 1 and X ∼ Exponential [START_REF] Aktas | Straggler mitigation by delayed relaunch of tasks[END_REF]. It is remarkable how the approximation is accurate under any load condition.

Conclusions

In this paper, we provide a first performance evaluation for job speculation in a queueing network. We characterize the stability region of a speculative queueing network and find the resulting stability region to be distinct from a queueing network implementing a standard load balancing scheme. We provide conditions on job size distributions for speculative load balancing to increase the size of the stability region. Specifically, in the presence of heavy tailed server slowdown, we find that speculation is a good mechanism to increase stability and thus throughput. We provide the first characterization of the optimal timeout for a speculative task. This follows simple implementable formulas [START_REF] Davis | Piecewise-deterministic markov processes: A general class of non-diffusion stochastic models[END_REF] and, under independence, [START_REF] Dean | The tail at scale[END_REF]. Under moderate to heavy loadings, simulations indicate that speculation can significantly improve performance when compared with redundancy schemes and standard load-balancing systems. Finally, using the Pollaczek-Khinchine formula, we postulate on the impact of speculation on response times by providing a numerically accurate approximation.

The proposed framework opens up important questions:

• It is possible to design schemes that combine the benefits of replication for a light loaded regime, while maintaining the desirable stability properties of speculation for moderate to high loads.

• The design of the optimal timeout requires the solution of Markov decision process. Since task sizes must be statistically estimated, real systems may need to apply reinforcement learning to design optimal task based replication decisions.

• The analysis in Section 6 forms a conjecture on the mean field limit of a speculative queueing network. The resolution of this conjecture requires further analysis.

• We have applied random server assignment to arriving and speculative tasks. However, it may be preferable to implement join-idle-queue or join-the-shortest-queue-d routing to these tasks. While we believe that the stability region obtained within such speculative dynamic schemes remains unchanged, delays are expected to be further reduced.

A natural generalization of our model considers multiple speculation levels. Specifically, timeouts can be used in second job executions and a job that timeouts in the second visited queue gets routed to a third queue, and so forth a number of times. We believe that our results generalize to this setting naturally, though a formal proof for Theorem 1 would require more work.

Although job speculation is widely used in practice, its performance has been understudied relative to recent works on redundancy. The proposed framework sheds a new light on speculative load balancing and addresses a number of important questions on the design of job replication in large scale computer systems.

Proof of Proposition 1. The proof follows from arguments in Bramson [START_REF] Bramson | Stability of queueing networks[END_REF]. Here we confirm that conditions stated in [START_REF] Bramson | Stability of queueing networks[END_REF] apply to our model and we refer the reader to appropriate sections and results in that work.

We note that, typically in the fluid analysis of queueing networks, it is assumed that the arrival, service and routing processes are independent. This is not true in our case under our first state description in Section 3. However, under the extended class structure in Section 4.1, the state description does have independent job sizes (within each class). Further it should be noted that notions of positive Harris recurrence and petite sets remain without these independence assumptions (see the remark following [START_REF] Dai | On positive harris recurrence of multiclass queueing networks: a unified approach via fluid limit models[END_REF]Proposition 2.1]). First we note that the process is a (Harris) Markov process. In particular, the state descriptor given in [START_REF] Aktas | Straggler mitigation by delayed relaunch of tasks[END_REF] and given by Bramson [START_REF] Bramson | Stability of queueing networks[END_REF]Section 4.1 & 4.3] remains Markov in our setting, since when we condition on this state descriptor all future events are function of independent random variables. Second, we assume head-of-the-line service. These conditions ensure that closed sets are petite; see [START_REF] Bramson | Stability of queueing networks[END_REF]Proposition 4.8].

Finally, we observe that the conditions of [START_REF] Bramson | Stability of queueing networks[END_REF]Theorem 4.16] have now been met. Thus as concluded in the theorem, queueing network stability (positive Harris recurrence) holds whenever the associated fluid model is stable.

Proof of Theorem 1

In view of Lemma 5.3 in [START_REF] Dai | On positive harris recurrence of multiclass queueing networks: a unified approach via fluid limit models[END_REF], we can restrict to fluid solutions where V = 0. Therefore, we can assume that for all i

Q c,i (t) = Q c,i (0) + λN p 0,i P(η 1 ≤ τ i µ i )t - T c,i (t) E[ η1 µi | η1 µi ≤ τ i ] ≥ 0 (28) Q u,i (t) = Q u,i (0) + λN p 0,i P(η 1 > τ i µ i )t - T u,i (t) τ i ≥ 0 (29) Q j,i (t) = Q j,i (0) - T j,i (t) E[ η2 µi | η1 µj > τ j ] + p 1,i T u,j (t) τ j ≥ 0, ∀(j, i) ∈ K 2 . (30)
For all i, let G i (t) be such that

G i (t) p 1,i µ i = E η 1 µ i | η 1 µ i ≤ τ i Q c,i (t) + τ i Q u,i (t) + j E η 2 µ i | η 1 µ j > τ j p 1,i Q u,j (t) + Q j,i (t) (31)
and note that G i (t) is absolutely continuous. The function G i (t) may be interpreted as a Lyapunov function on queue i and we note that it does not correspond to the workload in queue i. Substituting ( 28)-( 30) in [START_REF] Hellemans | Performance of redundancy (d) with identical/independent replicas[END_REF], after some algebra we obtain

G i (t) p 1,i µ i = G i (0) p 1,i µ i + λN p 0,i E η 1 µ i ∧ τ i t -T c,i (t) -T u,i (t) + j E η 2 µ i | η 1 µ j > τ j p 1,i λN p 0,j P(η 1 > τ j µ j )t -T j,i (t) = G i (0) µ i -B i (t) + λN p 0,i E η 1 µ i ∧ τ i t + j E η 2 µ i | η 1 µ j > τ j p 1,i λN p 0,j P(η 1 > τ j µ j ) t = G i (0) µ i -B i (t) + ρ i t where B i (t) := T c,i (t) + T u,i (t) + j =i T j,i (
where

Q i (t) := Q c,i (t) + Q u,i (t) + j =i Q j,i (t)
is the total number of jobs in queue i at time t. Thus, whenever

Q i (t) > 0, Ġi (t) p 1,i µ i = ρ i -1 < 0. ( 33
)
On the other hand, if Q i (t) = 0, Q s (t) > 0 and s = i, then

G i (t) -G s (t) =   j =i E η 2 | η 1 µ j > τ j Q u,j (t)   -G s (t) ≤   j =i E η 2 | η 1 µ j > τ j Q u,j (t)   -E η 1 p 1,s | η 1 µ s ≤ τ s Q c,s (t) - τ s µ s p 1,s Q u,s (t) - j =i E η 2 | η 1 µ j > τ j Q u,j (t) + Q j,s (t) p 1,s ≤ -E η 1 p 1,s | η 1 µ s ≤ τ s Q c,s (t) - τ s µ s p 1,s Q u,s (t) - j =i E η 2 | η 1 µ j > τ j Q j,s (t) p 1,s < 0
where the last inequality follows because Q s (t) > 0. Since s is generic, we obtain

G i (t) < min s =i G s (t) (34)
provided that Q i (t) = 0. Let G(t) := max i=1,...,N G i (t). With [START_REF] Huang | Fs2: Dynamic data replication in free disk space for improving disk performance and energy consumption[END_REF] holding true when Q i (t) > 0 and (34) holding true when Q i (t) = 0 and Q s (t) > 0, we can apply Lemma 3.2 of [START_REF] Dai | Stability and instability of fluid models for reentrant lines[END_REF], which implies that G(t) is also an absolutely continuous nonnegative function and such that Ġ(t) < -for some > 0, provided that t is a point of differentiability of G, G 1 , . . . , G d such that G(t) > 0. Applying Lemma 2.2 of [START_REF] Dai | Stability and instability of fluid models for reentrant lines[END_REF], we obtain that G(t) = 0 for all t ≥ δ, for some δ > 0. Finally, we notice that G(t) = 0 implies that the system is empty.

Proof of Proposition 2

We have

1 λ max i=1,...,N ρ i = max i=1,...,N N p 0,i E [η 1 ∧ τ i ] + N p 1,i j p 0,j P(η 1 > τ j )E [η 2 | η 1 > τ j ] ≥ i p 0,i (E [η 1 ∧ τ i ] + P(η 1 > τ i )E [η 2 | η 1 > τ i ]) ≥ min i E [η 1 ∧ τ i ] + P(η 1 > τ i )E [η 2 | η 1 > τ i ] ≥ inf t∈R+ (E [η 1 ∧ t] + P(η 1 > t)E [η 2 | η 1 > t]) = inf t∈R+ ρ(t) λ
as desired.

Proof of Theorem 2

Given τ ∈ R + , we notice that

ρ(τ ) λ -E[η 1 ] = E[η 1 ∧ τ ] + P(η 1 > τ )E[η 2 | η 1 > τ ] -E[η 1 ] = τ P(η 1 > τ ) + P(η 1 > τ )E[η 2 | η 1 > τ ] -E[η 1 | η 1 > τ ]P(η 1 > τ ) < 0
if and only if (13) holds.

Proof of Theorem 3

Using Assumption 2 and that X, S 1 and S 2 are independent, we obtain

ρ(τ ) λ = E[(S 1 X) ∧ τ ] + P(S 1 X > τ ) E[S 2 X | S 1 X > τ ] = x E[(S 1 X) ∧ τ | X = x] P(X = x) + E[S 2 XI {S1X>τ } ] = x E[(S 1 x) ∧ τ ] P(X = x) + x E[S 2 xI {S1x>τ } |X = x]P(X = x) = x E [S 1 x ∧ τ ] P(X = x) + x E[S 2 x] P(X = x)P(S 1 x > τ ) = x P(X = x) (E [S 1 x ∧ τ ] + E[S 2 x]P(S 1 x > τ )) . Since E[η 1 ] = E[X]E[S], we notice that E[η 1 ] - ρ(τ ) λ = x P(X = x) E[Sx] P(Sx ≤ τ ) -E [Sx ∧ τ ] (35)
and within Assumption 3 it is clear that the RHS of ( 35) is strictly greater than zero when τ = z, for some z ∈ R + . The final part of the proposition is straightforward.

Optimal Stopping Formulation of Theorem 4

First, we explain how the proof of Theorem 4 can be expressed as an optimal stopping problem; in the following, stopping time and timeout are used interchangeably. Then, we show how the optimal timeout can be verified as an application of the one-step-lookahead principle. We also give a proof in continuous time and with deterministic stopping times. The more general proof (continuous-time stochastic timeouts) is more involved and, due to space constraints, is included in the appendix.

If we wish to minimize the time spent by a job in the processing phase, then we must minimize

V = min τ ∈T E η 1 ∧ τ + η 2 I {τ ≤η1} (36)
= min

τ ∈T E τ 0 F1 (t)dt + η2 (τ ) F1 (τ ) ( 37
)
where T is the set of stopping times on R + , the functions f 1 (t) and F1 (t) are respectively the pdf and ccdf of η 1 , and η2 (t

) := E[η 2 | η 1 ≥ t].
The minimization ( 36) is an optimal stopping problem with continuation cost F1 (t) and stopping cost η2 (t) F1 (t). We note that the objective function above is equal to ρ(τ )/λ where ρ(τ ) is the induced load on the speculative queueing network for timeout τ . Thus, we aim at finding the stopping time that minimizes the load.

Discrete Time Argument. What follows is a brief informal argument for why the stopping condition [START_REF] Davis | Piecewise-deterministic markov processes: A general class of non-diffusion stochastic models[END_REF] is correct. If we discretize time as T ∆ := {0, ∆, 2∆, ...} and if we are only allowed to stop on this restricted set of times (rather than T ), then the optimization for V above is a discrete time Markov decision process. The Bellman equation for this problem is

V (t) = min p ∆ (t)[∆ + V (t + ∆)], η2 (t) ,
where we define p ∆ (t) := P(η 1 ≥ t + ∆|η 1 ≥ t) = 1 -f1(t)∆ F1(t) + o(∆) . The one-step-look-ahead is known to be optimal for a wide class of optimal stopping rules [START_REF] Bertsekas | Dynamic programming and optimal control 3rd edition, volume ii[END_REF]Section 4.4]. Here, we stop (or timeout) if it is better to stop now than continue one time step and then stop. In our case, it is easy to see that this corresponds to the condition: Observing the term in square brackets above, we see that up to terms of order o(∆) the one-step look-ahead rule gives the condition to stop at τ whenever 1 + η 2 (τ ) η2 (τ ) ≥ f 1 (τ ) F1 (τ ) .

This gives the stopping rule stated in [START_REF] Davis | Piecewise-deterministic markov processes: A general class of non-diffusion stochastic models[END_REF]. For one-step look-ahead to be optimal, we require that this set is closed, meaning that whenever the stopping condition is satisfied it remains satisfied for all future times. This is the motivation for Assumption 4.

Continuous Time Argument. If we restrict ourselves to deterministic stopping times, then it is clear that τ is the optimal stopping time: by conditioning on the value of η 1 , we have that the objective (36) satisfies Thus, under Assumption 4, the optimal stopping time condition is 1 + η 2 (τ ) η2 (τ ) = f 1 (τ ) F1 (τ ) .

Proof of Theorem 4

We put together the stochastic discrete time argument with the deterministic continuous time argument developed above to give a formal proof. Towards this purpose, we must formulate the optimal stopping problem as a free boundary problem and then solve it for the optimal rule. The theory of free boundary problems and optimal stopping is given in detail in [START_REF] Peskir | Optimal stopping and free-boundary problems[END_REF].

A value function must satisfy the following free boundary problem η2 (t) ≥ V (t) , (38a)

0 = 1 + V (t) - f 1 (t) F1 (t) V (

F1 (s)ds

where A is a constant which we will specify shortly.

We now investigate times τ ∈ [0, ∞] where V (τ ) = η2 (τ ). Substituting the above expression for V (t), we notice that (

) 39
Here we write V τ (t) to make the dependence on τ explicit. We now require the minimal solution, setting t = 0 and differentiating with respect to τ gives

∂ τ V τ (0) = η 2 (τ ) F1 (τ ) -η2 (τ )f 1 (τ ) + F1 (τ ) = η2 (τ ) F1 (τ ) 1 + η 2 (τ ) η2 (τ ) - f 1 (τ ) F1 (τ ) .
The term η2 (t) F1 (τ ) is positive while the term in square brackets is monotone increasing from Assumption 4. Thus, from the term in square brackets above, we see that the condition is that τ * is the minimal value such that the term in square brackets is positive. That is τ * = min τ ≥ 0 : 1 + η 2 (τ ) η2 (τ ) ≥ f 1 (τ ) F1 (τ ) .

Thus [START_REF] Raaijmakers | Achievable stability in redundancy systems[END_REF] with τ = τ * characterizes the solution up until time τ * . We note that for time t > τ * the solution must satisfy V (t) = η2 (t). This can be seen because of the following argument. If V (t) = η2 (t) did not hold for all t ≥ τ * then we can choose a time t such that V (t) = η2 (t), but the value function is strictly smaller immediately after time t; however, then under condition (38b) where τ * is given above, which implies that the optimal stopping set is S := {t : V (t) = η2 (t)} = {t : t ≥ τ * }. Thus, it is optimal to stop at time τ * as required.

V (t) = 1 - f 1 (t) F1 (t) V (t) = 1 - f 1 (t) F1 (
Finally, we note that if η 2 is independent of η 1 then η2 (t) is a constant, E[η 2 ], and the optimal stopping condition reduces to the condition [START_REF] Dean | The tail at scale[END_REF].

Figure 1 :

 1 Figure 1: Speculative vs standard load balancing via L(τ ), (15), under a number of S&X models.

Remark 4 .

 4 SLB yields an increased stability region w.r.t. CoS-d whenever the conditions in Theorems 2 and 3 are satisfied.

Figure 2 :

 2 Figure 2: Average response time obtained within Speculative Load Balancing (SLB), Cancel-on-Complete-d (CoC-d) and Cancel-on-Start-d (CoS-d) under S&X models. The vertical dashed black lines represent the limits of the stability region of SLB.

Figure 3 :

 3 Figure 3: Average response time obtained within Speculative Load Balancing (SLB) and Redundant-to-Idle-Queue-d (RIQ-d) under S&X models. The vertical dashed black lines represent the limits of the stability region of SLB.

Figure 4 :

 4 Figure 4: Average response times obtained by simulation and via Conjecture 1; S has the form (16) and N = 50.

E η 1

 1 ∧ τ + 2 I {τ ≤η1} = τ 0 F1 (t)dt + η2 (τ ) F1 (τ )and a stationary point of this optimization satisfies 0 = F1 (τ ) + η 2 (τ ) F1 (τ ) -η2 (τ )f 1

  )ds =⇒ A = η2 (τ ) F1 (τ ) + τ 0 F1 (s)ds .Thus, we see that the solutions the free boundary problem, for which there exists a time with V (τ ) = η2 (τ ), take the formV τ (t) = η2 (τ )f 1 (s) + F1 (s)ds , t ≤ τ .

  t) is interpreted as the cumulative time queue i has been busy (non-idle) in [0, t]. Now, assuming that t is a point of differentiability for G i (t)

	Ġi (t)	p 1,i µ i	= -I {Qi(t)>0} + ρ i

  η2 (t) ≤ p ∆ (t)[∆ + η2 (t + ∆)] .

	The RHS term can be simplified:
	p ∆ (t)[∆ + η2 (t + ∆)]
	= 1 -	f 1 (t)∆ F1 (t)	[∆ + ∆η 2 (t) + η2 (t)] + o(∆)
	= η2 (t) + ∆ 1 + η 2 (t) -	f 1 (t) F1 (t)	η2 (t) + o(∆) .

  t) on {V (t) < η2 (t)} . (38b)It is show in Section 2.2 of[START_REF] Peskir | Optimal stopping and free-boundary problems[END_REF] that a solution of[START_REF] Peskir | Optimal stopping and free-boundary problems[END_REF] defines the value of a policy that stops on the set S = inf{t : V (t) ≥ η2 (t)}. Assuming that V (t) < η2 (t), the o.d.e. (38b) can be solved as follows

					t
	=⇒ F1 (t)V (t) = -	F1 (s)ds + A
					0
	=⇒ V (t) =	A F1 (t)	-	1 F1 (t)
	0 = 1 + V (t) -	f 1 (t) F1 (t)	V (t)
	=⇒ f 1 (t)V (t) -F1 (t)V (t) = F1 (t)
	=⇒	d dt	(-F1 (t)V (t)) = F1 (t)
					22

t 0

  . Thus we have V (t) > η 2 (t). So we see that this leads to a contradiction since we assumed the function V (t) decreases below η2 (t) immediately after time t. This proves that V (t) = η2 (t) for all t ≥ τ * .From this we see that the minimal value function solving the free boundary problem is

				t)	η2 (t) > η 2 (t)
	where the inequality above holds since
		1 + η 2 (t) η2 (t)	>	f 1 (t) F1 (t)
	for t > τ V (t) =	η2 (τ * ) + 1 F1(t) η2 (t)	τ * t [η 2 (τ * )f 1 (s) + F1 (s)]ds t ≤ τ * t > τ *

*

For instance, Apache Spark applies the attribute spark.speculation while Hadoop MapReduce uses task configuration mapred.map.tasks.speculative.execution.

We point the reader unfamiliar with positive Harris recurrence to[START_REF] Dai | On positive harris recurrence of multiclass queueing networks: a unified approach via fluid limit models[END_REF] Section

[START_REF] Ananthanarayanan | Why let resources idle? aggressive cloning of jobs with dolly[END_REF]

We recall that η 1 and η 2 are assumed equal in distribution in this section.

Acknowledgment

This work is supported by the French National Research Agency in the framework of the "Investissements d'avenir" program (ANR-15-IDEX-02) and the LabEx PERSYVAL (ANR-11-LABX-0025-01).

Proof of Proposition 1

The proof below identifies how our model fits within the framework of Bramson [START_REF] Bramson | Stability of queueing networks[END_REF], under the multi-class structure given in Section 4.1.