説明
Submitted as project as part of Google Summer of Code with @MadhavJivrajani as second mentor.
EDIT: Project status by the end of GSoC https://github.com/apullo777/GSoC2025
While etcd is a powerful distributed key-value store, building scalable infrastructure management systems directly on top of it can be challenging. Kubernetes has demonstrated the effectiveness of the reconciliation pattern for managing complex deployments, and its watch cache plays a crucial role in achieving scalability. However, this crucial caching mechanism is tightly coupled with Kubernetes and not readily available for general etcd usage. Projects like Cilium and Calico Typha, while successfully using etcd for control planes, have had to implement custom solutions to address this gap.
This project addresses the need for a standardized, performant caching solution for etcd, enabling easier adoption of the reconciliation pattern and simplifying the development of scalable etcd-based systems. By providing a generic watch cache implementation, we aim to lower the barrier to entry for building robust and efficient infrastructure management tools on etcd.
Goals:
- Develop a generic proxy that provides feature parity to K8s watch cache
- Enable possibility of integrating into K8s and Cilium.
- Enable possibility of building a cache server for etcd.
Milestones:
- Cache for watch requests, stores history of watch events and demultiplexes requests. Combining multiple local Watch requests into single watch to etcd.
- Cache for non-consistent list requests, stores latest state of etcd in Btree cache. Cache is fed by Range response, that is later updated by subscribing to updates from Watch Cache.
- Handling requests during cache initialization and re-intialization.
- Testing, including e2e and robustness tests
- Metrics for cache size, cache latency etc
- Benchmarks for watch and read throughput.
- Support for custom encoder/decoder
- Support for custom indexing
- Support for consistent reads
- Support for exact stale reads, by storing snapshots of btree.
I'm proposing to locate the project within the etcd mono repo, but as a separate package, that will not be released/tagged until it's ready. Proposed package name: go.etcd.io/cache. Client library would be developed under go.etcd.io/cache/client.
/cc @fuweid @MadhavJivrajani @ahrtr @henrybear327