Guide · Open source
How to use Garnet: install, connect with Redis clients and cluster basics
Updated · written with AI from the project's own documentation and checked against our catalogue data
Garnet is an open-source remote cache-store from Microsoft Research. It runs as a separate server that applications reach over the network, and it speaks the RESP protocol, so many existing Redis client libraries can connect to it. This guide covers what you need, how to install it from the README commands, how to connect a client, and where cluster mode fits.
Quick start
- 1Install the .NET SDK. Install the .NET SDK. The README does not specify a version, so check the getting started docs for the required release.
- 2Install the garnet-server tool. Run the dotnet tool install command for garnet-server from NuGet to install it globally.
- 3Or clone the repository. If you want the source code, clone the microsoft/garnet repository from GitHub.
- 4Start the server. Run the server as described in the getting started documentation on the project website.
- 5Connect a Redis client. Point an existing RESP-compatible Redis client, such as StackExchange.Redis in C#, at your Garnet server address.
- 6Test your commands. Confirm the commands your application relies on work against Garnet before switching production traffic.
What Garnet is and what you need before you start
Garnet is a remote cache-store: a server your applications connect to over the network to store and fetch data quickly, similar to Redis. Because it adopts the RESP wire protocol, unmodified Redis clients in many languages can talk to it, such as StackExchange.Redis in C#.
You need the .NET SDK to install and build Garnet. The README does not specify which .NET version is required, so check the project's getting started documentation for that.
- Prerequisite: .NET SDK (the README does not state a version)
- Garnet is MIT licensed and written in C#
- Experience running server software is assumed for setup and cluster operations
Install Garnet with the dotnet tool or clone the repository
The README lists two install routes. The first installs the garnet-server dotnet tool from NuGet as a global tool. The second clones the source repository so you can build it yourself.
Use the clone route if you want to read or modify the code. The README points to the documentation site for further setup details.
dotnet tool install --global garnet-server
git clone https://github.com/microsoft/garnetConnect an existing Redis client to Garnet
Because Garnet supports the RESP protocol, you can point a Redis client library at a running Garnet server instead of a Redis server. The README names StackExchange.Redis as an example C# client that works with Garnet unmodified.
Test against Garnet before relying on it in production. The README does not claim full compatibility with Redis, so confirm that the commands and features your application uses are covered.
- Use a Redis client library in your language that speaks RESP
- Verify the specific commands your application needs
- Check the feature summary for supported data types such as strings, sorted sets, lists, and hashes
Understand the features Garnet supports
Garnet implements raw string operations such as gets, sets and key expiration, plus HyperLogLog, bitmaps, sorted sets and lists. It supports multi-key transactions through client-side RESP transactions and server-side stored procedures and modules written in C#. It also supports Lua scripts.
For secure connections, Garnet supports TLS through .NET's SslStream and provides basic access control. Its storage layer, Tsavorite, includes tiered storage across memory, SSD and cloud storage, checkpointing, recovery and operation logging for durability.
- Raw strings, HyperLogLog, bitmaps, sorted sets, lists, hashes, sets and geo types
- Custom operations on raw strings and custom object types written in C#
- Lua scripts
- TLS via SslStream and basic access control
- Checkpointing, recovery and operation logging
Run Garnet in cluster mode
Garnet has a cluster mode that lets you create and manage a sharded and replicated deployment. It supports dynamic key migration to rebalance shards. The README says you can use standard Redis cluster commands to create and manage Garnet clusters, and nodes share cluster state through gossip.
Cluster mode is passive. Garnet does not implement leader election. It responds to cluster commands from a control plane you provide. The README links to the documentation for details on that control plane.
- Sharding and replication are supported
- Key migration rebalances shards
- Leader election is not built in; you supply the control plane
Get more help and documentation
The project website at microsoft.github.io/garnet hosts the full documentation, including getting started, releases and benchmarking pages. The repository also has a Discord server linked from the README.
For a fully managed alternative, the README points to Azure Cosmos DB Garnet Cache, which provides Garnet as a managed service.
What people use it for
- Testing a different RESP server with an existing Redis client and minimal code changes
- Storing and fetching data for a C# or .NET service that handles many client connections with small requests
- Adding custom operations on strings or custom object types in C#
- Running a self-managed sharded and replicated cache cluster with key migration
Frequently asked questions
Is Garnet free to use?
Yes. The README states that Garnet is licensed under the MIT License, and the full license text is in the LICENSE file in the repository.
What do I need to install Garnet?
The README lists the .NET SDK as the prerequisite and does not state a specific version. Install it, then use the dotnet tool command or clone the repository.
How do I install Garnet?
Run dotnet tool install --global garnet-server to install the tool from NuGet, or clone the repository with git clone https://github.com/microsoft/garnet to build from source.
Is Garnet compatible with Redis?
Garnet uses the RESP protocol, so many unmodified Redis clients can connect to it. The README does not claim full compatibility, so verify the specific features your application uses.
What are the alternatives to Garnet?
The project lists Redis, Valkey, KeyDB and Dragonfly as comparable open-source cache-stores. If you want a managed service instead of self-hosting, the README points to Azure Cosmos DB Garnet Cache.
Is Garnet good for beginners?
The README's guidance implies it suits teams with some ops experience. Setup and cluster operations assume familiarity with running server software, so beginners may find a managed option easier.
New agent skills, repos and AI tools — every week
The best new skills and open-source projects, the fastest-growing repos, and one free prompt. Five minutes to read. Unsubscribe anytime.
Our verdict
Garnet suits teams already using Redis clients who want to test a different server with few code changes, and C# developers who want a cache server they can read and extend. It is a poor fit if you want a fully managed service or depend on Redis-specific features the README does not cover, in which case a managed offering or Redis, Valkey, KeyDB or Dragonfly may be a safer choice.
Install options & downloads