Repository navigation
fix(resolve): cache sessions over ducklake:postgres: catalogs, and one scan for one-off calls (#1429) - #1482
Merged
Merged
Conversation
…e scan for one-off calls (#1429) #1476 made no difference on er-dev, and its p95 got worse (p50 about 2.2 s, p95 3.9 to 7.8 s). Provisioning writes ER_LAKE_CATALOG as ducklake:postgres:..., and resolve_session_cacheable accepted only postgres:, so er-dev never kept a session. Every call then took the one-off path, which in #1476 scanned the S3 corpus twice: once to build the key table and again to fetch candidates. - resolve_session_cacheable accepts ducklake:postgres: as well as postgres:. A unit test pins the provisioned form. - ResolveCache::persistent() marks a cache that outlives the call; the server uses it. A one-off cache (resolve_record) filters the lake corpus directly in one scan, as before #1476's key table. Co-Authored-By: Claude Opus 5.5 <[email protected]>
athvin
temporarily deployed
to
marketing-preview
November 30, 2026 06:29 — with
GitHub Actions
Inactive
athvin
added a commit
that referenced
this pull request
Nov 30, 2026
…each resolve's time goes (#1495) (#1493) After #1482 er-dev resolve was p50 1660 / p95 2015 ms (pod at its 1-CPU limit). Single-threaded, as that pod runs, the local 520k benchmark is p50 260 / p95 282 ms. So er-dev's extra ~1.4 s is something only production has. The prime suspect is the dictionaries: every call dropped and re-seeded the nickname lexicon and ignore-words tables, which are tiny in the fixtures and large in production. - A persistent ResolveCache seeds the dictionaries once per content hash. - er_cli logs one 'resolve timings' event per call (seed, standardize, prefilter, prepare, predict, select, total, and the corpus candidates kept). er-server logs 'resolve inputs loaded' with the model, config and dictionary load time and the dictionary sizes. The next er-dev pass shows where any time remains. - resolve_latency_at_scale times single-threaded by default (ER_RESOLVE_THREADS), matching the pod. Co-authored-by: bmoore813 <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
athvin
added a commit
that referenced
this pull request
Nov 30, 2026
…the data files directly (#1497) (#1500) * perf(resolve): a lake-free session for DuckDB-file catalogs, reading the data files directly (#1497) er-dev's p3live keeps its catalog as a DuckDB file on EFS, so #1482's cached session never applied: every call attached the lake (~700 ms) and scanned the 259 MB corpus (~390 ms). A DuckDB-file catalog cannot be held between requests; the handle would lock out the runner pods' writes. - er_cli::detach_corpus lists, from an attached lake, the standardized corpus's and the membership's data files as read_parquet sources, plus the snapshot. It returns None, and the caller resolves through the lake, when a relation has delete files, has rows inlined in the catalog (the files' count differs from the table's), or is missing. ResolveCache::set_detached makes resolve_record_cached read those sources: corpus, prefilter key cache keyed by the change stamp, membership join, and snapshot. - er-server: a file-catalog dataset keeps an in-memory session and cache per env. The stamp is the mtime and size of the catalog file and its .wal. The lake is opened only when the stamp changes, to re-list the files, and then closed. Each call runs without a lake handle and reads only the candidates' rows. A failed resolve drops the session. a_detached_resolve_matches_the_lake_resolve: on base_10, a detached resolve equals the lake resolve (decision, candidates, probabilities, entity ids, snapshot), twice over the cached session. pg_launch_proof, whose lake is a local DuckDB file, passes on the detached path, including the run that writes the lake between resolves. er-cli resolve tests pass (8). Co-Authored-By: Claude Opus 5.5 <[email protected]> * refactor(lake): list a relation's data files in the engine core (#1497) The freeform_sql gate allows no free-form lake reads outside dedupe-core. The catalog file listing and the row-count check behind detach_corpus are DuckLake mechanics, like lake_table_exists, so they move to Session::lake_data_files. er-cli only builds the read_parquet source from its answer. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: bmoore813 <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
This branch was previously deployed
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.
Closes #1429
What
resolve_session_cacheableacceptsducklake:postgres:…, the form provisioning writes, as well aspostgres:. A unit test pins the provisioned form.ResolveCache::persistent()marks a cache that outlives the call, and the server uses it. A one-off cache (resolve_record) filters the lake corpus directly in one scan, as before perf(resolve): a cached session per dataset and a blocking prefilter, ~5x faster at 520k (#1429) #1476's key table.Why
#1476 made no difference on er-dev, and its p95 got worse. Measured by the project-2 session on
5f1e3bb9against p3live, 55 calls each pass:The web-api pod sat at 825m of its 1-CPU limit.
Cause: provisioning writes the catalog as
ducklake:postgres:…, and the cacheability check accepted onlypostgres:. So er-dev never kept a session, and every call took the one-off path. In #1476 that path scanned the S3 corpus twice: once for the key table, once for the candidates.Proof
only_a_postgres_catalog_caches_resolve_sessionscoversducklake:postgres:.acct_(12) pass.resolve_latency_at_scaleuses the persistent cache, and its answers still equal the uncached call's.make check: exit 0.Risk & rollback
er-dev now actually keeps a resolve session per dataset, as #1476 intended: a narrow key table (tens of MB at 520k) plus the TF tables, at most 32 envs. Rollback is
git revert <merge-sha>.Post-merge ledger
Closed by: unclosed
mainis green with this change on it — the merge SHA, and the runthat proves it. A later head SHA with this commit as an ancestor counts;
a cancelled run with zero jobs does not:
imagesbuilt, or correctly never ran because nothing that goes intoan image changed:
deployconverged — proved by a line the running process emitted, notby the image digest and not by the workflow conclusion:
deploy,drift,kind's nightly leg) is green, or knowingly red for a reason that is notthis change:
Donethrough the automation rather than byhand, and the issue closed:
(a skill, a reference, memory) — or nothing new was learned:
Specific to this change
🤖 Generated with Claude Code