Skip to content

Commit ca36b29

Browse files
Fixed timeout issues when pushing benchmark timeseries data (#448)
* architecture aware benchmark client link downloads * Fixed timeout issues when pushing benchmark timeseries data
1 parent 3a0448d commit ca36b29

File tree

13 files changed

+88
-44
lines changed

13 files changed

+88
-44
lines changed

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "redisbench-admin"
3-
version = "0.11.26"
3+
version = "0.11.32"
44
description = "Redis benchmark run helper. A wrapper around Redis and Redis Modules benchmark tools ( ftsb_redisearch, memtier_benchmark, redis-benchmark, aibench, etc... )."
55
authors = ["filipecosta90 <[email protected]>","Redis Performance Group <[email protected]>"]
66
readme = "README.md"

redisbench_admin/compare/compare.py

+1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ def compare_command_logic(args, project_name, project_version):
4949
port=args.redistimeseries_port,
5050
password=args.redistimeseries_pass,
5151
username=args.redistimeseries_user,
52+
retry_on_timeout=True,
5253
)
5354
rts.ping()
5455
default_baseline_branch = None

redisbench_admin/export/export.py

+1
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ def export_command_logic(args, project_name, project_version):
172172
host=args.redistimeseries_host,
173173
port=args.redistimeseries_port,
174174
password=args.redistimeseries_pass,
175+
retry_on_timeout=True,
175176
)
176177
try:
177178
rts.ping()

redisbench_admin/run/ftsb/ftsb.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,16 @@ def prepare_ftsb_benchmark_command(
5555

5656

5757
def extract_ftsb_extra_links(
58-
benchmark_config, benchmark_tool, config_key="clientconfig"
58+
benchmark_config, benchmark_tool, config_key="clientconfig", architecture="x86_64"
5959
):
6060
remote_tool_link = "/tmp/{}".format(benchmark_tool)
61+
arch_txt = "amd64"
62+
if architecture == "aarch64":
63+
arch_txt = "arm64"
64+
6165
tool_link = (
6266
"https://s3.amazonaws.com/benchmarks.redislabs/"
63-
+ "redisearch/tools/ftsb/{}_linux_amd64".format(benchmark_tool)
67+
+ f"redisearch/tools/ftsb/{benchmark_tool}_linux_{arch_txt}"
6468
)
6569
queries_file_link = None
6670
for entry in benchmark_config[config_key]:

redisbench_admin/run/run.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ def define_benchmark_plan(benchmark_definitions, default_specs):
124124
logging.info(f"FINAL DB CONFIG: {final_db_config}")
125125
test_benchmark_config["dbconfig"] = final_db_config
126126

127-
logging.info(
127+
logging.debug(
128128
f"final benchmark config for setup: {setup_name} and test: {test_name}. {test_benchmark_config}"
129129
)
130130
# add benchmark

redisbench_admin/run_local/run_local.py

+1
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ def run_local_command_logic(args, project_name, project_version):
129129
host=args.redistimeseries_host,
130130
port=args.redistimeseries_port,
131131
password=args.redistimeseries_pass,
132+
retry_on_timeout=True,
132133
)
133134
rts.ping()
134135

redisbench_admin/run_remote/remote_client.py

+2
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ def run_remote_client_tool(
5353
redis_conns=[],
5454
do_post_process=True,
5555
redis_password=None,
56+
architecture="x86_64",
5657
):
5758
(
5859
benchmark_min_tool_version,
@@ -83,6 +84,7 @@ def run_remote_client_tool(
8384
arch_str,
8485
client_ssh_port,
8586
private_key,
87+
architecture,
8688
)
8789
if "ann-benchmarks" in benchmark_tool:
8890
logging.info(

redisbench_admin/run_remote/remote_db.py

+3
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ def remote_db_spin(
104104
ignore_keyspace_errors=False,
105105
continue_on_module_check_error=False,
106106
keyspace_check_timeout=60,
107+
architecture="x86_64",
107108
):
108109
(
109110
_,
@@ -135,6 +136,7 @@ def remote_db_spin(
135136
username,
136137
continue_on_module_check_error,
137138
)
139+
logging.info(f"final remote module files {remote_module_files}...")
138140
# setup Redis
139141
redis_setup_result = True
140142
redis_conns = []
@@ -337,6 +339,7 @@ def remote_db_spin(
337339
[],
338340
False,
339341
redis_password,
342+
architecture,
340343
)
341344
logging.info(
342345
"Finished loading the data via client tool. Took {} seconds. Result={}".format(

redisbench_admin/run_remote/remote_helpers.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,11 @@ def remote_tool_pre_bench_step(
6666
arch_str,
6767
client_ssh_port,
6868
private_key,
69+
architecture="x86_64",
6970
):
70-
logging.info("Settting up remote tool {} requirements".format(benchmark_tool))
71+
logging.info(
72+
f"Settting up remote tool {benchmark_tool} requirements. architecture ={architecture}"
73+
)
7174
if benchmark_tool == "redisgraph-benchmark-go":
7275
setup_remote_benchmark_tool_redisgraph_benchmark_go(
7376
client_public_ip,
@@ -90,7 +93,9 @@ def remote_tool_pre_bench_step(
9093
queries_file_link,
9194
remote_tool_link,
9295
tool_link,
93-
) = extract_ftsb_extra_links(benchmark_config, benchmark_tool, config_key)
96+
) = extract_ftsb_extra_links(
97+
benchmark_config, benchmark_tool, config_key, architecture
98+
)
9499
logging.info(
95100
"FTSB Extracted:\nremote tool input: {}\nremote tool link: {}\ntool path: {}".format(
96101
queries_file_link, remote_tool_link, tool_link

redisbench_admin/run_remote/run_remote.py

+4
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,7 @@ def run_remote_command_logic(args, project_name, project_version):
276276
host=args.redistimeseries_host,
277277
port=args.redistimeseries_port,
278278
password=args.redistimeseries_pass,
279+
retry_on_timeout=True,
279280
)
280281
rts.ping()
281282

@@ -553,6 +554,8 @@ def run_remote_command_logic(args, project_name, project_version):
553554
flushall_on_every_test_start,
554555
ignore_keyspace_errors,
555556
continue_on_module_check_error,
557+
60,
558+
architecture,
556559
)
557560
if benchmark_type == "read-only":
558561
ro_benchmark_set(
@@ -698,6 +701,7 @@ def run_remote_command_logic(args, project_name, project_version):
698701
redis_conns,
699702
True,
700703
redis_password,
704+
architecture,
701705
)
702706

703707
if profilers_enabled:

redisbench_admin/run_remote/standalone.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,9 @@ def remote_module_files_cp(
7575
continue_on_module_check_error=False,
7676
):
7777
remote_module_files = []
78+
7879
if local_module_files is not None:
80+
logging.info(f"there is a total of {len(local_module_files)} modules")
7981
for local_module_file in local_module_files:
8082
splitted_module_and_plugins = []
8183
if type(local_module_file) is str:
@@ -135,7 +137,7 @@ def remote_module_files_cp(
135137
if pos > 1:
136138
remote_module_files_in = remote_module_files_in + " "
137139
remote_module_files_in = remote_module_files_in + remote_module_file
138-
remote_module_files.append(remote_module_files_in)
140+
remote_module_files.append(remote_module_files_in)
139141
logging.info(
140142
"There are a total of {} remote files {}".format(
141143
len(remote_module_files), remote_module_files

redisbench_admin/utils/remote.py

+57-37
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import os
1010
import sys
1111
import tempfile
12-
12+
import time
1313
import git
1414
import paramiko
1515
import pysftp
@@ -93,13 +93,22 @@ def copy_file_to_remote_setup(
9393
cnopts=cnopts,
9494
port=port,
9595
)
96-
srv.put(full_local_path, remote_file, callback=view_bar_simple)
97-
srv.close()
96+
if srv.exists(remote_file):
97+
print(f"Remote file {remote_file} already exists. Skipping the copy.")
98+
else:
99+
uploaded_file = srv.put(
100+
full_local_path, remote_file, callback=view_bar_simple
101+
)
102+
print(f"File uploaded to: {uploaded_file}")
98103
logging.info(
99104
"Finished Copying file {} to remote server {} ".format(
100105
full_local_path, remote_file
101106
)
102107
)
108+
file_info = srv.stat(remote_file)
109+
print(f"Remote file size: {file_info.st_size} bytes")
110+
print(f"Remote file permissions: {oct(file_info.st_mode)[-3:]}")
111+
srv.close()
103112
res = True
104113
else:
105114
if continue_on_module_check_error:
@@ -314,6 +323,9 @@ def setup_remote_environment(
314323
},
315324
raise_on_error=True,
316325
)
326+
infra_wait_secs = 60
327+
logging.warning(f"Infra ready wait... for {infra_wait_secs} secs")
328+
time.sleep(infra_wait_secs)
317329
return retrieve_tf_connection_vars(return_code, tf)
318330

319331

@@ -616,42 +628,50 @@ def push_data_to_redistimeseries(rts, time_series_dict: dict, expire_msecs=0):
616628
unit="benchmark time-series", total=len(time_series_dict.values())
617629
)
618630
for timeseries_name, time_series in time_series_dict.items():
619-
exporter_create_ts(rts, time_series, timeseries_name)
620-
for timestamp, value in time_series["data"].items():
621-
try:
622-
if timestamp is None:
623-
logging.warning("The provided timestamp is null. Using auto-ts")
624-
rts.ts().add(
625-
timeseries_name,
626-
value,
627-
duplicate_policy="last",
628-
)
629-
else:
630-
rts.ts().add(
631-
timeseries_name,
632-
timestamp,
633-
value,
634-
duplicate_policy="last",
631+
try:
632+
exporter_create_ts(rts, time_series, timeseries_name)
633+
for timestamp, value in time_series["data"].items():
634+
try:
635+
if timestamp is None:
636+
logging.warning(
637+
"The provided timestamp is null. Using auto-ts"
638+
)
639+
rts.ts().add(
640+
timeseries_name,
641+
value,
642+
duplicate_policy="last",
643+
)
644+
else:
645+
rts.ts().add(
646+
timeseries_name,
647+
timestamp,
648+
value,
649+
duplicate_policy="last",
650+
)
651+
datapoint_inserts += 1
652+
except redis.exceptions.DataError:
653+
logging.warning(
654+
"Error while inserting datapoint ({} : {}) in timeseries named {}. ".format(
655+
timestamp, value, timeseries_name
656+
)
635657
)
636-
datapoint_inserts += 1
637-
except redis.exceptions.DataError:
638-
logging.warning(
639-
"Error while inserting datapoint ({} : {}) in timeseries named {}. ".format(
640-
timestamp, value, timeseries_name
658+
datapoint_errors += 1
659+
pass
660+
except redis.exceptions.ResponseError:
661+
logging.warning(
662+
"Error while inserting datapoint ({} : {}) in timeseries named {}. ".format(
663+
timestamp, value, timeseries_name
664+
)
641665
)
642-
)
643-
datapoint_errors += 1
644-
pass
645-
except redis.exceptions.ResponseError:
646-
logging.warning(
647-
"Error while inserting datapoint ({} : {}) in timeseries named {}. ".format(
648-
timestamp, value, timeseries_name
649-
)
650-
)
651-
datapoint_errors += 1
652-
pass
653-
if expire_msecs > 0:
654-
rts.pexpire(timeseries_name, expire_msecs)
666+
datapoint_errors += 1
667+
pass
668+
if expire_msecs > 0:
669+
rts.pexpire(timeseries_name, expire_msecs)
670+
except redis.exceptions.TimeoutError:
671+
logging.error(
672+
f"Error while working in timeseries named {timeseries_name}. "
673+
)
674+
datapoint_errors += 1
655675
progress.update()
656676
return datapoint_errors, datapoint_inserts
657677

redisbench_admin/watchdog/watchdog.py

+1
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ def watchdog_command_logic(args, project_name, project_version):
153153
host=args.redistimeseries_host,
154154
port=args.redistimeseries_port,
155155
password=args.redistimeseries_pass,
156+
retry_on_timeout=True,
156157
)
157158
rts.ping()
158159
ec2_client = boto3.client("ec2")

0 commit comments

Comments
 (0)