Skip to content

Commit

Permalink
fix: import bench fixes from MystenLabs#670
Browse files Browse the repository at this point in the history
In the hope of fixing the benchmarks
  • Loading branch information
huitseeker committed Aug 22, 2022
1 parent 7216df4 commit 7c46b01
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 9 deletions.
2 changes: 1 addition & 1 deletion benchmark/benchmark/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ def print(self, filename):
def ip(multi_address):
address = multiaddr_to_url_data(multi_address)
assert isinstance(address, str)
return address.split(':')[0]
return address.split(':')[0].strip("/")


class LocalCommittee(Committee):
Expand Down
4 changes: 2 additions & 2 deletions benchmark/benchmark/full_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ def run(self, debug=False):
sleep(0.5) # Removing the store may take time.

# Recompile the latest code.
cmd = CommandMaker.compile(False)
cmd = CommandMaker.compile(mem_profiling=self.mem_profile)
subprocess.run(cmd, check=True, cwd=PathMaker.node_crate_path())
# Recompile the latest code.
cmd = CommandMaker.compile(False)
cmd = CommandMaker.compile(mem_profiling=self.mem_profile)
subprocess.run(cmd, check=True,
cwd=PathMaker.examples_crate_path())

Expand Down
15 changes: 9 additions & 6 deletions benchmark/benchmark/remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,21 +136,23 @@ def _background_run(self, host, command, log_file):
output = c.run(cmd, hide=True)
self._check_stderr(output)

def _update(self, hosts, collocate):
if collocate:
def _update(self, hosts, bench_parameters):
if bench_parameters.collocate:
ips = list(set(hosts))
else:
ips = list(set([x for y in hosts for x in y]))

Print.info(
f'Updating {len(ips)} machines (branch "{self.settings.branch}")...'
)
compile_cmd = ' '.join(CommandMaker.compile(
mem_profiling=bench_parameters.mem_profile))
cmd = [
f'(cd {self.settings.repo_name} && git fetch -f)',
f'(cd {self.settings.repo_name} && git checkout -f {self.settings.branch})',
f'(cd {self.settings.repo_name} && git checkout -f {self.settings.branch} --)',
f'(cd {self.settings.repo_name} && git pull -f)',
'source $HOME/.cargo/env',
f'(cd {self.settings.repo_name}/node && {CommandMaker.compile()})',
f'(cd {self.settings.repo_name}/node && {compile_cmd})',
CommandMaker.alias_binaries(
f'./{self.settings.repo_name}/target/release/'
)
Expand All @@ -166,7 +168,8 @@ def _config(self, hosts, node_parameters, bench_parameters):
subprocess.run([cmd], shell=True, stderr=subprocess.DEVNULL)

# Recompile the latest code.
cmd = CommandMaker.compile(mem_profiling=self.mem_profile)
cmd = CommandMaker.compile(
mem_profiling=bench_parameters.mem_profile)
Print.info(f"About to run {cmd}...")
subprocess.run(cmd, check=True, cwd=PathMaker.node_crate_path())

Expand Down Expand Up @@ -324,7 +327,7 @@ def run(self, bench_parameters_dict, node_parameters_dict, debug=False):

# Update nodes.
try:
self._update(selected_hosts, bench_parameters.collocate)
self._update(selected_hosts, bench_parameters)
except (GroupException, ExecutionError) as e:
e = FabricError(e) if isinstance(e, GroupException) else e
raise BenchError('Failed to update nodes', e)
Expand Down
3 changes: 3 additions & 0 deletions benchmark/fabfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ def demo(ctx, debug=True):
'rate': 50_000,
'tx_size': 512,
'duration': 10,
'mem_profiling': False,
}
node_params = {
"batch_size": 500000,
Expand Down Expand Up @@ -181,6 +182,7 @@ def remote(ctx, debug=False):
'tx_size': 512,
'duration': 300,
'runs': 2,
'mem_profiling': False,
}
node_params = {
'header_size': 1_000, # bytes
Expand All @@ -189,6 +191,7 @@ def remote(ctx, debug=False):
'sync_retry_delay': '10_000ms', # ms
'sync_retry_nodes': 3, # number of nodes
'batch_size': 500_000, # bytes
'max_batch_delay': '200ms', # ms,
'block_synchronizer': {
'certificates_synchronize_timeout': '2_000ms',
'payload_synchronize_timeout': '2_000ms',
Expand Down

0 comments on commit 7c46b01

Please sign in to comment.