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

Commit

Permalink
model 3 works better now
Browse files Browse the repository at this point in the history
  • Loading branch information
taivop committed Dec 18, 2016
1 parent c8d9823 commit ded9abb
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion scripts/oct/mva3_main.m
Original file line number Diff line number Diff line change
@@ -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.122988arg_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;endifoffset = 1;result_path = arg_list{1}nS = str2num(arg_list{1 + offset}) % number of serversnT = str2num(arg_list{2 + offset}) % number of threadsnC = str2num(arg_list{3 + offset}) % number of clientspW = str2num(arg_list{4 + offset}) / 100 % proportion of writestNW_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);
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.122988arg_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;endifoffset = 1;result_path = arg_list{1}nS = str2num(arg_list{1 + offset}) % number of serversnT = str2num(arg_list{2 + offset}) % number of threadsnC = str2num(arg_list{3 + offset}) % number of clientspW = str2num(arg_list{4 + offset}) / 100 % proportion of writestNW_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);
Expand Down
2 changes: 1 addition & 1 deletion scripts/oct/mva_model3.m
Original file line number Diff line number Diff line change
@@ -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 + networkC_GET = 1;C_SET = 2;ind_RW = 3:3+nS-1; % ReadWorkerind_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 = 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, 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 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 centerm(2) = 1; # M/M/1m(ind_RW) = nT; # M/M/mm(ind_WW) = 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_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 + networkC_GET = 1;C_SET = 2;ind_RW = 3:3+nS-1; % ReadWorkerind_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 = 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, 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 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 centerm(2) = 1; # M/M/1m(ind_RW) = nT; # M/M/mm(ind_WW) = 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
8 changes: 4 additions & 4 deletions scripts/r/part3_network_model3.r
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ded9abb

Please sign in to comment.