redis-benchmarks-specification 0.1.301__py3-none-any.whl → 0.1.303__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of redis-benchmarks-specification might be problematic. Click here for more details.

@@ -15,11 +15,14 @@ from redis_benchmarks_specification.__common__.timeseries import (
15
15
 
16
16
  def execute_init_commands(benchmark_config, r, dbconfig_keyname="dbconfig"):
17
17
  cmds = None
18
+ lua_scripts = None
18
19
  res = 0
19
20
  if dbconfig_keyname in benchmark_config:
20
21
  for k, v in benchmark_config[dbconfig_keyname].items():
21
22
  if "init_commands" in k:
22
23
  cmds = v
24
+ elif "init_lua" in k:
25
+ lua_scripts = v
23
26
 
24
27
  if type(cmds) == str:
25
28
  cmds = [cmds]
@@ -37,7 +40,7 @@ def execute_init_commands(benchmark_config, r, dbconfig_keyname="dbconfig"):
37
40
  quoting=csv.QUOTE_ALL,
38
41
  skipinitialspace=True,
39
42
  ):
40
- if lines[0] != " " and len(lines[0]) > 0:
43
+ if len(lines) > 0 and lines[0] != " " and len(lines[0]) > 0:
41
44
  cols.append(lines[0])
42
45
  cmd = cols
43
46
  is_array = True
@@ -57,6 +60,21 @@ def execute_init_commands(benchmark_config, r, dbconfig_keyname="dbconfig"):
57
60
  )
58
61
  )
59
62
 
63
+ # Process init_lua scripts
64
+ if lua_scripts is not None:
65
+ if type(lua_scripts) == str:
66
+ lua_scripts = [lua_scripts]
67
+
68
+ for lua_script in lua_scripts:
69
+ try:
70
+ logging.info("Executing Lua script (length: {} chars)".format(len(lua_script)))
71
+ # Execute the Lua script using EVAL command with 0 keys
72
+ stdout = r.execute_command("EVAL", lua_script, 0)
73
+ logging.info("Lua script result: {}".format(stdout))
74
+ res = res + 1
75
+ except Exception as e:
76
+ logging.error("Lua script execution failed: {}".format(e))
77
+
60
78
  return res
61
79
 
62
80
 
@@ -452,13 +470,16 @@ def exporter_datasink_common(
452
470
  deployment_type_and_name = f"{setup_type}_AND_{setup_name}"
453
471
  deployment_type_and_name_and_version = f"{setup_type}_AND_{setup_name}_AND_{git_version}"
454
472
 
455
- # Add to deployment-specific set
456
- deployment_set_key = f"ci.benchmarks.redis/{tf_triggering_env}/{deployment_type_and_name_and_version}:set"
457
- datasink_conn.sadd(deployment_set_key, test_name)
473
+ # Add to deployment-specific set (only if datasink connection is available)
474
+ if datasink_conn is not None:
475
+ deployment_set_key = f"ci.benchmarks.redis/{tf_triggering_env}/{deployment_type_and_name_and_version}:set"
476
+ datasink_conn.sadd(deployment_set_key, test_name)
458
477
 
459
- # Add to testcases set
460
- testcases_set_key = f"ci.benchmarks.redis/{tf_triggering_env}/testcases:set"
461
- datasink_conn.sadd(testcases_set_key, test_name)
478
+ # Add to testcases set
479
+ testcases_set_key = f"ci.benchmarks.redis/{tf_triggering_env}/testcases:set"
480
+ datasink_conn.sadd(testcases_set_key, test_name)
481
+ else:
482
+ logging.debug("Datasink connection not available, skipping set operations")
462
483
 
463
484
  # Add metadata fields to timeseries metadata
464
485
  metadata["deployment_type_AND_deployment_name"] = deployment_type_and_name
@@ -0,0 +1,203 @@
1
+ version: 0.4
2
+ name: memtier_benchmark-playbook-session-storage
3
+ description: |
4
+ Runs memtier_benchmark to simulate a session-based SaaS application.
5
+ The workload mimics user session CRUD, session tracking, organization-level analytics,
6
+ and rate limiting. It includes realistic key sizes and command mixes representative
7
+ of production traffic (e.g., 400–600B session hashes, ZSETs for analytics, and SETs for tracking).
8
+
9
+ Rate limiting is modeled using an atomic Lua script, inspired by the Upstash Redis example:
10
+ https://github.com/upstash/examples/tree/main/examples/ratelimit-with-redis
11
+
12
+ Each user has a dedicated key in the form of `ratelimit:user-<id>:/api/resource`, which is
13
+ used to track usage under a fixed window. The logic is evaluated atomically with the following script:
14
+
15
+ local key = KEYS[1]
16
+ local limit = 100
17
+ local window = 60
18
+ local current = redis.call("INCR", key)
19
+ if current == 1 then
20
+ redis.call("EXPIRE", key, window)
21
+ end
22
+ if current > limit then
23
+ return 0
24
+ else
25
+ return 1
26
+ end
27
+
28
+ This ensures that rate enforcement and usage tracking are done without race conditions, and
29
+ mirrors a real-world API quota model.
30
+
31
+ The workload emphasizes read-heavy patterns to reflect common SaaS access behavior. The overall
32
+ **read:write ratio is approximately 85:15**, with read operations covering session access, user-session
33
+ lookups, org analytics, and rate limit enforcement, while writes handle session updates, activity tracking,
34
+ and quota increments.
35
+
36
+ Command groups by use-case (approximate ratio of total operations):
37
+ - Session CRUD (HGETALL, HSET): ~55%
38
+ - User session tracking (SMEMBERS, SADD): ~21%
39
+ - Organization analytics (ZRANGE, ZADD): ~12%
40
+ - Rate limiting (EVAL-based quota check): ~12%
41
+
42
+ exporter:
43
+ redistimeseries:
44
+ break_by:
45
+ - version
46
+ - commit
47
+ timemetric: $."ALL STATS".Runtime."Start time"
48
+ metrics:
49
+ - $."BEST RUN RESULTS".Hgetalls."Ops/sec"
50
+ - $."BEST RUN RESULTS".Hsets."Ops/sec"
51
+ - $."BEST RUN RESULTS".Smemberss."Ops/sec"
52
+ - $."BEST RUN RESULTS".Sadds."Ops/sec"
53
+ - $."BEST RUN RESULTS".Zranges."Ops/sec"
54
+ - $."BEST RUN RESULTS".Zadds."Ops/sec"
55
+ - $."BEST RUN RESULTS".Evals."Ops/sec"
56
+ - $."BEST RUN RESULTS".Totals."Ops/sec"
57
+ - $."BEST RUN RESULTS".Totals."Latency"
58
+ - $."BEST RUN RESULTS".Totals."Misses/sec"
59
+ - $."BEST RUN RESULTS".Totals."Percentile Latencies"."p50.00"
60
+ - $."BEST RUN RESULTS".Totals."Percentile Latencies"."p99.00"
61
+ - $."ALL STATS".Hgetalls."Ops/sec"
62
+ - $."ALL STATS".Hsets."Ops/sec"
63
+ - $."ALL STATS".Smemberss."Ops/sec"
64
+ - $."ALL STATS".Sadds."Ops/sec"
65
+ - $."ALL STATS".Zranges."Ops/sec"
66
+ - $."ALL STATS".Zadds."Ops/sec"
67
+ - $."ALL STATS".Evals."Ops/sec"
68
+ - $."ALL STATS".Totals."Ops/sec"
69
+ - $."ALL STATS".Totals."Latency"
70
+ - $."ALL STATS".Totals."Misses/sec"
71
+ - $."ALL STATS".Hgetalls."Percentile Latencies"."p50.00"
72
+ - $."ALL STATS".Hsets."Percentile Latencies"."p50.00"
73
+ - $."ALL STATS".Smemberss."Percentile Latencies"."p50.00"
74
+ - $."ALL STATS".Sadds."Percentile Latencies"."p50.00"
75
+ - $."ALL STATS".Zranges."Percentile Latencies"."p50.00"
76
+ - $."ALL STATS".Zadds."Percentile Latencies"."p50.00"
77
+ - $."ALL STATS".Evals."Percentile Latencies"."p50.00"
78
+ - $."ALL STATS".Totals."Percentile Latencies"."p50.00"
79
+ - $."ALL STATS".Totals."Percentile Latencies"."p99.00"
80
+
81
+
82
+ dbconfig:
83
+ configuration-parameters:
84
+ save: '""'
85
+ resources:
86
+ requests:
87
+ memory: 1g
88
+ init_lua: |
89
+ -- Use a fixed seed for reproducibility
90
+ local seed = 12345
91
+ math.randomseed(seed)
92
+
93
+ local now = tonumber(redis.call('TIME')[1])
94
+
95
+ local function rand_str(len)
96
+ local chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
97
+ local res = ''
98
+ for i = 1, len do
99
+ local idx = math.random(#chars)
100
+ res = res .. chars:sub(idx, idx)
101
+ end
102
+ return res
103
+ end
104
+
105
+ for i = 1, 100000 do
106
+ local session_id = 'session:' .. i
107
+ local user_id = 'user-' .. i
108
+ local org_id = 'org-' .. i
109
+
110
+ redis.call('HSET', session_id,
111
+ 'userId', user_id,
112
+ 'organizationId', org_id,
113
+ 'role', 'member',
114
+ 'createdAt', tostring(now - math.random(3600)),
115
+ 'lastAccessed', tostring(now),
116
+ 'ipAddress', '192.168.1.' .. (i % 255),
117
+ 'device', 'device-' .. rand_str(8),
118
+ 'authMethod', 'password',
119
+ 'status', 'active',
120
+ 'metadata', rand_str(200 + (i % 100))
121
+ )
122
+
123
+ redis.call('SADD', 'user:' .. i .. ':sessions', session_id)
124
+
125
+ local org_key = 'org:' .. i .. ':sessions'
126
+ for j = 1, 10 do
127
+ local uid = 'user-' .. ((i + j) % 1000 + 1)
128
+ local sid = 'session:' .. ((i + j) % 1000 + 1)
129
+ local zmember = uid .. ':' .. sid
130
+ local zscore = now - math.random(86400)
131
+ redis.call('ZADD', org_key, zscore, zmember)
132
+ end
133
+
134
+ local endpoint = '/api/resource'
135
+ local rate_key = 'ratelimit:' .. user_id .. ':' .. endpoint
136
+ redis.call('INCR', rate_key)
137
+ redis.call('EXPIRE', rate_key, 60)
138
+ end
139
+
140
+ return 'OK'
141
+ tested-groups:
142
+ - hash
143
+ - zset
144
+ - set
145
+ - string
146
+
147
+ tested-commands:
148
+ - hgetall
149
+ - hset
150
+ - smembers
151
+ - sadd
152
+ - zrange
153
+ - zadd
154
+ - incr
155
+ - expire
156
+ - get
157
+
158
+ redis-topologies:
159
+ - oss-standalone
160
+ build-variants:
161
+ - gcc:8.5.0-amd64-debian-buster-default
162
+ - dockerhub
163
+
164
+ clientconfig:
165
+ run_image: redislabs/memtier_benchmark:edge
166
+ tool: memtier_benchmark
167
+ arguments: >
168
+ --key-prefix ""
169
+ --key-minimum 1
170
+ --key-maximum 100000
171
+ --data-size-range=400-600
172
+ --pipeline=1
173
+ --print-percentiles=50,90,95,99
174
+ --run-count=1
175
+ --test-time=120
176
+ --command="HGETALL session:__key__"
177
+ --command-key-pattern=R
178
+ --command-ratio=50
179
+ --command="HSET session:__key__ userId user-__key__ organizationId org-__key__ role admin email user__key__@example.com name "User __key__" permissions "["read","write"]" lastActivity __timestamp__ ipAddress 192.168.1.__key__ userAgent "Mozilla/5.0" createdAt __timestamp__"
180
+ --command-key-pattern=R
181
+ --command-ratio=5
182
+ --command="SMEMBERS user:__key__:sessions"
183
+ --command-key-pattern=R
184
+ --command-ratio=18
185
+ --command="SADD user:__key__:sessions session-__key__"
186
+ --command-key-pattern=R
187
+ --command-ratio=3
188
+ --command="ZRANGE org:__key__:sessions 0 -1 WITHSCORES"
189
+ --command-key-pattern=R
190
+ --command-ratio=10
191
+ --command="ZADD org:__key__:sessions 1 user-__key__:session-__key__"
192
+ --command-key-pattern=R
193
+ --command-ratio=2
194
+ --command='EVAL "local key=KEYS[1];local limit=10;local window=60;local current=redis.call(\"INCR\",key);if current==1 then redis.call(\"EXPIRE\",key,window) end;if current>limit then return 0 else return 1 end" 1 ratelimit:user-__key__:/api/resource'
195
+ --command-key-pattern=R
196
+ --command-ratio=12
197
+ --hide-histogram
198
+ resources:
199
+ requests:
200
+ cpus: '4'
201
+ memory: 2g
202
+
203
+ priority: 150
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: redis-benchmarks-specification
3
- Version: 0.1.301
3
+ Version: 0.1.303
4
4
  Summary: 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.
5
5
  Author: filipecosta90
6
6
  Author-email: filipecosta.90@gmail.com
@@ -15,7 +15,7 @@ redis_benchmarks_specification/__common__/builder_schema.py,sha256=kfDpRIk7NkJrb
15
15
  redis_benchmarks_specification/__common__/env.py,sha256=kvJ8Ll-fvI_Tc0vynrzUEr22TqnJizzvJ4Lu9RjNr_M,3119
16
16
  redis_benchmarks_specification/__common__/github.py,sha256=9TZtnISsSgXTSAN_VQejo5YRPDPhlU0gjxgKGPw_sP8,10699
17
17
  redis_benchmarks_specification/__common__/package.py,sha256=4uVt1BAZ999LV2rZkq--Tk6otAVIf9YR3g3KGeUpiW4,834
18
- redis_benchmarks_specification/__common__/runner.py,sha256=s5IJnxO527SoImhQmOU2UrqR4_h3MnHM2i7dh7wNV1Y,15649
18
+ redis_benchmarks_specification/__common__/runner.py,sha256=7Xc8QjwqYXQH9Vnq7s2YiP052zI3dk-OFhO-8Z5XY3o,16589
19
19
  redis_benchmarks_specification/__common__/spec.py,sha256=D_SN48wg6NMthW_-OS1H5bydSDiuZpfd4WPPj7Vfwmc,5760
20
20
  redis_benchmarks_specification/__common__/timeseries.py,sha256=w8XQrGPEFuuemDXXz4iny7lYsNbYH0ycQyq3jHIr80g,52916
21
21
  redis_benchmarks_specification/__compare__/__init__.py,sha256=DtBXRp0Q01XgCFmY-1OIePMyyYihVNAjZ1Y8zwqSDN0,101
@@ -271,10 +271,11 @@ redis_benchmarks_specification/test-suites/memtier_benchmark-nokeys-pubsub-mixed
271
271
  redis_benchmarks_specification/test-suites/memtier_benchmark-nokeys-pubsub-mixed-100-channels-128B-100-publishers-50K-subscribers-5k-conns.yml,sha256=mh_cAomSjsU4WL2l9gt0dhyWdSwfXTrEZgnRz6gzSQE,1144
272
272
  redis_benchmarks_specification/test-suites/memtier_benchmark-nokeys-pubsub-publish-1K-channels-10B-no-subscribers.yml,sha256=zwb27Jmg0mwcthbmdUe0KuzqRzAPs7OHcK2gc9-5VBE,779
273
273
  redis_benchmarks_specification/test-suites/memtier_benchmark-nokeys-server-time-pipeline-10.yml,sha256=7G_J8kUFay7jXhZvsZK5jvVHSLZvhMV0uuDMkZBbeSQ,675
274
+ redis_benchmarks_specification/test-suites/memtier_benchmark-playbook-session-storage.yml,sha256=Q5JKvADD1R71hyRx4Qsz5dxHHlYICHqWHD7XTAmX72M,6936
274
275
  redis_benchmarks_specification/test-suites/template.txt,sha256=d_edIE7Sxa5X7I2yG-Io0bPdbDIHR0oWFoCA3XUt_EU,435
275
276
  redis_benchmarks_specification/vector-search-test-suites/vector_db_benchmark_test.yml,sha256=PD7ow-k4Ll2BkhEC3aIqiaCZt8Hc4aJIp96Lw3J3mcI,791
276
- redis_benchmarks_specification-0.1.301.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
277
- redis_benchmarks_specification-0.1.301.dist-info/METADATA,sha256=C3ytp_y6zvhWnBn06yKTK1XZgSySycj3i9IJU5Ry9q8,22726
278
- redis_benchmarks_specification-0.1.301.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
279
- redis_benchmarks_specification-0.1.301.dist-info/entry_points.txt,sha256=x5WBXCZsnDRTZxV7SBGmC65L2k-ygdDOxV8vuKN00Nk,715
280
- redis_benchmarks_specification-0.1.301.dist-info/RECORD,,
277
+ redis_benchmarks_specification-0.1.303.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
278
+ redis_benchmarks_specification-0.1.303.dist-info/METADATA,sha256=EhMb2tY2pNg3PZtPh8R40wztMm6GVTR48j5P_fP04nw,22726
279
+ redis_benchmarks_specification-0.1.303.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
280
+ redis_benchmarks_specification-0.1.303.dist-info/entry_points.txt,sha256=x5WBXCZsnDRTZxV7SBGmC65L2k-ygdDOxV8vuKN00Nk,715
281
+ redis_benchmarks_specification-0.1.303.dist-info/RECORD,,