Feature Comparison: Redisson vs Jedis
Two of the most popular Java client libraries for Redis are Redisson and Jedis. Redisson offers in-memory data grid features with support for a variety of distributed objects and services for Redis. Jedis, on the other hand, is a more lightweight offering that lacks certain features of other libraries.
If you're looking for a Java client library for Redis, you might wonder about the pros and cons of Redisson and Jedis. In this article, we'll compare and contrast the different features that both Redisson and Jedis have to offer.
Distributed collections
Redisson | Jedis | |
---|---|---|
Map | plain commands only | |
JSON store | plain commands only | |
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 implementations of many different Java objects, including distributed collections. These Redisson objects help Java programmers use many of the familiar data structures that they are accustomed to in Java.
The list of distributed collections in Redisson includes:
- Map
- JSON Store
- Multimap
- Set
- List
- Queue
- Deque
- SortedSet
- ScoredSortedSet
- PriorityQueue
- PriorityDeque
- DelayedQueue
- Stream
- RingBuffer
Jedis, on the other hand, provides significantly less support for distributed collections in Redis.
The following objects are only supported with plain commands in Jedis:
- Map
- Multimap
- Set
- List
- Queue
- Deque
- ScoredSortedSet
Distributed locks and synchronizers
Redisson | Jedis | |
---|---|---|
Lock | ||
Semaphore | ||
CountDownLatch | ||
FairLock | ||
Fenced Lock | ||
Spin Lock | ||
MultiLock | ||
ReadWriteLock |
The question of locks and synchronization becomes much more complex when dealing with a distributed system, with different clients on separate machines.
Fortunately, Redisson supports some familiar Java locks and synchronizers for distributed computing, such as:
- Lock
- Semaphore
- CountDownLatch
- FairLock
- Fenced Lock
- Spin Lock
- MultiLock
Jedis, however, does not include support for any of these locks and synchronizers in Redis. That means you'll have to handle this issue on your own, making the development process more complex.
Distributed objects
Redisson | Jedis | |
---|---|---|
Object holder | plain commands only | |
JSON holder | plain commands only | |
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 | plain commands only | |
BinaryStream | ||
HyperLogLog | plain commands only | |
RateLimiter | plain commands only |
In addition to distributed collections, locks, and synchronizers, Redisson also implements a variety of other distributed objects in Java for Redis:
- ObjectHolder
- JSON Holder
- AtomicLong
- Publish/Subscribe
- AtomicDouble
- Geospatial
- BitSet
- BloomFilter
- BinaryStream
- HyperLogLog
Of the distributed objects above, Jedis does not support the BloomFilter or BinaryStream objects at all. The other objects in the list are supported via plain commands only.
Advanced cache support
Redisson | Jedis | |
---|---|---|
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 |
Only Redisson has a variety of advanced caching features. For example, Redisson includes support for three different caching strategies: read-through, write-through, and write-behind. Redisson also has a JCache API and a near cache that holds local copies of objects that are fetched from a remote cache. However, none of the features mentioned above are supported by Jedis out of the box.
Transactions
Redisson | Jedis | |
---|---|---|
Transactions API |
API architecture
Redisson | Jedis | |
---|---|---|
Instance thread-safety | ||
Asynchronous interface | ||
Reactive stream interface | ||
RxJava3 interface |
Redisson includes support for instances thread-safety, asynchronous interfaces, the Reactive Streams API, and the RxJava3 API. This support is entirely lacking in Jedis, however.
Distributed services
Redisson | Jedis | |
---|---|---|
ExecutorService | ||
MapReduce | ||
SchedulerService | ||
RemoteService | ||
LiveObjectService | ||
RediSearch |
Redisson provides support for a variety of distributed services in Java:
- ExecutorService
- MapReduce
- SchedulerService
- RemoteService
- LiveObjectService
Unfortunately, none of these distributed services are supported by Jedis.
Integration with frameworks
Redisson | Jedis | |
---|---|---|
Spring Cache | ||
Spring Cache with near cache (up to 45x faster) |
||
Spring Data | ||
Spring Session | ||
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 |
Jedis includes support for the Spring Session and Spring Cache frameworks. In addition to these two frameworks, Redisson supports Hibernate Cache and the Tomcat Session Manager.
Security
Redisson | Jedis | |
---|---|---|
Authentication | ||
SSL support |
The good news is that both Jedis and Redisson include crucial security features such as authentication and SSL support.
Custom data serialization
Redisson | Jedis | |
---|---|---|
JSON codec | ||
JDK Serialization | ||
Avro codec | ||
Smile codec | ||
CBOR codec | ||
MsgPack codec | ||
Kryo codec | ||
LZ4 compression codec | ||
Snappy compression codec | ||
Zstd compression codec |
Redisson supports the Java Serialization API, as well as a variety of codecs:
- JSON
- FST
- JDK Serialization
- CBOR
- MsgPack
- Kryo
- Avro
- Smile
- LZ4 compression
- Snappy compression
Unfortunately, Jedis does not support JDK serialization or any of the above codecs.
Stability and ease of use
Redisson | Jedis | |
---|---|---|
Fully-managed services support (AWS Elasticache, Azure Cache...) |
||
Large memory amount handling |
Both Redisson and Jedis are able to handle large amounts of memory. However, only Redisson includes support for fully managed services such as AWS Elasticache and Azure Cache.
Use Redis commands mapping table to find Redisson method for a particular Redis command.