-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_ec_offloading_testbed.cpp
134 lines (109 loc) · 4.14 KB
/
test_ec_offloading_testbed.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
#include "eventlist.h"
#include "logfile.h"
#include "loggers.h"
#include "aprx-fairqueue.h"
#include "fairqueue.h"
#include "priorityqueue.h"
#include "stoc-fairqueue.h"
#include "flow-generator.h"
#include "pipe.h"
#include "test.h"
#include "prof.h"
#include "conga-topology.h"
namespace ec_offload {
CongaTopology topo;
int generateRandomRoute(route_t *&fwd, route_t *&rev, uint32_t &src, uint32_t &dst);
}
using namespace std;
using namespace ec_offload;
void
conga_testbed(const ArgList &args, Logfile &logfile)
{
double Duration = 0.1;
double Utilization = 0.9;
uint32_t AvgFlowSize = 100000;
string QueueType = "droptail";
string calq = "cq";
string fairqueue = "fq";
string FlowDist = "uniform";
parseDouble(args, "duration", Duration);
parseInt(args, "flowsize", AvgFlowSize);
parseDouble(args, "utilization", Utilization);
parseString(args, "queue", QueueType);
parseString(args, "flowdist", FlowDist);
// Aggregation to core switches and vice-versa.
topo.genTopology(QueueType, logfile);
DataSource::EndHost eh = DataSource::EC_OFFLOAD;
Workloads::FlowDist fd = Workloads::ERASURE_CODING;
if (FlowDist == "pareto") {
fd = Workloads::PARETO;
} else if (FlowDist == "enterprise") {
fd = Workloads::ENTERPRISE;
} else if (FlowDist == "datamining") {
fd = Workloads::DATAMINING;
} else if (FlowDist == "erasure_coding") {
fd = Workloads::ERASURE_CODING;
} else {
fd = Workloads::UNIFORM;
}
// Calculate background traffic utilization.
double bg_flow_rate = Utilization * (CongaTopology::LEAF_SPEED * CongaTopology::N_SERVER * CongaTopology::N_LEAF);
FlowGenerator *bgFlowGen = new FlowGenerator(eh, generateRandomRoute, bg_flow_rate, AvgFlowSize, fd);
bgFlowGen->setTimeLimits(timeFromUs(1), timeFromSec(Duration) - 1);
EventList::Get().setEndtime(timeFromSec(Duration));
}
// in FPGA/core-agg offload case, flows go from client(src) to storage server(dst)
// modify src and dst here to change workload
// really sends flow to core; the route after reaching core is used as indicator when core issues forward flow
int
ec_offload::generateRandomRoute(route_t *&fwd,
route_t *&rev,
uint32_t &src,
uint32_t &core) // core-agg
{
uint32_t dst = 0; // need fix to match only server subset; any constraints?
if (dst != 0) {
dst = dst % CongaTopology::N_NODES;
} else {
dst = rand() % CongaTopology::N_NODES;
}
if (src != 0) {
src = src % (CongaTopology::N_NODES - 1);
} else {
src = rand() % (CongaTopology::N_NODES - 1);
}
if (src >= dst) {
src++;
}
if (core != 0) {
core = core % CongaTopology::N_CORE;
} else {
core = rand() % CongaTopology::N_CORE;
}
uint32_t src_tree = src / CongaTopology::N_SERVER;
uint32_t dst_tree = dst / CongaTopology::N_SERVER;
uint32_t src_server = src % CongaTopology::N_SERVER;
uint32_t dst_server = dst % CongaTopology::N_SERVER;
fwd = new route_t();
rev = new route_t();
fwd->push_back(topo.qServerLeaf[src_tree][src_server]);
fwd->push_back(topo.pServerLeaf[src_tree][src_server]);
rev->push_back(topo.qServerLeaf[dst_tree][dst_server]);
rev->push_back(topo.pServerLeaf[dst_tree][dst_server]);
if (src_tree != dst_tree) {
// core = get_best_lbtag(src, dst);
fwd->push_back(topo.qLeafCore[core][src_tree]);
fwd->push_back(topo.pLeafCore[core][src_tree]);
rev->push_back(topo.qLeafCore[core][dst_tree]);
rev->push_back(topo.pLeafCore[core][dst_tree]);
fwd->push_back(topo.qCoreLeaf[core][dst_tree]);
fwd->push_back(topo.pCoreLeaf[core][dst_tree]);
rev->push_back(topo.qCoreLeaf[core][src_tree]);
rev->push_back(topo.pCoreLeaf[core][src_tree]);
}
fwd->push_back(topo.qLeafServer[dst_tree][dst_server]);
fwd->push_back(topo.pLeafServer[dst_tree][dst_server]);
rev->push_back(topo.qLeafServer[src_tree][src_server]);
rev->push_back(topo.pLeafServer[src_tree][src_server]);
return core;
}