1%{ @file fj_mg1_respt_moments.m
2 % @brief Mean and variance of the M/G/1 response time, as ForkTail inputs
4 % @author LINE Development Team
8 % @brief Mean and variance of the M/G/1 response time, as ForkTail inputs
11 % Closes the white-box route of fj_tail_forktail
for a fork branch that
is
12 % an M/G/1 FCFS queue, from the first three moments of its service time:
14 % E[T] = E[S]*(1 + rho/(1-rho) * (1+SCV_S)/2)
15 % V[T] = E[W]^2 + lambda*E[S^3]/(3*(1-rho)) + E[S^2] - E[S]^2
17 % with rho = lambda*E[S] and E[W] = lambda*E[S^2]/(2*(1-rho)), i.e. the
18 % Pollaczek-Khinchine mean waiting time. The third moment enters only the
19 % variance, so an exponential or phase-type branch needs no extra input
20 % beyond what the service distribution already reports (getMoments(3) on a
21 % Markovian law, or 3*ES*VS + ES^3 + skewness*VS^(3/2) in general).
25 % [ET, VT] = fj_mg1_respt_moments(lambda, ES, ES2, ES3)
30 % <tr><th>Name<th>Description
31 % <tr><td>lambda<td>Arrival rate at the branch
32 % <tr><td>ES<td>First moment of the service time
33 % <tr><td>ES2<td>Second moment of the service time
34 % <tr><td>ES3<td>Third moment of the service time
39 % <tr><th>Name<th>Description
40 % <tr><td>ET<td>Mean response time
41 % <tr><td>VT<td>Variance of the response time
45 % M. Nguyen, S. Alesawi, N. Li, H. Che, H. Jiang,
"ForkTail: A Black-Box
46 % Fork-Join Tail Latency Prediction Model for User-Facing Datacenter
47 % Workloads", ACM HPDC 2018, Eqs. (10) and (11).
49function [ET, VT] = fj_mg1_respt_moments(lambda, ES, ES2, ES3)
53 line_error(mfilename,
'The branch is unstable (rho = %g >= 1); the response time moments do not exist.', rho);
56 line_error(mfilename, [
'The service law has no finite third moment, so the ForkTail response ' ...
57 'time variance is undefined (a Pareto branch with shape <= 3, for instance). ' ...
58 'Use a service law with three finite moments.']);
60scvS = (ES2 - ES^2) / ES^2;
61ET = ES * (1 + rho/(1-rho) * (1 + scvS)/2);
62EW = lambda * ES2 / (2*(1-rho));
63VT = EW^2 + lambda*ES3/(3*(1-rho)) + ES2 - ES^2;