Skip to content

Commit 7923bca

Browse files
[add] Enabled ftsb_redisearch support (#172)
1 parent 9b73d07 commit 7923bca

File tree

7 files changed

+134
-1
lines changed

7 files changed

+134
-1
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "redisbench-admin"
3-
version = "0.3.11"
3+
version = "0.4.0"
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]>"]
66
readme = "README.md"

redisbench_admin/run/common.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
from redisbench_admin.run.aibench_run_inference_redisai_vision.aibench_run_inference_redisai_vision import (
1515
prepare_aibench_benchmark_command,
1616
)
17+
from redisbench_admin.run.ftsb.ftsb import prepare_ftsb_benchmark_command
1718
from redisbench_admin.run.redis_benchmark.redis_benchmark import (
1819
prepare_redis_benchmark_command,
1920
)
@@ -108,6 +109,22 @@ def prepare_benchmark_parameters(
108109
isremote,
109110
cluster_api_enabled,
110111
)
112+
if "ftsb_" in benchmark_tool:
113+
input_data_file = None
114+
if isremote is True:
115+
benchmark_tool = "/tmp/{}".format(benchmark_tool)
116+
input_data_file = "/tmp/input.data"
117+
(command_arr, command_str,) = prepare_ftsb_benchmark_command(
118+
benchmark_tool,
119+
server_private_ip,
120+
server_plaintext_port,
121+
entry,
122+
current_workdir,
123+
remote_results_file,
124+
input_data_file,
125+
isremote,
126+
cluster_api_enabled,
127+
)
111128
if "aibench_" in benchmark_tool:
112129
input_data_file = None
113130
if isremote is True:
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Apache License Version 2.0
2+
#
3+
# Copyright (c) 2021., Redis Labs Modules
4+
# All rights reserved.
5+
#

redisbench_admin/run/ftsb/ftsb.py

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# Apache License Version 2.0
2+
#
3+
# Copyright (c) 2021., Redis Labs Modules
4+
# All rights reserved.
5+
#
6+
7+
from redisbench_admin.utils.local import check_if_needs_remote_fetch
8+
9+
10+
def prepare_ftsb_benchmark_command(
11+
executable_path: str,
12+
server_private_ip: object,
13+
server_plaintext_port: object,
14+
benchmark_config: object,
15+
current_workdir,
16+
result_file: str,
17+
remote_queries_file,
18+
is_remote: bool,
19+
cluster_api_enabled: bool = False,
20+
):
21+
"""
22+
Prepares prepare_ftsb_benchmark_command command parameters
23+
:param executable_path:
24+
:param server_private_ip:
25+
:param server_plaintext_port:
26+
:param benchmark_config:
27+
:param current_workdir:
28+
:return: [string] containing the required command to run the benchmark given the configurations
29+
"""
30+
command_arr = [executable_path]
31+
32+
command_arr.extend(
33+
["--host", "{}:{}".format(server_private_ip, server_plaintext_port)]
34+
)
35+
if cluster_api_enabled is True:
36+
command_arr.extend(["--cluster"])
37+
if "parameters" in benchmark_config:
38+
for k in benchmark_config["parameters"]:
39+
if "input" in k:
40+
input_file = k["input"]
41+
input_file = check_if_needs_remote_fetch(
42+
input_file, "/tmp", None, remote_queries_file, is_remote
43+
)
44+
command_arr.extend(["--input", input_file])
45+
else:
46+
for kk in k.keys():
47+
command_arr.extend(["--{}".format(kk), str(k[kk])])
48+
49+
command_arr.extend(["--json-out-file", result_file])
50+
51+
command_str = " ".join(command_arr)
52+
return command_arr, command_str
53+
54+
55+
def extract_ftsb_extra_links(benchmark_config, benchmark_tool):
56+
remote_tool_link = "/tmp/{}".format(benchmark_tool)
57+
tool_link = (
58+
"https://s3.amazonaws.com/benchmarks.redislabs/"
59+
+ "redisearch/tools/ftsb/{}_linux_amd64".format(benchmark_tool)
60+
)
61+
queries_file_link = None
62+
for entry in benchmark_config["clientconfig"]:
63+
if "parameters" in entry:
64+
for parameter in entry["parameters"]:
65+
if "input" in parameter:
66+
queries_file_link = parameter["input"]
67+
return queries_file_link, remote_tool_link, tool_link

redisbench_admin/run_local/args.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ def create_run_local_arguments(parser):
4040
type=str,
4141
default="redis-benchmark,redisgraph-benchmark-go,ycsb,"
4242
+ "tsbs_run_queries_redistimeseries,tsbs_load_redistimeseries,"
43+
+ "ftsb_redisearch,"
4344
+ "aibench_run_inference_redisai_vision",
4445
help="comma separated list of allowed tools for this module. By default all the supported are allowed.",
4546
)

redisbench_admin/run_remote/args.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ def create_run_remote_arguments(parser):
3434
type=str,
3535
default="redis-benchmark,redisgraph-benchmark-go,ycsb,"
3636
+ "tsbs_run_queries_redistimeseries,tsbs_load_redistimeseries,"
37+
+ "ftsb_redisearch,"
3738
+ "aibench_run_inference_redisai_vision",
3839
help="comma separated list of allowed tools for this module. By default all the supported are allowed.",
3940
)

redisbench_admin/run_remote/remote_helpers.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from redisbench_admin.run.aibench_run_inference_redisai_vision.aibench_run_inference_redisai_vision import (
1111
extract_aibench_extra_links,
1212
)
13+
from redisbench_admin.run.ftsb.ftsb import extract_ftsb_extra_links
1314
from redisbench_admin.run.redis_benchmark.redis_benchmark import (
1415
redis_benchmark_ensure_min_version_remote,
1516
redisbenchmark_go_link,
@@ -61,6 +62,7 @@ def remote_tool_pre_bench_step(
6162
client_public_ip,
6263
username,
6364
):
65+
logging.info("Settting up remote tool {} requirements".format(benchmark_tool))
6466
if benchmark_tool == "redisgraph-benchmark-go":
6567
setup_remote_benchmark_tool_redisgraph_benchmark_go(
6668
client_public_ip,
@@ -74,6 +76,28 @@ def remote_tool_pre_bench_step(
7476
username,
7577
private_key,
7678
)
79+
80+
if "ftsb_" in benchmark_tool:
81+
(
82+
queries_file_link,
83+
remote_tool_link,
84+
tool_link,
85+
) = extract_ftsb_extra_links(benchmark_config, benchmark_tool)
86+
logging.info(
87+
"FTSB Extracted:\nremote tool input: {}\nremote tool link: {}\ntool path: {}".format(
88+
queries_file_link, remote_tool_link, tool_link
89+
)
90+
)
91+
92+
setup_remote_benchmark_tool_requirements_ftsb(
93+
client_public_ip,
94+
username,
95+
private_key,
96+
tool_link,
97+
queries_file_link,
98+
remote_tool_link,
99+
)
100+
77101
if "tsbs_" in benchmark_tool:
78102
(
79103
queries_file_link,
@@ -115,6 +139,24 @@ def remote_tool_pre_bench_step(
115139
username,
116140
private_key,
117141
)
142+
logging.info("Finished up remote tool {} requirements".format(benchmark_tool))
143+
144+
145+
def setup_remote_benchmark_tool_requirements_ftsb(
146+
client_public_ip,
147+
username,
148+
private_key,
149+
tool_link,
150+
queries_file_link,
151+
remote_tool_link,
152+
remote_input_file="/tmp/input.data",
153+
):
154+
commands = [
155+
"wget {} -q -O {}".format(tool_link, remote_tool_link),
156+
"wget {} -q -O {}".format(queries_file_link, remote_input_file),
157+
"chmod 755 {}".format(remote_tool_link),
158+
]
159+
execute_remote_commands(client_public_ip, username, private_key, commands)
118160

119161

120162
def setup_remote_benchmark_tool_requirements_tsbs(

0 commit comments

Comments
 (0)