-
Notifications
You must be signed in to change notification settings - Fork 47
/
fabfile.py
155 lines (132 loc) · 3.4 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
from fabric import task
from benchmark.local import LocalBench
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):
"""Run benchmarks on localhost"""
bench_params = {
"faults": 0,
"nodes": 4,
"rate": 1_000,
"tx_size": 512,
"duration": 20,
}
node_params = {
"consensus": {
"timeout_delay": 1_000,
"sync_retry_delay": 10_000,
},
"mempool": {
"gc_depth": 50,
"sync_retry_delay": 5_000,
"sync_retry_nodes": 3,
"batch_size": 15_000,
"max_batch_delay": 10,
},
}
try:
ret = LocalBench(bench_params, node_params).run(debug=True).result()
print(ret)
except BenchError as e:
Print.error(e)
@task
def create(ctx, nodes=1):
"""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=1):
"""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):
"""Run benchmarks on AWS"""
bench_params = {
"faults": 0,
"nodes": [4],
"rate": [10_000],
"tx_size": 512,
"duration": 300,
"runs": 1,
}
node_params = {
"consensus": {
"timeout_delay": 5_000,
"sync_retry_delay": 5_000,
},
"mempool": {
"gc_depth": 50,
"sync_retry_delay": 5_000,
"sync_retry_nodes": 3,
"batch_size": 500_000,
"max_batch_delay": 100,
},
}
try:
Bench(ctx).run(bench_params, node_params, debug=False)
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],
"tx_size": 512,
"max_latency": [2_000, 5_000],
}
try:
Ploter.plot(plot_params)
except PlotError as e:
Print.error(BenchError("Failed to plot performance", e))
@task
def kill(ctx):
"""Stop any HotStuff 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))