API Compatibility
Garnet is a cache-store with a new thread-scalable system architecture. The network, processing, and storage (memory
and disk/cloud) layers of Garnet are all designed from the ground up. We chose the RESP API as a matter of
convenience given its broad adoption in the community. Garnet is not intended to be a 100% perfect drop-in
replacement for Redis, rather it should be regarded as a close-enough starting point for you to ensure compatibility
for features that matter to you. Garnet does work unmodified with many Redis clients (we have in particular tested
Garnet with StackExchange.Redis
very well), so getting started is very easy.
A list of API calls supported today by Garnet is maintained here. Below we highlight specific non-API-related choices that may not be compatible. This list is not exhaustive, rather it is meant as a broad guideline on what differences you can expect when using Garnet.
- Garnet being multi-threaded,
MSET
is not atomic. For an atomic version ofMSET
, you would need to express it as a transaction (stored procedure). - Garnet does not support the Redis functions or modules. Instead, it has its own C# based extensibility mechanisms that are optimized for high performance and ease of use.
- Garnet now has support for Lua scripting. However, a few libraries (
struct
andcmsgpack
) are not included by default. If you are interested in contributing these, check out this issue. Note however, that Lua scripts are slow in general, and if performance and scalability are important, you should instead use our server-side extensibility mechanisms instead. - Garnet respects the FIFO ordering of request-responses. However, when used with larger-than-memory data, and if you
opt in to using the scatter-gather version of IO (using the
EnableScatterGatherGet [--sg-get]
option) for increased disk performance, then even though results are still returned in FIFO order, the read operations may be executed out-of-order to earlier write operations in the same input operation sequence. - When Garnet is used with append-only-file (AOF) turned on, by default the server does not wait for commit before
returning success to the user. This can be adjusted using the
WaitForCommit [--aof-commit-wait]
option, while the frequency of commit can be tuned using theCommitFrequencyMs [--aof-commit-freq]
option. - You can disable the object store if your workload only consists of raw string operations, using the option
DisableObjects [--no-obj]
. The storage tier is disabled by default, and you can enable it usingEnableStorageTier [--storage-tier]
. You can disable the pub-sub feature using the optionDisablePubSub [--no-pubsub]
.