Microsoft.Garnet 1.0.6

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package Microsoft.Garnet --version 1.0.6                
NuGet\Install-Package Microsoft.Garnet -Version 1.0.6                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Microsoft.Garnet" Version="1.0.6" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Microsoft.Garnet --version 1.0.6                
#r "nuget: Microsoft.Garnet, 1.0.6"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Microsoft.Garnet as a Cake Addin
#addin nuget:?package=Microsoft.Garnet&version=1.0.6

// Install Microsoft.Garnet as a Cake Tool
#tool nuget:?package=Microsoft.Garnet&version=1.0.6                

Garnet

.NET CI Discord Shield

Garnet is a new remote cache-store from Microsoft Research, that offers several unique benefits:

  • Garnet adopts the popular RESP wire protocol as a starting point, which makes it possible to use Garnet from unmodified Redis clients available in most programming languages of today, such as StackExchange.Redis in C#.
  • Garnet offers much better throughput and scalability with many client connections and small batches, relative to comparable open-source cache-stores, leading to cost savings for large apps and services.
  • Garnet demonstrates extremely low client latencies (often less than 300 microseconds at the 99.9th percentile) using commodity cloud (Azure) VMs with Accelerated Networking enabled, which is critical to real-world scenarios.
  • Based on the latest .NET technology, Garnet is cross-platform, extensible, and modern. It is designed to be easy to develop for and evolve, without sacrificing performance in the common case. We leveraged the rich library ecosystem of .NET for API breadth, with open opportunities for optimization. Thanks to our careful use of .NET, Garnet achieves state-of-the-art performance on both Linux and Windows.

This repo contains the code to build and run Garnet. For more information and documentation, check out our website at https://microsoft.github.io/garnet.

Feature Summary

Garnet implements a wide range of APIs including raw strings (e.g., gets, sets, and key expiration), analytical (e.g., HyperLogLog and Bitmap), and object (e.g., sorted sets and lists) operations. It can handle multi-key transactions in the form of client-side RESP transactions and our own server-side stored procedures in C# and allows users to define custom operations on both raw strings and new object types, all in the convenience and safety of C#, leading to a lower bar for developing custom extensions.

Garnet uses a fast and pluggable network layer, enabling future extensions such as leveraging kernel-bypass stacks. It supports secure transport layer security (TLS) communications using the robust SslStream library of .NET, as well as basic access control. Garnet’s storage layer, called Tsavorite, was forked from our prior open-source project FASTER, and includes strong database features such as thread scalability, tiered storage support (memory, SSD, and cloud storage), fast non-blocking checkpointing, recovery, operation logging for durability, multi-key transaction support, and better memory management and reuse. Finally, Garnet supports a cluster mode of operation with support for sharding, replication, and dynamic key migration.

<p align="center"> <img src="https://github.com/microsoft/garnet/assets/18355833/851be90b-e43a-40ca-ae56-7dc087cf6adc" width=350 /> </p>

Performance Preview

We illustrate a few key results on our website comparing Garnet to leading open-source cache-stores.

Design Highlights

Garnet’s design re-thinks the entire cache-store stack – from receiving packets on the network, to parsing and processing database operations, to performing storage interactions. We build on top of years of our prior research. Below is Garnet’s overall architecture.

<p align="center"> <img src="https://github.com/microsoft/garnet/assets/18355833/8d89f719-f86b-4b1f-81d1-1ae7bd450001" width=400 /> </p>

Garnet’s network layer inherits a shared memory design inspired by our prior research on ShadowFax. TLS processing and storage interactions are performed on the IO completion thread, avoiding thread switching overheads in the common case. This approach allows CPU cache coherence to bring the data to the network, instead of traditional shuffle-based designs, which require data movement on the server.

Garnet’s storage design consists of two Tsavorite key-value stores whose fates are bound by a unified operation log. The first store, called the “main store,” is optimized for raw string operations and manages memory carefully to avoid garbage collection. The second, and optional, “object store” is optimized for complex objects and custom data types, including popular types such as Sorted Set, Set, Hash, List, and Geo. Data types in the object store leverage the .NET library ecosystem for their current implementations. They are stored on the heap in memory (which makes updates very efficient) and in a serialized form on disk. In the future, we plan to investigate using a unified index and log to ease maintenance.

A distinguishing feature of Garnet’s design is its narrow-waist Tsavorite storage API, which is used to implement the large, rich, and extensible RESP API surface on top. This API consists of read, upsert, delete, and atomic read-modify-write operations, implemented with asynchronous callbacks for Garnet to interject logic at various points during each operation. Our storage API model allows us to cleanly separate Garnet’s parsing and query processing concerns from storage details such as concurrency, storage tiering, and checkpointing. Garnet uses two-phase locking for multi-key transactions.

Cluster Mode

In addition to single-node execution, Garnet supports a cluster mode, which allows users to create and manage a sharded and replicated deployment. Garnet also supports an efficient and dynamic key migration scheme to rebalance shards. Users can use standard Redis cluster commands to create and manage Garnet clusters, and nodes perform gossip to share and evolve cluster state. Cluster is still work in progress.

Next Steps

Head over to our documentation site, or jump directly to the getting started or releases section.

License

This project is licensed under the MIT License, see the LICENSE file.

Privacy

Privacy information can be found at https://privacy.microsoft.com/en-us/.

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.

When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

Trademarks

This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow Microsoft's Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party's policies.

Redis is a registered trademark of Redis Ltd. Any rights therein are reserved to Redis Ltd. Any use by Microsoft is for referential purposes only and does not indicate any sponsorship, endorsement or affiliation between Redis and Microsoft.

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (7)

Showing the top 5 NuGet packages that depend on Microsoft.Garnet:

Package Downloads
MyHome.Common.Cache

Package Description

Biwen.Settings.Caching.Garnet

Biwen.Settings ,NET8+ 应用配置项管理模块

TsavoriteCache

Package Description

OrchardCoreContrib.Garnet.Abstractions

Provides an abstractions APIs for Garnet.

Object.Storage.Redis

基于Redis的对象存储

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.42 0 11/22/2024
1.0.41 15 11/21/2024
1.0.40 22 11/21/2024
1.0.39 410 11/13/2024
1.0.38 111 11/12/2024
1.0.37 73 11/12/2024
1.0.36 215 11/7/2024
1.0.35 262 10/31/2024
1.0.34 499 10/23/2024
1.0.33 342 10/15/2024
1.0.32 146 10/12/2024
1.0.31 160 10/12/2024
1.0.30 253 10/4/2024
1.0.29 1,743 9/27/2024
1.0.28 111 9/26/2024
1.0.27 322 9/23/2024
1.0.25 140 9/20/2024
1.0.24 114 9/18/2024
1.0.23 153 9/16/2024
1.0.22 238 9/12/2024
1.0.21 288 9/9/2024
1.0.20 133 9/9/2024
1.0.19 2,283 8/26/2024
1.0.18 1,793 8/3/2024
1.0.17 152 7/30/2024
1.0.16 107 7/29/2024
1.0.15 1,025 6/27/2024
1.0.14 662 6/17/2024
1.0.13 4,688 6/7/2024
1.0.12 337 5/31/2024
1.0.11 203 5/30/2024
1.0.10 319 5/17/2024
1.0.9 180 5/17/2024
1.0.8 290 5/10/2024
1.0.7 425 5/2/2024
1.0.6 283 4/25/2024
1.0.5 1,596 4/13/2024
1.0.4 579 4/5/2024
1.0.3 279 4/1/2024
1.0.2 521 3/28/2024
1.0.1 355 3/24/2024
1.0.0 508 3/18/2024