Feature Comparison: Redisson vs Spring Data Redis
In the battle of third-party Redis Java clients, which is better: Redisson or Spring Data Redis?
Redisson has many distributed Java collections, objects, and service implementations. With these features, Redisson significantly reduces the Redis learning curve for Java developers. In particular, Redisson makes it easier than ever to build key-value Redis databases.
According to its developers, Spring Data Redis (SDR) “provides easy configuration and access to Redis from Spring applications. It offers both low-level and high-level abstractions for interacting with the store, freeing users from infrastructural concerns." SDR provides both synchronous and asynchronous support for the Redis API — including Java data structures, publish/subscribe (pub/sub), high availability, and scalability.
Both Redisson and Spring Data Redis are excellent options for developing with Java and Redis. Below, we'l examine how the two third-party Redis clients stack up against each other in a Redisson vs. Spring Data Redis feature comparison.
Distributed collections
Redisson | Spring Data Redis | |
---|---|---|
Map | plain commands only | |
JSON store | ||
Multimap | ||
Set | plain commands only | |
List | plain commands only | |
Queue | plain commands only | |
Deque | plain commands only | |
SortedSet | ||
ScoredSortedSet | plain commands only | |
PriorityQueue | ||
PriorityDeque | ||
DelayedQueue | ||
Stream | plain commands only | |
RingBuffer | ||
TransferQueue | ||
TimeSeries |
Redisson has a more complete set of Java distributed collections; SDR supports the following collections for plain commands only:
Map
Set
List
Queue
Deque
ScoredSortedSet
Stream
Redisson supports all of the above collections, plus these:
JSON Store
Multimap
SortedSet
PriorityQueue
PriorityDeque
DelayedQueue
RingBuffer
TransferQueue
Distributed locks and synchronizers
Redisson | Spring Data Redis | |
---|---|---|
Lock | ||
Semaphore | ||
CountDownLatch | ||
FairLock | ||
Fenced Lock | ||
Spin Lock | ||
MultiLock | ||
ReadWriteLock |
When it comes to distributed locks and synchronizers, Redisson is the clear winner. The Redisson feature set includes:
Lock
Semaphore
CountDownLatch
FairLock
Fenced Lock
Spin Lock
MultiLock
ReadWriteLock
On the other hand, Spring Data Redis does not include any of these implementations.
Distributed objects
Redisson | Spring Data Redis | |
---|---|---|
Object holder | plain commands only | |
JSON holder | ||
AtomicLong | plain commands only | |
LongAdder | ||
DoubleAdder | ||
Publish/Subscribe | plain commands only | |
Reliable Publish/Subscribe | ||
Id Generator | ||
AtomicDouble | plain commands only | |
Geospatial | plain commands only | |
BitSet | plain commands only | |
BloomFilter | ||
BinaryStream | ||
HyperLogLog | plain commands only | |
RateLimiter |
Both Redisson and Spring Data Redis have a solid collection of Java distributed objects. Here's what SDR offers:
Object holder
AtomicLong
Publish/Subscribe (Pub/Sub)
AtomicDouble
Geospatial
BitSet
HyperLogLog
However, all of these Spring Data Redis implementations are for plain commands only. Redisson, meanwhile, includes all the objects listed above as well as these:
JSON holder
LongAdder
DoubleAdder
BinaryStream
RateLimiter
Advanced cache support
Redisson | Spring Data Redis | |
---|---|---|
JCache API | ||
JCache API with near cache (up to 45x faster) |
||
Near Cache | ||
Read-through strategy support | ||
Write-through strategy support | ||
Write-behind strategy support |
Redisson excels at caching, which can greatly boost database performance. The time and effort saved from caching data add up in the long run, helping your applications run faster and retrieve information more quickly.
Redisson's caching features include:
An implementation of the JCache API for Redis — including near caching — which can execute database operations up to 45 times faster.
Support for read-through, write-through, and write-behind caching.
On the other hand, advanced cache support in Spring Data Redis is minimal.
Transactions
Redisson | Spring Data Redis | |
---|---|---|
Transactions API |
Java transactions use a standard programming paradigm in which multiple commands are executed in a single step, ensuring that they all either succeed or fail as a single unit. This is crucial for use cases such as financial transactions, in which a single operation is actually performed by multiple commands under the hood (for example, a money transfer).
If you need support for Java transactions, Redisson is the better choice because it has an API specifically for transactions. Spring Data Redis, meanwhile, does not.
API architecture
Redisson | Spring Data Redis | |
---|---|---|
Instance thread-safety | ||
Asynchronous interface | ||
Reactive stream interface | ||
RxJava3 interface |
Programming models such as asynchronous, reactive, and RxJava3 are excellent ways for Java developers to optimize their applications. Only Redisson include full-fledged support for these three frameworks.
Both Redisson and Spring Data Redis have native support for thread safety. This reduces the likelihood of errors, crashes, and race conditions during program execution.
Distributed services
Redisson | Spring Data Redis | |
---|---|---|
ExecutorService | ||
MapReduce | ||
SchedulerService | ||
RemoteService | ||
LiveObjectService | ||
RediSearch |
Integration with frameworks
Redisson | Spring Data Redis | |
---|---|---|
Spring Boot | ||
Spring Data | ||
Spring Session | ||
Spring Cache | ||
Spring Cache with near cache (up to 45x faster) |
||
Hibernate Cache | ||
Hibernate Cache with near cache (up to 5x faster) |
||
MyBatis Cache | ||
MyBatis Cache with near cache (up to 45x faster) |
||
Quarkus Cache | ||
Quarkus Cache with near cache (up to 45x faster) |
||
Micronaut Cache | ||
Micronaut Cache with near cache (up to 45x faster) |
||
Micronaut Session | ||
Tomcat Session Manager |
Security
Redisson | Spring Data Redis | |
---|---|---|
Authentication | ||
SSL support |
Custom data serialization
Redisson | Spring Data Redis | |
---|---|---|
JSON codec | ||
JDK Serialization | ||
Avro codec | ||
Smile codec | ||
CBOR codec | ||
MsgPack codec | ||
Kryo codec | ||
LZ4 compression codec | ||
Snappy compression codec | ||
Zstd compression codec |
Stability and ease of use
Redisson | Spring Data Redis | |
---|---|---|
Fully-managed services support (AWS Elasticache, Azure Cache...) |
||
Large memory amount handling |
Both Redisson and Spring Data Redis can handle large amounts of memory, which is essential for stability. However, Redisson wins in the ease-of-use category. Redisson supports fully managed cloud services, such as Amazon ElastiCache and Azure Cache for Redis. These services significantly lower the learning curve for new users. Rather than managing a Redis deployment yourself, Redisson allows you to pass off this task to the cloud provider, reducing your IT workload.
Redisson also implements the Spring Data Redis API. If you already use the Spring Data Redis API, you can get to work right away with Redisson's implementation. Also, for those who already use SDR and won't want to migrate away from it, Redisson's Spring Data Redis API can serve as a way to implement the Redis interaction extension.
See the Redis commands mapping table to find the Redisson method for a particular Redis command.