Skills2026年4月13日·1 分钟阅读

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.

Agent 就绪

Agent 可直接安装

这个资产可安装;Agent 先选择当前运行时、检查安装计划,再运行匹配命令。

Native · 98/100策略:允许
Agent 入口
任意 MCP/CLI Agent
类型
Skill
安装
Single
信任
信任等级:Established
入口
step-1.md
直接安装命令
npx -y tokrepo@latest install 8d8fdb8c-3734-11f1-9bc6-00163e2b0d79 --target codex

先 dry-run 确认安装计划,再运行此命令。

TL;DR
Garnet is a Microsoft Research cache-store offering Redis compatibility, strong performance, and .NET cross-platform support.
§01

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.

§02

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.

§03

How to use

  1. Download Garnet from GitHub releases or build from source with .NET 8+.
  2. Start the Garnet server: dotnet run --project Garnet -- --port 6379
  3. Connect using any Redis client library (redis-py, ioredis, go-redis, etc.).
  4. Use standard Redis commands (GET, SET, HSET, LPUSH, etc.).
§04

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"
§05

Related on TokRepo

§06

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.

常见问题

Is Garnet a Redis fork?+

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.

Which Redis commands does Garnet support?+

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.

Does Garnet support clustering?+

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.

What are the performance advantages?+

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.

Can I run Garnet on Linux?+

Yes. Garnet runs on .NET 8, which supports Linux, macOS, and Windows. The C# codebase is fully cross-platform with no OS-specific dependencies.

引用来源 (3)

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产