|
|
Posted on 2024-3-28 18:00:42
|
|
|
|

Garnet is a new type of remote cache storage developed by Microsoft Research that offers several unique benefits:
- Garnet takes the popular RESP line protocol as a starting point, which makes it possible to use Garnet from unmodified Redis clients available in most programming languages today, such as StackExchange.Redis in C#.
- Garnet offers better throughput and scalability with many client connections and small batches compared to comparable open-source cache storage, saving costs for large applications and services.
- Garnet demonstrated extremely low client latency (typically less than 300 microseconds at 99.9%) using Commodity Cloud (Azure) VMs with accelerated TCP enabled, which is critical for real-world scenarios.
- Garnet is based on the latest .NET technology and is cross-platform, extensible, and modern. It is designed to be easy to develop and evolve without sacrificing performance in common situations. We leverage the rich library ecosystem of .NET to extend the API and provide open optimization opportunities. Thanks to our careful use of .NET, Garnet achieves state-of-the-art performance on both Linux and Windows.
Open Source Address:The hyperlink login is visible. Documentation:The hyperlink login is visible.
Garnet has the following key benefits:
- Server throughput (operations per second) is increased by several orders of magnitude for small batches and many client sessions relative to comparable open source cache storage.
- On commodity cloud (Azure) machines with accelerated TCP enabled on Windows and Linux, the latency per operation is extremely low (typically less than 300 microseconds at 99.9%).
- As the number of clients increases, better scalability is achieved with or without client batching.
- Ability to use all CPU/memory resources of a server computer through a single shared memory server instance (no need for intra-node clustering).
- Support for larger-than-memory datasets that overflow to on-premises and cloud storage devices.
- Database features such as quick checkpoint and recovery and publish/subscribe.
- Support for multi-node sharded hash partitioning (Redis "cluster" mode), state migration, and replication.
- Well tested with a comprehensive test suite (thousands of unit tests against Garnet and its storage tier Tsavorite).
- C# codebase that is easy to evolve and extend.
Garnet does not support all Redis commands, specifically supported commands to view:The hyperlink login is visible. The Garnet project includes a Benchmark tool for running RESP benchmarks using different clients, different workloads, and different policies to measure throughput, performance, and latency. Address:The hyperlink login is visible. RESP Protocol:The hyperlink login is visible.
This article uses Redis's built-in benchmarking tools for simple testing, and the test environment is as follows:
| cache | version | | Redis | Redis 3.0.504 (00000000/0) 64 bit | | Garnet | Garnet 1.0.2 64 bit; standalone mode |
Redis benchmarks
First, launch the Redis cache using the command line with the following command:
The test command is as follows:
The results are as follows:
====== SET ====== 500000 requests completed in 24.38 seconds 100 parallel clients 3 bytes payload keep alive: 1
0.03% <= 1 milliseconds 0.25% <= 2 milliseconds 2.65% <= 3 milliseconds 16.49% <= 4 milliseconds 59.95% <= 5 milliseconds 99.09% <= 6 milliseconds 99.76% <= 7 milliseconds 99.86% <= 8 milliseconds 99.93% <= 9 milliseconds 99.98% <= 10 milliseconds 99.99% <= 11 milliseconds 100.00% <= 12 milliseconds 20512.82 requests per second
====== GET ====== 500000 requests completed in 27.41 seconds 100 parallel clients 3 bytes payload keep alive: 1
0.03% <= 1 milliseconds 0.19% <= 2 milliseconds 6.44% <= 3 milliseconds 25.82% <= 4 milliseconds 45.65% <= 5 milliseconds 98.79% <= 6 milliseconds 99.98% <= 7 milliseconds 99.98% <= 8 milliseconds 99.98% <= 9 milliseconds 100.00% <= 9 milliseconds 18238.86 requests per second
Garnet benchmarks
Create a new .NET 8 console project and first reference the Microsoft.Garnet package with the following command:
The code is as follows:
The startup command is as follows:
Using the same benchmark command, the result is as follows:
====== SET ====== 500000 requests completed in 11.51 seconds 100 parallel clients 3 bytes payload keep alive: 1
75.51% <= 1 milliseconds 88.24% <= 2 milliseconds 92.04% <= 3 milliseconds 99.46% <= 4 milliseconds 99.98% <= 5 milliseconds 99.99% <= 6 milliseconds 100.00% <= 12 milliseconds 100.00% <= 12 milliseconds 43448.04 requests per second
====== GET ====== 500000 requests completed in 31.50 seconds 100 parallel clients 3 bytes payload keep alive: 1
0.01% <= 1 milliseconds 0.90% <= 2 milliseconds 27.25% <= 3 milliseconds 97.65% <= 4 milliseconds 99.82% <= 5 milliseconds 99.94% <= 6 milliseconds 99.98% <= 7 milliseconds 99.98% <= 9 milliseconds 99.98% <= 10 milliseconds 99.99% <= 11 milliseconds 100.00% <= 12 milliseconds 100.00% <= 12 milliseconds 15872.01 requests per second Due to the testing tools, software versions, test parameters, etc., all lead to different results, the tests are for reference only, through the simple tests in this article, it can be seen that Garnet has significantly lower latency than Redis.
(End) |
Previous:.NET/C# reflection attribute, which can be judged by null typesNext:SSE (1) uses ASP.NET Core as the SSE server
|