A Go caching library with advanced concurrency features to eliminate cache stampedes and minimize data source load in high-throughput systems.
sturdyc is a Go caching library built to eliminate cache stampedes and reduce load on underlying data sources in high-throughput applications. It provides advanced concurrency features like request coalescing, asynchronous refreshes, and in-flight tracking to make systems robust and performant under heavy load.
Go developers building I/O-heavy services that interact with databases, external APIs, or distributed caches and need to handle high concurrency while minimizing latency and data source load.
Developers choose sturdyc for its comprehensive stampede protection, flexible refresh strategies, and efficient batch handling—enabling significant reductions in P95 latency and data source load (over 90% in production cases) with a minimal API.
A caching library with advanced concurrency features designed to make I/O heavy applications robust and highly performant
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
In-flight tracking ensures only one request per key reaches the data source, eliminating thundering herd problems, as demonstrated with concurrent goroutine examples in the README.
Early refreshes with asynchronous background updates and configurable synchronous fallbacks keep data fresh without blocking reads, reducing P95 latency by orders of magnitude in production cases.
Refresh coalescing and individual record caching for batch endpoints minimize data source load, with the README showing over 90% reduction in outgoing requests through buffered batches.
Caches non-existent records to avoid repeated I/O for invalid IDs, improving performance for systems with faulty data ingestion, as explained in the non-existent records section.
The extensive configuration options, such as multiple time parameters for early refreshes and refresh coalescing, require careful tuning and can be overwhelming for simple use cases.
As a niche library, it lacks the broad community support, plugins, and third-party tools available for established solutions like Redis or groupcache, making integration more manual.
Permutated cache keys use reflection on structs, which may introduce performance overhead and limitations with complex or nested data types, as admitted in the README's permutations section.
The README points out an inconsistency in error handling between GetOrFetch (using ErrNotFound) and GetOrFetchBatch (omitting keys), which could lead to developer confusion and bugs.