Skip to content

test-suites: add three ZSCAN full-walk specs using memtier cursor iteration - #574

Merged
fcostaoliveira merged 3 commits into
redis:mainfrom
fcostaoliveira:zscan-incremental-iteration-specs
Sep 20, 2026
Merged

fcostaoliveira merged 3 commits into
redis:mainfrom
fcostaoliveira:zscan-incremental-iteration-specs

Conversation

@fcostaoliveira

@fcostaoliveira fcostaoliveira commented Sep 20, 2026 •

Copy link
Copy Markdown
Collaborator

Why

The existing ZSCAN specs re-issue cursor 0 on every call, so they only ever measure the first page of a ZSCAN (cursor progression, rehash safety and late-page cost are never exercised). memtier_benchmark now follows the cursor returned by ZSCAN — --scan-incremental-iteration extended to the key-scoped SCAN commands in redis/memtier_benchmark#539 — so this adds full-traversal companions for the three shapes that matter. Purely ZSCAN. The existing first-page specs keep their commands, preloads and encodings; the only touch to existing files is that the two specs loading the identical zset:1000 payload take the same accurate dataset_name/dataset_description as the new 1K spec (one physical dataset, one label).

New specs

spec dataset (same as its first-page sibling) walk
memtier_benchmark-1key-zset-200K-elements-zscan-count-10-incremental-iteration zscan200k, 200,000 short members, score 0, skiplist default COUNT → ~20,000 cursor round-trips per walk
memtier_benchmark-1key-zset-200K-elements-zscan-count-1000-incremental-iteration same COUNT 1000 → ~200 reply-construction-dominated pages per walk
memtier_benchmark-1key-zset-1K-elements-zscan-incremental-iteration zset:1000, 1,000 members with 6-decimal scores, skiplist default COUNT (bare ZSCAN zset:1000 0, like its sibling) → ~100 pages per walk; every emitted score takes the non-integer formatting path

Client: --command "ZSCAN <key> 0 COUNT n" --scan-incremental-iteration --pipeline 1 -c 50 -t 4 --hide-histogram --test-time 180. Each client keeps its own cursor, walks until the server returns 0, then starts over. memtier reports the initial ZSCAN 0 requests and the ZSCAN <cursor> continuations as separate rows; the exported Totals covers both. --pipeline 1 is required by the iteration mode. Descriptions state encoding, metric (Ops/sec) and the memtier requirement.

Validation

  • redis-benchmarks-spec-cli --tool stats --fail-on-required-diff on the branch: exit 0.
  • Each spec run end-to-end (preload/init and client arguments taken verbatim from the YAML) against a Redis unstable server with a memtier built from ci: fix update-in-place comment corruption (gh api -f -> -F) #539's head (45043d4), 20 s runs, one core for the server:
spec Zscan 0s ops/s Zscan <cursor>s ops/s Totals ops/s server cmdstat_zscan calls
200K, COUNT 10 9.99 55,449 55,459 1,109,955
200K, COUNT 1000 9.98 1,619 1,629 32,668
1K, fractional scores 620 58,550 59,170 1,183,850

Zscan 0s is exactly one initial request per connection (200 connections / 20 s ≈ 10/s) on the 200K specs, whose walks are longer than the 20 s window; on the 1K spec walks complete ~100 pages each. Three repeats of each spec (40 s) landed within 1.2% / 2.4% / 5.6% of each other on the same laptop.

Note

These specs need a memtier image that includes redis/memtier_benchmark#539 (redislabs/memtier_benchmark:edge once it is merged); on an older build memtier exits with --scan-incremental-iteration requires the command to be a SCAN command and the run produces no data.


Note

Low Risk
Benchmark YAML and metadata only; no Redis server or application runtime changes, though CI needs a memtier image that supports ZSCAN incremental iteration.

Overview
Adds three memtier benchmark specs that measure full ZSCAN traversals via --scan-incremental-iteration and --pipeline 1, pairing with existing first-page-only ZSCAN suites: 200K-member sets at COUNT 10 and COUNT 1000, and 1K members with fractional scores (non-integer score formatting).

Also corrects dataset metadata on memtier_benchmark-1key-zset-1K-elements-zrange-all-elements and memtier_benchmark-1key-zset-1K-elements-zscan: replaces the misleading 1key-sorted-set-32B-size label with 1key-zset-1K-elements-fractional-scores and an accurate description. New specs depend on memtier with ZSCAN cursor iteration (e.g. redislabs/memtier_benchmark:edge / memtier_benchmark#539).

Reviewed by Cursor Bugbot for commit bfe8acf. Bugbot is set up for automated code reviews on this repo. Configure here.

…ration

The existing ZSCAN specs re-issue cursor 0 on every call, so they only ever
measure the first page of a ZSCAN. memtier_benchmark now follows the cursor
returned by ZSCAN (--scan-incremental-iteration, redis/memtier_benchmark#539),
so add full-traversal companions for the three shapes that matter:

- 1key-zset-200K-elements-zscan-count-10-incremental-iteration
  (200K members, default COUNT: ~20,000 cursor round-trips per walk)
- 1key-zset-200K-elements-zscan-count-1000-incremental-iteration
  (200K members, COUNT 1000: ~200 reply-construction-dominated pages per walk)
- 1key-zset-1K-elements-zscan-incremental-iteration
  (1,000 members with non-integral scores: every emitted score takes the
  non-integer formatting path)

Datasets, key names and encodings are the same as the first-page siblings so
the two numbers can be read side by side. Each client keeps its own cursor,
walks until the server returns 0 and starts over; memtier reports the initial
"ZSCAN 0" requests and the "ZSCAN <cursor>" continuations separately and the
exported Totals covers both. --pipeline 1 is required by the iteration mode.
The existing first-page specs are left untouched.
@github-actions

github-actions Bot commented Sep 20, 2026 •

Copy link
Copy Markdown

🤖 Automated first-pass review — a human maintainer's review is still required before merge. This was a single read-only pass over the PR description, diff and the sibling specs already on main; nothing here was executed.

The three specs can't produce data until memtier #539 is in redislabs/memtier_benchmark:edge. The PR note already says this, and there's no way to defend it in-file: every memtier spec under test-suites/ runs run_image: redislabs/memtier_benchmark:edge, so there's no pinned tag to fall back on and nothing in the YAML that can gate on a client-side feature. Until that image carries the change, all three exit with --scan-incremental-iteration requires the command to be a SCAN command and leave a hole in the series rather than degrading to a first-page number. Worth sequencing the merge behind #539 landing and an edge rebuild rather than landing now and letting the fleet pick them up on the next commit.

Separately, not a blocker: the 1K spec gives the zset:1000 dataset a third name. Its init_commands payload is identical to memtier_benchmark-1key-zset-1K-elements-zscan.yml (same members, same scores), and that spec plus memtier_benchmark-1key-zset-1K-elements-zrange-all-elements.yml both label it dataset_name: 1key-sorted-set-32B-size; the new file calls it 1key-zset-1K-elements-fractional-scores. dataset_name isn't purely cosmetic — __runner__/runner.py accumulates unique_datasets from it and uses it as the preload-dedup key in memory-comparison mode, and __self_contained_coordinator__/parca_agent.py emits it as a profiling label — so one physical dataset under two labels splits those groupings. (The dedup path is preload_tool-only, so an init_commands spec won't actually skip a load; it's the labelling that diverges.) The new name is the more accurate of the two, since 1key-sorted-set-32B-size says nothing about 1,000 elements or fractional scores — so either reuse the existing label here or rename all three in one pass, whichever you'd rather.

Everything else lines up with what's already merged: the 200K preload is copied verbatim from the two existing 200K ZSCAN specs, including the single-__key__/literal-score shape that avoids the range-boundary off-by-one; tested-groups, tested-commands and priority: 53 match the siblings; the exported Totals jsonpaths in defaults.yml do cover both the ZSCAN 0 and continuation rows as the description claims; and both Validate SPEC fields and Stream field contract are green on this PR. The "~100 cursor round-trips per walk" figure in the 1K description also checks out against the 59,170/620 ≈ 95 calls per walk in your own validation table.

So the specs themselves look right to me — the only thing I'd hold on is the memtier image ordering.

…ommand like its sibling

dataset_name/description no longer inherit the sibling's stale
"1key-sorted-set-32B-size" / "redis set data structures" label; the
client command drops the explicit COUNT 10 so it matches
memtier_benchmark-1key-zset-1K-elements-zscan exactly (COUNT 10 is the
server default, as the description states).
@fcostaoliveira

Copy link
Copy Markdown
Collaborator Author

Thanks — both nits taken in f8b9e33:

  • The 1K spec now carries its own dataset label (1key-zset-1K-elements-fractional-scores, "1 sorted set key with 1,000 elements, each member a 10-byte alphanumeric string with a non-integral 6-decimal score") instead of the inherited "32B-size / set data structures" text.
  • Its client command is now the bare ZSCAN zset:1000 0 so it matches memtier_benchmark-1key-zset-1K-elements-zscan exactly; the name stays without -count-10 for the same reason (the 200K default-COUNT spec keeps -count-10- in its name because it also spells the COUNT explicitly, like its own sibling family).

On the merge ordering: agreed, and it is the plan — this PR is not to be merged (nor a release cut) until redis/memtier_benchmark#539 has merged and redislabs/memtier_benchmark:edge has been rebuilt from it; the specs will be exercised on a runner with that image before any release.

The two existing specs that load the identical zset:1000 payload
(1K-elements-zscan, 1K-elements-zrange-all-elements) take the same
accurate dataset_name/dataset_description as the new full-walk spec, so
the runner's unique-dataset accounting and the profiling label see one
dataset. Metadata only; commands, preloads and encodings are unchanged.
@fcostaoliveira

Copy link
Copy Markdown
Collaborator Author

Went with "rename all three in one pass" in bfe8acf: memtier_benchmark-1key-zset-1K-elements-zscan.yml and memtier_benchmark-1key-zset-1K-elements-zrange-all-elements.yml now carry the same 1key-zset-1K-elements-fractional-scores label and description as the new spec, so the identical zset:1000 payload has one name for the unique-dataset accounting and the profiling label. Metadata only — their commands, init payload and encodings are unchanged. PR description updated to say so.

@fcostaoliveira

Copy link
Copy Markdown
Collaborator Author

Pre-merge stability check on real hardware, with the edge image built from redis/memtier_benchmark#539 (sha256:356231d6…, 2026-09-20): the three specs were copied onto two runners and redis/redis unstable was run through them on three distinct tips (5f08991bce, c00f920b2a, 16e021b465), one run per tip, spec arguments exactly as in this PR (180 s, -c 50 -t 4).

spec Graviton4 (arm-aws-m8g.metal-24xl) ops/s, n=3 CV Sapphire Rapids (x86-aws-m7i.metal-24xl-2) ops/s, n=3 CV
…200K-elements-zscan-count-10-incremental-iteration 114,681 (114,660–115,500) 0.3% 115,548 (113,479–116,367) 1.1%
…200K-elements-zscan-count-1000-incremental-iteration 2,892 (2,847–2,909) 0.9% 3,717 (3,707–3,735) 0.3%
…1K-elements-zscan-incremental-iteration 118,849 (118,748–118,943) 0.1% 116,954 (116,864–116,985) 0.0%

Every run produced a datapoint and the run-to-run spread is ≤ 1.1% on both architectures. For reference, the first-page siblings on the same boxes sit at ~124–128K ops/s (200K, COUNT 10), ~2.9–3.8K (COUNT 1000) and ~119–123K (1K): the full walk costs a few percent more per page than the first page at COUNT 10 and about the same at COUNT 1000, as expected.

@fcostaoliveira
fcostaoliveira merged commit 3ad53eb into redis:main Sep 20, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant