This article is a mirror article of machine translation, please click here to jump to the original article.

View: 3522|Reply: 2

[Source] A simple comparison of Garnet cache and Redis developed with .NET

[Copy link]
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:

Redis Benchmark performance test
https://www.itsvse.com/thread-9645-1-1.html

cacheversion
RedisRedis 3.0.504 (00000000/0) 64 bit
GarnetGarnet 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 types
Next:SSE (1) uses ASP.NET Core as the SSE server
 Landlord| Posted on 2024-3-28 18:01:32 |
KeyDB is a completely open-source database powered by Snap and is a faster alternative to Redis. Address:https://docs.keydb.dev/
 Landlord| Posted on 2025-9-3 09:36:07 |
FASTER: Fast concurrent persistent key-value storage and logging in C# and C++.
        
Documentation:The hyperlink login is visible.
Source:The hyperlink login is visible.
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com