perf: optimize startup when there are many health-checked backends#898
Merged
jranson merged 5 commits intotrickstercache:mainfrom Dec 11, 2025
Merged
perf: optimize startup when there are many health-checked backends#898jranson merged 5 commits intotrickstercache:mainfrom
jranson merged 5 commits intotrickstercache:mainfrom
Conversation
Signed-off-by: James Ranson <james@ranson.org>
Signed-off-by: James Ranson <james@ranson.org>
Signed-off-by: James Ranson <james@ranson.org>
Signed-off-by: James Ranson <james@ranson.org>
Pull Request Test Coverage Report for Build 20150197051Details
💛 - Coveralls |
Signed-off-by: James Ranson <james@ranson.org>
crandles
approved these changes
Dec 11, 2025
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.
This fixes a startup bottleneck with health check initialization, and separately revives the
ProxyOnlybackend flag from Trickster 1.0.x, removed in 1.1.x.ProxyOnly
Back in the day, we had a ProxyOnly setting, but that was replaced eventually by just changing the backend provider type to
reverseproxy. Now that we have ALB features specific to time series (namely tsm), users may want to utilize features like TSM without necessarily using the caching features. I actually needed that exact setup to help debug this bottleneck, so I added it back in the process. Since it has been useful to me, it may be useful to others, so I kept it in here. The way it works is the DeltaProxyCache and ObjectProxyCache will both check the request's corresponding backend first thing; if it is configured for ProxyOnly, the Cache function will immediately hand the request off to the Proxy handler without doing any caching.Health Checks
At startup, the backends.StartHealthChecks routine iterates each health check that has an interval configured, and runs hc.Start() to bootstrap them. The root cause of the latency is that Start() blocks on the initial target probe response, causing the application startup to be slower and slower based on upon how many health check targets are configured and summation of network + server latency across all applicable health checks. To resolve, the initial probe is moved to inside of the probeLoop goroutine but before the ticker loop.