-
-
Notifications
You must be signed in to change notification settings - Fork 260
Optimize bit Boilerplate aspire's postgreSQL setup (#11973) #11974
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. WalkthroughA new PostgreSQL optimization extension method is added to configure memory parameters and container settings. The method computes and applies PostgreSQL runtime arguments based on available container memory, then integrates into the boilerplate application's database provisioning chain. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In
`@src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.AppHost/Extensions/IResourceBuilderExtensions.cs`:
- Around line 16-39: The WithOptimizedSetup method currently discards the result
of WithContainerRuntimeArgs and also allows totalContainerMemoryMB values that
make availableForPostgres <= 0; fix by validating totalContainerMemoryMB at the
start (throw ArgumentOutOfRangeException or clamp to a minimum like 1024) so
reservedOverhead/availableForPostgres produce positive values, ensure computed
sharedBuffersMB, effectiveCacheSizeMB, and maintenanceWorkMemMB are clamped to
sensible minima, and THEN return the chained result of
builder.WithContainerRuntimeArgs(...) instead of ignoring it so the runtime args
(and memory reservation) are actually applied; reference the WithOptimizedSetup
method, totalContainerMemoryMB, reservedOverhead, availableForPostgres,
sharedBuffersMB, maintenanceWorkMemMB, and WithContainerRuntimeArgs when making
the changes.
🧹 Nitpick comments (1)
src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.AppHost/Extensions/IResourceBuilderExtensions.cs (1)
44-49: Chain container runtime args and ensure tuning matches actual limits.
WithContainerRuntimeArgsisn’t chained; if it returns a new builder, the reservation may be lost. Also,--memory-reservationis soft; if tuning assumes a fixed cap, consider--memoryor update the comment.♻️ Suggested tweak
- builder - // --- RUNTIME RESOURCES --- - // Ensures the container actually gets the RAM we are tuning for. - .WithContainerRuntimeArgs("--memory-reservation", $"{totalContainerMemoryMB}m"); - - return builder + return builder + // --- RUNTIME RESOURCES --- + // Ensures the container actually gets the RAM we are tuning for. + .WithContainerRuntimeArgs("--memory-reservation", $"{totalContainerMemoryMB}m") // --- MEMORY TUNING --- .WithArgs("-c", $"shared_buffers={sharedBuffersMB}MB")
...t.Boilerplate/src/Server/Boilerplate.Server.AppHost/Extensions/IResourceBuilderExtensions.cs
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR optimizes PostgreSQL setup for the Boilerplate template by adding a new WithOptimizedSetup() extension method that configures production-grade tuning for vector search workloads using pgvector and DiskANN.
Changes:
- Adds a comprehensive PostgreSQL optimization extension method with memory, checkpoint, and I/O tuning
- Integrates the optimization into the PostgreSQL setup chain in AppHost Program.cs
- Configures settings optimized for SSD/NVMe storage and vector similarity search operations
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| src/Server/Boilerplate.Server.AppHost/Program.cs | Adds .WithOptimizedSetup() call to the PostgreSQL configuration chain |
| src/Server/Boilerplate.Server.AppHost/Extensions/IResourceBuilderExtensions.cs | Implements the WithOptimizedSetup extension method with calculated PostgreSQL parameters for memory management, checkpointing, WAL settings, and performance tuning |
closes #11973
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.