On the Twin Measure and System Predictability and Fairness David Raz
Hanoch Levy
Benjamin Avi-Itzhak
School of Computer Science Tel-Aviv University, Tel-Aviv, Israel
School of Computer Science Tel-Aviv University, Tel-Aviv, Israel
RUTCOR, Rutgers University New Brunswick, NJ, USA
[email protected]
[email protected]
ABSTRACT
[email protected]
Two identical customers with deterministically identical service times arrive at a queueing system simultaneously (Twins), but leave the system 2 hours apart. Is the sojourn time predictable? Is the system fair? We propose a novel measure based on the principle that in a predictable and fair system, “twin” customers should not depart the system very far apart. We analyze this measure for a number of common service policies and compare the results. We compare the results to those of other fairness and predictability approaches proposed recently and discuss its usefulness.
tioned on the customers’ service requirement. By conditioning on the service requirement, this measure also captures the notion of a policy which is not equally fair (or predictable) to all job sizes. The model and the measure we propose are described in Section 2. Analysis of the twin measure for common service disciplines is given in Section 3. A comparison of the policies is given in Section 4. We then (Section 5) compare the twin measure to a recently proposed predictability criterion. Finally, at Section 6 we discuss what optimality under the twin measure means, and we propose a policy which is optimal and also has optimal sojourn times.
1.
2.
INTRODUCTION
How does one measure the fairness and predictability of a queueing system? The importance of the issues of fairness and predictability is widely recognized in many works and applications. See for example [1] that surveys several studies discussing the subject of fairness, and some recent works quantifying job fairness. The issue of predictability was recently discussed in [4], which provides references to related work discussing its importance. In modern day systems (such as call centers and computer systems), where the actual workings of the system are hidden from the customer, one practical way to measure (and check for) system fairness and predictability is to launch a pair of identical jobs with deterministically identical service times (Twins). For example, it is very natural that a Web user who submits two concurrent identical (or close to identical) requests to the same Web site will appreciate the site predictability and fairness based on their relative response times. We propose a measure that is based on this notion. Obviously, a low “twin measure” is not a sufficient requirement for customer satisfaction. In fact, we do not even claim that it is sufficient for guaranteeing system fairness and predictability, as these issue are too complicated to be captured by this simple notion. However, we do claim that it is a required feature, and a simple one to measure and analyze, as we will show. Specifically, we propose a measure based on the expected value (and possibly higher moments) of the difference between the waiting times (or sojourn times) of identical, simultaneously arriving customers, condi-
MODEL AND NOTATION
We use an M/GI/1 model, namely, a single server queueing system with Poisson arrivals (at rate λ) and where the service requirements are sampled independently with probability density function (pdf) b(x) and cumulative distribution function (cdf) B(x). The service requirement has expected value x, second moment x2 , and variance σx2 . The load (utilization) of the server is defined as Z ∞ def ρ = λx = λ tb(t)dt, 0
and for stability we require ρ < 1. For this extended abstract we assume b(x) is continuous. In the full paper we abandon this assumption. We assume that the server is work conserving and non-idling.
2.1
The Twin Measures
Let C1 and C2 be identical customers, with service requirements x and x + δ respectively. We call such customers twins. Let the arrival, departure, and first service epochs of twin i, i = 1, 2 be ai , di , and si respectively. Assume that C1 arrives when (a1 ) the system is in steady state. Assume that the twins arrive ² time units apart, that is, a2 − a1 = ², ² > 0. Definition 2.1 (Twin Measure). Define the random variable Z(x, ², δ) = |d2 −d1 |, given x, ², and δ. Define the random variable Y (x) = lim ²→0,δ→0 Z(x, ², δ), assuming a single limit exists. For service policy φ and job size x, the n-th twin measure Tnφ (x) is defined as the n-th moment of the expected absolute difference in departure times of the twins, namely Tnφ (x) = E[Y (x)n ].
The shortened term twin measure, denoted T φ (x), is used to describe the first twin measure, namely T φ (x) = E[Y (x)]. Note that the twin measures are only defined when a single limit exists for both δ & 0 and δ % 0, while ² → 0. We will focus in this paper on the first twin measure, T φ (x).
3.
3.1
EVALUATING COMMON SERVICE POLICIES UNDER THE TWIN MEASURE Processor Sharing (PS)
Intuitively, both customers are identical and arrive simultaneously, so they will receive exactly the same service, and leave the system simultaneously. Thus Y (x) = 0 deterministically, i.e. T P S (x) = 0. More rigorously Z(x, ², δ) ≤ (²+δ)N where N is the maximum number of customers in the system in the interval (a1 , max(d1 , d2 )). Thus Y (x) = lim²→0,δ→0 Z(x, ², δ) = 0 and T F CF S (x) = 0.
3.2 First Come First Served (FCFS) Let W (x, ²) be the time elapsing between d1 and s2 . For FCFS we have Z(x, ², δ) = W (x, ²) + x + δ. For FCFS W (x, ²) is tha amount of work arriving in the interval between the arrival epochs of the twins, and therefore Z(x, ², delta) = λx² + x + δ and Y (x) = lim²→0,δ→0 Z(x, ², δ) = x and T F CF S (x) = x
3.3
Last Come First Served (LCFS)
We start with the non-preemptive case. There are two possible cases, either C1 is served before C2 arrives, which only happens if the system gets empty in the interval [a1 , a2 )) or C2 is served first. If C1 is served first, we can ignore all customers served before C1 . The service order from then onward is as follows. First C1 is served for x units of time. C2 then waits for a busy period created by all customers arriving while C1 was served, and is served at the completion of this busy period for x + δ units of time. Let V (x, ²) be the time elapsing between s1 and s2 . Thus Z(x, ², δ) = V (x, ²) + δ. V (x, ²) is simply a busy period starting with the service of a customer with service requirement x, the expected size of which is: x T LCF S (x) = . (1) 1−ρ For example, this can be derived from the transform of the distribution of a busy period starting with a ∗ customer of size x, G∗ (s, x) = e−x[s+λ−λG (s)] , where G∗ (s) is the transform of the distribution of the busy period length ([2, p. 212]). If C2 is served first, we can ignore all customers served before C2 . The service order from then onward is as follows. First C2 is served for x + δ units of time. Then all customers arriving while C1 was served are being served. Then all customers arriving between a1 and a2 are served, as well as customers arriving while those are served, followed by C1 being served for x units of time. Thus Z(x, ², δ) = V (x, ²), where
V (x, ²) in this case is a busy period starting with the service of a customer with service requirement x+δ+². T LCF S (x) however, is the same as above. For the preemptive case, note that all customers arriving while C2 is being served can be ignored, as they preempt C2 . The difference d2 − d1 is therefore composed of the service time of C2 and customers preempting it, plus the service time of customers arriving between a1 and a2 and customers preempting is. This is in fact a busy period, starting with a customer of size x + δ + ², just as it was in the non-preemptive case and therefore (1) holds for the preemptive case too.
3.4
Other Service Policies
From lack of space, for the other policies we just bring the final result, with intuitive explanation, and partial analysis. The full analysis will be available in a forthcoming paper. x . • Shortest Job First (SJF): T SJF (x) = 1−ρ(x) This is similar to LCFS, except that only customers with service requirement smaller than x, the load of which is ρ(x), are taken into consideration. x • Longest Job First (LJF): T LJF (x) = 1−(ρ−ρ(x)) . This is again similar to LCFS, with the load of customers whose service requirement is larger than x.
• Least Attained Service (LAS): T LAS (x) = 0. LAS treats identically sized customers the same way PS does. • Shortest Remaining Processing Time (SRPT): x T SRP T (x) = 1−ρ(x) . Assume w.l.g. that the first customer to depart is C1 . Following [3], T SRP T (x) can be decomposed into T SRP T (x) = E[W (x)]SRP T SRP T SRP T +E[R(x)] , where E[W (x)] is the expected waiting time for C2 of size x, i.e. the expected time from d1 to s2 , and E[R(x)]SRP T is the expected residence time for C2 of size x, i.e. the expected time from s2 to d2 . Observe customers arriving in an infinitesimal interval of size dt when C1 has remaining service requirement t. We argue that the delay they add is (ρ(x) − ρ(t)) dt 1 . 1 − ρ(t) 1 − ρ(x) Integrating this over (0, x) yields E[W (x)]SRP T . As for E[R(x)]SRP T , this is simply the residence time of a customer with service requirement x under SRPT, well known to be Z x dt E[R(x)]SRP T = . 1 − ρ(t) 0 Adding E[W (x)]SRP T and E[R(x)]SRP T yields the result. • Longest Remaining Processing Time (LRPT): T LRP T (x) = 0. In fact all customers leave simultaneously, at the end of the busy period.
4.
COMPARISON OF THE ANALYZED SERVICE POLICIES
First note that several very different policies yield a zero twin measure, namely PS, LAS and LRPT. This clearly demonstrates that the twin measure has very little to do with performance, as LAS is obviously much more efficient than PS. It also demonstrates that the twin measure is not sufficient to guarantee sojourn time predictability. For example LRPT has notoriously unpredictable sojourn times. Among the policies with strictly positive twin measure analyzed, FCFS has the smallest measure and LCFS has the largest. Note that the difference between these can be extreme in cases where ρ → 1. We conjecture that FCFS and LCFS have the extreme measures amongst the class of non-preemptive service policies. SJF and LJF have measures which are between LCFS and FCFS, where for small jobs (such that ρ(x) < ρ − ρ(x)) SJF has the lower measure, and the opposite for long jobs. Interestingly, SJF and SRPT have the same measure. An explanation is provided in the full paper.
5.
bine the two criteria, or require both.
6.
OPTIMALITY UNDER THE TWIN MEASURE
As several policies have zero twin measure, these policies can all be considered optimal. One might therefore want to find a measure which is both optimal in the twin measure sense, and has good sojourn time. Consider the following variant of SRPT, called SRPTα . Assume the customer with the shortest remaining processing time has remaining processing time x. Service is given in a processor sharing manner, to all customers with remaining processing time not larger than x + α. It is easy to see that if α can be arbitrarily small, this policy’s sojourn times are arbitrarily close to SRPT. On the other hand, if α ≥ ² + δ (which since ² → 0, δ → 0 can be done for arbitrarily small α), twin customers will be served in processor sharing manner from a2 until min d1 , d2 , at which point one of them will leave the system and the other one will have at most ² + δ service left. As ² → 0, δ → 0, this customer will receive full service from that epoch onwards, and thus Z(x, δ, ²) ≤ ² + δ and T SRP Tα (x) = 0. Thus SRPTα has both optimal COMPARISON TO THE PREDICTABIL- twin measure, and optimal sojourn time.
ITY CRITERION
Acknowledgements
Policy PS
Twin Very
Criterion Always
LAS
Very
Never
LRPT
Very
Never
FCFS
Quite
Sometimes
NP-LCFS
Never
Never
P-LCFS
Never
Always
NP-SJF
Sometimes
Sometimes
P-SJF
Sometimes
Never
NP-LJF
Sometimes
Never
P-SJF
Sometimes
Never
SRPT
Sometimes
Sometimes
Table 1: Comparison of the Twin Measure to the Predictability Criterion In Table 1 we compare the twin measure to the Predictability criterion proposed in [4]. For the criterion we use the notations defined in that paper. A policy can be either Always Predictable, Sometimes Predictable, or Never Predictable. For the twin measure, we use ”Very Predictable” when the twin measure is zero, ”Quite Predictable” when the twin measure is between zero and x, ”Sometimes Predictable” when the twin measure is close to x for some values of x, but far from it for other values, and ”Never Predictable” when the measure is as big as x/(1 − ρ). It is from the table obvious that for some policies the two criteria do not agree. This suggests that for guaranteeing predictability one might want to com-
This work was supported in part by the Israeli Ministry of Science and Technology, grant number 380801, and by EURO-NGI network of excellence
7. REFERENCES [1] B. Avi-Itzhak, H. Levy, and D. Raz. Quantifying fairness in queueing systems: Principles, approaches and applicability. Technical Report RRR-25-2005, RUTCOR, Rutgers University, August 2005. Submitted. [2] L. Kleinrock. Queueing Systems, Volume 1: Theory. Wiley, 1975. [3] L. E. Schrage and L. W. Miller. The queue M/G/1 with the shortest processing remaining time discipline. Operations Research, 14:670–684, 1966. [4] A. Wierman and M. Harchol-Balter. Classifying scheduling policies with respect to higher moments of conditional response time. In Proceedings of ACM Sigmetrics 2005 Conference on Measurement and Modeling of Computer Systems, pages 229–239, Banff, Alberta, Canada, June 2005.