|
1 | 1 | # multicache |
2 | 2 |
|
3 | | -multicache is an in-memory #golang cache library. |
| 3 | +multicache is an absurdly fast multi-threaded multi-tiered in-memory cache library for Go -- it offers higher performance than any other option ever created for the language. |
4 | 4 |
|
5 | | -It's been optimized over hundreds of experiments to be the highest performing cache available - both in terms of hit rates and throughput - and also features an optional multi-tier persistent cache option. |
| 5 | +It offers optional persistence with compression, and has been specifically optimized for Cloud Compute environments where the process is periodically restarted, such as Kubernetes or Google Cloud Run. |
6 | 6 |
|
7 | 7 | ## Install |
8 | 8 |
|
@@ -58,22 +58,22 @@ For maximum efficiency, all backends support S2 or Zstd compression via `pkg/sto |
58 | 58 |
|
59 | 59 | ## Performance |
60 | 60 |
|
61 | | -multicache has been exhaustively tested for performance using [gocachemark](https://github.com/tstromberg/gocachemark). As of Dec 2025, it's the highest performing cache implementation for Go. |
| 61 | +multicache has been exhaustively tested for performance using [gocachemark](https://github.com/tstromberg/gocachemark). |
62 | 62 |
|
63 | 63 | Where multicache wins: |
64 | 64 |
|
65 | | -- **Throughput**: 1 billion ints/second at 16 threads or higher. (2-3X faster than otter) |
66 | | -- **Hit rate**: Highest average across datasets (1.6% higher than sieve, 4.4% higher than otter) |
67 | | -- **Latency**: 8-11ns Gets, zero allocations (3-4X lower latency than otter) |
| 65 | +- **Throughput**: 954M int gets/sec at 16 threads (2.2X faster than otter). 140M string sets/sec (9X faster than otter). |
| 66 | +- **Hit rate**: Wins 7 of 9 workloads. Highest average across all datasets (+2.9% vs otter, +0.9% vs sieve). |
| 67 | +- **Latency**: 8ns int gets, 10ns string gets, zero allocations (4X lower latency than otter) |
68 | 68 |
|
69 | 69 | Where others win: |
70 | 70 |
|
71 | | -- **Memory**: freelru and otter use less memory per entry |
72 | | -- **Temporal workload hit rates**: Some caches work marginally better in certain workloads by a very thin margin: clock (+0.006% on thesios-block), sieve (+0.005% on thesios-file) |
| 71 | +- **Memory**: freelru and otter use less memory per entry (73 bytes/item overhead vs 15 for otter) |
| 72 | +- **Specific workloads**: clock +0.07% on ibm-docker, theine +0.34% on zipf |
73 | 73 |
|
74 | 74 | Much of the credit for high throughput goes to [puzpuzpuz/xsync](https://github.com/puzpuzpuz/xsync). While highly sharded maps and flightGroups performed well, you can't beat xsync's lock-free data structures. |
75 | 75 |
|
76 | | -Run `make competive-bench` for full results. |
| 76 | +Run `make benchmark` for full results, or see [benchmarks/gocachemark_results.md](benchmarks/gocachemark_results.md). |
77 | 77 |
|
78 | 78 | ## Algorithm |
79 | 79 |
|
|
0 commit comments