Skip to content

Commit a41cbfb

Browse files
Updated the benchmark SPEC to include command priority. Included --dry-run and --tests-priority-upper-limit in redis-benchmarks-spec-client-runner (#184)
1 parent 020377e commit a41cbfb

File tree

93 files changed

+280
-104
lines changed

Some content is hidden

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

93 files changed

+280
-104
lines changed

commands-priority.json

Lines changed: 70 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -74,84 +74,84 @@
7474
"setbit": 73,
7575
"zcount": 74,
7676
"unlink": 75,
77-
"select": 76,
78-
"setnx": 77,
79-
"type": 78,
80-
"hlen": 79,
81-
"sscan": 80,
82-
"hsetnx": 81,
77+
"setnx": 76,
78+
"type": 77,
79+
"hlen": 78,
80+
"sscan": 79,
81+
"hsetnx": 80,
82+
"select": 81,
8383
"srandmember": 82,
8484
"zscan": 83,
8585
"xack": 84,
8686
"pttl": 85,
8787
"restore": 86,
8888
"pexpireat": 87,
8989
"xdel": 88,
90-
"discard": 89,
91-
"xpending": 90,
92-
"getset": 91,
93-
"psetex": 92,
94-
"mset": 93,
95-
"bzpopmin": 94,
96-
"persist": 95,
97-
"pfcount": 96,
98-
"hkeys": 97,
99-
"xread": 98,
100-
"xlen": 99,
101-
"xtrim": 100,
102-
"decrby": 101,
103-
"rpushx": 102,
104-
"sinter": 103,
105-
"decr": 104,
106-
"sunion": 105,
107-
"sinterstore": 106,
108-
"smismember": 107,
109-
"zpopmin": 108,
110-
"echo": 109,
111-
"dbsize": 110,
112-
"lset": 111,
90+
"xpending": 89,
91+
"getset": 90,
92+
"psetex": 91,
93+
"mset": 92,
94+
"bzpopmin": 93,
95+
"persist": 94,
96+
"pfcount": 95,
97+
"hkeys": 96,
98+
"xread": 97,
99+
"xlen": 98,
100+
"xtrim": 99,
101+
"decrby": 100,
102+
"rpushx": 101,
103+
"sinter": 102,
104+
"decr": 103,
105+
"sunion": 104,
106+
"sinterstore": 105,
107+
"smismember": 106,
108+
"zpopmin": 107,
109+
"echo": 108,
110+
"dbsize": 109,
111+
"lset": 110,
112+
"geoadd": 111,
113113
"xclaim": 112,
114-
"geoadd": 113,
115-
"randomkey": 114,
116-
"rename": 115,
117-
"zrangebylex": 116,
118-
"zinterstore": 117,
119-
"append": 118,
120-
"zunionstore": 119,
121-
"xrange": 120,
122-
"getrange": 121,
123-
"xautoclaim": 122,
124-
"sunionstore": 123,
125-
"bitcount": 124,
126-
"dump": 125,
127-
"hrandfield": 126,
128-
"getex": 127,
129-
"strlen": 128,
130-
"pubsub": 129,
131-
"linsert": 130,
132-
"bitpos": 131,
133-
"sdiff": 132,
134-
"msetnx": 133,
135-
"getdel": 134,
136-
"sort": 135,
137-
"renamenx": 136,
138-
"setrange": 137,
139-
"lpos": 138,
140-
"geopos": 139,
141-
"blmove": 140,
142-
"georadius": 141,
143-
"zlexcount": 142,
144-
"pfmerge": 143,
145-
"xrevrange": 144,
146-
"georadiusbymember": 145,
147-
"zremrangebylex": 146,
148-
"lmove": 147,
149-
"sdiffstore": 148,
150-
"zpopmax": 149,
151-
"bzpopmax": 150,
152-
"zmscore": 151,
153-
"flushdb": 152,
154-
"zrevrangebylex": 153,
114+
"randomkey": 113,
115+
"rename": 114,
116+
"zrangebylex": 115,
117+
"zinterstore": 116,
118+
"append": 117,
119+
"zunionstore": 118,
120+
"xrange": 119,
121+
"getrange": 120,
122+
"xautoclaim": 121,
123+
"sunionstore": 122,
124+
"bitcount": 123,
125+
"dump": 124,
126+
"hrandfield": 125,
127+
"getex": 126,
128+
"strlen": 127,
129+
"pubsub": 128,
130+
"linsert": 129,
131+
"bitpos": 130,
132+
"sdiff": 131,
133+
"msetnx": 132,
134+
"getdel": 133,
135+
"sort": 134,
136+
"renamenx": 135,
137+
"setrange": 136,
138+
"lpos": 137,
139+
"geopos": 138,
140+
"blmove": 139,
141+
"georadius": 140,
142+
"zlexcount": 141,
143+
"pfmerge": 142,
144+
"xrevrange": 143,
145+
"georadiusbymember": 144,
146+
"zremrangebylex": 145,
147+
"lmove": 146,
148+
"sdiffstore": 147,
149+
"zpopmax": 148,
150+
"bzpopmax": 149,
151+
"zmscore": 150,
152+
"flushdb": 151,
153+
"zrevrangebylex": 152,
154+
"discard": 153,
155155
"smove": 154,
156156
"flushall": 155,
157157
"georadius_ro": 156,

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 = "redis-benchmarks-specification"
3-
version = "0.1.61"
3+
version = "0.1.62"
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"

redis_benchmarks_specification/__cli__/stats.py

Lines changed: 56 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,15 @@ def generate_stats_cli_command_logic(args, project_name, project_version):
4444
len(testsuite_spec_files), testsuites_folder
4545
)
4646
)
47+
priority_json = {}
48+
if args.commands_priority_file != "":
49+
with open(args.commands_priority_file, "r") as fd:
50+
logging.info(
51+
"Reading {} file with priority by commandstats".format(
52+
args.commands_priority_file
53+
)
54+
)
55+
priority_json = json.load(fd)
4756
tracked_groups = []
4857
override_enabled = args.override_tests
4958
fail_on_required_diff = args.fail_on_required_diff
@@ -76,6 +85,7 @@ def generate_stats_cli_command_logic(args, project_name, project_version):
7685
if "tested-groups" in benchmark_config:
7786
origin_tested_groups = benchmark_config["tested-groups"]
7887
origin_tested_commands = []
88+
7989
tested_commands = []
8090
if "tested-commands" in benchmark_config:
8191
origin_tested_commands = benchmark_config["tested-commands"]
@@ -126,6 +136,31 @@ def generate_stats_cli_command_logic(args, project_name, project_version):
126136
)
127137
)
128138

139+
priority = None
140+
# maximum priority of all tested commands
141+
priority_json_value = None
142+
for command in tested_commands:
143+
if command in priority_json:
144+
priority_v = priority_json[command]
145+
if priority_json_value is None:
146+
priority_json_value = priority_v
147+
if priority_v > priority_json_value:
148+
priority_json_value = priority_v
149+
150+
if "priority" in benchmark_config:
151+
priority = benchmark_config["priority"]
152+
else:
153+
if priority_json_value is not None:
154+
requires_override = True
155+
logging.warn(
156+
"dont have priority in {}, but the commands in the test have max priority of {}".format(
157+
test_name, priority_json_value
158+
)
159+
)
160+
priority = priority_json_value
161+
if priority is not None:
162+
benchmark_config["priority"] = priority
163+
129164
if tested_groups != origin_tested_groups:
130165
requires_override = True
131166
benchmark_config["tested-groups"] = tested_groups
@@ -171,6 +206,7 @@ def generate_stats_cli_command_logic(args, project_name, project_version):
171206

172207
# open file in read mode
173208
total_count = 0
209+
total_usecs = 0
174210
total_tracked_count = 0
175211
with open(
176212
args.commandstats_csv, "r", encoding="utf8", errors="ignore"
@@ -185,6 +221,10 @@ def generate_stats_cli_command_logic(args, project_name, project_version):
185221
cmdstat = row[0]
186222
cmdstat = cmdstat.replace("cmdstat_", "")
187223
count = int(row[1])
224+
usecs = None
225+
if len(row) > 2:
226+
usecs = int(row[2])
227+
total_usecs += usecs
188228
if count == 0:
189229
continue
190230
tracked = False
@@ -206,7 +246,7 @@ def generate_stats_cli_command_logic(args, project_name, project_version):
206246
if cmdstat in tracked_commands_json:
207247
tracked = True
208248
if module is False or include_modules:
209-
row = [cmdstat, group, count, tracked, deprecated]
249+
row = [cmdstat, group, count, usecs, tracked, deprecated]
210250
rows.append(row)
211251

212252
priority_list = sorted(((priority[cmd], cmd) for cmd in priority), reverse=True)
@@ -245,7 +285,16 @@ def generate_stats_cli_command_logic(args, project_name, project_version):
245285
json.dump(priority_json, fd, indent=True)
246286

247287
if args.summary_csv != "":
248-
header = ["command", "group", "count", "tracked", "deprecated", "%"]
288+
header = [
289+
"command",
290+
"group",
291+
"count",
292+
"usecs",
293+
"tracked",
294+
"deprecated",
295+
"% count",
296+
"% usecs",
297+
]
249298
import csv
250299

251300
with open(args.summary_csv, "w", encoding="UTF8", newline="") as f:
@@ -256,8 +305,13 @@ def generate_stats_cli_command_logic(args, project_name, project_version):
256305
for row in rows:
257306
# write the data
258307
count = row[2]
308+
usec = row[3]
259309
pct = count / total_count
310+
pct_usec = "n/a"
311+
if usec is not None:
312+
pct_usec = usec / total_usecs
260313
row.append(pct)
314+
row.append(pct_usec)
261315
writer.writerow(row)
262316

263317
if total_tracked_count > 0:

redis_benchmarks_specification/__runner__/args.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,18 @@ def create_client_runner_args(project_name):
5656
parser.add_argument("--db_server_host", type=str, default="localhost")
5757
parser.add_argument("--db_server_port", type=int, default=6379)
5858
parser.add_argument("--cpuset_start_pos", type=int, default=0)
59+
parser.add_argument(
60+
"--tests-priority-upper-limit",
61+
type=int,
62+
default=-1,
63+
help="Run a subset of the tests based uppon a preset priority. By default runs all tests.",
64+
)
65+
parser.add_argument(
66+
"--dry-run",
67+
default=False,
68+
action="store_true",
69+
help="Only check how many benchmarks we would run. Don't run benchmark but can change state of DB.",
70+
)
5971
parser.add_argument(
6072
"--datasink_redistimeseries_host", type=str, default=DATASINK_RTS_HOST
6173
)

redis_benchmarks_specification/__runner__/runner.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,8 @@ def process_self_contained_coordinator_stream(
262262
overall_result = True
263263
results_matrix = []
264264
total_test_suite_runs = 0
265+
dry_run_count = 0
266+
dry_run = args.dry_run
265267
for test_file in testsuite_spec_files:
266268
client_containers = []
267269

@@ -290,6 +292,7 @@ def process_self_contained_coordinator_stream(
290292
tf_github_repo = args.github_repo
291293
tf_triggering_env = args.platform_name
292294
setup_type = args.setup_type
295+
priority_limit = args.tests_priority_upper_limit
293296
git_hash = "NA"
294297
git_version = args.github_version
295298
build_variant_name = "NA"
@@ -364,6 +367,25 @@ def process_self_contained_coordinator_stream(
364367
_, test_tls_key = cp_to_workdir(
365368
temporary_dir_client, tls_key
366369
)
370+
priority = None
371+
if "priority" in benchmark_config:
372+
priority = benchmark_config["priority"]
373+
374+
if priority_limit > 0 and priority is not None:
375+
if priority_limit < priority:
376+
logging.warning(
377+
"Skipping test {} giving the priority limit ({}) is above the priority value ({})".format(
378+
test_name, priority_limit, priority
379+
)
380+
)
381+
continue
382+
logging.info(
383+
"Test {} priority ({}) is within the priority limit ({})".format(
384+
test_name,
385+
priority,
386+
priority_limit,
387+
)
388+
)
367389

368390
if "dataset" in benchmark_config["dbconfig"]:
369391
if args.run_tests_with_dataset is False:
@@ -374,6 +396,10 @@ def process_self_contained_coordinator_stream(
374396
)
375397
continue
376398

399+
if dry_run is True:
400+
dry_run_count = dry_run_count + 1
401+
continue
402+
377403
if "preload_tool" in benchmark_config["dbconfig"]:
378404
data_prepopulation_step(
379405
benchmark_config,
@@ -669,6 +695,11 @@ def process_self_contained_coordinator_stream(
669695
)
670696
csv_writer.dump(dest_fpath)
671697

698+
if dry_run is True:
699+
logging.info(
700+
"Number of tests that would have been run: {}".format(dry_run_count)
701+
)
702+
672703

673704
def cp_to_workdir(benchmark_tool_workdir, srcfile):
674705
head, filename = os.path.split(srcfile)

redis_benchmarks_specification/test-suites/memtier_benchmark-10Mkeys-load-hash-5-fields-with-1000B-values-pipeline-10.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,4 @@ exporter:
3131
- $."ALL STATS".Totals."Percentile Latencies"."p50.00"
3232
tested-groups:
3333
- hash
34+
priority: 5

redis_benchmarks_specification/test-suites/memtier_benchmark-10Mkeys-load-hash-5-fields-with-1000B-values.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,4 @@ exporter:
3131
- $."ALL STATS".Totals."Percentile Latencies"."p50.00"
3232
tested-groups:
3333
- hash
34+
priority: 5

redis_benchmarks_specification/test-suites/memtier_benchmark-10Mkeys-load-hash-5-fields-with-100B-values-pipeline-10.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,4 @@ exporter:
3131
- $."ALL STATS".Totals."Percentile Latencies"."p50.00"
3232
tested-groups:
3333
- hash
34+
priority: 5

redis_benchmarks_specification/test-suites/memtier_benchmark-10Mkeys-load-hash-5-fields-with-100B-values.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,4 @@ exporter:
3131
- $."ALL STATS".Totals."Percentile Latencies"."p50.00"
3232
tested-groups:
3333
- hash
34+
priority: 5

redis_benchmarks_specification/test-suites/memtier_benchmark-10Mkeys-load-hash-5-fields-with-10B-values-pipeline-10.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,4 @@ exporter:
3131
- $."ALL STATS".Totals."Percentile Latencies"."p50.00"
3232
tested-groups:
3333
- hash
34+
priority: 5

redis_benchmarks_specification/test-suites/memtier_benchmark-10Mkeys-load-hash-5-fields-with-10B-values.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,4 @@ exporter:
3131
- $."ALL STATS".Totals."Percentile Latencies"."p50.00"
3232
tested-groups:
3333
- hash
34+
priority: 5

redis_benchmarks_specification/test-suites/memtier_benchmark-1Mkeys-100B-expire-use-case.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,4 @@ exporter:
4040
- $."ALL STATS".Totals."Latency"
4141
- $."ALL STATS".Totals."Misses/sec"
4242
- $."ALL STATS".Totals."Percentile Latencies"."p50.00"
43+
priority: 33

0 commit comments

Comments
 (0)