Skip to content

Commit 3f78feb

Browse files
committed
Enabled oss cluster benchmarks for string (just set and get commands) benchmarks
1 parent a884ea9 commit 3f78feb

14 files changed

+117
-46
lines changed

redis_benchmarks_specification/__common__/runner.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,6 @@ def exporter_datasink_common(
178178
]
179179
},
180180
)
181-
print(overall_end_time_metrics)
182181
# 7 days from now
183182
expire_redis_metrics_ms = 7 * 24 * 60 * 60 * 1000
184183
export_redis_metrics(

redis_benchmarks_specification/__runner__/runner.py

Lines changed: 86 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ def prepare_memtier_benchmark_parameters(
220220
override_memtier_test_time=0,
221221
override_test_runs=1,
222222
):
223+
arbitrary_command = False
223224
benchmark_command = [
224225
full_benchmark_path,
225226
"--port",
@@ -256,7 +257,9 @@ def prepare_memtier_benchmark_parameters(
256257
benchmark_command_str = " ".join(benchmark_command)
257258
if "arguments" in clientconfig:
258259
benchmark_command_str = benchmark_command_str + " " + clientconfig["arguments"]
259-
logging.info(override_memtier_test_time)
260+
261+
if "--command" in benchmark_command_str:
262+
arbitrary_command = True
260263

261264
if override_test_runs > 1:
262265
benchmark_command_str = re.sub(
@@ -330,7 +333,7 @@ def prepare_memtier_benchmark_parameters(
330333
benchmark_command_str,
331334
)
332335

333-
return None, benchmark_command_str
336+
return None, benchmark_command_str, arbitrary_command
334337

335338

336339
def process_self_contained_coordinator_stream(
@@ -425,13 +428,41 @@ def process_self_contained_coordinator_stream(
425428
ssl_ca_certs=tls_cacert,
426429
ssl_check_hostname=False,
427430
)
431+
setup_name = "oss-standalone"
428432
r.ping()
429433
redis_conns = [r]
434+
if oss_cluster_api_enabled:
435+
redis_conns = []
436+
logging.info("updating redis connections from cluster slots")
437+
slots = r.cluster("slots")
438+
for slot in slots:
439+
# Master for slot range represented as nested networking information starts at pos 2
440+
# example: [0, 5460, [b'127.0.0.1', 30001, b'eccd21c2e7e9b7820434080d2e394cb8f2a7eff2', []]]
441+
slot_network_info = slot[2]
442+
prefered_endpoint = slot_network_info[0]
443+
prefered_port = slot_network_info[1]
444+
shard_conn = redis.StrictRedis(
445+
host=prefered_endpoint,
446+
port=prefered_port,
447+
password=password,
448+
ssl=tls_enabled,
449+
ssl_cert_reqs=ssl_cert_reqs,
450+
ssl_keyfile=tls_key,
451+
ssl_certfile=tls_cert,
452+
ssl_ca_certs=tls_cacert,
453+
ssl_check_hostname=False,
454+
)
455+
redis_conns.append(shard_conn)
456+
logging.info(
457+
"There are a total of {} shards".format(len(redis_conns))
458+
)
459+
setup_name = "oss-cluster"
460+
430461
redis_pids = []
431-
first_redis_pid = r.info()["process_id"]
432-
redis_pids.append(first_redis_pid)
462+
for conn in redis_conns:
463+
redis_pid = conn.info()["process_id"]
464+
redis_pids.append(redis_pid)
433465

434-
setup_name = "oss-standalone"
435466
github_actor = f"{tf_triggering_env}-{running_platform}"
436467
dso = "redis-server"
437468
profilers_artifacts_matrix = []
@@ -457,12 +488,15 @@ def process_self_contained_coordinator_stream(
457488
)
458489
if args.flushall_on_every_test_start:
459490
logging.info("Sending FLUSHALL to the DB")
460-
r.flushall()
491+
for conn in redis_conns:
492+
conn.flushall()
461493

462494
benchmark_required_memory = get_benchmark_required_memory(
463495
benchmark_config
464496
)
465-
maxmemory = get_maxmemory(r)
497+
maxmemory = 0
498+
for conn in redis_conns:
499+
maxmemory = maxmemory + get_maxmemory(conn)
466500
if benchmark_required_memory > maxmemory:
467501
logging.warning(
468502
"Skipping test {} given maxmemory of server is bellow the benchmark required memory: {} < {}".format(
@@ -536,7 +570,7 @@ def process_self_contained_coordinator_stream(
536570
continue
537571

538572
if "preload_tool" in benchmark_config["dbconfig"]:
539-
data_prepopulation_step(
573+
res = data_prepopulation_step(
540574
benchmark_config,
541575
benchmark_tool_workdir,
542576
client_cpuset_cpus,
@@ -555,12 +589,20 @@ def process_self_contained_coordinator_stream(
555589
password,
556590
oss_cluster_api_enabled,
557591
)
592+
if res is False:
593+
logging.warning(
594+
"Skipping this test given preload result was false"
595+
)
596+
continue
558597
execute_init_commands(
559598
benchmark_config, r, dbconfig_keyname="dbconfig"
560599
)
561600

562601
used_memory_check(
563-
test_name, benchmark_required_memory, r, "start of benchmark"
602+
test_name,
603+
benchmark_required_memory,
604+
redis_conns,
605+
"start of benchmark",
564606
)
565607

566608
logging.info("Checking if there is a keyspace check being enforced")
@@ -597,6 +639,7 @@ def process_self_contained_coordinator_stream(
597639
local_benchmark_output_filename
598640
)
599641
)
642+
arbitrary_command = False
600643

601644
if "memtier_benchmark" not in benchmark_tool:
602645
# prepare the benchmark command
@@ -617,6 +660,7 @@ def process_self_contained_coordinator_stream(
617660
(
618661
_,
619662
benchmark_command_str,
663+
arbitrary_command,
620664
) = prepare_memtier_benchmark_parameters(
621665
benchmark_config["clientconfig"],
622666
full_benchmark_path,
@@ -635,6 +679,16 @@ def process_self_contained_coordinator_stream(
635679
override_test_runs,
636680
)
637681

682+
if (
683+
arbitrary_command
684+
and oss_cluster_api_enabled
685+
and "memtier" in benchmark_tool
686+
):
687+
logging.warning(
688+
"Forcing skip this test given there is an arbitrary commmand and memtier usage. Check https://github.com/RedisLabs/memtier_benchmark/pull/117 ."
689+
)
690+
continue
691+
638692
client_container_image = extract_client_container_image(
639693
benchmark_config
640694
)
@@ -704,12 +758,16 @@ def process_self_contained_coordinator_stream(
704758
logging.info("Printing client tool stdout output")
705759

706760
used_memory_check(
707-
test_name, benchmark_required_memory, r, "end of benchmark"
761+
test_name,
762+
benchmark_required_memory,
763+
redis_conns,
764+
"end of benchmark",
708765
)
709766

710767
if args.flushall_on_every_test_end:
711768
logging.info("Sending FLUSHALL to the DB")
712-
r.flushall()
769+
for r in redis_conns:
770+
r.flushall()
713771
datapoint_time_ms = start_time_ms
714772

715773
post_process_benchmark_results(
@@ -886,8 +944,10 @@ def get_benchmark_required_memory(benchmark_config):
886944
return benchmark_required_memory
887945

888946

889-
def used_memory_check(test_name, benchmark_required_memory, r, stage):
890-
used_memory = r.info("memory")["used_memory"]
947+
def used_memory_check(test_name, benchmark_required_memory, redis_conns, stage):
948+
used_memory = 0
949+
for conn in redis_conns:
950+
used_memory = used_memory + conn.info("memory")["used_memory"]
891951
used_memory_gb = int(math.ceil(float(used_memory) / 1024.0 / 1024.0 / 1024.0))
892952
logging.info("Benchmark used memory at {}: {}g".format(stage, used_memory_gb))
893953
if used_memory > benchmark_required_memory:
@@ -974,6 +1034,7 @@ def data_prepopulation_step(
9741034
password=None,
9751035
oss_cluster_api_enabled=False,
9761036
):
1037+
result = True
9771038
# setup the benchmark
9781039
(
9791040
start_time,
@@ -995,7 +1056,11 @@ def data_prepopulation_step(
9951056

9961057
if "memtier_benchmark" in preload_tool:
9971058
override_memtier_test_time_preload = 0
998-
(_, preload_command_str,) = prepare_memtier_benchmark_parameters(
1059+
(
1060+
_,
1061+
preload_command_str,
1062+
arbitrary_command,
1063+
) = prepare_memtier_benchmark_parameters(
9991064
benchmark_config["dbconfig"]["preload_tool"],
10001065
full_benchmark_path,
10011066
port,
@@ -1011,6 +1076,12 @@ def data_prepopulation_step(
10111076
resp_version,
10121077
override_memtier_test_time_preload,
10131078
)
1079+
if arbitrary_command is True and oss_cluster_api_enabled:
1080+
logging.warning(
1081+
"Skipping this test given it implies arbitrary command on an cluster setup. Not supported on memtier: https://github.com/RedisLabs/memtier_benchmark/pull/117"
1082+
)
1083+
result = False
1084+
return result
10141085

10151086
logging.info(
10161087
"Using docker image {} as benchmark PRELOAD image (cpuset={}) with the following args: {}".format(
@@ -1049,6 +1120,7 @@ def data_prepopulation_step(
10491120
client_container_stdout,
10501121
)
10511122
)
1123+
return result
10521124

10531125

10541126
def generate_cpuset_cpus(ceil_db_cpu_limit, current_cpu_pos):

redis_benchmarks_specification/test-suites/memtier_benchmark-1Mkeys-load-string-with-100B-values-pipeline-10.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ build-variants:
1818
clientconfig:
1919
run_image: redislabs/memtier_benchmark:edge
2020
tool: memtier_benchmark
21-
arguments: '"--pipeline" "10" "--data-size" "100" --command "SET __key__ __data__" --command-key-pattern="P" --key-minimum=1 --key-maximum 1000000 --test-time 180 -c 50 -t 4 --hide-histogram'
21+
arguments: '"--pipeline" "10" "--data-size" "100" --ratio 1:0 --key-pattern P:P --key-minimum=1 --key-maximum 1000000 --test-time 180 -c 50 -t 4 --hide-histogram'
2222
resources:
2323
requests:
2424
cpus: '4'

redis_benchmarks_specification/test-suites/memtier_benchmark-1Mkeys-load-string-with-100B-values.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ build-variants:
2323
clientconfig:
2424
run_image: redislabs/memtier_benchmark:edge
2525
tool: memtier_benchmark
26-
arguments: '"--data-size" "100" --command "SET __key__ __data__" --command-key-pattern="P" --key-minimum=1 --key-maximum 1000000 --test-time 180 -c 50 -t 4 --hide-histogram'
26+
arguments: '"--data-size" "100" --ratio 1:0 --key-pattern P:P --key-minimum=1 --key-maximum 1000000 --test-time 180 -c 50 -t 4 --hide-histogram'
2727
resources:
2828
requests:
2929
cpus: '4'

redis_benchmarks_specification/test-suites/memtier_benchmark-1Mkeys-load-string-with-10B-values-pipeline-10.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ build-variants:
1818
clientconfig:
1919
run_image: redislabs/memtier_benchmark:edge
2020
tool: memtier_benchmark
21-
arguments: '"--pipeline" "10" "--data-size" "10" --command "SET __key__ __data__" --command-key-pattern="P" --key-minimum=1 --key-maximum 1000000 --test-time 180 -c 50 -t 4 --hide-histogram'
21+
arguments: '"--pipeline" "10" "--data-size" "10" --ratio 1:0 --key-pattern P:P --key-minimum=1 --key-maximum 1000000 --test-time 180 -c 50 -t 4 --hide-histogram'
2222
resources:
2323
requests:
2424
cpus: '4'

redis_benchmarks_specification/test-suites/memtier_benchmark-1Mkeys-load-string-with-10B-values.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ build-variants:
1818
clientconfig:
1919
run_image: redislabs/memtier_benchmark:edge
2020
tool: memtier_benchmark
21-
arguments: '"--data-size" "10" --command "SET __key__ __data__" --command-key-pattern="P" --key-minimum=1 --key-maximum 1000000 --test-time 180 -c 50 -t 4 --hide-histogram'
21+
arguments: '"--data-size" "10" --ratio 1:0 --key-pattern P:P --key-minimum=1 --key-maximum 1000000 --test-time 180 -c 50 -t 4 --hide-histogram'
2222
resources:
2323
requests:
2424
cpus: '4'

redis_benchmarks_specification/test-suites/memtier_benchmark-1Mkeys-load-string-with-1KiB-values.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ build-variants:
1818
clientconfig:
1919
run_image: redislabs/memtier_benchmark:edge
2020
tool: memtier_benchmark
21-
arguments: '"--data-size" "1000" --command "SET __key__ __data__" --command-key-pattern="P" --key-minimum=1 --key-maximum 1000000 --test-time 180 -c 50 -t 4 --hide-histogram'
21+
arguments: '"--data-size" "1000" --ratio 1:0 --key-pattern P:P --key-minimum=1 --key-maximum 1000000 --test-time 180 -c 50 -t 4 --hide-histogram'
2222
resources:
2323
requests:
2424
cpus: '4'

redis_benchmarks_specification/test-suites/memtier_benchmark-1Mkeys-string-get-100B-pipeline-10.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ dbconfig:
99
preload_tool:
1010
run_image: redislabs/memtier_benchmark:edge
1111
tool: memtier_benchmark
12-
arguments: '"--data-size" "100" "--command" "SET __key__ __data__" "--command-key-pattern" "P" "-c" "50" "-t" "2" "--hide-histogram" "--key-minimum" "1"'
12+
arguments: '"--data-size" "100" "--ratio" "1:0" "--key-pattern" "P:P" "-c" "50" "-t" "2" "--hide-histogram" "--key-minimum" "1"'
1313
resources:
1414
requests:
1515
memory: 1g
@@ -22,10 +22,10 @@ build-variants:
2222
clientconfig:
2323
run_image: redislabs/memtier_benchmark:edge
2424
tool: memtier_benchmark
25-
arguments: '"--pipeline" "10" "--data-size" "100" --command "GET __key__" --command-key-pattern="R" -c 50 -t 2 --hide-histogram --test-time 180'
25+
arguments: '"--pipeline" "10" "--data-size" "100" --ratio 0:1 --key-pattern R:R -c 25 -t 4 --hide-histogram --test-time 180'
2626
resources:
2727
requests:
28-
cpus: '2'
28+
cpus: '4'
2929
memory: 2g
3030

3131
tested-groups:

redis_benchmarks_specification/test-suites/memtier_benchmark-1Mkeys-string-get-100B.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ dbconfig:
99
preload_tool:
1010
run_image: redislabs/memtier_benchmark:edge
1111
tool: memtier_benchmark
12-
arguments: '"--data-size" "100" "--command" "SET __key__ __data__" "--command-key-pattern" "P" "-c" "50" "-t" "2" "--hide-histogram" "--key-minimum" "1"'
12+
arguments: '"--data-size" "100" "--ratio" "1:0" "--key-pattern" "P:P" "-c" "50" "-t" "2" "--hide-histogram" "--key-minimum" "1"'
1313
resources:
1414
requests:
1515
memory: 1g
@@ -22,10 +22,10 @@ build-variants:
2222
clientconfig:
2323
run_image: redislabs/memtier_benchmark:edge
2424
tool: memtier_benchmark
25-
arguments: '"--data-size" "100" --command "GET __key__" --command-key-pattern="R" -c 50 -t 2 --hide-histogram --test-time 180'
25+
arguments: '--data-size 100 --ratio 0:1 --key-pattern R:R -c 25 -t 4 --hide-histogram --test-time 180'
2626
resources:
2727
requests:
28-
cpus: '2'
28+
cpus: '4'
2929
memory: 2g
3030

3131
tested-groups:

redis_benchmarks_specification/test-suites/memtier_benchmark-1Mkeys-string-get-10B-pipeline-10.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ dbconfig:
99
preload_tool:
1010
run_image: redislabs/memtier_benchmark:edge
1111
tool: memtier_benchmark
12-
arguments: '"--data-size" "10" "--command" "SET __key__ __data__" "--command-key-pattern" "P" "-c" "50" "-t" "2" "--hide-histogram" "--key-minimum" "1"'
12+
arguments: '"--data-size" "10" "--ratio" "1:0" "--key-pattern" "P:P" "-c" "50" "-t" "2" "--hide-histogram" "--key-minimum" "1"'
1313
resources:
1414
requests:
1515
memory: 1g
@@ -22,10 +22,10 @@ build-variants:
2222
clientconfig:
2323
run_image: redislabs/memtier_benchmark:edge
2424
tool: memtier_benchmark
25-
arguments: '"--pipeline" "10" "--data-size" "10" --command "GET __key__" --command-key-pattern="R" -c 50 -t 2 --hide-histogram --test-time 180'
25+
arguments: '"--pipeline" "10" "--data-size" "10" --ratio 0:1 --key-pattern R:R -c 25 -t 4 --hide-histogram --test-time 180'
2626
resources:
2727
requests:
28-
cpus: '2'
28+
cpus: '4'
2929
memory: 2g
3030

3131
tested-groups:

0 commit comments

Comments
 (0)