├── LICENSE ├── README.md ├── data_processing ├── composition.py ├── e2e_parsing.py └── syn_results_train.py ├── experiment_scripts ├── run_real_experiment.sh ├── run_synth_experiment.sh └── util_scripts │ ├── cleanup_nf.sh │ ├── run_mg.sh │ ├── run_mg_comp.sh │ ├── run_nf.sh │ ├── run_nf_comp.sh │ ├── run_nf_real_comp.sh │ ├── run_nf_shuf.sh │ ├── run_nf_synth_comp.sh │ ├── stop_mg.sh │ ├── stop_nf.sh │ └── stop_pcm.sh ├── setup └── setup_nic.sh └── traffic_generator └── traffic_generation.lua /LICENSE: -------------------------------------------------------------------------------- 1 | The Clear BSD License 2 | 3 | Copyright (c) 2020 Carnegie Mellon University 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted (subject to the limitations in the disclaimer 8 | below) provided that the following conditions are met: 9 | 10 | * Redistributions of source code must retain the above copyright notice, 11 | this list of conditions and the following disclaimer. 12 | 13 | * Redistributions in binary form must reproduce the above copyright 14 | notice, this list of conditions and the following disclaimer in the 15 | documentation and/or other materials provided with the distribution. 16 | 17 | * Neither the name of the copyright holder nor the names of its 18 | contributors may be used to endorse or promote products derived from this 19 | software without specific prior written permission. 20 | 21 | NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY 22 | THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 23 | CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 24 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 25 | PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 26 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 27 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 28 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 29 | BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 30 | IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 32 | POSSIBILITY OF SUCH DAMAGE. 33 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # SLOMO 2 | Material for SLOMO performance prediction framework presented at SIGCOMM 2020 3 | 4 | ## **Hardware & OS** 5 | 6 | We use two machines for our experiments, one for hosting NFs and another for traffic generation. Below we describe two such hardware setups. 7 | 8 | **Setup 1** 9 | 10 | * _CPU_: Intel Xeon E5-2620 v4 11 | * _NIC_: Intel XL710 - 40GbE QSFP+ 1584 (2 NICs/server) 12 | 13 | * _OS_: Ubuntu 18.04.3 LTS - 4.15.0-99-generic 14 | * _DPDK_: 18.05.1 stable 15 | * _NIC Drivers_: i40e-2.9.21 - iavf-3.7.53 16 | 17 | 18 | **Setup 2** 19 | 20 | * *CPU*: Intel Xeon Silver 4110 21 | * *NIC*: Mellanox MT27700 Family [ConnectX-4] 1013 (2 NICs/server) 22 | 23 | * *OS*: Ubuntu 18.04.2 LTS - 4.15.0-48-generic 24 | * *DPDK*: 18.11.1 stable 25 | * *NIC Drivers*: MLNX_OFED_LINUX-4.5-1.0.1.0-ubuntu18.04-x86_64 26 | 27 | 28 | **Note:** 29 | 30 | * Each port on the generator is directly attached to the corresponding physical port of the testing server. 31 | * Ideally, both machines should be dual-socket with high core count processors. Hyper-threading should be deactivated. 32 | * The specific driver NICs were necessary to ensure that DPDK would work seamlessly on top of SR-IOV. 33 | 34 | 35 | ## **Installation - Setup** 36 | 37 | * setup/ contains sample setup commands for partitioning the NIC with SRIOV. 38 | * experiment_scripts/ contains sample scripts that initiate NF experiments 39 | * data_processing/ contains sample routines for parsing experiment data 40 | * traffic_generator/ contains a sample traffic generation script 41 | 42 | * The NFs we used in our work rely on DPDK for I/O. 43 | * Please ensure that your NIC’s VF drivers are updated and that a compatible version of DPDK is being used. 44 | * Please ensure that NFs will be spawned on cores of the same CPU socket as the NIC they will be receiving traffic from to avoid unnecessary communication over QPI. 45 | 46 | -------------------------------------------------------------------------------- /data_processing/composition.py: -------------------------------------------------------------------------------- 1 | import sys 2 | import numpy as np 3 | import pandas as pd 4 | import seaborn as sns 5 | import matplotlib.pyplot as plt 6 | import pickle 7 | from matplotlib import cm 8 | from mpl_toolkits.mplot3d import Axes3D 9 | from sklearn.feature_selection import mutual_info_regression 10 | from sklearn.ensemble import GradientBoostingRegressor 11 | from sklearn.model_selection import train_test_split 12 | from sklearn.neighbors import NearestNeighbors 13 | from sklearn.linear_model import LinearRegression 14 | 15 | 16 | nf=sys.argv[1] 17 | pkt_size = sys.argv[2] 18 | flow_count = sys.argv[3] 19 | 20 | try: 21 | cont_dict = pickle.load(open('contention_dictionary.p', 'rb')) 22 | except: 23 | cont_dict = {} 24 | 25 | cont_dict[(nf, pkt_size, flow_count)] = {} 26 | for competitor in ["0", "1", "2", "3", "4", "5", "6", "7", "8"]: 27 | all_counters = [] 28 | all_counters_solo = [] 29 | for itr in ["1", "2", "5", "10"]: 30 | for reads in ["10000", "5000", "1000"]: 31 | for size in ["2000000", "4000000","6000000", "8000000", "10000000", "15000000", "20000000"]: 32 | pps = [] 33 | bps = [] 34 | try: 35 | if competitor == "0": 36 | f = open('experiment_data_'+ nf +'/perf_data_'+ pkt_size + '_' +competitor+'.txt','r') 37 | else: 38 | f = open('experiment_data_'+ nf +'/perf_data_'+ pkt_size + '_' + flow_count + '_' + competitor+'_'+size +'_' + reads + '_'+itr+'.txt','r') 39 | except FileNotFoundError: 40 | continue 41 | 42 | if nf != "Suricata" and nf != "Snort": 43 | last_lines = f.readlines()[-22:] 44 | f.close() 45 | if len(last_lines) < 3: 46 | continue 47 | if "RX" in last_lines[-3]: 48 | lines = last_lines[1:-2][::2] 49 | lines[-1] = lines[-2] 50 | else: 51 | lines = last_lines[:-2][::2] 52 | 53 | for line in lines: 54 | pps.append(float(line.strip().split(":")[2].split(",")[0].strip().split(" ")[0])) 55 | bps.append(float(line.strip().split(":")[2].split(",")[1].strip().split(" ")[0])) 56 | 57 | elif nf == "Suricata": 58 | last_lines = f.readlines()[-25:] 59 | f.close() 60 | 61 | flag = False 62 | for line in last_lines: 63 | if 'decoder.pkts' in line: 64 | pax = float(line.strip().split("|")[2].strip()) 65 | flag = True 66 | elif 'decoder.bytes' in line: 67 | bts = float(line.strip().split("|")[2].strip()) 68 | flag = True 69 | elif 'uptime' in line: 70 | seconds = float(line.strip().split(",")[1].strip().split(" ")[-1][:-2].strip()) 71 | 72 | if not flag: 73 | continue 74 | mean_pps = pax/seconds 75 | mean_bps = bts/seconds 76 | 77 | elif nf == "Snort": 78 | last_lines = f.readlines()[-70:] 79 | f.close() 80 | 81 | flag = False 82 | for line in last_lines: 83 | if 'analyzed' in line: 84 | pax = float(line.strip().split(":")[1].strip()) 85 | flag = True 86 | if 'seconds' in line: 87 | seconds = float(line.strip().split(":")[1].strip()) 88 | 89 | if not flag: 90 | continue 91 | mean_pps = pax/seconds 92 | mean_bps = pax/seconds 93 | 94 | 95 | if competitor == "0": 96 | top_line = pd.read_csv('experiment_data_'+ nf +'/counters_after_' + pkt_size + '_' + flow_count + '_' + competitor + '.csv', header=None).ix[0] 97 | else: 98 | top_line = pd.read_csv('experiment_data_'+ nf +'/counters_before_' + pkt_size + '_' + flow_count + '_' + competitor + '_' + size + '_'+ reads +'_' + itr +'.csv', header=None).ix[0] 99 | headers = [] 100 | tmp = "" 101 | for itm in top_line: 102 | if pd.isnull(itm): 103 | headers.append(tmp) 104 | else: 105 | tmp = itm 106 | headers.append(tmp) 107 | 108 | if competitor == "0": 109 | counters_solo = pd.read_csv('experiment_data_'+ nf +'/counters_after_' + pkt_size + '_' + flow_count + '_' + competitor + '.csv', header=[1]).tail(10).ix[:, :len(headers)] 110 | line2 = counters_solo.columns.values 111 | else: 112 | counters = pd.read_csv('experiment_data_'+ nf +'/counters_before_' + pkt_size + '_' + flow_count + '_' + competitor + '_' + size + '_'+ reads +'_' + itr + '.csv', header=[1]).tail(10).ix[:, :len(headers)] 113 | line2 = counters.columns.values 114 | 115 | final = [] 116 | for itm in range(len(headers)): 117 | final.append(headers[itm] + " -> " + str(line2[itm])) 118 | 119 | final = np.asarray(final) 120 | if competitor == "0": 121 | counters_solo.columns=final 122 | else: 123 | counters.columns = final 124 | 125 | if competitor != "0": 126 | counters_after = pd.read_csv('experiment_data_'+ nf +'/counters_after_' + pkt_size + '_' + flow_count + '_' + competitor + '_' + size + '_'+ reads +'_' + itr + '.csv', header=[1]).tail(10).ix[:, :len(headers)] 127 | counters_after.columns = final 128 | 129 | diff_mem = (counters_after.filter(regex=("Socket1")).reset_index(drop=True)).subtract(counters.filter(regex=("Socket1")).reset_index(drop=True)) 130 | diff_mem_read = diff_mem.filter(regex=("READ")).reset_index(drop=True) 131 | diff_mem_write = diff_mem.filter(regex=("WRITE")).reset_index(drop=True) 132 | diff_mem_read.columns = ["READ"] 133 | diff_mem_write.columns= ["WRITE"] 134 | 135 | counters = counters.filter(regex=("Core1 ")).reset_index(drop=True) 136 | counters_after = counters_after.filter(regex=("Core1 ")).reset_index(drop=True) 137 | 138 | diff = counters_after 139 | diff["READ"] = diff_mem_read 140 | diff["WRITE"] = diff_mem_write 141 | 142 | all_counters.append(diff[:-5]) 143 | if competitor == "0": 144 | counters_solo = counters_solo.filter(regex=("Core1 ")).reset_index(drop=True) 145 | all_counters_solo.append(counters_solo[:-8]) 146 | 147 | try: 148 | total_vector = pd.concat(all_counters) 149 | except: 150 | continue 151 | 152 | df = total_vector 153 | df.columns = ["EXEC", "IPC", "FREQ", "AFREQ", "L3MISS", "L2MISS", "L3HIT", "L2HIT", "L3MPI", "L2MPI", "L3OCC", "LMB", "RMB", "READ", "WRITE"] 154 | 155 | normalized_df= df 156 | normalized_df = normalized_df.melt(var_name='groups', value_name='vals') 157 | cont_dict[(nf, pkt_size, flow_count)][competitor] = df 158 | 159 | pickle.dump(cont_dict, open("contention_dictionary.p", "wb")) 160 | -------------------------------------------------------------------------------- /data_processing/e2e_parsing.py: -------------------------------------------------------------------------------- 1 | import sys, os, pickle 2 | import pandas as pd 3 | import numpy as np 4 | from math import * 5 | 6 | import warnings 7 | warnings.filterwarnings("ignore") 8 | 9 | columns = ["EXEC", "IPC", "FREQ", "AFREQ", "L3MISS", "L2MISS", "L3HIT", "L2HIT", "L3MPI", "L2MPI", "L3OCC", "LMB", "RMB", "READ", "WRITE"] 10 | nf = sys.argv[1] 11 | pkt = sys.argv[2] 12 | flow_counter = sys.argv[3] 13 | 14 | cont_dict = pickle.load(open('../all_synthetic_data/contention_dictionary.p', 'rb')) 15 | sens_model = pickle.load(open('../all_synthetic_data/sensitivity_dictionary.p', 'rb')) 16 | occupancies = pickle.load(open('occupancies.p', 'rb')) 17 | solo_perf = pickle.load(open('solo_perf.p', 'rb')) 18 | car = pickle.load(open('car.p', 'rb')) 19 | errors = [] 20 | 21 | try: 22 | all_results = pickle.load(open('e2e_results.p', 'rb')) 23 | except FileNotFoundError: 24 | all_results = {} 25 | 26 | # Read list of competing NFs 27 | for directory in os.listdir('experiment_real_data_' + nf): 28 | split_name = directory.strip().split("_") 29 | if pkt not in split_name: 30 | continue 31 | if flow_counter not in split_name: 32 | continue 33 | 34 | competing_nfs = [] 35 | nr_competitors = 0 36 | 37 | try: 38 | f = open('experiment_real_data_'+ nf +'/' + directory + '/competitors.txt', 'rb') 39 | except FileNotFoundError: 40 | print("File not found") 41 | continue 42 | 43 | for line in f: 44 | comp = line.decode('UTF-8').strip() 45 | competing_nfs.append(comp) 46 | nr_competitors += 1 47 | f.close() 48 | 49 | nr_competitors = str(nr_competitors) 50 | competing_nfs = competing_nfs 51 | 52 | if nf not in all_results.keys(): 53 | all_results[nf] = {} 54 | all_results[nf][pkt] = {} 55 | all_results[nf][pkt][flow_counter] = {"1":{}, "2":{}, "3":{}, "4":{}, "5":{}, "6":{}, "7":{}} 56 | elif pkt not in all_results[nf].keys(): 57 | all_results[nf][pkt] = {} 58 | all_results[nf][pkt][flow_counter] = {"1":{}, "2":{}, "3":{}, "4":{}, "5":{}, "6":{}, "7":{}} 59 | elif flow_counter not in all_results[nf][pkt].keys(): 60 | all_results[nf][pkt][flow_counter] = {"1":{}, "2":{}, "3":{}, "4":{}, "5":{}, "6":{}, "7":{}} 61 | 62 | f = open('experiment_real_data_'+ nf +'/' + directory + '/target.txt', 'rb') 63 | for line in f: 64 | tNF = line.decode('UTF-8').strip() 65 | f.close() 66 | 67 | for filename in os.listdir('experiment_real_data_'+ nf +'/' + directory): 68 | if 'perf_data' in filename: 69 | f = open('experiment_real_data_'+ nf +'/' + directory + '/' + filename) 70 | if nf != "Snort" and nf != "Suricata": 71 | pps = [] 72 | bps = [] 73 | last_lines = f.readlines()[-42:] 74 | lines = last_lines[:-2][::2] 75 | last_lines = last_lines[-2:] 76 | for line in lines: 77 | pps.append(float(line.strip().split(":")[2].split(",")[0].strip().split(" ")[0])) 78 | f.close() 79 | elif nf == "Suricata": 80 | last_lines = f.readlines()[-25:] 81 | f.close() 82 | 83 | flag = False 84 | for line in last_lines: 85 | if 'decoder.pkts' in line: 86 | pax = float(line.strip().split("|")[2].strip()) 87 | flag = True 88 | elif 'decoder.bytes' in line: 89 | bts = float(line.strip().split("|")[2].strip()) 90 | flag = True 91 | elif 'uptime' in line: 92 | seconds = float(line.strip().split(",")[1].strip().split(" ")[-1][:-2].strip()) 93 | print(seconds) 94 | if not flag: 95 | continue 96 | pps = [pax/seconds] 97 | bps = [bts/seconds] 98 | else: 99 | last_lines = f.readlines()[-70:] 100 | f.close() 101 | 102 | flag = False 103 | for line in last_lines: 104 | if 'analyzed' in line: 105 | pax = float(line.strip().split(":")[1].strip()) 106 | flag = True 107 | if 'seconds' in line: 108 | seconds = float(line.strip().split(":")[1].strip()) 109 | if not flag: 110 | continue 111 | pps = [pax/seconds] 112 | bps = [pax/seconds] 113 | elif 'counters_before' in filename: 114 | top_line = pd.read_csv('experiment_real_data_'+ nf +'/' + directory + '/' + filename, header=None).ix[0] 115 | headers = [] 116 | tmp = "" 117 | for itm in top_line: 118 | if pd.isnull(itm): 119 | headers.append(tmp) 120 | else: 121 | tmp = itm 122 | headers.append(tmp) 123 | 124 | counters = pd.read_csv('experiment_real_data_'+ nf +'/' + directory + '/' + filename, header=[1]).tail(10).ix[:, :len(headers)] 125 | line2 = counters.columns.values 126 | 127 | final = [] 128 | for itm in range(len(headers)): 129 | final.append(headers[itm] + " -> " + str(line2[itm])) 130 | 131 | final = np.asarray(final) 132 | counters_after = pd.read_csv('experiment_real_data_'+ nf +'/' + directory + '/' + filename, header=[1]).tail(10).ix[:, :len(headers)] 133 | counters_after.columns = final 134 | counters_after = counters_after.filter(regex=("Socket1")).reset_index(drop=True) 135 | counters_after.columns = ["EXEC", "IPC", "FREQ", "AFREQ", "L3MISS", "L2MISS", "L3HIT", "L2HIT", "L3MPI", "L2MPI", "L3OCC", "LMB", "RMB", "READ", "WRITE", "TEMP"] 136 | 137 | 138 | # Compose contentiousness 139 | vector = cont_dict[(nf, pkt, flow_counter)] 140 | aggregate_cont_solo = [] 141 | aggregate_cont = [] 142 | counter = 0 143 | occupancy_of_competition = 0 144 | occupancy_of_target = occupancies[nf][pkt][flow_counter] 145 | car_solo_competition = 0 146 | for cNF in competing_nfs: 147 | occupancy_of_competition += occupancies[nf][pkt][flow_counter] 148 | car_solo_competition += car[nf][pkt][flow_counter] 149 | 150 | for cNF in competing_nfs: 151 | cNF_cont_solo = vector["0"].median() 152 | cNF_cont = vector[nr_competitors].median() 153 | if counter == 0: 154 | aggregate_cont = cNF_cont 155 | aggregate_cont_solo = cNF_cont_solo 156 | counter += 1 157 | else: 158 | aggregate_cont += cNF_cont 159 | aggregate_cont_solo += cNF_cont_solo 160 | counter += 1 161 | 162 | aggregate_cont = pd.DataFrame(aggregate_cont.values.reshape(1,-1), columns=columns) 163 | aggregate_cont['IPC'] = aggregate_cont['IPC'].div(int(nr_competitors)) 164 | aggregate_cont['EXEC'] = aggregate_cont['EXEC'].div(8) 165 | aggregate_cont['AFREQ'] = aggregate_cont['AFREQ'].div(int(nr_competitors)) 166 | aggregate_cont['FREQ'] = aggregate_cont['FREQ'].div(8) 167 | aggregate_cont['L2HIT'] = aggregate_cont['L2HIT'].div(int(nr_competitors)) 168 | aggregate_cont['L3HIT'] = aggregate_cont['L3HIT'].div(int(nr_competitors)) 169 | 170 | aggregate_cont_solo = pd.DataFrame(aggregate_cont_solo.values.reshape(1,-1), columns=columns) 171 | aggregate_cont_solo['IPC'] = aggregate_cont_solo['IPC'].div(int(nr_competitors)) 172 | aggregate_cont_solo['EXEC'] = aggregate_cont_solo['EXEC'].div(8) 173 | aggregate_cont_solo['AFREQ'] = aggregate_cont_solo['AFREQ'].div(int(nr_competitors)) 174 | aggregate_cont_solo['FREQ'] = aggregate_cont_solo['FREQ'].div(8) 175 | aggregate_cont_solo['L2HIT'] = aggregate_cont_solo['L2HIT'].div(int(nr_competitors)) 176 | aggregate_cont_solo['L3HIT'] = aggregate_cont_solo['L3HIT'].div(int(nr_competitors)) 177 | 178 | # Retrieve sensitivity function for target NF 179 | tNF = (nf, pkt, flow_counter) 180 | model = sens_model[tNF]['slomo'] 181 | dobrescu_model = sens_model[tNF]['dobrescu'] 182 | mars_model = sens_model[tNF]['mars'] 183 | 184 | #Make predictions 185 | dobrescu_result = dobrescu_model.predict(np.asarray([car_solo_competition]).reshape(-1, 1))[0] 186 | mars_result = mars_model.predict(aggregate_cont['L3OCC'].reshape(-1, 1))[0] 187 | 188 | result = model.predict(aggregate_cont)[0] 189 | result_no_comp = model.predict(counters_after)[0] 190 | result_bad_composition = model.predict(aggregate_cont_solo)[0] 191 | observed = np.mean(np.asarray(pps)) 192 | 193 | local_errors = [] 194 | local_errors_nc = [] 195 | local_errors_bc = [] 196 | local_errors_dobrescu = [] 197 | local_errors_mars = [] 198 | 199 | local_abs_errors = [] 200 | local_abs_errors_nc = [] 201 | local_abs_errors_bc = [] 202 | local_abs_errors_dobrescu = [] 203 | local_abs_errors_mars = [] 204 | 205 | for x in pps: 206 | abs_error = abs(100*(result- x)/x) 207 | error = 100*(result- x)/x 208 | 209 | abs_nc_error = abs(100*(result_no_comp - x)/x) 210 | nc_error = 100*(result_no_comp - x)/x 211 | 212 | abs_bc_error = abs(100*(result_bad_composition - x)/x) 213 | bc_error = 100*(result_bad_composition - x)/x 214 | 215 | dobrescu_abs_error = abs(100*(dobrescu_result- x)/x) 216 | dobrescu_error = 100*(dobrescu_result- x)/x 217 | 218 | mars_abs_error = abs(100*(mars_result- x)/x) 219 | mars_error = 100*(mars_result- x)/x 220 | 221 | local_abs_errors.append(abs_error) 222 | local_abs_errors_nc.append(abs_nc_error) 223 | local_abs_errors_bc.append(abs_bc_error) 224 | local_abs_errors_dobrescu.append(dobrescu_abs_error) 225 | local_abs_errors_mars.append(mars_abs_error) 226 | 227 | local_errors.append(error) 228 | local_errors_nc.append(nc_error) 229 | local_errors_bc.append(bc_error) 230 | local_errors_dobrescu.append(dobrescu_error) 231 | local_errors_mars.append(mars_error) 232 | 233 | print("Prediction: ", result) 234 | print("Prediction NC ", result_no_comp) 235 | print("Dobrescu Prediction: ", dobrescu_result) 236 | print("Observed: ", observed) 237 | print("Error: ", np.asarray(local_errors).mean()) 238 | print("NC Error ", np.asarray(local_errors_nc).mean()) 239 | print("BC Error ", np.asarray(local_errors_bc).mean()) 240 | print("Dobrescu Error ", np.asarray(local_errors_dobrescu).mean()) 241 | 242 | all_results[nf][pkt][flow_counter][nr_competitors] = {"slomo_prediction": result, 243 | "dobrescu_prediction": dobrescu_result, 244 | "mars_prediction": mars_result, 245 | "observed": pps, 246 | "slomo_abs_error": local_abs_errors, "slomo_error":local_errors, 247 | "nc_abs_error": local_abs_errors_nc, "nc_error": local_errors_nc, 248 | "dobrescu_abs_error": local_abs_errors_dobrescu, "dobrescu_error":local_errors_dobrescu, 249 | "mars_abs_error": local_abs_errors_mars, "mars_error": local_errors_mars} 250 | 251 | pickle.dump(all_results, open('e2e_results.p', 'wb')) 252 | -------------------------------------------------------------------------------- /data_processing/syn_results_train.py: -------------------------------------------------------------------------------- 1 | import sys 2 | import numpy as np 3 | import pandas as pd 4 | import seaborn as sns 5 | import matplotlib.pyplot as plt 6 | from matplotlib import cm 7 | from mpl_toolkits.mplot3d import Axes3D 8 | from sklearn.feature_selection import mutual_info_regression 9 | from sklearn.ensemble import GradientBoostingRegressor 10 | from sklearn.model_selection import train_test_split 11 | from sklearn.neighbors import NearestNeighbors 12 | from sklearn.linear_model import LinearRegression 13 | import pickle 14 | 15 | 16 | nf=sys.argv[1] 17 | pkt_size = sys.argv[2] 18 | flow_size = sys.argv[3] 19 | 20 | try: 21 | sens_models = pickle.load(open('sensitivity_dictionary.p', 'rb')) 22 | except: 23 | sens_models = {} 24 | all_counters = [] 25 | 26 | for size in ["2000000", "4000000","6000000", "8000000", "10000000", "15000000", "20000000"]: 27 | for itr in ["1", "2", "5", "10"]: 28 | for reads in ["10000", "1000"]: 29 | for descriptor in ["1", "2", "3", "4", "5", "6", "7"]: 30 | pps = [] 31 | bps = [] 32 | try: 33 | f = open('experiment_data_'+ nf +'/perf_data_'+ pkt_size + '_' + flow_size+ "_" + descriptor+'_'+size +'_' + reads + '_'+itr+'.txt','r') 34 | except FileNotFoundError: 35 | continue 36 | if nf != "Suricata" and nf != "Snort": 37 | last_lines = f.readlines()[-22:] 38 | f.close() 39 | if len(last_lines) < 3: 40 | continue 41 | if "RX" in last_lines[-3]: 42 | lines = last_lines[1:-2][::2] 43 | lines[-1] = lines[-2] 44 | else: 45 | lines = last_lines[:-2][::2] 46 | 47 | for line in lines: 48 | pps.append(float(line.strip().split(":")[2].split(",")[0].strip().split(" ")[0])) 49 | bps.append(float(line.strip().split(":")[2].split(",")[1].strip().split(" ")[0])) 50 | 51 | elif nf == "Suricata": 52 | last_lines = f.readlines()[-25:] 53 | f.close() 54 | 55 | flag = False 56 | for line in last_lines: 57 | if 'decoder.pkts' in line: 58 | pax = float(line.strip().split("|")[2].strip()) 59 | flag = True 60 | elif 'decoder.bytes' in line: 61 | bts = float(line.strip().split("|")[2].strip()) 62 | flag = True 63 | elif 'uptime' in line: 64 | seconds = float(line.strip().split(",")[1].strip().split(" ")[-1][:-2].strip()) 65 | print(seconds) 66 | if not flag: 67 | continue 68 | mean_pps = pax/seconds 69 | mean_bps = bts/seconds 70 | 71 | elif nf == "Snort": 72 | last_lines = f.readlines()[-70:] 73 | f.close() 74 | 75 | flag = False 76 | for line in last_lines: 77 | if 'analyzed' in line: 78 | pax = float(line.strip().split(":")[1].strip()) 79 | flag = True 80 | if 'seconds' in line: 81 | seconds = float(line.strip().split(":")[1].strip()) 82 | 83 | if not flag: 84 | continue 85 | mean_pps = pax/seconds #float(last_lines.strip().split(":")[1].strip()) 86 | mean_bps = pax/seconds #float(last_lines.strip().split(":")[1].strip()) 87 | 88 | top_line = pd.read_csv('experiment_data_'+ nf +'/counters_before_' + pkt_size + '_' + flow_size+ "_"+ descriptor + '_' + size + '_'+ reads +'_' + itr +'.csv', header=None).ix[0] 89 | headers = [] 90 | tmp = "" 91 | for itm in top_line: 92 | if pd.isnull(itm): 93 | headers.append(tmp) 94 | else: 95 | tmp = itm 96 | headers.append(tmp) 97 | 98 | if descriptor == "0": 99 | counters = pd.read_csv('experiment_data_'+ nf +'/counters_after_' + pkt_size + '_' + flow_size+ "_"+ descriptor + '.csv', header=[1]).tail(10).ix[:, :len(headers)] 100 | else: 101 | counters = pd.read_csv('experiment_data_'+ nf +'/counters_before_' + pkt_size + '_' + flow_size+ "_"+ descriptor + '_' + size + '_'+ reads +'_' + itr + '.csv', header=[1]).tail(10).ix[:, :len(headers)] 102 | 103 | line2 = counters.columns.values 104 | 105 | final = [] 106 | for itm in range(len(headers)): 107 | final.append(headers[itm] + " -> " + str(line2[itm])) 108 | 109 | final = np.asarray(final) 110 | counters.columns = final 111 | 112 | if nf != "Suricata" and nf != "Snort": 113 | counters['Perf'] = np.asarray(pps)[:len(counters)] 114 | else: 115 | perf = [mean_pps for x in range(len(counters))] 116 | counters['Perf'] = np.asarray(perf) 117 | all_counters.append(counters[:-2]) 118 | 119 | total_vector = pd.concat(all_counters) 120 | 121 | X_train_dobrescu = total_vector.filter(regex=("Socket1 -> L2MISS.2")).reset_index( drop=True) 122 | X_train_mars = total_vector.filter(regex=("Socket1 -> L3OCC.1")).reset_index(drop=True) 123 | X_train_slomo = total_vector.filter(regex=("Socket1 -> *")).reset_index( drop=True) 124 | Y_train = total_vector['Perf'].reset_index()['Perf'] 125 | 126 | dobrescu_reg1 = LinearRegression() 127 | mars_reg1 = LinearRegression() 128 | slomo_reg1 = GradientBoostingRegressor() 129 | 130 | dobrescu_reg1.fit(X_train_dobrescu, Y_train) 131 | mars_reg1.fit(X_train_mars, Y_train) 132 | slomo_reg1.fit(X_train_slomo, Y_train) 133 | 134 | sens_models[(nf, pkt_size, flow_size)] = {"slomo": slomo_reg1, "dobrescu":dobrescu_reg1, "mars":mars_reg1} 135 | pickle.dump(sens_models, open('sensitivity_dictionary.p', 'wb')) 136 | -------------------------------------------------------------------------------- /experiment_scripts/run_real_experiment.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | rate=40000 4 | packet_size=80 5 | 6 | for tNF_packet_size in 64 500 1500 7 | do 8 | for nf_type in mon_dpdk vpn ip_131k mon_dpdk Suricata Snort maglev 9 | do 10 | mkdir experiment_real_data_${nf_type} 11 | for nr_competitors in 0 1 2 3 4 5 6 7 12 | do 13 | if [ ${nr_competitors} -eq 0 ] 14 | then 15 | ssh -tt node0 'bash -s' < ./util_scripts/cleanup_nf.sh & 16 | sleep 5 17 | ssh -tt node0 'bash -s' < ./util_scripts/stop_pcm.sh 18 | ssh -tt node1 'bash -s' < ./util_scripts/run_mg.sh "${rate}" "${tNF_packet_size}" "${nr_competitors}" & 19 | ssh -tt node0 'bash -s' < ./util_scripts/run_nf.sh "${nf_type}" "${nr_competitors}" & 20 | sleep 40 21 | 22 | ssh -tt node1 'bash -s' < ./util_scripts/stop_mg.sh 23 | if [ "${nf_type}" != "Suricata" ] && [ "${nf_type}" != "Snort" ] && [ "${nf_type}" != "maglev" ] 24 | then 25 | ssh -tt node0 'bash -s' < ./util_scripts/stop_nf.sh "click" 26 | sleep 5 27 | scp node1:perf_data_${nr_competitors}.txt ./experiment_data_${nf_type}/perf_data_${tNF_packet_size}_${nr_competitors}.txt 28 | scp node0:counters_before_${nr_competitors}.csv ./experiment_data_${nf_type}/counters_before_${tNF_packet_size}_${nr_competitors}.csv 29 | scp node0:counters_after_${nr_competitors}.csv ./experiment_data_${nf_type}/counters_after_${tNF_packet_size}_${nr_competitors}.csv 30 | elif [ "${nf_type}" == "Suricata" ] 31 | then 32 | ssh -tt node0 'bash -s' < ./util_scripts/stop_nf.sh "Suricata" 33 | sleep 5 34 | scp node0:/usr/local/var/log/suricata/stats_1.log ./experiment_real_data_${nf_type}/perf_data_${tNF_packet_size}_${nr_competitors}.txt 35 | scp node0:counters_before_${nr_competitors}.csv ./experiment_real_data_${nf_type}/counters_before_${tNF_packet_size}_${nr_competitors}.csv 36 | scp node0:counters_after_${nr_competitors}.csv ./experiment_real_data_${nf_type}/counters_after_${tNF_packet_size}_${nr_competitors}.csv 37 | elif [ "${nf_type}" == "Snort" ] 38 | then 39 | ssh -tt node0 'bash -s' < ./util_scripts/stop_nf.sh "snort" 40 | sleep 10 41 | scp node0:output_app1.txt ./experiment_real_data_${nf_type}/perf_data_${tNF_packet_size}_${nr_competitors}.txt 42 | scp node0:counters_before_${nr_competitors}.csv ./experiment_real_data_${nf_type}/counters_before_${tNF_packet_size}_${nr_competitors}.csv 43 | scp node0:counters_after_${nr_competitors}.csv ./experiment_real_data_${nf_type}/counters_after_${tNF_packet_size}_${nr_competitors}.csv 44 | elif [ "${nf_type}" == "maglev" ] 45 | then 46 | ssh -tt node0 'bash -s' < ./util_scripts/stop_nf.sh "NetBricks" 47 | sleep 5 48 | scp node1:perf_data_${nr_competitors}.txt ./experiment_data_${nf_type}/perf_data_${tNF_packet_size}_${nr_competitors}.txt 49 | scp node0:counters_before_${nr_competitors}.csv ./experiment_data_${nf_type}/counters_before_${tNF_packet_size}_${nr_competitors}.csv 50 | scp node0:counters_after_${nr_competitors}.csv ./experiment_data_${nf_type}/counters_after_${tNF_packet_size}_${nr_competitors}.csv 51 | fi 52 | else 53 | ssh -tt node0 'bash -s' < ./util_scripts/cleanup_nf.sh & 54 | sleep 5 55 | ssh -tt node1 'bash -s' < ./util_scripts/run_mg.sh "${rate}" "${tNF_packet_size}" "${nr_competitors}" & 56 | ssh -tt node1 'bash -s' < ./util_scripts/run_mg_comp.sh "${rate}" "${packet_size}" "${nr_competitors}" & 57 | ssh -tt node0 'bash -s' < ./util_scripts/run_nf_real_comp.sh "${nr_competitors}" "${nf_type}" & 58 | 59 | sleep 60 60 | 61 | ssh -tt node0 'bash -s' < ./util_scripts/stop_pcm.sh 62 | ssh -tt node0 'bash -s' < ./util_scripts/run_nf.sh "${nf_type}" "${nr_competitors}" & 63 | sleep 80 64 | 65 | ssh -tt node1 'bash -s' < ./util_scripts/stop_mg.sh 66 | if [ "${nf_type}" != "Suricata" ] && [ "${nf_type}" != "Snort" ] && [ "${nf_type}" != "maglev" ] 67 | then 68 | ssh -tt node0 'bash -s' < ./util_scripts/stop_nf.sh "click" 69 | sleep 5 70 | scp node1:perf_data_${nr_competitors}.txt ./experiment_real_data_${nf_type}/perf_data_${tNF_packet_size}_${nr_competitors}.txt 71 | scp node0:counters_before_${nr_competitors}.csv ./experiment_real_data_${nf_type}/counters_before_${tNF_packet_size}_${nr_competitors}.csv 72 | scp node0:counters_after_${nr_competitors}.csv ./experiment_real_data_${nf_type}/counters_after_${tNF_packet_size}_${nr_competitors}.csv 73 | elif [ "${nf_type}" == "Suricata" ] 74 | then 75 | ssh -tt node0 'bash -s' < ./util_scripts/stop_nf.sh "Suricata" 76 | sleep 5 77 | scp node0:/usr/local/var/log/suricata/stats_1.log ./experiment_real_data_${nf_type}/perf_data_${tNF_packet_size}_${nr_competitors}.txt 78 | scp node0:counters_before_${nr_competitors}.csv ./experiment_real_data_${nf_type}/counters_before_${tNF_packet_size}_${nr_competitors}.csv 79 | scp node0:counters_after_${nr_competitors}.csv ./experiment_real_data_${nf_type}/counters_after_${tNF_packet_size}_${nr_competitors}.csv 80 | elif [ "${nf_type}" == "Snort" ] 81 | then 82 | ssh -tt node0 'bash -s' < ./util_scripts/stop_nf.sh "snort" 83 | sleep 10 84 | scp node0:output_app1.txt ./experiment_real_data_${nf_type}/perf_data_${tNF_packet_size}_${nr_competitors}.txt 85 | scp node0:counters_before_${nr_competitors}.csv ./experiment_real_data_${nf_type}/counters_before_${tNF_packet_size}_${nr_competitors}.csv 86 | scp node0:counters_after_${nr_competitors}.csv ./experiment_real_data_${nf_type}/counters_after_${tNF_packet_size}_${nr_competitors}.csv 87 | elif [ "${nf_type}" == "maglev" ] 88 | then 89 | ssh -tt node0 'bash -s' < ./util_scripts/stop_nf.sh "NetBricks" 90 | sleep 5 91 | scp node1:perf_data_${nr_competitors}.txt ./experiment_real_data_${nf_type}/perf_data_${tNF_packet_size}_${nr_competitors}.txt 92 | scp node0:counters_before_${nr_competitors}.csv ./experiment_real_data_${nf_type}/counters_before_${tNF_packet_size}_${nr_competitors}.csv 93 | scp node0:counters_after_${nr_competitors}.csv ./experiment_real_data_${nf_type}/counters_after_${tNF_packet_size}_${nr_competitors}.csv 94 | fi 95 | fi 96 | done 97 | done 98 | done 99 | -------------------------------------------------------------------------------- /experiment_scripts/run_synth_experiment.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | rate=40000 4 | packet_size=80 5 | 6 | for tNF_packet_size in 64 500 1500 7 | do 8 | for nf_type in mon_dpdk vpn mon_dpdk Suricata Snort maglev 9 | do 10 | mkdir experiment_data_${nf_type} 11 | for nr_competitors in 1 2 3 4 5 6 7 12 | do 13 | if [ ${nr_competitors} -eq 0 ] 14 | then 15 | ssh -tt node0 'bash -s' < ./util_scripts/cleanup_nf.sh & 16 | sleep 5 17 | ssh -tt node0 'bash -s' < ./util_scripts/stop_pcm.sh 18 | ssh -tt node1 'bash -s' < ./util_scripts/run_mg.sh "${rate}" "${tNF_packet_size}" "${nr_competitors}" & 19 | ssh -tt node0 'bash -s' < ./util_scripts/run_nf.sh "${nf_type}" "${nr_competitors}" & 20 | sleep 30 21 | 22 | ssh -tt node1 'bash -s' < ./util_scripts/stop_mg.sh 23 | if [ "${nf_type}" != "Suricata" ] && [ "${nf_type}" != "Snort" ] 24 | then 25 | ssh -tt node0 'bash -s' < ./util_scripts/stop_nf.sh "click" 26 | sleep 5 27 | scp node1:perf_data_${nr_competitors}.txt ./experiment_data_${nf_type}/perf_data_${tNF_packet_size}_${nr_competitors}.txt 28 | scp node0:counters_before_${nr_competitors}.csv ./experiment_data_${nf_type}/counters_before_${tNF_packet_size}_${nr_competitors}.csv 29 | scp node0:counters_after_${nr_competitors}.csv ./experiment_data_${nf_type}/counters_after_${tNF_packet_size}_${nr_competitors}.csv 30 | elif [ "${nf_type}" == "Suricata" ] 31 | then 32 | ssh -tt node0 'bash -s' < ./util_scripts/stop_nf.sh "Suricata" 33 | sleep 5 34 | scp node0:/usr/local/var/log/suricata/stats_1.log ./experiment_data_${nf_type}/perf_data_${tNF_packet_size}_${nr_competitors}.txt 35 | scp node0:counters_before_${nr_competitors}.csv ./experiment_data_${nf_type}/counters_before_${tNF_packet_size}_${nr_competitors}.csv 36 | scp node0:counters_after_${nr_competitors}.csv ./experiment_data_${nf_type}/counters_after_${tNF_packet_size}_${nr_competitors}.csv 37 | elif [ "${nf_type}" == "Snort" ] 38 | then 39 | ssh -tt node0 'bash -s' < ./util_scripts/stop_nf.sh "snort" 40 | sleep 10 41 | scp node0:output_app1.txt ./experiment_data_${nf_type}/perf_data_${tNF_packet_size}_${nr_competitors}.txt 42 | scp node0:counters_before_${nr_competitors}.csv ./experiment_data_${nf_type}/counters_before_${tNF_packet_size}_${nr_competitors}.csv 43 | scp node0:counters_after_${nr_competitors}.csv ./experiment_data_${nf_type}/counters_after_${tNF_packet_size}_${nr_competitors}.csv 44 | fi 45 | else 46 | for size in 2000000 6000000 15000000 20000000; do 47 | for reads in 10000 5000 1000; do 48 | for iters in 1 5 10; do 49 | ssh -tt node0 'bash -s' < ./util_scripts/cleanup_nf.sh & 50 | sleep 2 51 | ssh -tt node1 'bash -s' < ./util_scripts/run_mg.sh "${rate}" "${tNF_packet_size}" "${nr_competitors}" & 52 | ssh -tt node1 'bash -s' < ./util_scripts/run_mg_comp.sh "${rate}" "${packet_size}" "${nr_competitors}" & 53 | ssh -tt node0 'bash -s' < ./util_scripts/run_nf_synth_comp.sh "${nr_competitors}" "${size}" "${reads}" "${iters}" & 54 | sleep 20 55 | 56 | ssh -tt node0 'bash -s' < ./util_scripts/stop_pcm.sh 57 | ssh -tt node0 'bash -s' < ./util_scripts/run_nf.sh "${nf_type}" "${nr_competitors}" & 58 | sleep 40 59 | 60 | ssh -tt node1 'bash -s' < ./util_scripts/stop_mg.sh 61 | if [ "${nf_type}" != "Suricata" ] && [ "${nf_type}" != "Snort" ] && [ "${nf_type}" != "maglev" ] 62 | then 63 | ssh -tt node0 'bash -s' < ./util_scripts/stop_nf.sh "click" 64 | sleep 5 65 | scp node1:perf_data_${nr_competitors}.txt ./experiment_data_${nf_type}/perf_data_${tNF_packet_size}_${nr_competitors}_${size}_${reads}_${iters}.txt 66 | scp node0:counters_before_${nr_competitors}.csv ./experiment_data_${nf_type}/counters_before_${tNF_packet_size}_${nr_competitors}_${size}_${reads}_${iters}.csv 67 | scp node0:counters_after_${nr_competitors}.csv ./experiment_data_${nf_type}/counters_after_${tNF_packet_size}_${nr_competitors}_${size}_${reads}_${iters}.csv 68 | elif [ "${nf_type}" == "Suricata" ] 69 | then 70 | ssh -tt node0 'bash -s' < ./util_scripts/stop_nf.sh "Suricata" 71 | sleep 5 72 | scp node0:/usr/local/var/log/suricata/stats_1.log ./experiment_data_${nf_type}/perf_data_${tNF_packet_size}_${nr_competitors}_${size}_${reads}_${iters}.txt 73 | scp node0:counters_before_${nr_competitors}.csv ./experiment_data_${nf_type}/counters_before_${tNF_packet_size}_${nr_competitors}_${size}_${reads}_${iters}.csv 74 | scp node0:counters_after_${nr_competitors}.csv ./experiment_data_${nf_type}/counters_after_${tNF_packet_size}_${nr_competitors}_${size}_${reads}_${iters}.csv 75 | elif [ "${nf_type}" == "Snort" ] 76 | then 77 | ssh -tt node0 'bash -s' < ./util_scripts/stop_nf.sh "snort" 78 | sleep 10 79 | scp node0:output_app1.txt ./experiment_data_${nf_type}/perf_data_${tNF_packet_size}_${nr_competitors}_${size}_${reads}_${iters}.txt 80 | scp node0:counters_before_${nr_competitors}.csv ./experiment_data_${nf_type}/counters_before_${tNF_packet_size}_${nr_competitors}_${size}_${reads}_${iters}.csv 81 | scp node0:counters_after_${nr_competitors}.csv ./experiment_data_${nf_type}/counters_after_${tNF_packet_size}_${nr_competitors}_${size}_${reads}_${iters}.csv 82 | elif [ "${nf_type}" == "maglev" ] 83 | then 84 | ssh -tt node0 'bash -s' < ./util_scripts/stop_nf.sh "NetBricks" 85 | sleep 5 86 | scp node1:perf_data_${nr_competitors}.txt ./experiment_data_${nf_type}/perf_data_${tNF_packet_size}_${nr_competitors}_${size}_${reads}_${iters}.txt 87 | scp node0:counters_before_${nr_competitors}.csv ./experiment_data_${nf_type}/counters_before_${tNF_packet_size}_${nr_competitors}_${size}_${reads}_${iters}.csv 88 | scp node0:counters_after_${nr_competitors}.csv ./experiment_data_${nf_type}/counters_after_${tNF_packet_size}_${nr_competitors}_${size}_${reads}_${iters}.csv 89 | fi 90 | done 91 | done 92 | done 93 | fi 94 | done 95 | done 96 | done 97 | -------------------------------------------------------------------------------- /experiment_scripts/util_scripts/cleanup_nf.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "Stopping NFs on test node" 4 | sudo -S killall -q -9 pcm 5 | sudo -S killall -q -9 click 6 | sudo -S killall -q -9 snort 7 | sudo -S killall -q -9 Suricata 8 | sudo -S killall -q -9 NetBricks 9 | 10 | exit 11 | -------------------------------------------------------------------------------- /experiment_scripts/util_scripts/run_mg.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | rate=${1} 4 | pkt_size=${2} 5 | competitors=${3} 6 | 7 | echo "Starting MoonGen on traffic generator" 8 | 9 | sudo /root/MoonGen/build/MoonGen /root/MoonGen/examples/traffic_generation.lua 0 0 -r ${rate} -s ${pkt_size} -n ${competitors} > perf_data_${competitors}.txt & 10 | -------------------------------------------------------------------------------- /experiment_scripts/util_scripts/run_mg_comp.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | 4 | rate=${1} 5 | pkt_size=${2} 6 | compet=${3} 7 | 8 | echo "Starting MoonGen on traffic generator" 9 | sudo /root/MoonGen2/build/MoonGen /root/MoonGen2/examples/traffic_generation.lua 0 0 -r ${rate} -s ${pkt_size} -n ${compet} > perf_data_competition.txt & 10 | 11 | -------------------------------------------------------------------------------- /experiment_scripts/util_scripts/run_nf.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | nf=${1} 4 | competitors=${2} 5 | 6 | echo "Starting Experiment on testing node" 7 | if [ "${nf}" != "Suricata" ] && [ "${nf}" != "Snort" ] && [ "${nf}" != "maglev" ] 8 | then 9 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 8 -n 4 --file-prefix=app1 -w 0000:8a:02.0 -- /root/click/conf/${nf}/${nf}.click & 10 | sleep 2 11 | 12 | elif [ "${nf}" == "Suricata" ] 13 | then 14 | sudo -S rm /usr/local/var/log/suricata/stats_* 15 | sudo -S rm /usr/local/var/log/suricata/eve*.json 16 | sudo -S numactl -m 1 /root/new_suricata/DPDK-Suricata_3.0/suricata_1/src/suricata -c /root/new_suricata/DPDK-Suricata_3.0/suricata_1/suricata.yaml --dpdkintel & 17 | 18 | elif [ "${nf}" == "Snort" ] 19 | then 20 | sudo -S bash /root/intel_snort/snort3/run_snort.sh "8" "app1" "0000:8a:02.0" & 21 | sleep 2 22 | 23 | elif [ "${nf}" == "maglev" ] 24 | then 25 | sudo -S numactl -m 1 -N 1 -- bash /root/NetBricks/build.sh run maglev -f /root/NetBricks/config.toml & 26 | sleep 2 27 | fi 28 | 29 | sleep 2 30 | echo "Starting Intel pcm" 31 | sudo -S numactl -m 1 /root/pcm/pcm.x -r -csv=counters_after_${competitors}.csv & 32 | -------------------------------------------------------------------------------- /experiment_scripts/util_scripts/run_nf_comp.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | competitors=${1} 4 | 5 | echo "Starting Experiment on Radish" 6 | if [ ${competitors} -eq 0 ] 7 | then 8 | echo "Do nothing" 9 | 10 | elif [ ${competitors} -eq 1 ] 11 | then 12 | for iter in 1 2 3 4 5 13 | do 14 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 9 -n 4 --file-prefix=app2 -w 0000:8a:02.1 -- /root/click/conf/syn/syn.click SIZ=${size} READ=10000 ITER=${iterations} & 15 | sleep 2 16 | done 17 | elif [ ${competitors} -eq 2 ] 18 | then 19 | for iter in 1 2 3 4 5 20 | do 21 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 9 -n 4 --file-prefix=app2 -w 0000:8a:02.1 -- /root/click/conf/syn/syn.click SIZ=${size} READ=10000 ITER=${iterations} & 22 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 10 -n 4 --file-prefix=app3 -w 0000:8a:02.2 -- /root/click/conf/syn/syn.click SIZ=${size} READ=10000 ITER=${iterations} & 23 | sleep 2 24 | done 25 | 26 | elif [ ${competitors} -eq 3 ] 27 | then 28 | for iter in 1 2 3 4 5 29 | do 30 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 9 -n 4 --file-prefix=app2 -w 0000:8a:02.1 -- /root/click/conf/syn/syn.click SIZ=${size} READ=10000 ITER=${iterations} & 31 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 10 -n 4 --file-prefix=app3 -w 0000:8a:02.2 -- /root/click/conf/syn/syn.click SIZ=${size} READ=10000 ITER=${iterations} & 32 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 11 -n 4 --file-prefix=app4 -w 0000:8a:02.3 -- /root/click/conf/syn/syn.click SIZ=${size} READ=10000 ITER=${iterations} & 33 | sleep 2 34 | done 35 | 36 | elif [ ${competitors} -eq 4 ] 37 | then 38 | for iter in 1 2 3 4 5 39 | do 40 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 9 -n 4 --file-prefix=app2 -w 0000:8a:02.1 -- /root/click/conf/syn/syn.click SIZ=${size} READ=10000 ITER=${iterations} & 41 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 10 -n 4 --file-prefix=app3 -w 0000:8a:02.2 -- /root/click/conf/syn/syn.click SIZ=${size} READ=10000 ITER=${iterations} & 42 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 11 -n 4 --file-prefix=app4 -w 0000:8a:02.3 -- /root/click/conf/syn/syn.click SIZ=${size} READ=10000 ITER=${iterations} & 43 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 12 -n 4 --file-prefix=app5 -w 0000:8b:02.0 -- /root/click/conf/syn/syn.click SIZ=${size} READ=10000 ITER=${iterations} & 44 | sleep 2 45 | done 46 | 47 | elif [ ${competitors} -eq 5 ] 48 | then 49 | for iter in 1 2 3 4 5 50 | do 51 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 9 -n 4 --file-prefix=app2 -w 0000:8a:02.1 -- /root/click/conf/syn/syn.click SIZ=${size} READ=10000 ITER=${iterations} & 52 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 10 -n 4 --file-prefix=app3 -w 0000:8a:02.2 -- /root/click/conf/syn/syn.click SIZ=${size} READ=10000 ITER=${iterations} & 53 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 11 -n 4 --file-prefix=app4 -w 0000:8a:02.3 -- /root/click/conf/syn/syn.click SIZ=${size} READ=10000 ITER=${iterations} & 54 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 12 -n 4 --file-prefix=app5 -w 0000:8b:02.0 -- /root/click/conf/syn/syn.click SIZ=${size} READ=10000 ITER=${iterations} & 55 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 13 -n 4 --file-prefix=app6 -w 0000:8b:02.1 -- /root/click/conf/syn/syn.click SIZ=${size} READ=10000 ITER=${iterations} & 56 | done 57 | 58 | elif [ ${competitors} -eq 6 ] 59 | then 60 | for iter in 1 2 3 4 5 61 | do 62 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 9 -n 4 --file-prefix=app2 -w 0000:8a:02.1 -- /root/click/conf/syn/syn.click SIZ=${size} READ=10000 ITER=${iterations} & 63 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 10 -n 4 --file-prefix=app3 -w 0000:8a:02.2 -- /root/click/conf/syn/syn.click SIZ=${size} READ=10000 ITER=${iterations} & 64 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 11 -n 4 --file-prefix=app4 -w 0000:8a:02.3 -- /root/click/conf/syn/syn.click SIZ=${size} READ=10000 ITER=${iterations} & 65 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 12 -n 4 --file-prefix=app5 -w 0000:8b:02.0 -- /root/click/conf/syn/syn.click SIZ=${size} READ=10000 ITER=${iterations} & 66 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 13 -n 4 --file-prefix=app6 -w 0000:8b:02.1 -- /root/click/conf/syn/syn.click SIZ=${size} READ=10000 ITER=${iterations} & 67 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 14 -n 4 --file-prefix=app7 -w 0000:8b:02.2 -- /root/click/conf/syn/syn.click SIZ=${size} READ=10000 ITER=${iterations} & 68 | done 69 | 70 | elif [ ${competitors} -eq 7 ] 71 | then 72 | for iter in 1 2 3 4 5 73 | do 74 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 9 -n 4 --file-prefix=app2 -w 0000:8a:02.1 -- /root/click/conf/syn/syn.click SIZ=${size} READ=10000 ITER=${iterations} & 75 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 10 -n 4 --file-prefix=app3 -w 0000:8a:02.2 -- /root/click/conf/syn/syn.click SIZ=${size} READ=10000 ITER=${iterations} & 76 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 11 -n 4 --file-prefix=app4 -w 0000:8a:02.3 -- /root/click/conf/syn/syn.click SIZ=${size} READ=10000 ITER=${iterations} & 77 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 12 -n 4 --file-prefix=app5 -w 0000:8b:02.0 -- /root/click/conf/syn/syn.click SIZ=${size} READ=10000 ITER=${iterations} & 78 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 13 -n 4 --file-prefix=app6 -w 0000:8b:02.1 -- /root/click/conf/syn/syn.click SIZ=${size} READ=10000 ITER=${iterations} & 79 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 14 -n 4 --file-prefix=app7 -w 0000:8b:02.2 -- /root/click/conf/syn/syn.click SIZ=${size} READ=10000 ITER=${iterations} & 80 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 15 -n 4 --file-prefix=app8 -w 0000:8b:02.3 -- /root/click/conf/syn/syn.click SIZ=${size} READ=10000 ITER=${iterations} & 81 | done 82 | fi 83 | 84 | sleep 2 85 | echo "Starting Intel pcm" 86 | sudo -S numactl -m 1 /root/pcm/pcm.x -r -csv=counters_before_${competitors}.csv & 87 | -------------------------------------------------------------------------------- /experiment_scripts/util_scripts/run_nf_real_comp.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | competitors=${1} 4 | nf=${2} 5 | 6 | echo "Starting Experiment on test node" 7 | if [ "${nf}" != "Suricata" ] && [ "${nf}" != "Snort" ] 8 | then 9 | if [ ${competitors} -eq 0 ] 10 | then 11 | echo "Do nothing" 12 | 13 | elif [ ${competitors} -eq 1 ] 14 | then 15 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 12 -n 4 --file-prefix=app5 -w 0000:8b:02.0 -- /root/click/conf/${nf}/${nf}.click & 16 | 17 | elif [ ${competitors} -eq 2 ] 18 | then 19 | for iters in 1 2 3 4 5 20 | do 21 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 12 -n 4 --file-prefix=app5 -w 0000:8b:02.0 -- /root/click/conf/${nf}/${nf}.click & 22 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 13 -n 4 --file-prefix=app6 -w 0000:8b:02.1 -- /root/click/conf/${nf}/${nf}.click & 23 | done 24 | 25 | elif [ ${competitors} -eq 3 ] 26 | then 27 | for iters in 1 2 3 4 5 28 | do 29 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 12 -n 4 --file-prefix=app5 -w 0000:8b:02.0 -- /root/click/conf/${nf}/${nf}.click & 30 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 13 -n 4 --file-prefix=app6 -w 0000:8b:02.1 -- /root/click/conf/${nf}/${nf}.click & 31 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 14 -n 4 --file-prefix=app7 -w 0000:8b:02.2 -- /root/click/conf/${nf}/${nf}.click & 32 | done 33 | 34 | elif [ ${competitors} -eq 4 ] 35 | then 36 | for iters in 1 2 3 4 5 37 | do 38 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 12 -n 4 --file-prefix=app5 -w 0000:8b:02.0 -- /root/click/conf/${nf}/${nf}.click & 39 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 13 -n 4 --file-prefix=app6 -w 0000:8b:02.1 -- /root/click/conf/${nf}/${nf}.click & 40 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 14 -n 4 --file-prefix=app7 -w 0000:8b:02.2 -- /root/click/conf/${nf}/${nf}.click & 41 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 15 -n 4 --file-prefix=app8 -w 0000:8b:02.3 -- /root/click/conf/${nf}/${nf}.click & 42 | done 43 | 44 | elif [ ${competitors} -eq 5 ] 45 | then 46 | for iters in 1 2 3 4 5 47 | do 48 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 9 -n 4 --file-prefix=app2 -w 0000:8a:02.1 -- /root/click/conf/${nf}/${nf}.click & 49 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 10 -n 4 --file-prefix=app3 -w 0000:8a:02.2 -- /root/click/conf/${nf}/${nf}.click & 50 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 11 -n 4 --file-prefix=app4 -w 0000:8a:02.3 -- /root/click/conf/${nf}/${nf}.click & 51 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 12 -n 4 --file-prefix=app5 -w 0000:8b:02.0 -- /root/click/conf/${nf}/${nf}.click & 52 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 13 -n 4 --file-prefix=app6 -w 0000:8b:02.1 -- /root/click/conf/${nf}/${nf}.click & 53 | done 54 | 55 | elif [ ${competitors} -eq 6 ] 56 | then 57 | for iters in 1 2 3 4 5 58 | do 59 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 9 -n 4 --file-prefix=app2 -w 0000:8a:02.1 -- /root/click/conf/${nf}/${nf}.click & 60 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 10 -n 4 --file-prefix=app3 -w 0000:8a:02.2 -- /root/click/conf/${nf}/${nf}.click & 61 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 11 -n 4 --file-prefix=app4 -w 0000:8a:02.3 -- /root/click/conf/${nf}/${nf}.click & 62 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 12 -n 4 --file-prefix=app5 -w 0000:8b:02.0 -- /root/click/conf/${nf}/${nf}.click & 63 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 13 -n 4 --file-prefix=app6 -w 0000:8b:02.1 -- /root/click/conf/${nf}/${nf}.click & 64 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 14 -n 4 --file-prefix=app7 -w 0000:8b:02.2 -- /root/click/conf/${nf}/${nf}.click & 65 | done 66 | 67 | elif [ ${competitors} -eq 7 ] 68 | then 69 | for iters in 1 2 3 4 5 70 | do 71 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 9 -n 4 --file-prefix=app2 -w 0000:8a:02.1 -- /root/click/conf/${nf}/${nf}.click & 72 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 10 -n 4 --file-prefix=app3 -w 0000:8a:02.2 -- /root/click/conf/${nf}/${nf}.click & 73 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 11 -n 4 --file-prefix=app4 -w 0000:8a:02.3 -- /root/click/conf/${nf}/${nf}.click & 74 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 12 -n 4 --file-prefix=app5 -w 0000:8b:02.0 -- /root/click/conf/${nf}/${nf}.click & 75 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 13 -n 4 --file-prefix=app6 -w 0000:8b:02.1 -- /root/click/conf/${nf}/${nf}.click & 76 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 14 -n 4 --file-prefix=app7 -w 0000:8b:02.2 -- /root/click/conf/${nf}/${nf}.click & 77 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 15 -n 4 --file-prefix=app8 -w 0000:8b:02.3 -- /root/click/conf/${nf}/${nf}.click & 78 | done 79 | fi 80 | elif [ "${nf}" == "Snort" ] 81 | then 82 | if [ ${competitors} -eq 5 ] 83 | then 84 | for iters in 1 2 3 4 5 85 | do 86 | sudo -S bash /root/intel_snort/snort3/run_snort.sh "12" "app5" "0000:8b:02.0" & 87 | sudo -S bash /root/intel_snort/snort3/run_snort.sh "13" "app6" "0000:8b:02.1" & 88 | done 89 | 90 | elif [ ${competitors} -eq 6 ] 91 | then 92 | for iters in 1 2 3 4 5 93 | do 94 | sudo -S bash /root/intel_snort/snort3/run_snort.sh "12" "app5" "0000:8b:02.0" & 95 | sudo -S bash /root/intel_snort/snort3/run_snort.sh "13" "app6" "0000:8b:02.1" & 96 | sudo -S bash /root/intel_snort/snort3/run_snort.sh "14" "app7" "0000:8b:02.2" & 97 | done 98 | 99 | elif [ ${competitors} -eq 7 ] 100 | then 101 | for iters in 1 2 3 4 5 102 | do 103 | sudo -S bash /root/intel_snort/snort3/run_snort.sh "12" "app5" "0000:8b:02.0" & 104 | sudo -S bash /root/intel_snort/snort3/run_snort.sh "13" "app6" "0000:8b:02.1" & 105 | sudo -S bash /root/intel_snort/snort3/run_snort.sh "14" "app7" "0000:8b:02.2" & 106 | sudo -S bash /root/intel_snort/snort3/run_snort.sh "15" "app8" "0000:8b:02.3" & 107 | done 108 | fi 109 | elif [ "${nf}" == "Suricata" ] 110 | then 111 | if [ ${competitors} -eq 5 ] 112 | then 113 | for iters in 1 114 | do 115 | sudo -S rm /usr/local/var/log/suricata/stats_* 116 | sudo -S rm /usr/local/var/log/suricata/eve*.json 117 | sudo -S numactl -m 1 /root/new_suricata/DPDK-Suricata_3.0/suricata_2/src/suricata -c /root/new_suricata/DPDK-Suricata_3.0/suricata_2/suricata.yaml --dpdkintel & 118 | done 119 | 120 | elif [ ${competitors} -eq 6 ] 121 | then 122 | for iters in 1 123 | do 124 | sudo -S rm /usr/local/var/log/suricata/stats_* 125 | sudo -S rm /usr/local/var/log/suricata/eve*.json 126 | sudo -S numactl -m 1 /root/new_suricata/DPDK-Suricata_3.0/suricata_2/src/suricata -c /root/new_suricata/DPDK-Suricata_3.0/suricata_2/suricata.yaml --dpdkintel & 127 | sudo -S numactl -m 1 /root/new_suricata/DPDK-Suricata_3.0/suricata_3/src/suricata -c /root/new_suricata/DPDK-Suricata_3.0/suricata_3/suricata.yaml --dpdkintel & 128 | done 129 | 130 | elif [ ${competitors} -eq 7 ] 131 | then 132 | for iters in 1 133 | do 134 | sudo -S rm /usr/local/var/log/suricata/stats_* 135 | sudo -S rm /usr/local/var/log/suricata/eve*.json 136 | sudo -S numactl -m 1 /root/new_suricata/DPDK-Suricata_3.0/suricata_2/src/suricata -c /root/new_suricata/DPDK-Suricata_3.0/suricata_2/suricata.yaml --dpdkintel & 137 | sudo -S numactl -m 1 /root/new_suricata/DPDK-Suricata_3.0/suricata_3/src/suricata -c /root/new_suricata/DPDK-Suricata_3.0/suricata_3/suricata.yaml --dpdkintel & 138 | sudo -S numactl -m 1 /root/new_suricata/DPDK-Suricata_3.0/suricata_4/src/suricata -c /root/new_suricata/DPDK-Suricata_3.0/suricata_4/suricata.yaml --dpdkintel & 139 | done 140 | fi 141 | fi 142 | sleep 2 143 | echo "Starting Intel pcm" 144 | sudo -S numactl -m 1 /root/pcm/pcm.x -r -csv=counters_before_${competitors}.csv & 145 | -------------------------------------------------------------------------------- /experiment_scripts/util_scripts/run_nf_shuf.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | competitors=${1} 4 | list_comp=("ip_131k" "mon_dpdk" "vpn" "fw_1000") 5 | 6 | echo "Starting Experiment on testing node" 7 | echo "" > competitors.txt 8 | if [ ${competitors} -eq 1 ] 9 | then 10 | index=`shuf -i 0-3 -n 1` 11 | echo ${list_comp[${index}]} >> competitors.txt 12 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 9 -n 4 --file-prefix=app2 -w 0000:8a:02.1 -- /root/click/conf/${list_comp[${index}]}/${list_comp[${index}]}.click & 13 | 14 | elif [ ${competitors} -eq 2 ] 15 | then 16 | 17 | index=`shuf -i 0-3 -n 1` 18 | echo ${list_comp[${index}]} >> competitors.txt 19 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 10 -n 4 --file-prefix=app2 -w 0000:8a:02.1 -- /root/click/conf/${list_comp[${index}]}/${list_comp[${index}]}.click & 20 | 21 | index=`shuf -i 0-3 -n 1` 22 | echo ${list_comp[${index}]} >> competitors.txt 23 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 11 -n 4 --file-prefix=app3 -w 0000:8a:02.2 -- /root/click/conf/${list_comp[${index}]}/${list_comp[${index}]}.click & 24 | 25 | elif [ ${competitors} -eq 3 ] 26 | then 27 | 28 | index=`shuf -i 0-3 -n 1` 29 | echo ${list_comp[${index}]} >> competitors.txt 30 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 10 -n 4 --file-prefix=app2 -w 0000:8a:02.1 -- /root/click/conf/${list_comp[${index}]}/${list_comp[${index}]}.click & 31 | 32 | index=`shuf -i 0-3 -n 1` 33 | echo ${list_comp[${index}]} >> competitors.txt 34 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 11 -n 4 --file-prefix=app3 -w 0000:8a:02.2 -- /root/click/conf/${list_comp[${index}]}/${list_comp[${index}]}.click & 35 | 36 | index=`shuf -i 0-3 -n 1` 37 | echo ${list_comp[${index}]} >> competitors.txt 38 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 12 -n 4 --file-prefix=app4 -w 0000:8a:02.3 -- /root/click/conf/${list_comp[${index}]}/${list_comp[${index}]}.click & 39 | 40 | elif [ ${competitors} -eq 4 ] 41 | then 42 | index=`shuf -i 0-3 -n 1` 43 | echo ${list_comp[${index}]} >> competitors.txt 44 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 10 -n 4 --file-prefix=app2 -w 0000:8a:02.1 -- /root/click/conf/${list_comp[${index}]}/${list_comp[${index}]}.click & 45 | 46 | index=`shuf -i 0-3 -n 1` 47 | echo ${list_comp[${index}]} >> competitors.txt 48 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 11 -n 4 --file-prefix=app3 -w 0000:8a:02.2 -- /root/click/conf/${list_comp[${index}]}/${list_comp[${index}]}.click & 49 | 50 | index=`shuf -i 0-3 -n 1` 51 | echo ${list_comp[${index}]} >> competitors.txt 52 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 12 -n 4 --file-prefix=app4 -w 0000:8a:02.3 -- /root/click/conf/${list_comp[${index}]}/${list_comp[${index}]}.click & 53 | 54 | index=`shuf -i 0-3 -n 1` 55 | echo ${list_comp[${index}]} >> competitors.txt 56 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 13 -n 4 --file-prefix=app5 -w 0000:8b:02.0 -- /root/click/conf/${list_comp[${index}]}/${list_comp[${index}]}.click & 57 | 58 | elif [ ${competitors} -eq 5 ] 59 | then 60 | index=`shuf -i 0-3 -n 1` 61 | echo ${list_comp[${index}]} >> competitors.txt 62 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 10 -n 4 --file-prefix=app2 -w 0000:8a:02.1 -- /root/click/conf/${list_comp[${index}]}/${list_comp[${index}]}.click & 63 | 64 | index=`shuf -i 0-3 -n 1`1 65 | echo ${list_comp[${index}]} >> competitors.txt 66 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 11 -n 4 --file-prefix=app3 -w 0000:8a:02.2 -- /root/click/conf/${list_comp[${index}]}/${list_comp[${index}]}.click & 67 | 68 | index=`shuf -i 0-3 -n 1` 69 | echo ${list_comp[${index}]} >> competitors.txt 70 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 12 -n 4 --file-prefix=app4 -w 0000:8a:02.3 -- /root/click/conf/${list_comp[${index}]}/${list_comp[${index}]}.click & 71 | 72 | index=`shuf -i 0-3 -n 1` 73 | echo ${list_comp[${index}]} >> competitors.txt 74 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 13 -n 4 --file-prefix=app5 -w 0000:8b:02.0 -- /root/click/conf/${list_comp[${index}]}/${list_comp[${index}]}.click & 75 | 76 | index=`shuf -i 0-3 -n 1` 77 | echo ${list_comp[${index}]} >> competitors.txt 78 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 14 -n 4 --file-prefix=app6 -w 0000:8b:02.1 -- /root/click/conf/${list_comp[${index}]}/${list_comp[${index}]}.click & 79 | 80 | elif [ ${competitors} -eq 6 ] 81 | then 82 | index=`shuf -i 0-3 -n 1` 83 | echo ${list_comp[${index}]} >> competitors.txt 84 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 10 -n 4 --file-prefix=app2 -w 0000:8a:02.1 -- /root/click/conf/${list_comp[${index}]}/${list_comp[${index}]}.click & 85 | 86 | index=`shuf -i 0-3 -n 1` 87 | echo ${list_comp[${index}]} >> competitors.txt 88 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 11 -n 4 --file-prefix=app3 -w 0000:8a:02.2 -- /root/click/conf/${list_comp[${index}]}/${list_comp[${index}]}.click & 89 | 90 | index=`shuf -i 0-3 -n 1` 91 | echo ${list_comp[${index}]} >> competitors.txt 92 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 12 -n 4 --file-prefix=app4 -w 0000:8a:02.3 -- /root/click/conf/${list_comp[${index}]}/${list_comp[${index}]}.click & 93 | 94 | index=`shuf -i 0-3 -n 1` 95 | echo ${list_comp[${index}]} >> competitors.txt 96 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 13 -n 4 --file-prefix=app5 -w 0000:8b:02.0 -- /root/click/conf/${list_comp[${index}]}/${list_comp[${index}]}.click & 97 | 98 | index=`shuf -i 0-3 -n 1` 99 | echo ${list_comp[${index}]} >> competitors.txt 100 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 14 -n 4 --file-prefix=app6 -w 0000:8b:02.1 -- /root/click/conf/${list_comp[${index}]}/${list_comp[${index}]}.click & 101 | 102 | index=`shuf -i 0-3 -n 1` 103 | echo ${list_comp[${index}]} >> competitors.txt 104 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 15 -n 4 --file-prefix=app7 -w 0000:8b:02.2 -- /root/click/conf/${list_comp[${index}]}/${list_comp[${index}]}.click 105 | 106 | elif [ ${competitors} -eq 7 ] 107 | then 108 | index=`shuf -i 0-3 -n 1` 109 | echo ${list_comp[${index}]} >> competitors.txt 110 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 9 -n 4 --file-prefix=app2 -w 0000:8a:02.1 -- /root/click/conf/${list_comp[${index}]}/${list_comp[${index}]}.click & 111 | 112 | index=`shuf -i 0-3 -n 1` 113 | echo ${list_comp[${index}]} >> competitors.txt 114 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 10 -n 4 --file-prefix=app3 -w 0000:8a:02.2 -- /root/click/conf/${list_comp[${index}]}/${list_comp[${index}]}.click & 115 | 116 | index=`shuf -i 0-3 -n 1` 117 | echo ${list_comp[${index}]} >> competitors.txt 118 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 11 -n 4 --file-prefix=app4 -w 0000:8a:02.3 -- /root/click/conf/${list_comp[${index}]}/${list_comp[${index}]}.click & 119 | 120 | index=`shuf -i 0-3 -n 1` 121 | echo ${list_comp[${index}]} >> competitors.txt 122 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 12 -n 4 --file-prefix=app5 -w 0000:8b:02.0 -- /root/click/conf/${list_comp[${index}]}/${list_comp[${index}]}.click & 123 | 124 | index=`shuf -i 0-3 -n 1` 125 | echo ${list_comp[${index}]} >> competitors.txt 126 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 13 -n 4 --file-prefix=app6 -w 0000:8b:02.1 -- /root/click/conf/${list_comp[${index}]}/${list_comp[${index}]}.click & 127 | 128 | index=`shuf -i 0-3 -n 1` 129 | echo ${list_comp[${index}]} >> competitors.txt 130 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 14 -n 4 --file-prefix=app7 -w 0000:8b:02.2 -- /root/click/conf/${list_comp[${index}]}/${list_comp[${index}]}.click & 131 | 132 | index=`shuf -i 0-3 -n 1` 133 | echo ${list_comp[${index}]} >> competitors.txt 134 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 15 -n 4 --file-prefix=app8 -w 0000:8b:02.3 -- /root/click/conf/${list_comp[${index}]}/${list_comp[${index}]}.click & 135 | fi 136 | 137 | sleep 2 138 | echo "Starting Intel pcm" 139 | sudo -S numactl -m 1 /root/pcm/pcm.x -r -csv=counters_before_${competitors}.csv & 140 | -------------------------------------------------------------------------------- /experiment_scripts/util_scripts/run_nf_synth_comp.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | competitors=${1} 4 | size=${2} 5 | reads=${3} 6 | iter=${4} 7 | 8 | echo "Starting Experiment on Radish" 9 | if [ ${competitors} -eq 0 ] 10 | then 11 | echo "Do nothing" 12 | 13 | elif [ ${competitors} -eq 1 ] 14 | then 15 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 12 -n 4 --file-prefix=app5 -w 0000:8b:02.0 -- /root/click/conf/syn_conf/syn_conf.click SIZE=${size} READS=${reads} ITERS=${iter} & 16 | 17 | elif [ ${competitors} -eq 2 ] 18 | then 19 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 12 -n 4 --file-prefix=app5 -w 0000:8b:02.0 -- /root/click/conf/syn_conf/syn_conf.click SIZE=${size} READS=${reads} ITERS=${iter} & 20 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 13 -n 4 --file-prefix=app6 -w 0000:8b:02.1 -- /root/click/conf/syn_conf/syn_conf.click SIZE=${size} READS=${reads} ITERS=${iter} & 21 | 22 | elif [ ${competitors} -eq 3 ] 23 | then 24 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 12 -n 4 --file-prefix=app5 -w 0000:8b:02.0 -- /root/click/conf/syn_conf/syn_conf.click SIZE=${size} READS=${reads} ITERS=${iter} & 25 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 13 -n 4 --file-prefix=app6 -w 0000:8b:02.1 -- /root/click/conf/syn_conf/syn_conf.click SIZE=${size} READS=${reads} ITERS=${iter} & 26 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 14 -n 4 --file-prefix=app7 -w 0000:8b:02.2 -- /root/click/conf/syn_conf/syn_conf.click SIZE=${size} READS=${reads} ITERS=${iter} & 27 | 28 | elif [ ${competitors} -eq 4 ] 29 | then 30 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 12 -n 4 --file-prefix=app5 -w 0000:8b:02.0 -- /root/click/conf/syn_conf/syn_conf.click SIZE=${size} READS=${reads} ITERS=${iter} & 31 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 13 -n 4 --file-prefix=app6 -w 0000:8b:02.1 -- /root/click/conf/syn_conf/syn_conf.click SIZE=${size} READS=${reads} ITERS=${iter} & 32 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 14 -n 4 --file-prefix=app7 -w 0000:8b:02.2 -- /root/click/conf/syn_conf/syn_conf.click SIZE=${size} READS=${reads} ITERS=${iter} & 33 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 15 -n 4 --file-prefix=app8 -w 0000:8b:02.3 -- /root/click/conf/syn_conf/syn_conf.click SIZE=${size} READS=${reads} ITERS=${iter} & 34 | 35 | elif [ ${competitors} -eq 5 ] 36 | then 37 | for iters in 1 2 3 4 5 38 | do 39 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 9 -n 4 --file-prefix=app2 -w 0000:8a:02.1 -- /root/click/conf/syn/syn.click SIZ=${size} READ=${reads} ITER=${iter} & 40 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 10 -n 4 --file-prefix=app3 -w 0000:8a:02.2 -- /root/click/conf/syn/syn.click SIZ=${size} READ=${reads} ITER=${iter} & 41 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 11 -n 4 --file-prefix=app4 -w 0000:8a:02.3 -- /root/click/conf/syn/syn.click SIZ=${size} READ=${reads} ITER=${iter} & 42 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 12 -n 4 --file-prefix=app5 -w 0000:8b:02.0 -- /root/click/conf/syn/syn.click SIZ=${size} READ=${reads} ITER=${iter} & 43 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 13 -n 4 --file-prefix=app6 -w 0000:8b:02.1 -- /root/click/conf/syn/syn.click SIZ=${size} READ=${reads} ITER=${iter} & 44 | done 45 | 46 | elif [ ${competitors} -eq 6 ] 47 | then 48 | for iters in 1 2 3 4 5 49 | do 50 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 9 -n 4 --file-prefix=app2 -w 0000:8a:02.1 -- /root/click/conf/syn/syn.click SIZ=${size} READ=${reads} ITER=${iter} & 51 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 10 -n 4 --file-prefix=app3 -w 0000:8a:02.2 -- /root/click/conf/syn/syn.click SIZ=${size} READ=${reads} ITER=${iter} & 52 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 11 -n 4 --file-prefix=app4 -w 0000:8a:02.3 -- /root/click/conf/syn/syn.click SIZ=${size} READ=${reads} ITER=${iter} & 53 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 12 -n 4 --file-prefix=app5 -w 0000:8b:02.0 -- /root/click/conf/syn/syn.click SIZ=${size} READ=${reads} ITER=${iter} & 54 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 13 -n 4 --file-prefix=app6 -w 0000:8b:02.1 -- /root/click/conf/syn/syn.click SIZ=${size} READ=${reads} ITER=${iter} & 55 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 14 -n 4 --file-prefix=app7 -w 0000:8b:02.2 -- /root/click/conf/syn/syn.click SIZ=${size} READ=${reads} ITER=${iter} & 56 | done 57 | 58 | elif [ ${competitors} -eq 7 ] 59 | then 60 | for iters in 1 2 3 4 5 61 | do 62 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 9 -n 4 --file-prefix=app2 -w 0000:8a:02.1 -- /root/click/conf/syn/syn.click SIZ=${size} READ=${reads} ITER=${iter} & 63 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 10 -n 4 --file-prefix=app3 -w 0000:8a:02.2 -- /root/click/conf/syn/syn.click SIZ=${size} READ=${reads} ITER=${iter} & 64 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 11 -n 4 --file-prefix=app4 -w 0000:8a:02.3 -- /root/click/conf/syn/syn.click SIZ=${size} READ=${reads} ITER=${iter} & 65 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 12 -n 4 --file-prefix=app5 -w 0000:8b:02.0 -- /root/click/conf/syn/syn.click SIZ=${size} READ=${reads} ITER=${iter} & 66 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 13 -n 4 --file-prefix=app6 -w 0000:8b:02.1 -- /root/click/conf/syn/syn.click SIZ=${size} READ=${reads} ITER=${iter} & 67 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 14 -n 4 --file-prefix=app7 -w 0000:8b:02.2 -- /root/click/conf/syn/syn.click SIZ=${size} READ=${reads} ITER=${iter} & 68 | sudo -S numactl -m 1 /root/click/bin/click --dpdk -l 15 -n 4 --file-prefix=app8 -w 0000:8b:02.3 -- /root/click/conf/syn/syn.click SIZ=${size} READ=${reads} ITER=${iter} & 69 | done 70 | fi 71 | 72 | sleep 2 73 | echo "Starting Intel pcm" 74 | sudo -S numactl -m 1 /root/pcm/pcm.x -r -csv=counters_before_${competitors}.csv & 75 | -------------------------------------------------------------------------------- /experiment_scripts/util_scripts/stop_mg.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "Stopping MoonGen on traffic generator" 4 | sudo -S pkill MoonGen 5 | exit 6 | -------------------------------------------------------------------------------- /experiment_scripts/util_scripts/stop_nf.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "Stopping NFs on testing node" 4 | sudo pkill pcm 5 | sleep 1 6 | sudo killall -q -9 click 7 | sudo killall -q -9 NetBricks 8 | sudo pkill ${1} 9 | 10 | exit 11 | -------------------------------------------------------------------------------- /experiment_scripts/util_scripts/stop_pcm.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "Stopping NFs on testing node" 4 | sudo pkill pcm 5 | exit 6 | -------------------------------------------------------------------------------- /setup/setup_nic.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | for i in 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 4 | do 5 | echo 0 > /sys/devices/system/cpu/cpu${i}/online 6 | done 7 | 8 | 9 | ~/dpdk-stable-18.05.1/usertools/dpdk-devbind.py -b i40e 0000:8a:00.0 10 | echo 8 > /sys/bus/pci/devices/0000\:8a\:00.0/sriov_numvfs 11 | modprobe uio 12 | modprobe vfio 13 | modprobe vfio-pci 14 | modprobe msr 15 | insmod ~/dpdk-stable-18.05.1/build/kmod/igb_uio.ko 16 | 17 | ip link set ens11 vf 0 mac 52:67:f7:65:74:e2 18 | ip link set ens11 vf 1 mac b2:85:38:6e:df:bc 19 | ip link set ens11 vf 2 mac ee:14:a4:5f:dc:f6 20 | ip link set ens11 vf 3 mac ee:c4:fd:68:14:c4 21 | ip link set ens11 vf 4 mac b2:a6:35:6f:e6:c7 22 | ip link set ens11 vf 5 mac 4a:50:54:ed:de:76 23 | ip link set ens11 vf 6 mac 8e:69:26:d2:c3:30 24 | ip link set ens11 vf 7 mac 86:b3:7b:e0:31:65 25 | ip link set ens11 up 26 | 27 | ~/dpdk-stable-18.05.1/usertools/dpdk-devbind.py -b igb_uio 0000:8a:02.0 28 | ~/dpdk-stable-18.05.1/usertools/dpdk-devbind.py -b igb_uio 0000:8a:02.1 29 | ~/dpdk-stable-18.05.1/usertools/dpdk-devbind.py -b igb_uio 0000:8a:02.2 30 | ~/dpdk-stable-18.05.1/usertools/dpdk-devbind.py -b igb_uio 0000:8a:02.3 31 | ~/dpdk-stable-18.05.1/usertools/dpdk-devbind.py -b igb_uio 0000:8a:02.4 32 | ~/dpdk-stable-18.05.1/usertools/dpdk-devbind.py -b igb_uio 0000:8a:02.5 33 | ~/dpdk-stable-18.05.1/usertools/dpdk-devbind.py -b igb_uio 0000:8a:02.6 34 | ~/dpdk-stable-18.05.1/usertools/dpdk-devbind.py -b igb_uio 0000:8a:02.7 35 | ~/dpdk-stable-18.05.1/usertools/dpdk-devbind.py -s 36 | 37 | echo 10 > /sys/devices/system/node/node1/hugepages/hugepages-1048576kB/nr_hugepages 38 | -------------------------------------------------------------------------------- /traffic_generator/traffic_generation.lua: -------------------------------------------------------------------------------- 1 | local mg = require "moongen" 2 | local memory = require "memory" 3 | local device = require "device" 4 | local ts = require "timestamping" 5 | local stats = require "stats" 6 | local hist = require "histogram" 7 | local timer = require "timer" 8 | 9 | local ETH_SRC = "0C:C4:7A:19:73:B6" 10 | local ETH_DST = "0c:c4:7a:19:74:30" 11 | local eth_addresses_str = {"52:67:f7:65:74:e2", "b2:85:38:6e:df:bc", "ee:14:a4:5f:dc:f6", "ee:c4:fd:68:14:c4" , "b2:a6:35:6f:e6:c7", "4a:50:54:ed:de:76", "8e:69:26:d2:c3:30", "86:b3:7b:e0:31:65"} 12 | 13 | 14 | local function getRstFile(...) 15 | local args = { ... } 16 | for i, v in ipairs(args) do 17 | result, count = string.gsub(v, "%-%-result%=", "") 18 | if (count == 1) then 19 | return i, result 20 | end 21 | end 22 | return nil, nil 23 | end 24 | 25 | function convertMacAddress(address) 26 | local bytes = {string.match(address, 27 | '(%x+)[-:](%x+)[-:](%x+)[-:](%x+)[-:](%x+)[-:](%x+)')} 28 | 29 | local convertedAddress = 0 30 | for i = 1, 6 do 31 | convertedAddress = convertedAddress + 32 | tonumber(bytes[#bytes + 1 - i], 16) * 256 ^ (i - 1) 33 | end 34 | return convertedAddress 35 | end 36 | 37 | 38 | function configure(parser) 39 | parser:description("Generates bidirectional CBR traffic with hardware rate control and measure latencies.") 40 | parser:argument("dev1", "Device to transmit/receive from."):convert(tonumber) 41 | parser:argument("dev2", "Device to transmit/receive from."):convert(tonumber) 42 | parser:option("-r --rate", "Transmit rate in Mbit/s."):default(10000):convert(tonumber) 43 | parser:option("-s --size", "Packet size in Bytes"):default(80):convert(tonumber) 44 | parser:option("-n --number", "Number of receiving interfaces"):default(8):convert(tonumber) 45 | parser:option("-c --flowCount", "Flow count"):default(0):convert(tonumber) 46 | parser:option("-f --file", "Filename of the latency histogram."):default("histogram.csv") 47 | end 48 | 49 | function master(args) 50 | local dev1 = device.config({port = args.dev1, rxQueues = 3, txQueues = 3}) 51 | local dev2 = device.config({port = args.dev2, rxQueues = 3, txQueues = 3}) 52 | local PKT_SIZE = args.size 53 | local number = args.number 54 | local flowCount = args.flowCount 55 | local ips = {} 56 | 57 | device.waitForLinks() 58 | dev1:getTxQueue(0):setRate(args.rate) 59 | mg.startTask("loadSlave", dev1:getTxQueue(0), PKT_SIZE, number, flowCount, ips) 60 | 61 | stats.startStatsTask{dev1} 62 | mg.waitForTasks() 63 | end 64 | 65 | function loadSlave(queue, PKT_SIZE, number, flowCount, ips) 66 | local converted1 = bit.rshift(bit.bswap(convertMacAddress(eth_addresses_str[1]) + 0ULL), 16) 67 | local converted2 = bit.rshift(bit.bswap(convertMacAddress(eth_addresses_str[2]) + 0ULL), 16) 68 | local converted3 = bit.rshift(bit.bswap(convertMacAddress(eth_addresses_str[3]) + 0ULL), 16) 69 | local converted4 = bit.rshift(bit.bswap(convertMacAddress(eth_addresses_str[4]) + 0ULL), 16) 70 | local converted5 = bit.rshift(bit.bswap(convertMacAddress(eth_addresses_str[5]) + 0ULL), 16) 71 | local converted6 = bit.rshift(bit.bswap(convertMacAddress(eth_addresses_str[6]) + 0ULL), 16) 72 | local converted7 = bit.rshift(bit.bswap(convertMacAddress(eth_addresses_str[7]) + 0ULL), 16) 73 | local converted8 = bit.rshift(bit.bswap(convertMacAddress(eth_addresses_str[8]) + 0ULL), 16) 74 | local converted_src = bit.rshift(bit.bswap(convertMacAddress(ETH_SRC) + 0ULL), 16) 75 | local converted_dst = bit.rshift(bit.bswap(convertMacAddress(ETH_DST) + 0ULL), 16) 76 | 77 | local eth_addresses_mac = {converted1, converted2, converted3, converted4, converted5, converted6, converted7, converted8} 78 | 79 | local mem = memory.createMemPool(function(buf) 80 | buf:getTcpPacket():fill{ 81 | ethSrc = txDev, 82 | ethDst = eth_addresses_str[0], 83 | ethType = 0x0800, 84 | ip4Dst = math.random(1, 2^32 - 1), 85 | ip4Src = math.random(1, 2^32 - 1), 86 | ip4Version = 4 87 | } 88 | end) 89 | local bufs = mem:bufArray() 90 | local counter = 0 91 | bufs:alloc(PKT_SIZE) 92 | while mg.running() do 93 | for _, buf in ipairs(bufs) do 94 | local pkt = buf:getTcpPacket() 95 | counter = (counter + 1) % flowCount 96 | if (counter == 0) then 97 | counter = 1 98 | end 99 | pkt.ip4.src:set(math.random(0, 2^32 - 1)) 100 | pkt.ip4.dst:set(math.random(2^32 - 1 - flowCount, 2^32 - 1)) 101 | 102 | pkt.eth:setDst(eth_addresses_mac[math.random(1, number)]) 103 | pkt.eth:setSrc(converted_src) 104 | end 105 | bufs:offloadTcpChecksums() 106 | queue:send(bufs) 107 | end 108 | end 109 | 110 | function timerSlave(txQueue, rxQueue, histfile) 111 | local converted1 = bit.rshift(bit.bswap(convertMacAddress(eth_addresses_str[1]) + 0ULL), 16) 112 | local timestamper = ts:newUdpTimestamper(txQueue, rxQueue) 113 | local rateLimit = timer:new(0.001) 114 | local hist = hist:new() 115 | mg.sleepMillis(300) -- ensure that the load task is running 116 | while mg.running() do 117 | hist:update(timestamper:measureLatency(84, function(buf) 118 | buf:getUdpPacket():fill{ 119 | ethSrc = txDev, 120 | ethDst = eth_addresses_str[0], 121 | ethType = 0x0800, 122 | ip4Dst = math.random(0, 2^32 - 1), 123 | ip4Src = math.random(0, 2^32 - 1), 124 | ip4Version = 4, 125 | udpDst = 319 126 | } 127 | 128 | local pkt = buf:getTcpPacket() 129 | pkt.ip4.src:set(math.random(0, 2^32 - 1)) 130 | pkt.ip4.dst:set(math.random(0, 2^32 - 1)) 131 | pkt.eth:setDst(converted1) 132 | 133 | end)) 134 | rateLimit:wait() 135 | rateLimit:reset() 136 | end 137 | hist:print() 138 | hist:save(histfile) 139 | end 140 | 141 | --------------------------------------------------------------------------------