Microsoft Introduces Garnet: Next-Generation Cache Store
Microsoft recently opened the source code of the NOSQL system Garnet, designed to create caching storages and compatible with existing client libraries for Redis storage. Garnet supports the creation of scalable clusters for caching data, allowing for replication, keys migration, and segmenting data between cluster nodes. The project, written in C# with the core storage in C++, is open under the MIT license and can be used on all platforms supported in .NET, including Linux.
To store data, Garnet uses the engine Tsavorite, which maintains multi-flow processing of requests, transactions, fixing changes in non-closing mode, recovery after failures, maintaining copies, and conducting operations. The network handler in Garnet is built using the shared memory architecture proposed by the research project Shadowfax. TLS processing and interaction with the repository are performed in a single stream to avoid overhead flowing flows and efficiently use the CPU cache when transmitting data on the network.
The architecture of Garnet separates the logic of analysis and processing of requests from storage operations. Data is stored in two storage facilities in key-value format based on the Tsavorite library. The “main” storage is optimized for quick line performance, while the “object” storage is optimized for complex objects and expanded data types, such as hashes and lists. Data in the second storage is implemented with the involvement of .NET libraries and stored in a heap format on disk.
Key features of Garnet include:
- Deployment of multi-level storage facilities covering RAM, SSD drives, and cloud storages to create caches by moving less popular data to slower storage facilities when RAM size is exceeded.
- Extensible support for devices to create layers optimized for different devices such as SSDs, hard disks, and Azure Storage cloud storage.
- An effective mechanism for re-using released space in RAM to prevent fragmentation.