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.
Ready-to-run agent install
This asset can be installed after the agent chooses its runtime, checks the plan, and runs the matching command.
npx -y tokrepo@latest install 8d8fdb8c-3734-11f1-9bc6-00163e2b0d79 --target codexRun after dry-run confirms the install plan.
What it is
Garnet is a remote cache-store from Microsoft Research that offers strong performance, scalability, and Redis protocol compatibility. Written in C#, it leverages the .NET runtime for cross-platform support and modern memory management.
Garnet targets teams looking for a Redis-compatible cache with better throughput and lower tail latency at scale. It is designed for high-concurrency workloads where predictable performance matters.
The project is actively maintained and suitable for both individual developers and teams looking to integrate it into their existing toolchain. Documentation and community support are available for onboarding.
How it saves time or tokens
Garnet is a drop-in replacement for Redis in most scenarios. Existing Redis client libraries work without modification because Garnet implements the Redis serialization protocol (RESP). Migration from Redis requires no application code changes. Garnet's threading model reduces tail latency under high concurrency, meaning fewer retries and timeouts in your application.
How to use
- Download Garnet from GitHub releases or build from source with .NET 8+.
- Start the Garnet server:
dotnet run --project Garnet -- --port 6379 - Connect using any Redis client library (redis-py, ioredis, go-redis, etc.).
- Use standard Redis commands (GET, SET, HSET, LPUSH, etc.).
Example
# Build and run Garnet
git clone https://github.com/microsoft/garnet.git
cd garnet
dotnet restore
dotnet run --project Garnet -- --port 6379
# Connect with redis-cli (works because Garnet speaks RESP)
redis-cli -p 6379
> SET mykey 'hello'
OK
> GET mykey
"hello"
> HSET user:1 name 'Alice' age 30
(integer) 2
> HGETALL user:1
1) "name"
2) "Alice"
3) "age"
4) "30"
Related on TokRepo
- AI Tools for Database — Compare Garnet with other data stores and caching solutions.
- Featured Workflows — Browse curated infrastructure and backend tools.
Common pitfalls
- Assuming 100% Redis command coverage. Garnet implements the most common Redis commands but not all. Check the compatibility matrix for Lua scripting, Pub/Sub, and cluster commands before migrating.
- Not benchmarking with your specific workload. Garnet's performance advantages vary by access pattern. Run your actual workload against both Garnet and Redis to measure the difference.
- Skipping persistence configuration. By default, Garnet stores data in memory only. Configure checkpointing for durability if your use case requires data survival across restarts.
- Not reading the changelog before upgrading. Breaking changes between versions can cause unexpected failures in production. Pin your version and review release notes.
Frequently Asked Questions
No. Garnet is built from scratch in C# by Microsoft Research. It implements the Redis protocol (RESP) for compatibility but uses a completely different internal architecture optimized for modern hardware.
Garnet supports the most commonly used Redis commands including strings, hashes, lists, sets, sorted sets, and HyperLogLog. Some advanced features like Lua scripting and Redis Cluster protocol have limited support.
Garnet supports sharding for horizontal scalability. The clustering model is different from Redis Cluster. Check the Garnet documentation for the current state of cluster support.
Garnet's architecture uses a FASTER-based storage engine and a scalable threading model. Benchmarks show higher throughput and lower p99 latency compared to Redis under high concurrency. Results depend on workload characteristics.
Yes. Garnet runs on .NET 8, which supports Linux, macOS, and Windows. The C# codebase is fully cross-platform with no OS-specific dependencies.
Citations (3)
- Garnet GitHub— Remote cache-store from Microsoft Research
- Garnet Documentation— Redis protocol compatibility (RESP)
- Microsoft Research FASTER— FASTER-based storage engine for high performance
Related on TokRepo
Discussion
Related Assets
Varnish Cache — High-Performance HTTP Reverse Proxy and Accelerator
An open-source HTTP reverse proxy and caching engine designed to accelerate web applications by serving content from memory at high throughput.
StarRocks — High-Performance Analytical Database with MySQL Protocol
StarRocks is a next-generation MPP database that delivers extreme analytical query performance on large datasets. Benchmarks frequently show it as the fastest open-source OLAP engine — with full MySQL compatibility and support for data lake queries.
gRPC-Go — High-Performance RPC Framework for Go
gRPC-Go is the Go implementation of gRPC, a high-performance, open-source RPC framework. It uses Protocol Buffers for serialization and HTTP/2 for transport, enabling efficient communication between microservices with strongly-typed contracts.
JAX — High-Performance Numerical Computing by Google
A Python library for high-performance machine learning research combining NumPy-like syntax with automatic differentiation, XLA compilation, and hardware acceleration on GPU and TPU.