Skip to content

Commit 401f64a

Browse files
committed
feat: change port number and bump rocksdb
1 parent 07a2381 commit 401f64a

File tree

2 files changed

+25
-19
lines changed

2 files changed

+25
-19
lines changed

benchmark/benchmark/local.py

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,49 +5,55 @@
55
from time import sleep
66

77
from benchmark.commands import CommandMaker
8-
from benchmark.config import Key, LocalCommittee, NodeParameters, BenchParameters, ConfigError
8+
from benchmark.config import (
9+
Key,
10+
LocalCommittee,
11+
NodeParameters,
12+
BenchParameters,
13+
ConfigError,
14+
)
915
from benchmark.logs import LogParser, ParseError
1016
from benchmark.utils import Print, BenchError, PathMaker
1117

1218

1319
class LocalBench:
14-
BASE_PORT = 3000
20+
BASE_PORT = 4000
1521

1622
def __init__(self, bench_parameters_dict, node_parameters_dict):
1723
try:
1824
self.bench_parameters = BenchParameters(bench_parameters_dict)
1925
self.node_parameters = NodeParameters(node_parameters_dict)
2026
except ConfigError as e:
21-
raise BenchError('Invalid nodes or bench parameters', e)
27+
raise BenchError("Invalid nodes or bench parameters", e)
2228

2329
def __getattr__(self, attr):
2430
return getattr(self.bench_parameters, attr)
2531

2632
def _background_run(self, command, log_file):
2733
name = splitext(basename(log_file))[0]
28-
cmd = f'{command} 2> {log_file}'
29-
subprocess.run(['tmux', 'new', '-d', '-s', name, cmd], check=True)
34+
cmd = f"{command} 2> {log_file}"
35+
subprocess.run(["tmux", "new", "-d", "-s", name, cmd], check=True)
3036

3137
def _kill_nodes(self):
3238
try:
3339
cmd = CommandMaker.kill().split()
3440
subprocess.run(cmd, stderr=subprocess.DEVNULL)
3541
except subprocess.SubprocessError as e:
36-
raise BenchError('Failed to kill testbed', e)
42+
raise BenchError("Failed to kill testbed", e)
3743

3844
def run(self, debug=False):
3945
assert isinstance(debug, bool)
40-
Print.heading('Starting local benchmark')
46+
Print.heading("Starting local benchmark")
4147

4248
# Kill any previous testbed.
4349
self._kill_nodes()
4450

4551
try:
46-
Print.info('Setting up testbed...')
52+
Print.info("Setting up testbed...")
4753
nodes, rate = self.nodes[0], self.rate[0]
4854

4955
# Cleanup all files.
50-
cmd = f'{CommandMaker.clean_logs()} ; {CommandMaker.cleanup()}'
56+
cmd = f"{CommandMaker.clean_logs()} ; {CommandMaker.cleanup()}"
5157
subprocess.run([cmd], shell=True, stderr=subprocess.DEVNULL)
5258
sleep(0.5) # Removing the store may take time.
5359

@@ -77,12 +83,12 @@ def run(self, debug=False):
7783
workers_addresses = committee.workers_addresses(self.faults)
7884
rate_share = ceil(rate / committee.workers())
7985
for i, addresses in enumerate(workers_addresses):
80-
for (id, address) in addresses:
86+
for id, address in addresses:
8187
cmd = CommandMaker.run_client(
8288
address,
8389
self.tx_size,
8490
rate_share,
85-
[x for y in workers_addresses for _, x in y]
91+
[x for y in workers_addresses for _, x in y],
8692
)
8793
log_file = PathMaker.client_log_file(i, id)
8894
self._background_run(cmd, log_file)
@@ -94,34 +100,34 @@ def run(self, debug=False):
94100
PathMaker.committee_file(),
95101
PathMaker.db_path(i),
96102
PathMaker.parameters_file(),
97-
debug=debug
103+
debug=debug,
98104
)
99105
log_file = PathMaker.primary_log_file(i)
100106
self._background_run(cmd, log_file)
101107

102108
# Run the workers (except the faulty ones).
103109
for i, addresses in enumerate(workers_addresses):
104-
for (id, address) in addresses:
110+
for id, address in addresses:
105111
cmd = CommandMaker.run_worker(
106112
PathMaker.key_file(i),
107113
PathMaker.committee_file(),
108114
PathMaker.db_path(i, id),
109115
PathMaker.parameters_file(),
110116
id, # The worker's id.
111-
debug=debug
117+
debug=debug,
112118
)
113119
log_file = PathMaker.worker_log_file(i, id)
114120
self._background_run(cmd, log_file)
115121

116122
# Wait for all transactions to be processed.
117-
Print.info(f'Running benchmark ({self.duration} sec)...')
123+
Print.info(f"Running benchmark ({self.duration} sec)...")
118124
sleep(self.duration)
119125
self._kill_nodes()
120126

121127
# Parse logs and return the parser.
122-
Print.info('Parsing logs...')
128+
Print.info("Parsing logs...")
123129
return LogParser.process(PathMaker.logs_path(), faults=self.faults)
124130

125131
except (subprocess.SubprocessError, ParseError) as e:
126132
self._kill_nodes()
127-
raise BenchError('Failed to run benchmark', e)
133+
raise BenchError("Failed to run benchmark", e)

store/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ edition = "2018"
66
publish = false
77

88
[dependencies]
9-
rocksdb = "0.16.0"
10-
tokio = { version = "1.5.0", features = ["sync", "macros", "rt"] }
9+
rocksdb = "0.22.0"
10+
tokio = { version = "1.5.0", features = ["sync", "macros", "rt"] }

0 commit comments

Comments
 (0)