RepoMicrosoftMicrosoftpublished Aug 21, 2023seen 5d

microsoft/garnet

C#

Open original ↗

Captured source

source ↗
published Aug 21, 2023seen 5dcaptured 8hhttp 200method plain

microsoft/garnet

Description: Garnet is a remote cache-store from Microsoft Research that offers strong performance (throughput and latency), scalability, storage, recovery, cluster sharding, key migration, and replication features. Garnet can work with existing Redis clients.

Language: C#

License: MIT

Stars: 11870

Forks: 667

Open issues: 60

Created: 2023-08-21T21:54:58Z

Pushed: 2026-06-11T03:51:53Z

Default branch: main

Fork: no

Archived: no

README:

Garnet

![.NET CI](https://github.com/microsoft/garnet/actions/workflows/ci.yml) ![Discord Shield](https://aka.ms/garnet-discord)

Garnet is a new remote cache-store from Microsoft Research, that offers several unique benefits:

  • Garnet adopts the popular RESP wire protocol as a starting point, which makes it possible to use Garnet from unmodified Redis clients available in

most programming languages of today, such as StackExchange.Redis in C#.

  • Garnet offers much better throughput and scalability with many client connections and small batches, relative to comparable open-source cache-stores, leading to cost savings for large apps and services.
  • Garnet demonstrates extremely low client latencies (often less than 300 microseconds at the 99.9th percentile) using commodity cloud (Azure) VMs with Accelerated Networking enabled, which is critical to real-world scenarios.
  • Based on the latest .NET technology, Garnet is cross-platform, extensible, and modern. It is designed to be easy to develop for and evolve, without sacrificing performance in the

common case. We leveraged the rich library ecosystem of .NET for API breadth, with open opportunities for optimization. Thanks to our careful use of .NET, Garnet achieves state-of-the-art performance on both Linux and Windows.

This repo contains the code to build and run Garnet. For more information and documentation, check out our website at https://microsoft.github.io/garnet.

Looking for a fully managed service? Azure Cosmos DB Garnet Cache provides Garnet as a fully managed, enterprise-ready caching solution with built-in high availability, performance guarantees and zero infrastructure management.

What's New 🎉

  • 🚀 [Vector Sets (Preview)](https://microsoft.github.io/garnet/docs/commands/vector-sets) — Approximate nearest-neighbor search backed by the DiskANN algorithm and Garnet's Tsavorite storage engine. In our initial results), Garnet leads on QPS, p99 latency, and recall.
  • 🔍 [Range Index (Preview)](https://microsoft.github.io/garnet/docs/commands/range-index) — Secondary range and equality indexes over Garnet keys, powered by Bf-Tree.
  • 📄 The Garnet paper will appear at VLDB 2026! B. Chandramouli, V. Zois, T. Hart, T. Zaccai, L. M. Maas, Y. Rajasekaran, D. Gehring. *Garnet: A Next-Generation Cache-Store for Accelerating Applications and Services.* PVLDB 2026. [[PDF]](https://www.vldb.org/pvldb/vol19/p224-chandramouli.pdf)

Feature Summary

Garnet implements a wide range of APIs including raw strings (e.g., gets, sets, and key expiration), analytical (e.g., HyperLogLog and Bitmap), and object (e.g., sorted sets and lists) operations. It can handle multi-key transactions in the form of client-side RESP transactions and our own server-side stored procedures and modules in C#. It allows users to define custom operations on both raw strings and custom object types, all in the convenience and safety of C#, leading to a lower bar for developing custom extensions. Garnet also supports Lua scripts.

Garnet uses a fast and pluggable network layer, enabling future extensions such as leveraging kernel-bypass stacks. It supports secure transport layer security (TLS) communications using the robust SslStream library of .NET, as well as basic access control. Garnet’s storage layer, called Tsavorite, is built for high performance and includes strong database features such as thread scalability, tiered storage support (memory, SSD, and cloud storage), fast non-blocking checkpointing, recovery, operation logging for durability, multi-key transaction support, and better memory management and reuse. Finally, Garnet supports a cluster mode of operation with support for sharding, replication, and dynamic key migration.

Performance Preview

We illustrate a few key results on our website comparing Garnet to leading open-source cache-stores.

Design Highlights

Garnet’s design re-thinks the entire cache-store stack – from receiving packets on the network, to parsing and processing database operations, to performing storage interactions. We build on top of years of our prior research. Below is Garnet’s overall architecture.

Garnet’s network layer is based on a shared memory design, with TLS processing and storage interactions performed on the network IO completion thread, avoiding thread switching overheads in the common case. This approach allows CPU cache coherence to bring the data to the processing logic, instead of traditional shuffle-based network designs, which require data movement to the appropriate shard on the server.

Garnet’s storage design consists of two Tsavorite key-value stores whose fates are bound by a unified operation log. The first store, called the “main store,” is optimized for raw string operations and manages memory carefully to avoid garbage collection. The second, and optional, “object store” is optimized for complex objects and custom data types, including popular types such as Sorted Set, Set, Hash, List, and Geo. Data types in the object store leverage the .NET library ecosystem for their current implementations. They are stored on the heap in memory (which makes updates very efficient) and in a serialized form on disk. In the future, we plan to investigate…

Excerpt shown — open the source for the full document.

Notability

Scored, but no written rationale attached yet.

Microsoft has a repo signal matching data demand, infrastructure.