perf: share single lumberjack writer across loggers#20018
Draft
perf: share single lumberjack writer across loggers#20018
Conversation
Each CreateLogger call created an independent lumberjack.Logger for the same log file, spawning its own rotation goroutine. With ~30 loggers, that's 30 goroutines + 30 file handles to the same file. Share a single writer per path via a map. This reduces log rotation goroutines from 30 to 1 and eliminates potential corruption from concurrent uncoordinated writes to the same file. GC sweet spot experiment findings (included in commit message for context): - 128Mi: GC thrashing (84 GC/min, 200m CPU) - 160Mi: Sweet spot (2 GC/min, 4m CPU) - 192Mi: Comfortable (0 GC/min, 3m CPU) - Rule: set limit to 1.3-1.5x natural heap size Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Skipping CI for Draft Pull Request. |
Contributor
🚀 Build Images ReadyImages are ready for commit 31f6f34. To use with deploy scripts: export MAIN_IMAGE_TAG=4.11.x-658-g31f6f34727 |
1 similar comment
Contributor
🚀 Build Images ReadyImages are ready for commit 31f6f34. To use with deploy scripts: export MAIN_IMAGE_TAG=4.11.x-658-g31f6f34727 |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #20018 +/- ##
=======================================
Coverage 49.61% 49.61%
=======================================
Files 2765 2765
Lines 208628 208635 +7
=======================================
+ Hits 103509 103523 +14
+ Misses 97462 97456 -6
+ Partials 7657 7656 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
4 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.
Description
Share a single lumberjack log rotation writer per file path instead of creating one per logger. Previously each of 100+ loggers created its own lumberjack writer for the same log file, resulting in ~30 rotation-watching goroutines.
Changes
lumberjack.Loggerinstance per output pathMeasurements
Depends on the zap sampling change (#19997, merged).
User-facing documentation
Testing and quality
Automated testing
How I validated my change
AI-assisted.