Skip to content

Commit 3a0448d

Browse files
Merge pull request #446 from redis-performance/support.aarch64
Initial support for arm64 on runner and compare
2 parents 2a5a443 + c910847 commit 3a0448d

File tree

15 files changed

+159
-34
lines changed

15 files changed

+159
-34
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.20"
3+
version = "0.11.26"
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/args.py

+19-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
# environment variables
88
import datetime
9-
9+
import os
1010
from redisbench_admin.run.common import get_start_time_vars, PERFORMANCE_GH_TOKEN
1111
from redisbench_admin.utils.remote import (
1212
PERFORMANCE_RTS_HOST,
@@ -29,6 +29,10 @@
2929
LAST_MONTH_UTC = NOW_UTC - (31 * 24 * 60 * 60 * 1000)
3030
START_TIME_NOW_UTC, _, _ = get_start_time_vars()
3131
START_TIME_LAST_MONTH_UTC = START_TIME_NOW_UTC - datetime.timedelta(days=30)
32+
ARCH_X86 = "x86_64"
33+
ARCH_ARM = "aarch64"
34+
VALID_ARCHS = [ARCH_X86, ARCH_ARM]
35+
ARCH = os.getenv("ARCH", ARCH_X86)
3236

3337

3438
def create_compare_arguments(parser):
@@ -56,6 +60,20 @@ def create_compare_arguments(parser):
5660
parser.add_argument("--metric_name", type=str, default=None)
5761
parser.add_argument("--running_platform", type=str, default=None)
5862
parser.add_argument("--extra-filter", type=str, default=None)
63+
parser.add_argument(
64+
"--baseline_architecture",
65+
type=str,
66+
required=False,
67+
default=ARCH,
68+
help=f"Architecture to filter baseline time-series. One of {VALID_ARCHS}.",
69+
)
70+
parser.add_argument(
71+
"--comparison_architecture",
72+
type=str,
73+
required=False,
74+
default=ARCH,
75+
help=f"Architecture to filter comparison time-series. One of {VALID_ARCHS}.",
76+
)
5977
parser.add_argument(
6078
"--last_n",
6179
type=int,

redisbench_admin/compare/compare.py

+15
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
generate_new_pr_comment_notification,
2323
)
2424
from redisbench_admin.utils.remote import get_overall_dashboard_keynames
25+
from redisbench_admin.compare.args import ARCH_X86
2526

2627

2728
def get_project_compare_zsets(triggering_env, org, repo):
@@ -225,6 +226,8 @@ def compare_command_logic(args, project_name, project_version):
225226
"redisjson": "UErSC0jGk",
226227
"redistimeseries": "2WMw61UGz",
227228
}
229+
baseline_architecture = args.baseline_architecture
230+
comparison_architecture = args.comparison_architecture
228231
uid = None
229232
if tf_github_repo.lower() in grafana_dashboards_uids:
230233
uid = grafana_dashboards_uids[tf_github_repo.lower()]
@@ -274,6 +277,8 @@ def compare_command_logic(args, project_name, project_version):
274277
to_ts_ms,
275278
use_metric_context_path,
276279
running_platform,
280+
baseline_architecture,
281+
comparison_architecture,
277282
)
278283
comment_body = ""
279284
if total_comparison_points > 0:
@@ -498,6 +503,8 @@ def compute_regression_table(
498503
to_ts_ms=None,
499504
use_metric_context_path=None,
500505
running_platform=None,
506+
baseline_architecture=ARCH_X86,
507+
comparison_architecture=ARCH_X86,
501508
):
502509
START_TIME_NOW_UTC, _, _ = get_start_time_vars()
503510
START_TIME_LAST_MONTH_UTC = START_TIME_NOW_UTC - datetime.timedelta(days=31)
@@ -584,6 +591,8 @@ def compute_regression_table(
584591
tf_triggering_env,
585592
verbose,
586593
running_platform,
594+
baseline_architecture,
595+
comparison_architecture,
587596
)
588597
logging.info(
589598
"Printing differential analysis between {} and {}".format(
@@ -711,6 +720,8 @@ def from_rts_to_regression_table(
711720
tf_triggering_env,
712721
verbose,
713722
running_platform=None,
723+
baseline_architecture=ARCH_X86,
724+
comparison_architecture=ARCH_X86,
714725
):
715726
print_all = print_regressions_only is False and print_improvements_only is False
716727
table = []
@@ -735,6 +746,8 @@ def from_rts_to_regression_table(
735746
]
736747
if running_platform is not None:
737748
filters_baseline.append("running_platform={}".format(running_platform))
749+
if baseline_architecture != ARCH_X86:
750+
filters_baseline.append(f"arch={baseline_architecture}")
738751
filters_comparison = [
739752
"{}={}".format(by_str_comparison, comparison_str),
740753
"metric={}".format(metric_name),
@@ -744,6 +757,8 @@ def from_rts_to_regression_table(
744757
]
745758
if running_platform is not None:
746759
filters_comparison.append("running_platform={}".format(running_platform))
760+
if comparison_architecture != ARCH_X86:
761+
filters_comparison.append(f"arch={comparison_architecture}")
747762
baseline_timeseries = rts.ts().queryindex(filters_baseline)
748763
comparison_timeseries = rts.ts().queryindex(filters_comparison)
749764

redisbench_admin/run/args.py

+11
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,20 @@
4444
ALLOWED_TOOLS_DEFAULT = "memtier_benchmark,redis-benchmark,redisgraph-benchmark-go,ycsb,go-ycsb,tsbs_run_queries_redistimeseries,tsbs_load_redistimeseries,ftsb_redisearch,aibench_run_inference_redisai_vision,ann-benchmarks"
4545
ALLOWED_BENCH_TOOLS = os.getenv("ALLOWED_BENCH_TOOLS", ALLOWED_TOOLS_DEFAULT)
4646
SKIP_DB_SETUP = bool(int(os.getenv("SKIP_DB_SETUP", "0")))
47+
ARCH_X86 = "x86_64"
48+
ARCH_ARM = "aarch64"
49+
VALID_ARCHS = [ARCH_X86, ARCH_ARM]
50+
ARCH = os.getenv("ARCH", ARCH_X86)
4751

4852

4953
def common_run_args(parser):
54+
parser.add_argument(
55+
"--architecture",
56+
type=str,
57+
required=False,
58+
default=ARCH,
59+
help=f"Architecture to run the benchmark on. One of {VALID_ARCHS}.",
60+
)
5061
parser.add_argument(
5162
"--keep_env_and_topo",
5263
required=False,

redisbench_admin/run/common.py

+30-21
Original file line numberDiff line numberDiff line change
@@ -702,45 +702,54 @@ def dso_check(dso, local_module_file):
702702

703703

704704
def dbconfig_keyspacelen_check(
705-
benchmark_config, redis_conns, ignore_keyspace_errors=False
705+
benchmark_config, redis_conns, ignore_keyspace_errors=False, timeout=60
706706
):
707-
result = True
707+
start_time = time.time()
708708
(
709709
requires_keyspacelen_check,
710710
keyspacelen,
711711
) = check_dbconfig_keyspacelen_requirement(benchmark_config)
712-
if requires_keyspacelen_check:
713-
result = False
712+
713+
if not requires_keyspacelen_check:
714+
return True
715+
716+
attempt = 0
717+
while time.time() - start_time < timeout:
714718
logging.info(
715-
"Ensuring keyspace length requirement = {} is met.".format(keyspacelen)
719+
f"Ensuring keyspace length requirement = {keyspacelen} is met. attempt #{attempt + 1}"
716720
)
717721
total_keys = 0
718722
for shard_conn in redis_conns:
719723
keyspace_dict = shard_conn.info("keyspace")
720724
for _, dbdict in keyspace_dict.items():
721-
shard_keys = dbdict["keys"]
722-
total_keys += shard_keys
725+
total_keys += dbdict.get("keys", 0)
723726

724727
if total_keys == keyspacelen:
725728
logging.info(
726-
"The total numbers of keys in setup matches the expected spec: {}=={}".format(
729+
"The total number of keys in setup matches the expected spec: {} == {}".format(
727730
keyspacelen, total_keys
728731
)
729732
)
730-
result = True
731-
else:
732-
logging.error(
733-
"The total numbers of keys in setup does not match the expected spec: {}!={}. Aborting...".format(
734-
keyspacelen, total_keys
735-
)
733+
return True
734+
735+
logging.warning(
736+
"Keyspace length mismatch ({} != {}). Retrying in {} seconds...".format(
737+
total_keys, keyspacelen, 2**attempt
736738
)
737-
if ignore_keyspace_errors is False:
738-
raise Exception(
739-
"The total numbers of keys in setup does not match the expected spec: {}!={}. Aborting...".format(
740-
keyspacelen, total_keys
741-
)
742-
)
743-
return result
739+
)
740+
time.sleep(2**attempt) # Exponential backoff
741+
attempt += 1
742+
743+
logging.error(
744+
f"The total number of keys in setup does not match the expected spec: {keyspacelen} != {total_keys}. Aborting after {attempt + 1} tries..."
745+
)
746+
747+
if not ignore_keyspace_errors:
748+
raise Exception(
749+
f"The total number of keys in setup does not match the expected spec: {keyspacelen} != {total_keys}. Aborting after {attempt + 1} tries..."
750+
)
751+
752+
return False
744753

745754

746755
def common_properties_log(

redisbench_admin/run/ftsb/ftsb.py

-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ def prepare_ftsb_benchmark_command(
2929
:return: [string] containing the required command to run the benchmark given the configurations
3030
"""
3131
command_arr = [executable_path]
32-
3332
command_arr.extend(
3433
["--host", "{}:{}".format(server_private_ip, server_plaintext_port)]
3534
)

redisbench_admin/run/run.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,13 @@ def define_benchmark_plan(benchmark_definitions, default_specs):
5757
benchmark_runs_plan[benchmark_type] = {}
5858

5959
# extract dataset-name
60-
benchmark_contains_dbconfig, dataset_name, _, _, _ = (
61-
extract_redis_dbconfig_parameters(benchmark_config, "dbconfig")
62-
)
60+
(
61+
benchmark_contains_dbconfig,
62+
dataset_name,
63+
_,
64+
_,
65+
_,
66+
) = extract_redis_dbconfig_parameters(benchmark_config, "dbconfig")
6367
logging.info(
6468
f"Benchmark contains specific dbconfig on test {test_name}: {benchmark_contains_dbconfig}"
6569
)

redisbench_admin/run_local/local_db.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ def local_db_spin(
158158
logging.info("Skipping DB spin step...")
159159

160160
if setup_type == "oss-standalone":
161-
r = redis.Redis(port=args.port, host=args.host)
161+
r = redis.Redis(port=args.port, host=args.host, password=args.password)
162162
r.ping()
163163
r.client_setname("redisbench-admin-standalone")
164164
redis_conns.append(r)
@@ -192,6 +192,11 @@ def local_db_spin(
192192
benchmark_tool_workdir,
193193
cluster_api_enabled,
194194
"dbconfig",
195+
None,
196+
None,
197+
None,
198+
None,
199+
args.password,
195200
)
196201

197202
# run the benchmark
@@ -206,7 +211,6 @@ def local_db_spin(
206211
load_via_benchmark_duration_seconds
207212
)
208213
)
209-
210214
dbconfig_keyspacelen_check(benchmark_config, redis_conns, ignore_keyspace_errors)
211215

212216
artifact_version = run_redis_pre_steps(

redisbench_admin/run_remote/remote_db.py

+2
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ def remote_db_spin(
103103
flushall_on_every_test_start=False,
104104
ignore_keyspace_errors=False,
105105
continue_on_module_check_error=False,
106+
keyspace_check_timeout=60,
106107
):
107108
(
108109
_,
@@ -372,6 +373,7 @@ def remote_db_spin(
372373
benchmark_config,
373374
redis_conns,
374375
ignore_keyspace_errors,
376+
keyspace_check_timeout,
375377
)
376378
artifact_version = run_redis_pre_steps(
377379
benchmark_config, redis_conns[0], required_modules

redisbench_admin/run_remote/remote_env.py

+9
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
from python_terraform import TerraformCommandError
99

10+
from redisbench_admin.run.args import ARCH_X86
1011
from redisbench_admin.run_remote.terraform import (
1112
retrieve_inventory_info,
1213
terraform_spin_or_reuse_env,
@@ -33,12 +34,18 @@ def remote_env_setup(
3334
spot_instance_error=False,
3435
spot_price_counter=0,
3536
full_price_counter=0,
37+
architecture=ARCH_X86,
3638
):
3739
server_plaintext_port = args.db_port
3840
db_ssh_port = args.db_ssh_port
3941
client_ssh_port = args.client_ssh_port
4042
username = args.user
43+
44+
logging.info(f"specified arch for deployment {architecture}")
4145
if args.inventory is not None:
46+
logging.info(
47+
f"inventory info passed. avoiding to deploy using terraform {args.inventory}"
48+
)
4249
(
4350
status,
4451
client_public_ip,
@@ -85,6 +92,7 @@ def remote_env_setup(
8592
tf_timeout_secs,
8693
tf_override_name,
8794
tf_folder_spot_path,
95+
architecture,
8896
)
8997
spot_available_and_used = True
9098
spot_price_counter = spot_price_counter + 1
@@ -123,6 +131,7 @@ def remote_env_setup(
123131
tf_timeout_secs,
124132
tf_override_name,
125133
tf_folder_path,
134+
architecture,
126135
)
127136
full_price_counter = full_price_counter + 1
128137
logging.info("Using the following connection addresses.")

redisbench_admin/run_remote/run_remote.py

+10-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
PerfDaemonRemoteCaller,
2222
PERF_DAEMON_LOGNAME,
2323
)
24-
from redisbench_admin.run.args import PROFILE_FREQ
24+
from redisbench_admin.run.args import PROFILE_FREQ, VALID_ARCHS
2525
from redisbench_admin.run.common import (
2626
get_start_time_vars,
2727
BENCHMARK_REPETITIONS,
@@ -300,6 +300,14 @@ def run_remote_command_logic(args, project_name, project_version):
300300
benchmark_artifacts_table_name = "Benchmark client artifacts"
301301
benchmark_artifacts_table_headers = ["Setup", "Test-case", "Artifact", "link"]
302302
benchmark_artifacts_links = []
303+
architecture = args.architecture
304+
if architecture not in VALID_ARCHS:
305+
logging.critical(
306+
f"The specified architecture {architecture} is not valid. Specify one of {VALID_ARCHS}"
307+
)
308+
exit(1)
309+
else:
310+
logging.info(f"Running benchmark for architecture {architecture}")
303311

304312
# contains the overall target-tables ( if any target is defined )
305313
overall_tables = {}
@@ -441,6 +449,7 @@ def run_remote_command_logic(args, project_name, project_version):
441449
spot_instance_error,
442450
0,
443451
0,
452+
architecture,
444453
)
445454

446455
# after we've created the env, even on error we should always teardown

redisbench_admin/run_remote/terraform.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ def terraform_spin_or_reuse_env(
3030
tf_timeout_secs=7200,
3131
tf_override_name=None,
3232
tf_folder_path=None,
33+
architecture="x86_64",
3334
):
3435
(
3536
remote_setup,
@@ -40,11 +41,10 @@ def terraform_spin_or_reuse_env(
4041
"https://github.com/redis-performance/testing-infrastructure.git",
4142
"master",
4243
tf_folder_path,
44+
architecture,
4345
)
4446
logging.info(
45-
"Repetition {} of {}. Deploying test {} on AWS using {}".format(
46-
repetition, BENCHMARK_REPETITIONS, test_name, remote_setup
47-
)
47+
f"Repetition {repetition} of {BENCHMARK_REPETITIONS}. Deploying test {test_name} on AWS using (architecture={architecture}) {remote_setup}"
4848
)
4949
if tf_override_name is None:
5050
tf_setup_name = "{}{}".format(remote_setup, tf_setup_name_sufix)

0 commit comments

Comments
 (0)