explaingit

microsoft/garnet

Analysis updated 2026-06-24

11,825C#Audience · ops devopsComplexity · 4/5LicenseSetup · moderate

TLDR

A high-speed caching server from Microsoft Research that works as a drop-in replacement for Redis, same protocol, no code changes needed, with clustering, disk persistence, and under 300 microsecond response times.

Mindmap

mindmap
  root((garnet))
    What it does
      In-memory cache
      Redis-compatible
      Disk persistence
    Tech Stack
      C#
      .NET
      Tsavorite
    Features
      Clustering
      Lua scripting
      Custom data types
    Use Cases
      Cache layer
      High-throughput apps
      Redis replacement
    Deployment
      Self-hosted VPS
      Azure Cosmos DB
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Replace Redis in an existing application without changing client code, since Garnet uses the same network protocol.

USE CASE 2

Run a low-latency cache layer for a high-traffic web app that needs sub-millisecond response times.

USE CASE 3

Set up a multi-node cluster that distributes cached data across machines and replicates it for reliability.

USE CASE 4

Write custom C# data types and operations to extend the cache for application-specific storage needs.

What is it built with?

C#.NETLuaTsavorite

How does it compare?

microsoft/garnetodysseusyuan/lky_officetoolsluckypennysoftware/mediatr
Stars11,82511,82111,832
LanguageC#C#C#
Setup difficultymoderateeasyeasy
Complexity4/51/52/5
Audienceops devopsgeneraldeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · moderate Time to first run · 30min

Requires .NET runtime, cluster mode adds multi-machine coordination complexity.

Use freely for any purpose, including commercial use, as long as you retain the copyright notice.

In plain English

Garnet is a caching server built by Microsoft Research. A cache-store is a piece of software that sits between your application and your main database, keeping frequently requested data in fast memory so the app does not have to query the database every time. Garnet fills this role and is designed to handle a very large number of simultaneous connections while keeping response times extremely short. One of Garnet's main practical advantages is that it speaks the same network protocol as Redis, a widely used open-source cache. That means existing applications and libraries already written to talk to Redis can switch to Garnet without changing any code. The README notes response times under 300 microseconds at the 99.9th percentile, which is relevant for applications where speed is critical. Garnet supports a wide range of data operations: storing and retrieving text values, working with sorted lists and sets, running Lua scripts, and executing multi-step transactions. Users can also write custom data types and operations in C#, which is the programming language the project is built on. For larger deployments, Garnet includes a cluster mode that spreads data across multiple machines, copies data to backup nodes for reliability, and can move data between nodes to balance load. Each node handles its own storage using a component called Tsavorite, which supports saving data to disk and recovering after a restart. Microsoft also offers Garnet as a fully managed cloud service through Azure Cosmos DB for teams that do not want to run the infrastructure themselves. The project is open source under the MIT license and includes documentation, benchmarks, and getting-started guides on its website.

Copy-paste prompts

Prompt 1
Show me how to connect to a Garnet server from a C# application using an existing StackExchange.Redis client.
Prompt 2
Set up a Garnet cluster with two nodes on my local machine and test failover when one node goes down.
Prompt 3
Write a benchmark in C# that compares read and write latency between Garnet and a local Redis instance.
Prompt 4
Configure Garnet to persist data to disk using Tsavorite so cached values survive a server restart.
Prompt 5
Migrate my Node.js app from Redis to Garnet, show me what, if anything, needs to change in the connection setup.

Frequently asked questions

What is garnet?

A high-speed caching server from Microsoft Research that works as a drop-in replacement for Redis, same protocol, no code changes needed, with clustering, disk persistence, and under 300 microsecond response times.

What language is garnet written in?

Mainly C#. The stack also includes C#, .NET, Lua.

What license does garnet use?

Use freely for any purpose, including commercial use, as long as you retain the copyright notice.

How hard is garnet to set up?

Setup difficulty is rated moderate, with roughly 30min to a first successful run.

Who is garnet for?

Mainly ops devops.

Open on GitHub → Explain another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.