Repository navigation
fix: share immutable MongoDB configuration across request clones - #201
Merged
Merged
Conversation
Merged
codedmart
added a commit
that referenced
this pull request
Nov 3, 2026
Bumps the workspace to `2.1.5` and adds the changelog entry for #201: - Share immutable MongoDB configuration across router-state and per-query clones instead of deeply copying it, reducing memory usage for large static schemas. Follows #200 and #196: only `Cargo.toml`, the workspace package versions in `Cargo.lock`, and `CHANGELOG.md` change. No dependency updates or CI workaround are included. After merge: tag `v2.1.5` on the merge commit, check that the draft release's `connector-definition.tgz` has `ghcr.io/hasura/ndc-mongodb:v2.1.5` and non-empty `sha256` values, then publish and update ndc-hub. No tag or release is created by this PR. Validation: `cargo check --workspace` and `cargo check --workspace --locked` both passed with Rust 1.94.1. The lockfile diff contains only the ten workspace-package version bumps; no external dependency or checksum changes. Hosted checks run normally; the separate MongoDB 8.3.13 / hosted Ubuntu kernel-detection failure has not been bypassed or changed in this version bump.
codedmart
added a commit
to hasura/ndc-hub
that referenced
this pull request
Nov 3, 2026
Release [ndc-mongodb v2.1.5](https://github.com/hasura/ndc-mongodb/releases/tag/v2.1.5): share immutable configuration across router-state and per-query clones instead of deeply copying it, reducing memory usage for large static schemas ([hasura/ndc-mongodb#201](hasura/ndc-mongodb#201)). - Set MongoDB's latest version to `v2.1.5`. - Add release packaging with the tagged commit `74d85cae7b869f71987b3ddfd8551ab76901ad53` and the existing MongoDB e2e test configuration. - Use SHA-256 `f0da724690e1a609022b6613d009c4ad14ec38ac4e77fe4d5b1733c72497e58e`, calculated from the downloaded `connector-definition.tgz` and matched to GitHub's release-asset digest. The release workflow completed successfully and the release is published. Verified that the archive references `ghcr.io/hasura/ndc-mongodb:v2.1.5` and all five CLI-plugin downloads match the embedded hashes, release `sha256sum`, and GitHub asset digests. Only the two registry files change, following #758 and the registry portion of #764. No workflow, DDN workspace, test, or unrelated connector changes. The repository's Go validators passed for MongoDB latest-version metadata, the downloaded packaging checksum and existing test configuration, and the downloaded connector metadata spec. Hosted CI/e2e checks will run normally; those have not been claimed as passing locally. No hub merge or publication is performed by opening this PR.
3 tasks
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.
Summary
Share immutable
ConfigurationwithArcinsideMongoConfigurationinstead of deeply cloning the full configuration on router-state and per-query clones.MongoConfiguration::newand migrate production/test construction sites.Arcdereferencing.Why
With a large static schema, deriving
Cloneon the owned configuration causes expensive full copies at the SDK state-clone boundary and again during static configuration resolution. Sharing immutable data avoids the transient allocations and their glibc retained-RSS aftermath.Validation
The memory experiment used an isolated VM, local MongoDB and synthetic data only—not customer configuration or traffic. Matched source builds were made from v2.1.1 (
8f5d1314d282355ab91c46259428d0ffc1071a6a) using the same Cargo.lock, Rust 1.94.0 and release profile. Both ran with the original pinned release-image glibc 2.40 loader/libraries and equal container limits. The only production-source difference in that A/B was this patch. The local baseline is not bit-identical to the published release binary.Large-schema fixture: 12,001 object types / 10,584,163 JSON bytes; tiny
/queryresult of 4,129 bytes; 4 workers × 24 requests × 3 bursts, with fully drained 60-second idle windows. Same schema file, query, MongoDB data and runtime for both builds.Final idle RSS was 87.5% lower. All 72 requests per variant succeeded and all response bytes/SHA-256 hashes matched. Pre-query RSS is also lower because configuration clones during server/router setup now share the same allocation. Observed peaks are lower bounds from 100 ms sampling.
Controls:
All eight A/B runs completed: 504/504 requests succeeded, all baseline/shared response sizes and SHA-256 hashes matched, no OOMs, and no active client requests in any idle sample.
cargo test --locked --release --package mongodb-agent-common --package mongodb-connectorpassed 301 tests on the patched v2.1.1 build, including both new sharing regressions. MongoDB-backed feature-gated relational integration tests were not enabled.This PR is based on current
main(041108675cc096e16d97a94e2ce6a2c80f8f45a0, v2.1.4), not the old release. All 14 touched Rust files are unchanged between the A/B source revision and that base, so the exact tested diff applies without adaptation.mainhas newer dependencies/toolchain. The same package-test command also passed 301/301 tests on the actual PR commit5700496with current-main dependencies and Rust 1.94.1, including both new sharing regressions. This is separate from the v2.1.1 memory measurements. Feature-gated MongoDB-backed integration tests were not enabled locally; the broader GitHub CI suite is still running. No current-main memory A/B is claimed.Interactive report and raw evidence (HasuraQL access required). Evidence includes source patch, compiler record, RSS/allocator CSVs, full-response hashes and reproduction instructions. No fixture bulk or VM tooling is included in this code PR.
Scope and limitations
This establishes the configuration-copy amplification in the synthetic static-config case. It does not establish the cause of a customer's incident, exclude an independent leak, cover live reload, or recommend
malloc_trimin production. No customer/production changes were performed. Human review is requested; no approval or merge has been performed.