Skip to content

Commit be419d3

Browse files
authored
Merge pull request #200 from redis/oss.cluster.client.runner
Client runner: enabled oss cluster benchmarks for string (just set and get commands) benchmarks
2 parents 8ac83e6 + 4e987fb commit be419d3

15 files changed

+132
-46
lines changed

redis_benchmarks_specification/__cli__/stats.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,11 @@ def generate_stats_cli_command_logic(args, project_name, project_version):
101101
if is_memtier:
102102
arguments = benchmark_config["clientconfig"]["arguments"]
103103
arguments_split = arguments.split("--command")
104+
105+
if len(arguments_split) == 1:
106+
# this means no arbitrary command is being used so we default to memtier default group, which is 'string'
107+
tested_groups.append("string")
108+
104109
for command_part in arguments_split[1:]:
105110
command_part = command_part.strip()
106111
command_p = command_part.split(" ", 1)[0]
@@ -248,6 +253,8 @@ def generate_stats_cli_command_logic(args, project_name, project_version):
248253
for row in csv_reader:
249254
if len(row) == 0:
250255
continue
256+
if "cmdstat_" not in row[0]:
257+
continue
251258
# row variable is a list that represents a row in csv
252259
cmdstat = row[0]
253260
cmdstat = cmdstat.replace("cmdstat_", "")
@@ -323,8 +330,10 @@ def generate_stats_cli_command_logic(args, project_name, project_version):
323330
"usecs",
324331
"tracked",
325332
"deprecated",
333+
"usec_per_call",
326334
"% count",
327335
"% usecs",
336+
"diff count usecs",
328337
]
329338
import csv
330339

@@ -339,10 +348,16 @@ def generate_stats_cli_command_logic(args, project_name, project_version):
339348
usec = row[3]
340349
pct = count / total_count
341350
pct_usec = "n/a"
351+
usec_per_call = "n/a"
352+
diff_pct = "n/a"
342353
if usec is not None:
343354
pct_usec = usec / total_usecs
355+
usec_per_call = float(usec) / float(count)
356+
diff_pct = pct_usec - pct
357+
row.append(usec_per_call)
344358
row.append(pct)
345359
row.append(pct_usec)
360+
row.append(diff_pct)
346361
writer.writerow(row)
347362

348363
if total_tracked_count > 0:

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,
@@ -556,12 +590,20 @@ def process_self_contained_coordinator_stream(
556590
password,
557591
oss_cluster_api_enabled,
558592
)
593+
if res is False:
594+
logging.warning(
595+
"Skipping this test given preload result was false"
596+
)
597+
continue
559598
execute_init_commands(
560599
benchmark_config, r, dbconfig_keyname="dbconfig"
561600
)
562601

563602
used_memory_check(
564-
test_name, benchmark_required_memory, r, "start of benchmark"
603+
test_name,
604+
benchmark_required_memory,
605+
redis_conns,
606+
"start of benchmark",
565607
)
566608

567609
logging.info("Checking if there is a keyspace check being enforced")
@@ -598,6 +640,7 @@ def process_self_contained_coordinator_stream(
598640
local_benchmark_output_filename
599641
)
600642
)
643+
arbitrary_command = False
601644

602645
if "memtier_benchmark" not in benchmark_tool:
603646
# prepare the benchmark command
@@ -618,6 +661,7 @@ def process_self_contained_coordinator_stream(
618661
(
619662
_,
620663
benchmark_command_str,
664+
arbitrary_command,
621665
) = prepare_memtier_benchmark_parameters(
622666
benchmark_config["clientconfig"],
623667
full_benchmark_path,
@@ -636,6 +680,16 @@ def process_self_contained_coordinator_stream(
636680
override_test_runs,
637681
)
638682

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

729783
used_memory_check(
730-
test_name, benchmark_required_memory, r, "end of benchmark"
784+
test_name,
785+
benchmark_required_memory,
786+
redis_conns,
787+
"end of benchmark",
731788
)
732789

733790
if args.flushall_on_every_test_end:
734791
logging.info("Sending FLUSHALL to the DB")
735-
r.flushall()
792+
for r in redis_conns:
793+
r.flushall()
736794
datapoint_time_ms = start_time_ms
737795

738796
post_process_benchmark_results(
@@ -909,8 +967,10 @@ def get_benchmark_required_memory(benchmark_config):
909967
return benchmark_required_memory
910968

911969

912-
def used_memory_check(test_name, benchmark_required_memory, r, stage):
913-
used_memory = r.info("memory")["used_memory"]
970+
def used_memory_check(test_name, benchmark_required_memory, redis_conns, stage):
971+
used_memory = 0
972+
for conn in redis_conns:
973+
used_memory = used_memory + conn.info("memory")["used_memory"]
914974
used_memory_gb = int(math.ceil(float(used_memory) / 1024.0 / 1024.0 / 1024.0))
915975
logging.info("Benchmark used memory at {}: {}g".format(stage, used_memory_gb))
916976
if used_memory > benchmark_required_memory:
@@ -998,6 +1058,7 @@ def data_prepopulation_step(
9981058
password=None,
9991059
oss_cluster_api_enabled=False,
10001060
):
1061+
result = True
10011062
# setup the benchmark
10021063
(
10031064
start_time,
@@ -1019,7 +1080,11 @@ def data_prepopulation_step(
10191080

10201081
if "memtier_benchmark" in preload_tool:
10211082
override_memtier_test_time_preload = 0
1022-
(_, preload_command_str,) = prepare_memtier_benchmark_parameters(
1083+
(
1084+
_,
1085+
preload_command_str,
1086+
arbitrary_command,
1087+
) = prepare_memtier_benchmark_parameters(
10231088
benchmark_config["dbconfig"]["preload_tool"],
10241089
full_benchmark_path,
10251090
port,
@@ -1035,6 +1100,12 @@ def data_prepopulation_step(
10351100
resp_version,
10361101
override_memtier_test_time_preload,
10371102
)
1103+
if arbitrary_command is True and oss_cluster_api_enabled:
1104+
logging.warning(
1105+
"Skipping this test given it implies arbitrary command on an cluster setup. Not supported on memtier: https://github.com/RedisLabs/memtier_benchmark/pull/117"
1106+
)
1107+
result = False
1108+
return result
10381109

10391110
# run the benchmark
10401111
preload_start_time = datetime.datetime.now()
@@ -1093,6 +1164,7 @@ def data_prepopulation_step(
10931164
client_container_stdout,
10941165
)
10951166
)
1167+
return result
10961168

10971169

10981170
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:

0 commit comments

Comments
 (0)