Repository navigation
feat: add CDC lazy chunking and delete delay to Helm chart - #1083
Conversation
|
This change is part of the following stack: Change managed by git-spice. |
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request enhances the Helm chart by integrating support for new CDC lazy chunking configuration options. This allows users to fine-tune the behavior of lazy chunking, including the number of background workers and the delay before deleting compressed NAR files, directly through their Helm values, ultimately improving Time To First Byte (TTFB) by enabling asynchronous chunking. Highlights
Changelog
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request adds support for CDC lazy chunking to the Helm chart. The changes to values.yaml and the chart tests are well-implemented. I've provided two suggestions for improvement: one to simplify the Helm template logic in configmap.yaml for better maintainability and adherence to concise boolean expressions, and another to correct the feature description in CDC.md to more accurately reflect its behavior and comply with documentation formatting rules.
8cefa7f to
28d9595
Compare
8e48cfb to
3dc4fe3
Compare
28d9595 to
91037f0
Compare
f6c88ed to
e6201e2
Compare
Add support for the new CDC lazy chunking configuration options in the Helm chart and documentation: - Add lazyChunkingEnabled, backgroundWorkers, and deleteDelay to values.yaml - Update configmap template to render the new CDC flags - Add tests for the new CDC configuration options - Update CDC documentation with lazy chunking section and new parameters This enables users to configure lazy chunking behavior directly from their Helm values, including the delay before deleting compressed NAR files after chunking completes.
- Simplify lazy-chunking-enabled rendering in Helm configmap template - Fix lazy chunking behavior description in CDC documentation Co-Authored-By: Claude Opus 4.6 <[email protected]>
e6201e2 to
b6b4dc8
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1083 +/- ##
=====================================
Coverage 5.04% 5.04%
=====================================
Files 6 6
Lines 436 436
=====================================
Hits 22 22
Misses 410 410
Partials 4 4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Documentation Updates 2 document(s) were updated by changes in this PR: Cache and Storage Configuration FlagsView Changes@@ -209,10 +209,16 @@
**Behavior:**
-When lazy chunking is enabled (the default), NAR files are:
-1. Stored compressed without chunking (with `total_chunks=0` in the database)
-2. Served immediately from storage when requested
-3. Chunked asynchronously in the background by worker processes
+When lazy chunking is enabled (the default), NAR files are stored in their original compressed format first, then chunked in the background. When a new NAR is added to the cache:
+
+1. The NAR is downloaded from upstream and stored in its original compressed form (e.g., xz, zstd) in a temporary location
+2. The associated narinfo is immediately normalized to `compression: none` and stored in the database, signaling that the NAR will eventually be served from chunks
+3. The first client request for the NAR is served by decompressing the temporary file on the fly, ensuring fast Time To First Byte (TTFB)
+4. In the background, the NAR is asynchronously chunked from the temporary file
+5. Once chunking is complete, subsequent requests are served from the newly created chunks
+6. The temporary compressed file is deleted
+
+The `deleteDelay` parameter applies when migrating an existing whole-file NAR to chunks, not to new NARs. It ensures the original whole file remains available for a configured period after migration to allow clients to update their caches.
When lazy chunking is disabled (`--cache-cdc-lazy-chunking-enabled=false`), the original immediate chunking behavior is restored, where NAR files are chunked during the download/storage process.
NAR File Download and StreamingView Changes@@ -127,7 +127,7 @@
If CDC is not enabled in the database, the command will return an error: "migrate-nar-to-chunks command requires CDC to be enabled in the database; please run 'ncps serve' with CDC enabled first". This ensures that the migration infrastructure is properly configured before attempting to migrate existing NAR files to the chunked storage format.
-When lazy chunking is enabled (the default via `--cache-cdc-lazy-chunking-enabled=true`), compressed NAR files are stored without immediate chunking, and background workers automatically perform migration using the same infrastructure as the `migrate-nar-to-chunks` command. The background workers can be configured via `--cache-cdc-background-workers` (defaults to CPU count).
+When lazy chunking is enabled (the default via `--cache-cdc-lazy-chunking-enabled=true`), compressed NAR files are stored without immediate chunking, and background workers automatically perform migration using the same infrastructure as the `migrate-nar-to-chunks` command. The background workers can be configured via `--cache-cdc-background-workers` (default: number of CPUs).
> **⚠️ CDC Configuration Enforcement**
>
@@ -251,8 +251,10 @@
**Configuration:**
- `--cache-cdc-lazy-chunking-enabled` (default: `true`): Enable lazy chunking for optimal TTFB
-- `--cache-cdc-background-workers` (default: CPU count): Number of background workers for asynchronous chunking
+- `--cache-cdc-background-workers` (default: number of CPUs): Number of background workers for asynchronous chunking
- `--cache-cdc-delete-delay` (default: `24h`): Delay before deleting compressed NAR files after chunking completes
+
+These parameters are also configurable via the Helm chart under `config.cdc` in values.yaml (`lazyChunkingEnabled`, `backgroundWorkers`, `deleteDelay`).
**Serving Logic:**
@@ -266,7 +268,7 @@
**Delayed Deletion:**
-When lazy chunking is enabled, the system implements delayed deletion of compressed NAR files after chunking completes. Rather than immediately deleting the original compressed NAR when the chunked version becomes available, the system preserves it for a configurable grace period (controlled by `--cache-cdc-delete-delay`, default: 24 hours). This provides:
+When lazy chunking is enabled, the system implements delayed deletion of compressed NAR files after chunking completes. Rather than immediately deleting the original compressed NAR when the chunked version becomes available, the system preserves it for a configurable grace period (controlled by `--cache-cdc-delete-delay`, default: 24 hours). This parameter applies when migrating existing whole-file NARs to chunks, not to new NARs downloaded with lazy chunking enabled. It ensures the original whole file remains available during the migration period to allow clients to update their cached narinfo records. This provides:
- A grace period for clients to update their cached narinfo records
- Graceful degradation if the chunked version encounters issues |
## Summary The `[Unreleased]` section was populated in #1309 but skewed toward the recent CDC-drain, in-flight-staging, and Ent-migration work, omitting several user-facing features and fixes that also landed since v0.9.4. This backfills the missing notable changes, each cross-referenced by PR. **Added** - `ncps fsck` command + Helm fsck CronJob (#975, #996, #998, #999, #1000, #1004, #1006, #1176) - Closure pinning HTTP endpoints `POST`/`DELETE /pin/{hash}.narinfo`, `GET /pins` (#1108) - pprof server via `--pprof-addr` (#1063) - CDC lazy chunking as a feature + `--cache-cdc-lazy-cleanup-schedule` + recovery cron (#1082, #1083, #1089, #1096) - Helm: auto `GOMEMLIMIT` (#1061), configurable temp volume / `volumeClaimTemplate` (#1074, #1077), SQLite `Recreate` strategy (#1012) - Startup storage reporting + deprecated-narinfo warning (#959, #961) - `docker-dev` image (#1097) **Fixed** - `store/tmp` no longer wiped on startup (#1313) - `nix-hash` NAR verification (#1101) - Prometheus counters primed at startup (#1337, #1343) - 404 on un-reassemblable chunked NARs (#1319), purged narinfo no longer 500 (#1318), fail-fast tmp validation (#1086) - Further CDC/cache reliability fixes (#1317, #1346, #1341, #1342, #1331, #1347) **Changed** - CDC config now persisted in the DB config table (#971) Dependency bumps, CI/test-only changes, and the internal Ent-conversion PRs are intentionally excluded; the existing Ent-migration entry already covers that work. ## Test plan - [x] `nix fmt` reports no changes (docs-only edit) - [x] CHANGELOG section structure intact (Added/Fixed/Changed/Removed/Migration/CI)
Add support for the new CDC lazy chunking configuration options in the
Helm chart and documentation:
values.yaml
This enables users to configure lazy chunking behavior directly from
their Helm values, including the delay before deleting compressed NAR
files after chunking completes.