Add optional LocalCache storage tier for certificate assets - #402
Open
mbardelmeijer wants to merge 1 commit into
Open
Add optional LocalCache storage tier for certificate assets#402mbardelmeijer wants to merge 1 commit into
mbardelmeijer wants to merge 1 commit into
Conversation
Certificates are loaded from Storage during handshakes whenever the in-memory cache misses, which is slow when Storage is remote. This adds an optional Config.LocalCache Storage that sits between the two: reads that serve certificates are answered locally, while the operations that coordinate with the rest of the cluster (renewals, issuance, and reloading a certificate a peer renewed) read Storage directly and refresh the local cache with what they read. Writes and deletions go to Storage first, then to the local cache; locking is never local. Callers pick between the two with cachedStorage and groundTruthStorage. Certificate, key, and metadata files and OCSP staples all go through the same path. WarmLocalCache pre-populates the local cache for a subject without touching the in-memory cache or doing any certificate operations. The field is nil by default, so behavior is unchanged when it is unset.
mholt
requested changes
Aug 31, 2026
mholt
left a comment
Member
There was a problem hiding this comment.
Hey, thank you. I think this is good, if it is working well for you.
My only question would be is if there's a failure mid-write, since Storage doesn't provide atomic writes for multiple files, I wonder if we should have a recovery plan:
- If the cached certificate and key fail to parse or match, retry the complete resource once using
groundTruthStorage(). - That retry naturally overwrites the local entries with authoritative values.
- Add a test with an old cached key and a renewed authoritative certificate/key.
What do you think?
Thank you for the contribution!
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.
Certificates are loaded from Storage during handshakes whenever the in-memory cache misses, which is slow when Storage is remote. This adds an optional Config.LocalCache Storage that sits between the two: reads that serve certificates are answered locally, while the operations that coordinate with the rest of the cluster (renewals, issuance, and reloading a certificate a peer renewed) read Storage directly and refresh the local cache with what they read. Writes and deletions go to Storage first, then to the local cache; locking is never local.
Callers pick between the two with cachedStorage and groundTruthStorage. Certificate, key, and metadata files and OCSP staples all go through the same path. WarmLocalCache pre-populates the local cache for a subject without touching the in-memory cache or doing any certificate operations.
The field is nil by default, so behavior is unchanged when it is unset.
Build with Claude Opus 5
If the direction of this PR is good/workable, I'm happy to run some field tests with it.