From c8d9823cd7f29ccdb5392cca51f3b5e06e2c118a Mon Sep 17 00:00:00 2001 From: taivop Date: Sun, 18 Dec 2016 14:38:30 +0100 Subject: [PATCH] revert model2 #192 --- scripts/oct/mva_model2.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/oct/mva_model2.m b/scripts/oct/mva_model2.m index 0ddc2a7..93c234a 100644 --- a/scripts/oct/mva_model2.m +++ b/scripts/oct/mva_model2.m @@ -1 +1 @@ -function [U, R, Q, X] = mva_model2(result_path, nS, nR, nT, nC, pW, tNW_g, tNW_s, tLB_g, tLB_s, tWW, tRW, tMC, tWWR) pkg load queueing; % ---- Setup ---- nK = 1 + 1 + nS + nS + nS + nS + 1; % network + LoadBalancer + ReadWorkers + WriteWorker + memcached + WriteWorkerRet + network C_GET = 1; C_SET = 2; ind_RW = 3:3+nS-1; % ReadWorker ind_WW = 3+nS:3+2*nS-1; % WriteWorker ind_MC = 3+2*nS:3+3*nS-1; % Memcached ind_WWR = 3+3*nS:nK-1; % WriteWorkerRet % ---- Inputs to the model ---- % N -- Population size (number of requests in the system, N ≥ 0). If N == 0, this function returns U = R = Q = X = 0 N = zeros(2, 1); N(2) = round(nC * pW); N(1) = nC - N(2); % S -- S(k) is the mean service time at center k (S(k) ≥ 0). S = zeros(2, nK); S(C_GET, 1) = tNW_g / 1000; % ms -> s S(C_GET, 2) = tLB_g / 1000; % ms -> s S(C_GET, ind_RW) = tRW / 1000; % ms -> s S(C_GET, nK) = S(C_GET, 1); S(C_SET, 1) = tNW_s / 1000; % ms -> s S(C_SET, 2) = tLB_s / 1000; % ms -> s S(C_SET, ind_WW) = tWW / 1000; % ms -> s S(C_SET, ind_MC) = tMC / 1000; % ms -> s S(C_SET, ind_WWR) = tWWR / 1000; % ms -> s S(C_SET, nK) = S(C_SET, 1); S(C_GET, ind_WW) = S(C_SET, ind_WW); % these should not matter S(C_SET, ind_RW) = S(C_GET, ind_RW); % these should not matter S(C_GET, ind_MC) = S(C_SET, ind_MC); % these should not matter S(C_GET, ind_WWR) = S(C_SET, ind_WWR); % these should not matter % V -- V(k) is the average number of visits to service center k (V(k) ≥ 0). V = zeros(2, nK); V(C_GET, 1:2) = 1; V(C_GET, ind_RW) = 1 / nS; V(C_GET, nK) = 1; V(C_SET, 1:2) = 1; V(C_SET, ind_WW) = 1 / nS; V(C_SET, ind_MC) = nR / nS; V(C_SET, ind_WWR) = 1 / nS; V(C_SET, nK) = 1; % m -- m(k) is the number of servers at center k (if m is a scalar, all centers have that number of servers). % If m(k) < 1, center k is a delay center (IS); otherwise it is a regular queueing center (FCFS, LCFS-PR or PS) with m(k) servers. % Default is m(k) = 1 for all k (each service center has a single server). m = ones(nK, 1); m(1) = 0; # delay center m(2) = 1; # M/M/1 m(ind_RW) = nT; # M/M/m m(ind_WW) = 1; # M/M/1 m(ind_MC) = 0; # delay center m(ind_WWR) = 1; # M/M/1 m(nK) = 0; # delay center % Z -- External delay for customers (Z ≥ 0). Default is 0. Z = zeros(2, 1); % ---- Results ---- [U, R, Q, X] = qncmmva (N, S, V, m, Z); save(result_path, "-v7", "N", "S", "V", "m", "Z", "U", "R", "Q", "X"); % U -- If k is a FCFS, LCFS-PR or PS node (m(k) ≥ 1), then U(k) is the utilization of center k, 0 ≤ U(k) ≤ 1. If k is an IS node (m(k) < 1), then U(k) is the traffic intensity defined as X(k)*S(k). In this case the value of U(k) may be greater than one. % R -- R(k) is the response time at center k. The Residence Time at center k is R(k) * V(k). The system response time Rsys can be computed either as Rsys = N/Xsys - Z or as Rsys = dot(R,V) % Q -- Q(k) is the average number of requests at center k. The number of requests in the system can be computed either as sum(Q), or using the formula N-Xsys*Z. % X -- X(k) is the throughput of center k. The system throughput Xsys can be computed as Xsys = X(1) / V(1) endfunction \ No newline at end of file +function [U, R, Q, X] = mva_model2(result_path, nS, nR, nT, nC, pW, tNW_g, tNW_s, tLB_g, tLB_s, tWW, tRW, tMC, tWWR) pkg load queueing; % ---- Setup ---- nK = 1 + 1 + nS + nS + nS + nS + 1; % network + LoadBalancer + ReadWorkers + WriteWorker + memcached + WriteWorkerRet + network C_GET = 1; C_SET = 2; ind_RW = 3:3+nS-1; % ReadWorker ind_WW = 3+nS:3+2*nS-1; % WriteWorker ind_MC = 3+2*nS:3+3*nS-1; % Memcached ind_WWR = 3+3*nS:nK-1; % WriteWorkerRet % ---- Inputs to the model ---- % N -- Population size (number of requests in the system, N ≥ 0). If N == 0, this function returns U = R = Q = X = 0 N = zeros(2, 1); N(2) = round(nC * pW); N(1) = nC - N(2); % S -- S(k) is the mean service time at center k (S(k) ≥ 0). S = zeros(2, nK); S(C_GET, 1) = tNW_g / 1000; % ms -> s S(C_GET, 2) = tLB_g / 1000; % ms -> s S(C_GET, ind_RW) = tRW / 1000; % ms -> s S(C_GET, nK) = S(C_GET, 1); S(C_SET, 1) = tNW_s / 1000; % ms -> s S(C_SET, 2) = tLB_s / 1000; % ms -> s S(C_SET, ind_WW) = tWW / 1000; % ms -> s S(C_SET, ind_MC) = tMC / 1000; % ms -> s S(C_SET, ind_WWR) = tWWR / 1000; % ms -> s S(C_SET, nK) = S(C_SET, 1); S(C_GET, ind_WW) = S(C_SET, ind_WW); % these should not matter S(C_SET, ind_RW) = S(C_GET, ind_RW); % these should not matter S(C_GET, ind_MC) = S(C_SET, ind_MC); % these should not matter S(C_GET, ind_WWR) = S(C_SET, ind_WWR); % these should not matter % V -- V(k) is the average number of visits to service center k (V(k) ≥ 0). V = zeros(2, nK); V(C_GET, 1:2) = 1; V(C_GET, ind_RW) = 1 / nS; V(C_GET, nK) = 1; V(C_SET, 1:2) = 1; V(C_SET, ind_WW) = 1 / nS; V(C_SET, ind_MC) = nR / nS; V(C_SET, ind_WWR) = 1 / nS; V(C_SET, nK) = 1; % m -- m(k) is the number of servers at center k (if m is a scalar, all centers have that number of servers). % If m(k) < 1, center k is a delay center (IS); otherwise it is a regular queueing center (FCFS, LCFS-PR or PS) with m(k) servers. % Default is m(k) = 1 for all k (each service center has a single server). m = ones(nK, 1); m(1) = 0; # delay center m(2) = 1; # M/M/1 m(ind_RW) = nT; # M/M/m m(ind_WW) = 1; # M/M/1 m(ind_MC) = 0; # delay center m(ind_WWR) = 1; # M/M/1 m(nK) = 0; # delay center % Z -- External delay for customers (Z ≥ 0). Default is 0. Z = zeros(2, 1); % ---- Results ---- [U, R, Q, X] = qncmmva (N, S, V, m, Z); save(result_path, "-v7", "N", "S", "V", "m", "Z", "U", "R", "Q", "X"); % U -- If k is a FCFS, LCFS-PR or PS node (m(k) ≥ 1), then U(k) is the utilization of center k, 0 ≤ U(k) ≤ 1. If k is an IS node (m(k) < 1), then U(k) is the traffic intensity defined as X(k)*S(k). In this case the value of U(k) may be greater than one. % R -- R(k) is the response time at center k. The Residence Time at center k is R(k) * V(k). The system response time Rsys can be computed either as Rsys = N/Xsys - Z or as Rsys = dot(R,V) % Q -- Q(k) is the average number of requests at center k. The number of requests in the system can be computed either as sum(Q), or using the formula N-Xsys*Z. % X -- X(k) is the throughput of center k. The system throughput Xsys can be computed as Xsys = X(1) / V(1) endfunction \ No newline at end of file