Skip to content

Commit 1ae9e26

Browse files
Updated benchmark config to include resource memory usage. Checking valid memory settings upon CLI runner (#186)
* Removing numpy dep from project * Updated redisbench-admin dep * Updated redisbench-admin dep * Updated redisbench-admin dep * Updated redisbench-admin dep * include password option in benchmark runner * Fixed override test time * Fixed override test time * Fixed override test time * Fixed override test time * Fixed override test time * Exporting memory and commandstats metrics * Updated benchmark config to include resource memory usage
1 parent a41cbfb commit 1ae9e26

File tree

97 files changed

+958
-228
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+958
-228
lines changed

pyproject.toml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,27 @@
11
[tool.poetry]
22
name = "redis-benchmarks-specification"
3-
version = "0.1.62"
3+
version = "0.1.63"
44
description = "The Redis benchmarks specification describes the cross-language/tools requirements and expectations to foster performance and observability standards around redis related technologies. Members from both industry and academia, including organizations and individuals are encouraged to contribute."
55
authors = ["filipecosta90 <filipecosta.90@gmail.com>","Redis Performance Group <performance@redis.com>"]
66
readme = "Readme.md"
77

88
[tool.poetry.dependencies]
9-
python = "^3.8"
10-
Flask = "^2.2.2"
11-
Werkzeug = "^2.2.2"
9+
python = "^3.6.9a"
10+
Flask = "^2.0.3"
1211
flask-restx = "^0.5.0"
1312
redis = "^4.2.0"
1413
marshmallow = "^3.12.2"
1514
argparse = "^1.4.0"
1615
Flask-HTTPAuth = "^4.4.0"
1716
PyYAML = "^6.0"
1817
docker = "^5.0.0"
19-
redisbench-admin = "0.9.31"
18+
redisbench-admin = "^0.9.23"
2019
psutil = "^5.9.4"
2120
PyGithub = "^1.55"
2221
GitPython = "^3.1.20"
2322
semver = "^2.13.0"
2423
node-semver = "^0.8.1"
2524
typed-ast = "^1.5.0"
26-
numpy = "^1.23.4"
2725
oyaml = "^1.0"
2826

2927
[tool.poetry.dev-dependencies]

redis_benchmarks_specification/__cli__/stats.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,33 @@ def generate_stats_cli_command_logic(args, project_name, project_version):
161161
if priority is not None:
162162
benchmark_config["priority"] = priority
163163

164+
resources = {}
165+
if "resources" in benchmark_config["dbconfig"]:
166+
resources = benchmark_config["dbconfig"]["resources"]
167+
else:
168+
benchmark_config["dbconfig"]["resources"] = resources
169+
170+
resources_requests = {}
171+
if "requests" in resources:
172+
resources_requests = benchmark_config["dbconfig"]["resources"][
173+
"requests"
174+
]
175+
else:
176+
benchmark_config["dbconfig"]["resources"][
177+
"requests"
178+
] = resources_requests
179+
180+
if "memory" not in resources_requests:
181+
benchmark_config["dbconfig"]["resources"]["requests"][
182+
"memory"
183+
] = "1g"
184+
requires_override = True
185+
logging.warn(
186+
"dont have resources.requests.memory in {}. Setting 1GB default".format(
187+
test_name
188+
)
189+
)
190+
164191
if tested_groups != origin_tested_groups:
165192
requires_override = True
166193
benchmark_config["tested-groups"] = tested_groups

redis_benchmarks_specification/__common__/runner.py

Lines changed: 163 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,64 @@
1+
import csv
12
import logging
23
import os
34
import pathlib
45
import re
56

7+
import redis
8+
from redisbench_admin.run.metrics import collect_redis_metrics
9+
from redisbench_admin.run.redistimeseries import timeseries_test_sucess_flow
10+
from redisbench_admin.run_remote.run_remote import export_redis_metrics
11+
12+
13+
def execute_init_commands(benchmark_config, r, dbconfig_keyname="dbconfig"):
14+
cmds = None
15+
res = 0
16+
if dbconfig_keyname in benchmark_config:
17+
# print(benchmark_config[dbconfig_keyname])
18+
# print(type(benchmark_config[dbconfig_keyname]))
19+
for k, v in benchmark_config[dbconfig_keyname].items():
20+
if "init_commands" in k:
21+
cmds = v
22+
23+
if type(cmds) == str:
24+
cmds = [cmds]
25+
if cmds is not None:
26+
for cmd in cmds:
27+
is_array = False
28+
print(type(cmd))
29+
if type(cmd) == list:
30+
is_array = True
31+
if '"' in cmd:
32+
cols = []
33+
for lines in csv.reader(
34+
cmd,
35+
quotechar='"',
36+
delimiter=" ",
37+
quoting=csv.QUOTE_ALL,
38+
skipinitialspace=True,
39+
):
40+
if lines[0] != " " and len(lines[0]) > 0:
41+
cols.append(lines[0])
42+
cmd = cols
43+
is_array = True
44+
try:
45+
logging.info("Sending init command: {}".format(cmd))
46+
stdout = ""
47+
if is_array:
48+
stdout = r.execute_command(*cmd)
49+
else:
50+
stdout = r.execute_command(cmd)
51+
res = res + 1
52+
logging.info("Command reply: {}".format(stdout))
53+
except redis.connection.ConnectionError as e:
54+
logging.error(
55+
"Error establishing connection to Redis. Message: {}".format(
56+
e.__str__()
57+
)
58+
)
59+
60+
return res
61+
662

763
def get_benchmark_specs(testsuites_folder, test="", test_regex=".*"):
864
final_files = []
@@ -56,3 +112,110 @@ def extract_testsuites(args):
56112
)
57113
)
58114
return testsuite_spec_files
115+
116+
117+
def reset_commandstats(redis_conns):
118+
for pos, redis_conn in enumerate(redis_conns):
119+
logging.info("Resetting commmandstats for shard {}".format(pos))
120+
try:
121+
redis_conn.config_resetstat()
122+
except redis.exceptions.ResponseError as e:
123+
logging.warning(
124+
"Catched an error while resetting status: {}".format(e.__str__())
125+
)
126+
127+
128+
def exporter_datasink_common(
129+
benchmark_config,
130+
benchmark_duration_seconds,
131+
build_variant_name,
132+
datapoint_time_ms,
133+
dataset_load_duration_seconds,
134+
datasink_conn,
135+
datasink_push_results_redistimeseries,
136+
git_branch,
137+
git_version,
138+
metadata,
139+
redis_conns,
140+
results_dict,
141+
running_platform,
142+
setup_name,
143+
setup_type,
144+
test_name,
145+
tf_github_org,
146+
tf_github_repo,
147+
tf_triggering_env,
148+
topology_spec_name,
149+
):
150+
logging.info("Using datapoint_time_ms: {}".format(datapoint_time_ms))
151+
timeseries_test_sucess_flow(
152+
datasink_push_results_redistimeseries,
153+
git_version,
154+
benchmark_config,
155+
benchmark_duration_seconds,
156+
dataset_load_duration_seconds,
157+
None,
158+
topology_spec_name,
159+
setup_name,
160+
None,
161+
results_dict,
162+
datasink_conn,
163+
datapoint_time_ms,
164+
test_name,
165+
git_branch,
166+
tf_github_org,
167+
tf_github_repo,
168+
tf_triggering_env,
169+
metadata,
170+
build_variant_name,
171+
running_platform,
172+
)
173+
logging.info("Collecting memory metrics")
174+
(_, _, overall_end_time_metrics,) = collect_redis_metrics(
175+
redis_conns,
176+
["memory"],
177+
{
178+
"memory": [
179+
"used_memory",
180+
"used_memory_dataset",
181+
]
182+
},
183+
)
184+
# 7 days from now
185+
expire_redis_metrics_ms = 7 * 24 * 60 * 60 * 1000
186+
export_redis_metrics(
187+
git_version,
188+
datapoint_time_ms,
189+
overall_end_time_metrics,
190+
datasink_conn,
191+
setup_name,
192+
setup_type,
193+
test_name,
194+
git_branch,
195+
tf_github_org,
196+
tf_github_repo,
197+
tf_triggering_env,
198+
{"metric-type": "redis-metrics"},
199+
expire_redis_metrics_ms,
200+
)
201+
logging.info("Collecting commandstat metrics")
202+
(
203+
_,
204+
_,
205+
overall_commandstats_metrics,
206+
) = collect_redis_metrics(redis_conns, ["commandstats"])
207+
export_redis_metrics(
208+
git_version,
209+
datapoint_time_ms,
210+
overall_commandstats_metrics,
211+
datasink_conn,
212+
setup_name,
213+
setup_type,
214+
test_name,
215+
git_branch,
216+
tf_github_org,
217+
tf_github_repo,
218+
tf_triggering_env,
219+
{"metric-type": "commandstats"},
220+
expire_redis_metrics_ms,
221+
)

redis_benchmarks_specification/__runner__/args.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,19 @@ def create_client_runner_args(project_name):
5454
help="Interpret PATTERN as a regular expression to filter test names",
5555
)
5656
parser.add_argument("--db_server_host", type=str, default="localhost")
57+
parser.add_argument("--db_server_password", type=str, default=None)
5758
parser.add_argument("--db_server_port", type=int, default=6379)
5859
parser.add_argument("--cpuset_start_pos", type=int, default=0)
60+
parser.add_argument(
61+
"--tests-priority-lower-limit",
62+
type=int,
63+
default=0,
64+
help="Run a subset of the tests based uppon a preset priority. By default runs all tests.",
65+
)
5966
parser.add_argument(
6067
"--tests-priority-upper-limit",
6168
type=int,
62-
default=-1,
69+
default=100000,
6370
help="Run a subset of the tests based uppon a preset priority. By default runs all tests.",
6471
)
6572
parser.add_argument(
@@ -68,6 +75,12 @@ def create_client_runner_args(project_name):
6875
action="store_true",
6976
help="Only check how many benchmarks we would run. Don't run benchmark but can change state of DB.",
7077
)
78+
parser.add_argument(
79+
"--dry-run-include-preload",
80+
default=False,
81+
action="store_true",
82+
help="Run all steps before benchmark. This can change the state of the DB.",
83+
)
7184
parser.add_argument(
7285
"--datasink_redistimeseries_host", type=str, default=DATASINK_RTS_HOST
7386
)

0 commit comments

Comments
 (0)