Repository navigation
Done
Labels
Description
Problem
- Every key-browse page, refresh and filter change scans the keyspace again from cursor 0, up to 10,000 keys, sorts them and then slices the page. With a selective MATCH on a large keyspace that is many SCAN round trips before the first page. Keys past the first 10,000 cannot be reached at all, a limit the user did not choose.
- A grid page reads up to 64 KB of every string key for a one-line preview: a 1,000-key page of large values moves and holds up to about 64 MB.
- A streamed scan or export takes about 11 round trips per 1,000 keys: about 9 minutes per 1M keys at 50 ms RTT (estimate from the round-trip count).
- On a cluster, a pipeline that spans several masters is sent to them one after another, so each page's two pipelines cost N round trips each on N masters.
Cause
executeKeyBrowsecallsscanAllKeys(maxKeys: 10_000), deduplicates through aSetand slices[offset, offset + limit)(apple/Plugins/RedisDriverPlugin/RedisPluginDriver+Scan.swift:42-68).scanAllKeyswalks fromRedisClusterCursor.startwith COUNT up tomaxKeyBrowseScanand sorts the keys (:13-40,apple/Plugins/RedisDriverPlugin/RedisPluginDriver.swift:40). Nothing keeps the cursor between pages.buildKeyBrowseResultpassesRedisStringPreview.byteLimit(65,536,apple/Packages/TableProCore/Sources/TableProRedisCore/RedisStringPreview.swift:5) as the string limit (apple/Plugins/RedisDriverPlugin/RedisPluginDriver+ResultBuilding.swift:53), so each string key becomesGETRANGE key 0 65535(apple/Packages/TableProCore/Sources/TableProRedisCore/RedisKeySummary.swift:41).streamScanRowssends SCAN COUNT 1000, splits the keys into batches ofkeySummaryBatchSize(200,RedisPluginDriver+ResultBuilding.swift:37), and for each batch awaits a TYPE+TTL pipeline and then a length+preview pipeline (apple/Plugins/RedisDriverPlugin/RedisKeyContentsRead.swift:45-86) before the next SCAN (RedisPluginDriver.swift:581-619).streamKeyRowsdoes the same after KEYS (:622-642).RedisClusterChannel.executePipelinegroups commands by node and awaits each node in turn (apple/Plugins/RedisDriverPlugin/RedisClusterChannel.swift:233-262), though each node has its own connection and queue.
Change
- Keep a scan state per tab: database, MATCH, TYPE, cursor and the keys seen so far, deduplicated. Paint the first page as soon as the SCAN replies hold
limitkeys, and continue from the saved cursor when the user pages forward. Reset it on refresh or a filter change. Sort each newly loaded batch, keep the rows of pages already shown where they are, and say in the status that the order covers the loaded keys. This removes the 10,000-key ceiling, since every page is reachable by walking on. - Size the grid's string preview to what a cell shows (1-4 KB), mark the cell truncated from the
STRLENalready fetched, and read the full value withGETwhen the value editor or detail pane opens it, as export already does. - In streams, size summary batches by keys and expected bytes like
PluginRowBatcherinstead of a fixed 200, and send the next SCAN in the same pipeline as the current batch's TYPE+TTL reads, so the server never waits on the client. - Send the per-node sub-pipelines of a cluster pipeline concurrently with a task group, then resolve MOVED and ASK replies as today.
Measure
- Open a db tab and go to the next page on keyspaces of 10k, 1M and 10M keys, with and without a selective MATCH: time and SCAN round trips per page (MONITOR or a capture). Target: one continuation SCAN per next page instead of a rescan.
- Bytes received for a 1,000-key page of 100 KB strings (
INFO statstotal_net_output_bytesdelta). - Export 100k and 1M keys locally and at +50 ms RTT: time and round trips. Target: about 2 RTT per 1,000-2,000 keys instead of 11 per 1,000.
- Page load on a 3-master cluster at +50 ms: (N - 1) x 2 RTT less.
Part of the performance plan.
Activity
datlechin commentedon Nov 25, 2026
What the first PR for this issue ships, and what is left:
RedisStatementGenerator.isShownInPart), and nothing reads the whole value when the value editor or detail pane opens it. A smaller preview without that read would lock every value between the new size and 64 KB. It needs a host path that reads one cell's full value on open, which this driver does not have yet.streamScanRowsand the cluster channel.