Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
levkk
reviewed
Sep 16, 2026
mehcode
marked this pull request as draft
September 17, 2026 13:38
Signed-off-by: Ryan Leckey <leckey.ryan@gmail.com>
Signed-off-by: Ryan Leckey <leckey.ryan@gmail.com>
Signed-off-by: Ryan Leckey <leckey.ryan@gmail.com>
…RU or LFU Signed-off-by: Ryan Leckey <leckey.ryan@gmail.com>
Signed-off-by: Ryan Leckey <leckey.ryan@gmail.com>
Signed-off-by: Ryan Leckey <leckey.ryan@gmail.com>
mehcode
force-pushed
the
rl-lfu-cache-1530
branch
from
September 20, 2026 11:06
b030960 to
4151d58
Compare
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.
Closes #1530
Introduce
pgdog-cache::Cache<K, V>which is a policy-configurable (LRU or exact-LFU) single-threaded cache implementation.pgdog-cache::Cache<K, V>hasO(1)insertion, removal, and lookup.Switch the per-connection statement cache to use
pgdog_cache::Cacherather thanlru::LruCache.Add
prepared_statements_evictionto[general]takinglru(default) orlfu(also available throughPGDOG_PREPARED_STATEMENTS_EVICTIONandSET ...).I investigated several crates before committing to
pgdog_cache::Cache<K, V>. The per-connection cache in pgdog is interesting because admission to the cache must not affect existing entries and entries can only manually evicted later. Most crates in the ecosystem do not work like that. This is because an eviction of the cache involves sending aClosemessage to postgres. Additionally several of the crates are either over-tuned for async (with unnecessary overhead for a per-connection cache) or unusable with async (notSend).Sendpgdog_cachecachekit0.8.0evictor0.7.2lru0.18.14lfu0.2.5lfu_cache1.3.0schnellru0.2.4Full benchmark results of
pgdog_cacheon my local machine. tldr,pgdog_cache::Cachehandily beats every LFU cache crate under review and is near parity with the best LRU crates at representative workloads (see thetrafficbenchmark).Details
I see the codecov report, I can add more unit test coverage early next week. Leaving this as draft pending additional unit test coverage.