Skip to content

Added extra session caching, RPUSH, and SET benchmarks #308

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Aug 13, 2025
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
ersion: 0.4
name: memtier_benchmark-10Kkeys-load-list-rpush-bulkload-pipeline-50
description: |
Runs memtier_benchmark to stress multi-element RPUSH on a single LIST key using
high pipelining and concurrency. This targets quicklist multi-insert behavior and
bulk argument parsing performance (context: Redis PR #13860).
dbconfig:
configuration-parameters:
save: '""'
check:
keyspacelen: 0
resources:
requests:
memory: 1g
tested-groups:
- list
tested-commands:
- rpush
redis-topologies:
- oss-standalone
build-variants:
- gcc:15.2.0-amd64-debian-bookworm-default
- gcc:15.2.0-arm64-debian-bookworm-default
- dockerhub
clientconfig:
run_image: redislabs/memtier_benchmark:edge
tool: memtier_benchmark
arguments: >-
--pipeline 50
--command "RPUSH __key__ a b c d e f g h i j k l m n o p q r s t u v w x y z
aa bb cc dd ee ff gg hh ii jj kk ll mm nn oo pp qq rr ss tt uu vv ww xx yy zz
ab bc cd de ef fg gh hi ij jk kl lm mn no op pq qr rs st tu uv vw wx xy yz za
ac bd ce df eg fh gi hj ik jl km ln mo np oq pr qs rt su tv uw vx" --distinct-client-seed
--test-time 120 -c 50 -t 4 --hide-histogram --key-minimum=1 --key-maximum 10000
resources:
requests:
cpus: '4'
memory: 2g
priority: 39
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
version: 0.4
name: memtier_benchmark-1Mkeys-load-string-with-1KiB-values-pipeline-10
description: Runs memtier_benchmark, for a keyspace length of 1M keys loading STRINGs
in which the value has a data size of 1000 Bytes.
dbconfig:
configuration-parameters:
save: '""'
check:
keyspacelen: 0
resources:
requests:
memory: 3g
tested-commands:
- set
redis-topologies:
- oss-standalone
build-variants:
- gcc:15.2.0-amd64-debian-bookworm-default
- gcc:15.2.0-arm64-debian-bookworm-default
- dockerhub
clientconfig:
run_image: redislabs/memtier_benchmark:edge
tool: memtier_benchmark
arguments: '--pipeline 10 --distinct-client-seed --data-size 1000 --ratio 1:0 --key-pattern R:R --key-minimum=1 --key-maximum
1000000 --test-time 180 -c 50 -t 4 --hide-histogram'
resources:
requests:
cpus: '4'
memory: 2g
tested-groups:
- string
priority: 17
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
version: 0.4
name: memtier_benchmark-session-caching-string-100k-sessions
description: |
Runs memtier_benchmark to simulate a session caching workload for a SaaS application.
This benchmark focuses exclusively on **string-based session storage**, where each session
is stored in Redis as a serialized JSON string (`session:<id>`) containing fields like
user ID, timestamps, device info, and metadata (total ~400–600B).

The benchmark models a typical read-heavy cache usage pattern, with an approximate
**read:write ratio of 80:20**, reflecting session retrievals and infrequent updates.

Command groups:
- Session cache reads (`GET`): ~80%
- Session cache writes (`SET`): ~20%

To better approximate real-world access patterns, the benchmark uses a **Zipfian key distribution**
(`--command-key-pattern=Z`). This simulates **skewed access** where a small subset of sessions (hot keys)
receives a majority of reads — a common pattern in production workloads.

While Zipfian is technically a power-law distribution, it effectively mimics **Poisson-like behavior**
in large-scale systems, where access frequency is uneven but statistically predictable.
This access skew mirrors real-life scenarios such as:
- Frequently accessed or "sticky" user sessions
- Popular user accounts or active devices
- Hot caches for trending or recently used resources

Using Zipfian distribution allows this benchmark to capture **contention**, **cache pressure**, and
**read amplification** effects that occur in real SaaS applications under load.

dbconfig:
configuration-parameters:
save: '""'
resources:
requests:
memory: 1g
init_lua: |
local seed = 12345
math.randomseed(seed)
local now = tonumber(redis.call('TIME')[1])
local function rand_str(len)
local chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
local res = ''
for i = 1, len do
local idx = math.random(#chars)
res = res .. chars:sub(idx, idx)
end
return res
end
for i = 1, 100000 do
local session_id = 'session:' .. i
local session_data = string.format(
'{"userId":"user-%d","organizationId":"org-%d","role":"member","createdAt":"%d","lastAccessed":"%d","ipAddress":"192.168.1.%d","device":"device-%s","authMethod":"password","status":"active","metadata":"%s"}',
i, i, now - math.random(3600), now, (i % 255), rand_str(8), rand_str(200 + (i % 100))
)
redis.call('SET', session_id, session_data)
end
return 'OK'

tested-groups:
- string

tested-commands:
- get
- set

redis-topologies:
- oss-standalone

build-variants:
- gcc:15.2.0-amd64-debian-bookworm-default
- gcc:15.2.0-arm64-debian-bookworm-default
- dockerhub

clientconfig:
run_image: redislabs/memtier_benchmark:edge
tool: memtier_benchmark
arguments: >
--key-prefix ""
--key-minimum 1
--key-maximum 100000
--data-size-range=400-600
--pipeline=1
--print-percentiles=50,90,95,99
--run-count=1
--test-time=120
--command="GET session:__key__"
--command-key-pattern=Z
--command-ratio=90
--command='SET session:__key__ "{\"userId\":\"user-__key__\",\"organizationId\":\"org-__key__\",\"role\":\"member\",\"createdAt\":\"1754905396\",\"lastAccessed\":\"1754906472\",\"ipAddress\":\"192.168.1.36\",\"device\":\"device-2T8YGLbl\",\"authMethod\":\"password\",\"status\":\"active\",\"metadata\":\"wDVmiQsSe2oSEPfhhvYN6jbVxVykSCzQXmnsqCIv5MEmpslD1LMgwJcUe8Wmhvhh56dgTDhH4o3M9vYa6JyAS3Axs2zufVVPWtTsCRVbNGjMmumy7j5vIM0OuclgbHBOxtGDtCU88YBc9IP5oNYiycXXCmq5s7mWAdmRhFrmFxOy3VKlrXJz4ZrtF6KHEflGhoF1FzXtLO8Dckg3B34kdxGsnNiRjNIEtWVxeXekUSDyrxcnwiIy29Zx8SxX2g8ZUrz3sTpEwX7KQZFpIi7XoSKZywvC6I63VMNpZcAO\"}"'
--command-key-pattern=Z
--command-ratio=10
--hide-histogram
resources:
requests:
cpus: '4'
memory: 2g

priority: 150