Skip to content

perf(redis): page keys from a saved scan cursor and send cluster pipelines at once - #4586

Merged
datlechin merged 5 commits into
mainfrom
perf/redis-scan-cursor
Nov 26, 2026
Merged

datlechin merged 5 commits into
mainfrom
perf/redis-scan-cursor

Conversation

@datlechin

Copy link
Copy Markdown
Member

Summary

  • Key browse pages walk forward from a saved SCAN cursor instead of rescanning the keyspace from cursor 0 for every page. The walk (RedisKeyBrowseWalk, TableProRedisCore) keeps the cursor and the keys seen so far, once each, per database, MATCH and TYPE.
  • The first page paints as soon as the SCAN replies hold its keys. A later page continues the walk; the first page and the page on screen asked for again (Refresh, a changed filter) start over.
  • The 10,000-key ceiling is gone for paged browsing: every page is reachable by walking on. A browse that asks for every key at once still stops at 10,000 and says so.
  • Each load is sorted on its own and appended, so rows already shown keep their place. While keys remain on the server the status says the order covers the loaded keys.
  • A cluster pipeline sends its per-node parts concurrently with a task group, then resolves MOVED and ASK as before, so a page on N masters costs one round trip per pipeline instead of N.

Left for later, in a comment on #4549: sizing the grid's string preview to the cell needs a full-value read when the editor opens a shortened value (today a shortened value cannot be edited inline, so a smaller preview would lock more values); pipelining the next SCAN with a stream batch's reads.

Test plan

  • RedisKeyBrowseWalkTests (TableProRedisCore): per-load sorting keeps earlier rows, duplicates dropped, continuation and restart rules.
  • RedisKeyBrowsePagingTests (RedisDriverTests): the second page sends one SCAN from the saved cursor (SCAN 0, then SCAN 7), a page past 10,000 keys is reached, Refresh rescans, a new MATCH starts its own walk, a browse of every key keeps its offset, and an offset at Int.max does not overflow. On main the second page sends SCAN 0 again.
  • RedisClusterChannelTests/pipelinePartsKeepOrder: one part per node, replies in send order.
  • RedisKeyBrowseWalkTests pass locally under swift test. The RedisDriverTests suites run on CI; the local test runner queue was full. verify.sh build RedisDriver and lint pass.

Closes #4549

…lines at once

Every key browse page scanned the keyspace again from cursor 0, up to 10,000
keys, then sliced the page. A walk per database, MATCH and TYPE now keeps the
cursor and the keys seen, so the next page continues from where the last one
stopped and paints once the replies hold it; each load is sorted on its own.
A cluster pipeline sends its per-node parts concurrently.
@datlechin
datlechin enabled auto-merge (squash) November 26, 2026 01:51
@datlechin
datlechin merged commit 77cff41 into main Nov 26, 2026
11 checks passed
@datlechin
datlechin deleted the perf/redis-scan-cursor branch November 27, 2026 16:37
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.

perf(redis): page keys with a saved scan cursor and overlap the pipelines

1 participant