Repository navigation
perf(db): batch move redirect learning and reference updates - #447
Merged
Merged
Conversation
nixuuu
force-pushed
the
perf/db2-18-redirects
branch
from
November 9, 2026 18:26
de980e6 to
c9e1daf
Compare
nixuuu
marked this pull request as ready for review
November 9, 2026 18:31
nixuuu
force-pushed
the
perf/db2-18-redirects
branch
from
November 9, 2026 20:02
c9e1daf to
de19ad4
Compare
This was referenced Nov 9, 2026
nixuuu
added a commit
that referenced
this pull request
Nov 9, 2026
Move previews used a complete exported bot conversation just to list reconnectable account names. The preview now fetches only the required metadata. Move dependency inspection resolves bot/thread headers in two owner-scoped grouped reads. ## Measurement Two warmups, 20 samples. One bot has 2,048 additional 4 KiB messages; 32 connectors; inspection covers 16 bots and 8 threads. | Operation | Queries before → after | p95 ms before → after | Rows before → after | Decoded bytes before → after | |---|---:|---:|---:|---:| | Bot move preview | 6 → 6 | 272.35 → 4.25 | 4 → 35 | 10,255,669 → 2,345 | | Inspect 24 dependencies | 24 → 2 | 6.35 → 1.93 | 24 → 24 | 1,624 → 1,602 | ## SQL audit | Statements / path | Verdict | |---|---| | moves-preview.ts: bot preview | Connection-name metadata only; no conversation export/decode. | | moves-preview.ts: inspect | Batched bot/thread/project headers; owner predicate includes side threads. | | move source/target durability | Export and transfer behavior unchanged; not measured as a preview optimization. | | computers/redirects.ts | Separate audit/optimization on the final redirect layer; not claimed covered by preview changes. | Real service without transport; inspection response is synthetic. Full move gRPC tests cover transfer/restart/owner behavior; transport serialization is not measured. ## Method and stack validation Synthetic data only, private PostgreSQL 18 (2 CPU, 1.5 GiB, max_connections=40; ordinary measurement pool 8 unless stated). Latency runs without tracing; a separate diagnostic pass counts SQL including transaction controls, returned rows and decoded JSON representation bytes, and captures EXPLAIN (ANALYZE, BUFFERS). These bytes are not wire traffic, scanned bytes or disk I/O. Shared-host observations are not production SLOs. Raw results, hosts and datasets are not committed. All layers remain **ready for review**, as requested by the maintainer. The bottom targets dev; descendants target the preceding branch. The stack is rebased on **dev 6e5a371**, including the client and sync performance stacks, #418, #426, #429, #449, #450, #451, #452 and #453. New migrations are **0103–0109**, following **0102_bot_composer**, the schema expectation is updated, and no new index duplicates turns_composer_choices or overlaps bot_composer tables/indexes. Full top-branch gates and remaining audit gaps are recorded in the top PR. CI remains the full gate. Polish documentation is updated; no UI text changes, so the copy audit does not apply. The SQL audit table describes the statements reviewed for this layer. It does not claim that the repository's entire static SQL inventory has received a large-dataset EXPLAIN. ## CI mirror-list investigation The original layer-14 head `200edb16` passed the unchanged repeated-blackhole case 10/10 times (108.06 seconds, clean temp directory). Dev `618cbd15` at diagnosis passed its ordinary run too. In CI, every committed worker/project/thread retention assertion passed before the failing assertion: `awayReason(peer)` was still undefined. Connection tracking removes the ready transport before awaiting the SQL presence update. The test waited only for transport disappearance and then assumed the overview's persisted presence had already changed. A temporary 100 ms delay before persisting `unreachable` reproduced the exact assertion on **both dev and layer 14** (4,897 ms and 4,875 ms respectively). Waiting for both transport readiness and the overview's actual presence made that same delayed experiment pass (11.53 seconds). The temporary injected delay is not committed. The permanent test correction, placed on the bottom layer so every PR receives it, polls the real overview presence on both disconnect and recovery. Every poll still checks committed workers, projects, threads and the 500 ms local-list bound. The linked fixture does not run the pruning job; active mirror generations remain excluded from pruning. No production mirror, lease, presence or retention behavior is changed by this correction. The existing retention/mirror integration tests remain part of the focused revalidation. The corrected repeated-blackhole case passed **10/10 rounds in 110.24 seconds**, with a clean temp directory. Focused retention (5), durable mirrors (20), mirror listing (3), migration/index (28) and bot composer/routine (17) tests also passed. These focused runs used top head `1c4f213f`, before the subsequent dev refreshes; the final top-branch full run is recorded in #447.
This was referenced Nov 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Move redirect handshake learning performed one local-object lookup, one durable write and one reference update per notice. It now groups local-object reads, persists at most 128 distinct IDs per statement and updates distinct target references together. Identical replay uses the restored map and does no SQL.
Measurement
Three rounds, two warmups and 20 samples each; 256 notices, half bots and half threads, no live local targets. Reset and map loading are outside timing. Real Redirects service, no transport.
The first lookup-only experiment still had new-redirect p95 2,133.23 ms and 514 queries, so it was rejected. EXPLAIN showed tiny individual lookups/writes (roughly 0.01–0.42 ms); 256 separately committed inserts dominated the service path. The accepted version groups durable writes as well. No claim is made for large populated reference tables; the performance fixture's reference table is empty.
SQL audit
Move suite passed seven tests; additional owner/durability tests verify two owners, local bots/threads, spoofed senders, stale/equal-time notices, restart and reference isolation. A final regression check also verifies that uppercase UUIDs retain single-notice deduplication and routing after reload. No sync transport/client-stream/computer-link changes overlap the other delegate.
Method and stack validation
Synthetic data only, private PostgreSQL 18 (2 CPU, 1.5 GiB, max_connections=40; ordinary measurement pool 8 unless stated). Latency runs without tracing; a separate diagnostic pass counts SQL including transaction controls, returned rows and decoded JSON representation bytes, and captures EXPLAIN (ANALYZE, BUFFERS). These bytes are not wire traffic, scanned bytes or disk I/O. Shared-host observations are not production SLOs. Raw results, hosts and datasets are not committed.
All layers remain ready for review, as requested by the maintainer. The bottom targets dev; descendants target the preceding branch. The stack is rebased on dev 6e5a371, including the client and sync performance stacks, #418, #426, #429, #449, #450, #451, #452 and #453. New migrations are 0103–0109, following 0102_bot_composer, the schema expectation is updated, and no new index duplicates turns_composer_choices or overlaps bot_composer tables/indexes. Full top-branch gates and remaining audit gaps are recorded in the top PR. CI remains the full gate. Polish documentation is updated; no UI text changes, so the copy audit does not apply.
The SQL audit table describes the statements reviewed for this layer. It does not claim that the repository's entire static SQL inventory has received a large-dataset EXPLAIN.
Remaining across the stack
This is a ready stack with an incomplete statement-level SQL audit. At the previous publication, the static inventory contained 2,177 statement/fragment locations across 311 files. It includes DDL, transaction controls, triggers and overlapping/dynamic fragments, so it is not a count of distinct executable application queries. The historical diagnostic snapshot on the plan-capture layer matched 380 of 2,171 locations to plan templates; those numbers are not current-revision or complete large-dataset coverage.
A pre-rebase diagnostic pass on head
3381f50bran 22 standard benchmark operations with--explain-writes --iterations 1: 80 plans, 58 unique fingerprints, zero plan errors, zero skipped plans, 64 candidate source locations matched and 16 plans unmatched. There are 2,113 locations without evidence from that revision's pass, including DDL/controls/dynamic fragments. The fixture used 240 threads, a 2,048-turn long thread, 4 KiB content, large import/command queues and approximately 201 MiB of database storage. That publication's post-rebase static inventory had 2,177 locations across 311 files; it was not refreshed for the latest dev base, and plan matches were not reassigned across revisions. This refresh does not replace paired latency evidence or prove execution of every matching call site; historical and current line matches are not combined.The overview scratch-lock fast path was removed before publication because the user's repeated-load criterion rejected its streaming-ingest regression. The concurrency/overview layer retains the benchmark and all three before/experimental-after rounds in its Remaining section. No approval is inferred for that rejected change.
CI repair and revalidation
Rebased top head:
de19ad424da6601523792908dc1fdef2030c608c, source tree15f769e5b291fdec6665c40170b505e969197fda, based on dev6e5a37188f41381d3d94153d34fa328359d29fe4(including #429, #449, #450, #451, #452 and #453). All 18 layers remain ready, as requested by the maintainer. The seven DB2 migrations are now 0103–0109, in the layers that introduce them. SQL file contents are byte-identical renames; schema expectations and Polish docs are updated. The base's0102_bot_composeris preserved, no DB2 index overlaps its tables/indexes orturns_composer_choices, and the retention policy explicitly preserves bot composer drafts and attachments.Both CI failures were test synchronization races that also occur on dev, not demonstrated production regressions in the performance layers. The slow-read test included roughly 10 seconds of RPC admission wait in its 20-second timeout assertion; the repeated-blackhole test read overview presence before the asynchronous presence write committed. The corrected waits live on the bottom layer so every PR receives them. Full original-head/dev diagnostics, including a controlled 100 ms presence-write delay that reproduces the exact #443 assertion on both, are documented in #439 and #443. No diagnostic instrumentation is committed and no production timeout, mirror, lease or retention behavior is relaxed. The #442 enqueue type alias keeps the combined #449/routine changes within the function size limit without changing SQL/runtime behavior.
Focused validation on prior top
1c4f213f: 104 pass, 0 fail, including three complete timeout-file rounds (21 tests), ten repeated-blackhole rounds, migration/index tests (28), retention (5), durable mirrors (20), mirror listing (3) and bot composer/routines (17). Every temp-directory check passed. Subsequent dev refreshes include gateway/configuration, protocol, mobile and web changes; this focused result is historical, and the final top-head full run is recorded separately below.On prior head
3baeb92f, all local gates passed, including a complete foregroundbun run check:tmp: 2,022 tests, 163 skips, 0 failures, 24,835 assertions across 367 files in 1,018.18 seconds, with nothing left in the checked temp directory.On final head
de19ad424da6601523792908dc1fdef2030c608c,bun install,bun run gen:check, fullbun run typecheck(including scripts/tools),bun run lint,bun run format:checkand the web build all passed. The complete foregroundbun run check:tmppassed 2,035 tests, 163 skips, 0 failures, 25,556 assertions across 370 files in 995.54 seconds. The temp-directory check passed. Both previously failing scenarios passed in this run: repeated blackholes in 9,964.81 ms and slow live reads in 32,017.39 ms. The working tree is clean.Paired latency measurements in the individual layers were not rerun during this CI repair. Their original methods and limitations remain documented. Local validation does not replace the full CI gate on every current stack head. CI status after the lease-protected restack push is recorded separately below, especially for #434, #435, #442 and #445.
Current-head CI publication snapshot
After the atomic push with explicit per-branch force-with-lease checks, all 18 current heads have a CI workflow run (queued or in progress). None is missing CI, including #434, #435, #442 and #445. The aggregate
Typecheck, tests, buildsmust still pass on every layer before merge; this snapshot does not claim green CI. All PRs remain ready (isDraft=false), with no approving review recorded. Snapshot: 2026-11-09, approximately 20:05 UTC.perf/db2-1-imports6dc7ed8b0f0c795e3d1bb4daaa87805fb68541ecperf/db2-2-online-indexes36841847211f8470492b65efc0599453eddea607perf/db2-3-schedulesf9ba88510c460e5d17dfca76acd96720bf9193f2perf/db2-4-retentione1c0676cdbfffd6c6bba003a0b3c5b42ef9842e1perf/db2-5-bounded-reads9ad42f78c85d99f8d3a09fda11ce7fd8de00dbadperf/db2-6-overview73cb9fa3bc1a52c1c2c2682562550af51e7b6cf7perf/db2-7-snapshot-decoding94185a553b84bdb16cc248bc6e76f74d7f0e1a21perf/db2-8-audit-plansdceeb2dcf860aecc4cd988f2036a655d2839d15bperf/db2-9-config-stores4b8583f43937dea79e4f0a08ac27bd52c3b6970cperf/db2-10-lifecycleb8ce40857b2d878961a014b16b90ad723eb80d4bperf/db2-11-skill-reads105f47aa7e18ae81850a4ccf1d8b9c0e1a3a790eperf/db2-12-secret-queues935f16adfa0c8f1d4cf56508851a665cea218ba9perf/db2-13-routines4896642250c8962e593d451f0ff5780ef61aee4fperf/db2-14-move-previews3e086ff0a89af5a5ead37c02386fddde294ab551perf/db2-15-config-blobs59f015d96c6a3cbcc26ba2cf77a7dd350bdd3449perf/db2-16-bot-configf612a949d3a833fb320f72805a92d63f3398c96fperf/db2-17-config-records2ba4ff15d9d516dba1161d9e25bda66d48be366cperf/db2-18-redirectsde19ad424da6601523792908dc1fdef2030c608c