Jedis Alternative:
Why Redisson is the Best Jedis Replacement

Jedis and Redisson are two of the most popular third-party Redis Java clients. But which one is the best Redis Java client for you?

According to its GitHub project page, Jedis is "a blazingly small and sane Redis Java client" that was conceived with ease of use in mind. The advantages of Jedis include a healthy user community and official support from the Spring Data Redis project.

Redisson emphasizes a low learning curve, thanks to many familiar Java constructs, as well as a rich array of features: caching, task scheduling, web sessions, messaging, microservices, and more.

There are aspects of both Jedis and Redisson that will appeal to different users - so which one is better for your purposes? If you're looking for a Jedis replacement, this article will discuss the most important reasons why Redisson is the best alternative to Jedis.

Lettuce vs. Redisson

Jedis and Redisson are two of the only three Java clients that are officially recommended by Redis. However, the two projects could hardly be more different in terms of their advantages and use cases.

As mentioned above, the selling points for Jedis include ease of use and speed. Meanwhile, the benefits of Redisson include lightning-fast performance, implementations of many Java distributed objects and collections, and support for different programming models and architectures.

It's true that in a vacuum, Jedis is easy to use. However, it's also missing many important features that can simplify and streamline your development process. In this regard, Jedis may actually be harder to use than Redisson, requiring you to roll your own implementations of many common Java constructs.

Below, we'll mention some of the specific ways in which Redisson compensates for the shortcomings of Jedis.

Why Redisson is the Best Jedis Replacement

1. Distributed objects, collections, and locks and synchronizers

Jedis includes some Java distributed objects and collections, but it's no comparison to what Redisson includes. The following Java distributed objects and collections are supported in Jedis with plain commands only:

  • Map
  • Set
  • List
  • Queue
  • Deque
  • ScoredSortedSet
  • Stream
  • Object holder
  • AtomicLong
  • Publish/Subscribe
  • AtomicDouble
  • Geospatial
  • BitSet
  • HyperLogLog

Redisson, on the other hand, includes all of the above classes and more:

  • Multimap
  • SortedSet
  • PriorityQueue
  • PriorityDeque
  • DelayedQueue
  • RingBuffer
  • TransferQueue
  • BloomFilter
  • BinaryStream
  • RateLimiter

Most notably, Jedis is missing any distributed locks and synchronizers, which are crucial when building complex distributed systems. Redisson makes up for this issue by implementing the following Java classes:

  • Lock
  • Semaphore
  • CountDownLatch
  • FairLock
  • MultiLock
  • ReadWriteLock
2. Advanced cache support

Caching your database queries and computations improves the flexibility, scalability, and performance of your database. Only Redisson, however, includes advanced cache support, including:

  • A built-in JCache API.
  • A "near cache" that stores frequently accessed data on the heap, improving caching performance by up to 45 times faster.
  • Multiple caching strategies, including read-through, write-through, and write-behind.

Jedis, for its part, does not include these advanced caching features out of the box. Since caching is so integral to database performance, you may be forced to implement your own caching functionality in Jedis, which will undoubtedly make the development process more complex and time-consuming.

3. Distributed services

Complex databases with high traffic may need to manage dozens, hundreds, or thousands of tasks every second. Handling this many users may require a distributed database across multiple machines.

To simplify the task of building a distributed system, Redisson includes support for remote procedure calls (RPCs), task management, and task scheduling. The distributed services available within Redisson (and not Jedis) are:

  • RemoteService: Java Remote Method invocation.
  • LiveObjectService: Creating "live objects", which are enhanced Java objects that can be shared across different Java Virtual Machines (JVMs) and different computers.
  • ExecutorService: Managing the progress and termination of asynchronous Java tasks.
  • ScheduledExecutorService: Scheduling Java tasks periodically or after a given delay.
  • MapReduce: Implementing the MapReduce programming model for processing very large quantities of data.
4. Custom data serialization

When communicating over a network, as you'll need to do for a distributed database, it's a good idea to perform data serialization. Redisson gives you a wide range of options for how to serialize your Redis data.

The custom data serialization codecs supported by Redisson include: JDK, JSON, Avro, Smile, CBOR, MsgPack, Kryo, FST, LZ4 compression, and Snappy compression. Meanwhile, as a relatively lightweight Redis Java client, Jedis does not have built-in support for data serialization.

5. Better performance

Redisson PRO is an ultra-fast version of Redisson with even more features and functionality. In a benchmark between Redisson PRO and Jedis, Redisson PRO performed all Redis commands (except blocking commands) significantly faster than Jedis. The benchmark included frequently used Redis commands such as HSET, RPUSH, SADD, SET, and INCR.

Similar articles