-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathrampup.js
175 lines (157 loc) · 3.11 KB
/
rampup.js
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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
// increase the concurrency level by the factor of 10
var limitConcurrencyFactor = 10;
var itemDataSizes = [
"10KB", "1MB", "100MB", "10GB"
];
var limitCount = 1000000;
var limitTime = 100;
// initial concurrency limit value
var limitConcurrency = 1;
function configLimitConcurrency(c) {
return {
"storage": {
"driver": {
"limit": {
"concurrency": c
}
}
}
}
};
function configItemDataSize(s) {
return {
"item": {
"data": {
"size": s
}
}
}
};
function configCreate(iterId, size, itemOutputFile, limitCount, limitTime) {
return {
"item": {
"data": {
"size": size
},
"output": {
"file": itemOutputFile,
"path": "/default"
}
},
"load": {
"op": {
"limit": {
"count": limitCount
}
},
"step": {
"id": "create0_" + iterId,
"limit": {
"count": limitCount,
"time": limitTime
}
}
}
}
};
function configRead(iterId, itemInputFile) {
return {
"item": {
"input": {
"file": itemInputFile
}
},
"load": {
"step": {
"id": "read1_" + iterId
}
}
}
};
function configUpdate(iterId, itemInputFile, itemOutputFile) {
return {
"item": {
"input": {
"file": itemInputFile
},
"output": {
"file": itemOutputFile
}
},
"load": {
"step": {
"id": "update2_" + iterId
}
}
}
};
function configReadPartial(iterId, itemInputFile) {
return {
"item": {
"input": {
"file": itemInputFile
}
},
"load": {
"step": {
"id": "read3_" + iterId
}
}
}
};
function configDelete(iterId, itemInputFile) {
return {
"item": {
"input": {
"file": itemInputFile
}
},
"load": {
"step": {
"id": "delete4_" + iterId
}
}
}
};
// typically OS open files limit is 1024 so won't try to use the concurrency level higher than that
while(limitConcurrency < 1024) {
for(var i = 0; i < itemDataSizes.length; i ++) {
itemDataSize = itemDataSizes[i];
print(
"Run the load steps using the concurrency limit of " + limitConcurrency
+ " and items data size " + itemDataSize
);
var nextConfigLimitConcurrency = configLimitConcurrency(limitConcurrency);
var iterId = "concurrency" + limitConcurrency + "_size" + itemDataSize;
var iterItemsFile0 = "items_" + iterId + "_0.csv";
var iterItemsFile11 = "items_" + iterId + "_1.csv";
CreateLoad
.config(nextConfigLimitConcurrency)
.config(configItemDataSize(itemDataSize))
.config(
configCreate(
iterId, itemDataSize, iterItemsFile0, limitCount, limitTime
)
)
.run();
ReadLoad
.config(nextConfigLimitConcurrency)
.config(configRead(iterId, iterItemsFile0))
.run();
UpdateRandomRangeLoad
.config(nextConfigLimitConcurrency)
.config(configUpdate(iterId, iterItemsFile0, iterItemsFile11))
.run();
ReadVerifyRandomRangeLoad
.config(nextConfigLimitConcurrency)
.config(configReadPartial(iterId, iterItemsFile11))
.run();
DeleteLoad
.config(nextConfigLimitConcurrency)
.config(configDelete(iterId, iterItemsFile0))
.run();
}
limitConcurrency *= limitConcurrencyFactor;
// cast limitConcurrency value to int
limitConcurrency = ~~limitConcurrency;
}