Skip to content
This repository has been archived by the owner on Dec 16, 2022. It is now read-only.

Commit

Permalink
revert model2 #192
Browse files Browse the repository at this point in the history
  • Loading branch information
taivop committed Dec 18, 2016
1 parent 090d9ff commit c8d9823
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion scripts/oct/mva_model2.m
Original file line number Diff line number Diff line change
@@ -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 + networkC_GET = 1;C_SET = 2;ind_RW = 3:3+nS-1; % ReadWorkerind_WW = 3+nS:3+2*nS-1; % WriteWorkerind_MC = 3+2*nS:3+3*nS-1; % Memcachedind_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 = 0N = 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 -> sS(C_GET, 2) = tLB_g / 1000; % ms -> sS(C_GET, ind_RW) = tRW / 1000; % ms -> sS(C_GET, nK) = S(C_GET, 1);S(C_SET, 1) = tNW_s / 1000; % ms -> sS(C_SET, 2) = tLB_s / 1000; % ms -> sS(C_SET, ind_WW) = tWW / 1000; % ms -> sS(C_SET, ind_MC) = tMC / 1000; % ms -> sS(C_SET, ind_WWR) = tWWR / 1000; % ms -> sS(C_SET, nK) = S(C_SET, 1);S(C_GET, ind_WW) = S(C_SET, ind_WW); % these should not matterS(C_SET, ind_RW) = S(C_GET, ind_RW); % these should not matterS(C_GET, ind_MC) = S(C_SET, ind_MC); % these should not matterS(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 centerm(2) = 1; # M/M/1m(ind_RW) = nT; # M/M/mm(ind_WW) = 1; # M/M/1 m(ind_MC) = 0; # delay centerm(ind_WWR) = 1; # M/M/1m(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
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 + networkC_GET = 1;C_SET = 2;ind_RW = 3:3+nS-1; % ReadWorkerind_WW = 3+nS:3+2*nS-1; % WriteWorkerind_MC = 3+2*nS:3+3*nS-1; % Memcachedind_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 = 0N = 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 -> sS(C_GET, 2) = tLB_g / 1000; % ms -> sS(C_GET, ind_RW) = tRW / 1000; % ms -> sS(C_GET, nK) = S(C_GET, 1);S(C_SET, 1) = tNW_s / 1000; % ms -> sS(C_SET, 2) = tLB_s / 1000; % ms -> sS(C_SET, ind_WW) = tWW / 1000; % ms -> sS(C_SET, ind_MC) = tMC / 1000; % ms -> sS(C_SET, ind_WWR) = tWWR / 1000; % ms -> sS(C_SET, nK) = S(C_SET, 1);S(C_GET, ind_WW) = S(C_SET, ind_WW); % these should not matterS(C_SET, ind_RW) = S(C_GET, ind_RW); % these should not matterS(C_GET, ind_MC) = S(C_SET, ind_MC); % these should not matterS(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 centerm(2) = 1; # M/M/1m(ind_RW) = nT; # M/M/mm(ind_WW) = 1; # M/M/1 m(ind_MC) = 0; # delay centerm(ind_WWR) = 1; # M/M/1m(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
Expand Down

0 comments on commit c8d9823

Please sign in to comment.