ConfigsApr 13, 2026·3 min read

Garnet — High-Performance Cache Store from Microsoft Research

Garnet is a remote cache-store from Microsoft Research that offers strong performance, scalability, and Redis protocol compatibility. Written in C#, it leverages .NET for cross-platform support and modern hardware optimization.

AI
AI Open Source · Community
Quick Use

Use it first, then decide how deep to go

This block should tell both the user and the agent what to copy, install, and apply first.

# Run with Docker
docker run -p 6379:6379 --name garnet \
  ghcr.io/microsoft/garnet:latest

# Connect with any Redis client
redis-cli -p 6379
> SET greeting "Hello Garnet"
> GET greeting
> INCR counter
> LPUSH queue "task1" "task2"

# Or build from source
git clone https://github.com/microsoft/garnet.git
cd garnet
dotnet restore
dotnet run --project main/GarnetServer

Introduction

Garnet is a cache-store from Microsoft Research that is compatible with the Redis protocol (RESP). It is designed to achieve better throughput and lower latency than Redis by leveraging modern hardware features — multi-threaded processing, storage tiering, and the .NET runtime for safe, managed code.

With over 12,000 GitHub stars since its release in 2024, Garnet represents a new approach to in-memory data stores. It matches or exceeds Redis performance on many benchmarks while providing features like cluster sharding, replication, and key migration out of the box.

What Garnet Does

Garnet serves as a drop-in replacement for Redis in many scenarios. It supports the RESP protocol, meaning existing Redis clients (redis-py, ioredis, Jedis, etc.) connect without changes. It provides strings, lists, hashes, sets, sorted sets, and other Redis data structures with additional optimizations for modern hardware.

Architecture Overview

[Redis Clients]
redis-py, ioredis, Jedis,
redis-cli — any RESP client
        |
   [Garnet Server (C# / .NET)]
   RESP protocol handler
        |
   [Multi-Threaded Engine]
   Thread-per-session model
   Lock-free data structures
        |
+-------+-------+
|               |
[Main Store]    [Object Store]
Raw strings,    Complex types:
numerics        lists, hashes,
(FASTER-based)  sets, sorted sets
        |
   [Storage Tiering]
   Hot data in memory
   Warm data on SSD
   via FASTER log
        |
   [Cluster Mode]
   Sharding, replication,
   key migration

Self-Hosting & Configuration

# Docker with persistence and TLS
docker run -d --name garnet \
  -p 6379:6379 \
  -v garnet-data:/data \
  ghcr.io/microsoft/garnet:latest \
  --checkpointdir /data/checkpoints \
  --recover

# With authentication
docker run -d --name garnet \
  -p 6379:6379 \
  ghcr.io/microsoft/garnet:latest \
  --auth Password --password "your-strong-password"

# Cluster mode (3 nodes)
# Configure each node with --cluster and --port
# Works with standard Redis clients
import redis

r = redis.Redis(host="localhost", port=6379)

# All standard Redis commands work
r.set("user:1", "Alice")
r.hset("session:abc", mapping={"user": "Alice", "role": "admin"})
r.lpush("queue", "job1", "job2", "job3")
r.zadd("leaderboard", {"player1": 100, "player2": 250})

print(r.get("user:1"))  # b'Alice'
print(r.hgetall("session:abc"))
print(r.zrangebyscore("leaderboard", 0, 300, withscores=True))

Key Features

  • Redis Compatible — RESP protocol, works with existing Redis clients
  • Multi-Threaded — better utilization of modern multi-core CPUs
  • Storage Tiering — automatically tier data between memory and SSD
  • Cluster Mode — built-in sharding and replication
  • Cross-Platform — runs on Linux, macOS, and Windows via .NET
  • Managed Code — written in C# for memory safety and easier development
  • Checkpointing — durable state with periodic checkpoints
  • Key Migration — seamless key migration between cluster nodes

Comparison with Similar Tools

Feature Garnet Redis DragonflyDB Valkey KeyDB
Language C# (.NET) C C++ C C++
Multi-Threaded Yes I/O threads Yes I/O threads Yes
Storage Tiering Yes (SSD) No (RAM only) No No No
Redis Compatible RESP Native RESP RESP (fork) RESP
License MIT RSALv2/SSPL BSL-1.1 BSD BSD
Cluster Built-in Redis Cluster Single-node Redis Cluster Yes
Best For .NET shops, SSD tiering Standard caching High throughput OSS Redis fork Multi-threaded

FAQ

Q: Can Garnet replace Redis in production? A: For many workloads, yes. Garnet supports most Redis commands and the RESP protocol. Test with your specific command set and access patterns before migrating.

Q: What is storage tiering? A: Garnet can keep hot data in memory and automatically move less-accessed data to SSD storage. This allows you to store more data than available RAM while maintaining fast access for frequently used keys.

Q: Why C# instead of C/C++? A: C# and .NET provide memory safety, easier development, and modern language features. The .NET runtime JIT compiles to native code, achieving near-C performance without the memory safety risks of C/C++.

Q: Is Garnet production-ready? A: Garnet is from Microsoft Research and is actively developed. It is used internally at Microsoft. For critical production workloads, evaluate with your specific requirements and test thoroughly.

Sources

Discussion

Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.

Related Assets