From ded9abbb8696637f87125985feca3a02276bce90 Mon Sep 17 00:00:00 2001 From: taivop Date: Sun, 18 Dec 2016 14:41:31 +0100 Subject: [PATCH] model 3 works better now --- scripts/oct/mva3_main.m | 2 +- scripts/oct/mva_model3.m | 2 +- scripts/r/part3_network_model3.r | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/oct/mva3_main.m b/scripts/oct/mva3_main.m index aeeb18b..4fc37ce 100644 --- a/scripts/oct/mva3_main.m +++ b/scripts/oct/mva3_main.m @@ -1 +1 @@ -addpath ("./scripts/oct/") %nS = 5 % number of servers %nT = 32 % number of threads %nC = 180 % number of clients %pW = 5 / 100 % proportion of writes % %tNW_g = 2.826752 %tLB_g = 0.003863378 %tMC_g = 3.048588 %tNW_s = 2.858229 %tLB_s = 0.003403551 %tMC_s = 3.122988 arg_list = argv (); num_args_required = 11; if(length(arg_list) != num_args_required) printf("Check usage: %d arguments given, %d required.\n", length(arg_list), num_args_required); return; endif offset = 1; result_path = arg_list{1} nS = str2num(arg_list{1 + offset}) % number of servers nT = str2num(arg_list{2 + offset}) % number of threads nC = str2num(arg_list{3 + offset}) % number of clients pW = str2num(arg_list{4 + offset}) / 100 % proportion of writes tNW_g = str2num(arg_list{5 + offset}) tNW_s = str2num(arg_list{6 + offset}) tLB_g = str2num(arg_list{7 + offset}) tLB_s = str2num(arg_list{8 + offset}) tWW = str2num(arg_list{9 + offset}) tRW = str2num(arg_list{10 + offset}) [U, R, Q, X] = mva_model1_multiclass(result_path, nS, nT, nC, pW, tNW_g, tNW_s, tLB_g, tLB_s, tWW, tRW); \ No newline at end of file +addpath ("./scripts/oct/") %nS = 5 % number of servers %nT = 32 % number of threads %nC = 180 % number of clients %pW = 5 / 100 % proportion of writes % %tNW_g = 2.826752 %tLB_g = 0.003863378 %tMC_g = 3.048588 %tNW_s = 2.858229 %tLB_s = 0.003403551 %tMC_s = 3.122988 arg_list = argv (); num_args_required = 11; if(length(arg_list) != num_args_required) printf("Check usage: %d arguments given, %d required.\n", length(arg_list), num_args_required); return; endif offset = 1; result_path = arg_list{1} nS = str2num(arg_list{1 + offset}) % number of servers nT = str2num(arg_list{2 + offset}) % number of threads nC = str2num(arg_list{3 + offset}) % number of clients pW = str2num(arg_list{4 + offset}) / 100 % proportion of writes tNW_g = str2num(arg_list{5 + offset}) tNW_s = str2num(arg_list{6 + offset}) tLB_g = str2num(arg_list{7 + offset}) tLB_s = str2num(arg_list{8 + offset}) tWW = str2num(arg_list{9 + offset}) tRW = str2num(arg_list{10 + offset}) [U, R, Q, X] = mva_model3(result_path, nS, nT, nC, pW, tNW_g, tNW_s, tLB_g, tLB_s, tWW, tRW); \ No newline at end of file diff --git a/scripts/oct/mva_model3.m b/scripts/oct/mva_model3.m index 6023664..c092691 100644 --- a/scripts/oct/mva_model3.m +++ b/scripts/oct/mva_model3.m @@ -1 +1 @@ -function [U, R, Q, X] = mva_model2(result_path, nS, nT, nC, pW, tNW_g, tNW_s, tLB_g, tLB_s, tWW, tRW); pkg load queueing; % ---- Setup ---- nK = 1 + 1 + nS + nS + 1; % network + LoadBalancer + ReadWorkers + WriteWorker + network C_GET = 1; C_SET = 2; ind_RW = 3:3+nS-1; % ReadWorker ind_WW = 3+nS:3+2*nS-1; % WriteWorker % ---- 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, 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 % 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, 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(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_model3(result_path, nS, nT, nC, pW, tNW_g, tNW_s, tLB_g, tLB_s, tWW, tRW); pkg load queueing; % ---- Setup ---- nK = 1 + 1 + nS + nS + 1; % network + LoadBalancer + ReadWorkers + WriteWorker + network C_GET = 1; C_SET = 2; ind_RW = 3:3+nS-1; % ReadWorker ind_WW = 3+nS:3+2*nS-1; % WriteWorker % ---- 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, 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 % 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, 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(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 diff --git a/scripts/r/part3_network_model3.r b/scripts/r/part3_network_model3.r index dbd8517..a6461fe 100644 --- a/scripts/r/part3_network_model3.r +++ b/scripts/r/part3_network_model3.r @@ -78,16 +78,16 @@ mss <- memaslap_summary(memaslap) %>% inputs <- model_inputs(requests, mss) %>% as.data.frame() # ---- Model results ---- -octave_output_dir <- paste0(octave_dir_base, "/model2/", dir_name_end) +octave_output_dir <- paste0(octave_dir_base, "/model3/", dir_name_end) system(paste0("mkdir -p ", octave_output_dir)) octave_output_file <- paste0(octave_output_dir, "/results.mat") arg_list <- paste(octave_output_file, - num_servers, num_replication, num_threads, num_clients, perc_writes, + num_servers, num_threads, num_clients, perc_writes, inputs$tNW_get, inputs$tNW_set, inputs$tLB_get, inputs$tLB_set, - inputs$tWW, inputs$tRW, inputs$tMC, 0, + inputs$tWW, inputs$tRW, collapse=" ") -system(paste0("octave scripts/oct/mva2_main.m ", arg_list)) +system(paste0("octave scripts/oct/mva3_main.m ", arg_list)) mva <- readMat(octave_output_file) K <- ncol(mva$U) # number of nodes in the network