Skip to content

Garnet

A fast, Redis-compatible cache and key-value store written in C# by Microsoft Research.

Stars
12.1k
Forks
719
Licence
MIT
Language
C#
Last update
4 days ago
Type
App

What it is

Garnet is a remote cache-store: a separate server that applications connect to over the network to store and fetch data quickly, similar to Redis. It speaks the RESP protocol, so many existing Redis client libraries can talk to it without modification. Teams use it to reduce latency and handle many client connections, and it also offers persistence, recovery, and cluster sharding and replication.

  • Use it as a drop-in cache in front of a database by pointing an existing Redis client at a Garnet server
  • Store strings with expiration, plus HyperLogLog, bitmap, sorted set, list, and hash data
  • Write custom server-side operations or stored procedures in C#
  • Run a sharded, replicated cluster that can rebalance keys across nodes

Great for

  • Teams already using Redis clients who want to test a different server with minimal code changes
  • C# and .NET developers who want a cache server they can read, extend, or add custom operations to
  • Services with many client connections and small requests where throughput matters
  • Operators who need sharding, replication, and key migration in a self-managed cluster

Not ideal for

  • Teams that need a fully managed service without running servers; the README points to Azure Cosmos DB Garnet Cache for that
  • Projects that depend on Redis-specific features not covered by the README; full compatibility is not claimed
  • Beginners with no experience running server software, since setup and cluster operations assume some ops knowledge
Step-by-step guide: how to use GarnetInstall, first run, examples, tips and FAQs

How to get it

  1. 1

    Install with a package manager

    You'll need: .NET SDK (version not specified in the README)

    Install the dotnet tool from NuGet

    dotnet tool install --global garnet-server

    Clone the repository

    git clone https://github.com/microsoft/garnet
  2. 2

    Run it

    • Install the garnet-server dotnet tool or download a release archive for your platform
    • Start the server with the garnet-server command
    • Connect with any Redis client pointed at the server's host and port
    • Send a simple SET and GET command to confirm it works
  3. 3

    Get the most out of it

    • Use the Redis-compatible client library you already have instead of writing a new client
    • Enable TLS through .NET SslStream if traffic crosses untrusted networks
    • Read the cluster documentation before relying on sharding or migration in production
    • Consider the object store for complex types, and check the docs for which data types are supported

Downloads

Strengths

  • Works with unmodified Redis clients such as StackExchange.Redis, per the README
  • Built on .NET and cross-platform, with TLS support via SslStream and basic access control
  • Storage layer supports tiered storage, checkpointing, recovery, and operation logging

Trade-offs

  • Cluster mode is described as passive: it has no leader election and relies on an external control plane
  • The latency and throughput claims come from Microsoft's own benchmarks on Azure VMs, so results on your hardware may differ
  • Newer features such as Vector Sets and Range Index are labeled as preview

How it compares

ProjectStarsTypeLevelUpdatedBest for
garnet (this)12.1kAppintermediate4 days agoTeams already using Redis clients who want to test a different server with minimal code changes
query50.5kLibraryintermediate4 days agoFrontend developers building apps that load data from a server
srs29.4kAppintermediate6 days agoDevelopers building live streaming backends that need several delivery protocols
kcp17kLibraryadvanced5 months agoDevelopers building their own UDP-based protocol who need reliable delivery

Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.