forked from MystenLabs/sui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfabfile.py
308 lines (277 loc) · 8.19 KB
/
fabfile.py
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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
# Copyright(C) Facebook, Inc. and its affiliates.
# Copyright (c) Mysten Labs, Inc.
# SPDX-License-Identifier: Apache-2.0
from fabric import task
from benchmark.seed import SeedData
from benchmark.local import LocalBench
from benchmark.full_demo import Demo
from benchmark.logs import ParseError, LogParser
from benchmark.utils import Print
from benchmark.plot import Ploter, PlotError
from benchmark.instance import InstanceManager
from benchmark.remote import Bench, BenchError
@task
def local(ctx, debug=True):
''' Run benchmarks on localhost '''
bench_params = {
'faults': 0,
'nodes': 4,
'workers': 1,
'rate': 50_000,
'tx_size': 512,
'duration': 60,
}
node_params = {
'header_num_of_batches_threshold': 32,
'max_header_num_of_batches': 1000,
'max_header_delay': '1000ms', # ms
'gc_depth': 50, # rounds
'sync_retry_delay': '10_000ms', # ms
'sync_retry_nodes': 3, # number of nodes
'batch_size': 500_000, # bytes
'max_batch_delay': '200ms', # ms,
'max_concurrent_requests': 500_000,
'prometheus_metrics': {
"socket_addr": "/ip4/127.0.0.1/tcp/0/http"
},
"network_admin_server": {
# Use a random available local port.
"primary_network_admin_server_port": 0,
"worker_network_admin_server_base_port": 0
},
}
try:
ret = LocalBench(bench_params, node_params).run(debug)
print(ret.result())
except BenchError as e:
Print.error(e)
@task
def smoke(ctx, debug=True, release=False):
''' Run benchmarks on localhost without release mode'''
bench_params = {
'faults': 0,
'nodes': 4,
'workers': 1,
'rate': 50_000,
'tx_size': 512,
'duration': 10,
}
node_params = {
'header_num_of_batches_threshold': 32,
'max_header_num_of_batches': 1000,
'max_header_delay': '1000ms', # ms
'gc_depth': 50, # rounds
'sync_retry_delay': '10_000ms', # ms
'sync_retry_nodes': 3, # number of nodes
'batch_size': 500_000, # bytes
'max_batch_delay': '200ms', # ms,
'max_concurrent_requests': 500_000,
'prometheus_metrics': {
"socket_addr": "/ip4/127.0.0.1/tcp/0/http"
},
"network_admin_server": {
# Use a random available local port.
"primary_network_admin_server_port": 0,
"worker_network_admin_server_base_port": 0
},
}
try:
ret = LocalBench(bench_params, node_params).run(
debug=debug, release=release)
print(ret.result())
except BenchError as e:
Print.error(e)
@task
def failpoints(ctx, debug=True):
''' Run benchmarks on localhost '''
bench_params = {
'faults': 0,
'nodes': 4,
'workers': 1,
'rate': 50_000,
'tx_size': 512,
'duration': 20,
}
node_params = {
'header_num_of_batches_threshold': 32,
'max_header_num_of_batches': 1000,
'max_header_delay': '200ms', # ms
'gc_depth': 50, # rounds
'sync_retry_delay': '10_000ms', # ms
'sync_retry_nodes': 3, # number of nodes
'batch_size': 500_000, # bytes
'max_batch_delay': '200ms', # ms,
'max_concurrent_requests': 500_000,
'prometheus_metrics': {
"socket_addr": "/ip4/127.0.0.1/tcp/0/http"
},
"network_admin_server": {
# Use a random available local port.
"primary_network_admin_server_port": 0,
"worker_network_admin_server_base_port": 0
},
}
try:
ret = LocalBench(bench_params, node_params).run(
debug=debug, failpoints=True)
print(ret.result())
except BenchError as e:
Print.error(e)
@task
def demo(ctx, debug=True):
''' Run benchmarks on localhost '''
bench_params = {
'faults': 0,
'nodes': 4,
'workers': 1,
'rate': 50_000,
'tx_size': 512,
'duration': 10,
}
node_params = {
"batch_size": 500000,
"gc_depth": 50, # rounds
'header_num_of_batches_threshold': 32,
"max_header_num_of_batches": 1000,
"max_batch_delay": "200ms", # ms
"max_concurrent_requests": 500_000,
"max_header_delay": "1000ms", # ms
"sync_retry_delay": "10_000ms", # ms
"sync_retry_nodes": 3, # number of nodes
'prometheus_metrics': {
# Use a random available local port.
"socket_addr": "/ip4/127.0.0.1/tcp/0/http"
},
"network_admin_server": {
# Use a random available local port.
"primary_network_admin_server_port": 0,
"worker_network_admin_server_base_port": 0
},
}
try:
ret = Demo(bench_params, node_params).run(debug)
print(ret.result())
except BenchError as e:
Print.error(e)
@task
def seed(ctx, starting_data_port):
''' Run data seeder '''
bench_params = {
'faults': 0,
'nodes': 4,
'workers': 1,
'rate': 50_000,
'tx_size': 512,
'duration': 20,
}
try:
SeedData(bench_params).run(int(starting_data_port))
except BenchError as e:
Print.error(e)
@task
def create(ctx, nodes=2):
''' Create a testbed'''
try:
InstanceManager.make().create_instances(nodes)
except BenchError as e:
Print.error(e)
@task
def destroy(ctx):
''' Destroy the testbed '''
try:
InstanceManager.make().terminate_instances()
except BenchError as e:
Print.error(e)
@task
def start(ctx, max=2):
''' Start at most `max` machines per data center '''
try:
InstanceManager.make().start_instances(max)
except BenchError as e:
Print.error(e)
@task
def stop(ctx):
''' Stop all machines '''
try:
InstanceManager.make().stop_instances()
except BenchError as e:
Print.error(e)
@task
def info(ctx):
''' Display connect information about all the available machines '''
try:
InstanceManager.make().print_info()
except BenchError as e:
Print.error(e)
@task
def install(ctx):
''' Install the codebase on all machines '''
try:
Bench(ctx).install()
except BenchError as e:
Print.error(e)
@task
def remote(ctx, debug=False):
''' Run benchmarks on AWS '''
bench_params = {
'faults': 3,
'nodes': [10],
'workers': 1,
'collocate': True,
'rate': [10_000, 110_000],
'tx_size': 512,
'duration': 300,
'runs': 2,
}
node_params = {
'header_num_of_batches_threshold': 32,
'max_header_num_of_batches': 1000,
'max_header_delay': '200ms', # ms
'gc_depth': 50, # rounds
'sync_retry_delay': '10_000ms', # ms
'sync_retry_nodes': 3, # number of nodes
'batch_size': 500_000, # bytes
'max_batch_delay': '200ms', # ms,
'max_concurrent_requests': 500_000,
'prometheus_metrics': {
"socket_addr": "/ip4/0.0.0.0/tcp/0/http"
},
"network_admin_server": {
# Use a random available local port.
"primary_network_admin_server_port": 0,
"worker_network_admin_server_base_port": 0
},
}
try:
Bench(ctx).run(bench_params, node_params, debug)
except BenchError as e:
Print.error(e)
@task
def plot(ctx):
''' Plot performance using the logs generated by "fab remote" '''
plot_params = {
'faults': [0],
'nodes': [10, 20, 50],
'workers': [1],
'collocate': True,
'tx_size': 512,
'max_latency': [3_500, 4_500]
}
try:
Ploter.plot(plot_params)
except PlotError as e:
Print.error(BenchError('Failed to plot performance', e))
@task
def kill(ctx):
''' Stop execution on all machines '''
try:
Bench(ctx).kill()
except BenchError as e:
Print.error(e)
@task
def logs(ctx):
''' Print a summary of the logs '''
try:
print(LogParser.process('./logs', faults='?').result())
except ParseError as e:
Print.error(BenchError('Failed to parse logs', e))