DEV Community

Nikita Koksharov
Nikita Koksharov

Posted on

Feature Comparison: Valkey and Redis vs. Hazelcast

In-memory data stores are a critical building block for developers of high-performance, distributed applications. Data stores go past the limitations of traditional relational databases by moving data in and out of system memory instead of slower, disk-based reads and writes. Developers use data stores as caches, message queues, and more for their raw speed and scalability.

The most popular choices for Java developers are Valkey, the open-source offshoot of the long-standing Redis project, Redis or Hazelcast. Although Valkey and Redis don’t support Java natively, the Redisson client addresses this issue and adds new features via familiar classes and methods. Hazelcast is an in-memory data grid written in Java that’s often used in distributed applications.

This comparison will look at Valkey/Redis (plus Redisson) and Hazelcast to help you understand their features, capabilities, performance, and more. In the end, you will have the knowledge to pick the best in-memory data store for you or your Java development team.

API Architecture

The first feature we'll compare is the API architecture offered by Redis/Valkey plus Redisson versus that of Hazelcast. The design and flexibility of an API are critical for building responsive, scalable applications. Redisson offers a comprehensive suite of API styles to support varying application architectures.

For example, it has a fully asynchronous API for all operations. This allows developers to write non-blocking code, freeing up threads to handle other requests while waiting for data to come in or out. Hazelcast offers asynchronous support for some of its methods, but it lacks Redisson's support for reactive programming paradigms like Reactive Streams or RxJava.

Feature Valkey or Redis + Redisson Hazelcast
Asynchronous interface partial support
Reactive stream interface
RxJava3 interface

Collections

Redisson leverages the rich data structures of Valkey/Redis to deliver distributed collections that mirror standard Java collection interfaces. This includes RMap object, which implements java.util.concurrent.ConcurrentMap and java.util.Map to give developers a familiar API with added features. Hazelcast offers a handful of distributed collections, although not as many as Redisson.

Feature Valkey or Redis + Redisson Hazelcast
Map
Multimap
JSON Store
Set
List
SortedSet
ScoredSortedSet
TimeSeries

Queues

Distributed queues are fundamental building blocks of asynchronous communication and other traits of modern applications. Redisson provides a comprehensive suite of queue implementations. This includes Reliable Queue, which ensures a message will eventually be processed even if the consumer crashes. Hazelcast also offers a few different queues, built around its stream processing engine.

Feature Valkey or Redis + Redisson Hazelcast
Reliable Queue
Reliable Fanout
Queue
Deque
PriorityQueue
PriorityDeque
TransferQueue
RingBuffer
Stream

Objects

Beyond standard collections and queues, modern distributed applications require tools and data structures to manage individual objects or publish/subscribe (pub/sub) messaging. Redisson offers a long list of specialized distributed objects, while Hazelcast only has some equivalents.

Feature Valkey or Redis + Redisson Hazelcast
Object holder
JSON holder
Topic (Pub/Sub)
Reliable Topic (Pub/Sub)
Geospatial
BitSet
BloomFilter
BinaryStream
HyperLogLog
RateLimiter

Counters

From generating unique IDs and tracking statistics to managing resource counts and coordinating distributed operations, counters are an essential tool for today's enterprise developers. Redisson meets this need by providing distributed versions of common Java atomic number classes and specialized counters. In comparison, Hazelcast only covers the basic use cases with tools for ID generation and atomic long operations.

Feature Valkey or Redis + Redisson Hazelcast
Id Generator
AtomicLong
AtomicDouble
LongAdder
DoubleAdder

Locks and Synchronizers

Coordinating access to shared resources and aligning operations across multiple nodes requires developers to employ various locks and synchronizers. Redisson offers multiple innovative solutions, such as FairLock, which guarantees that threads attempting to acquire a lock are serviced in the order they requested it. Meanwhile, Hazelcast has tools similar to some of Redisson's offerings, but not all of them.

Feature Valkey or Redis + Redisson Hazelcast
Lock
Semaphore
CountDownLatch
FairLock
Fenced Lock
Spin Lock
MultiLock
ReadWriteLock

Advanced Caching

Caching used to only be about storing frequently-used data in memory for faster access. Today's more complex applications utilize much more sophisticated caching strategies to maximize performance, reduce latency, and ensure data consistency. Both Valkey/Redis with Redisson and Hazelcast offer modern caching options.

Feature Valkey or Redis + Redisson Hazelcast
Near Cache
Read-through strategy
Write-through strategy
Write-behind strategy

Cache API Implementations

Developers today expect standardized caching APIs and direct integration with popular frameworks, so they don't have to write custom code to access critical features. Both Redisson PRO and Hazelcast support a wide range of cache API implementations, although only Redisson can work with Quarkus's caching annotations and infrastructure.

Feature Valkey or Redis + Redisson Hazelcast
JCache API
JCache API with near cache
Spring Cache
Spring Cache with near cache
Hibernate Cache
Hibernate Cache with near cache
MyBatis Cache
MyBatis Cache with near cache
Quarkus Cache
Quarkus Cache with near cache
Micronaut Cache
Micronaut Cache with near cache

Transactions

Both Redisson and Hazelcast support transactional operations, which are critical for maintaining data consistency across multiple operations and data sources.

Feature Valkey or Redis + Redisson Hazelcast
Transactions API
XA Transactions

Session Management

In modern web applications designed for high availability, developers must find ways to manage HTTP sessions effectively. Storing sessions in a distributed, fault-tolerant manner ensures that user session data is not lost if a server instance fails and that users can be seamlessly routed to an available node. Both Redisson and Hazelcast support popular session management frameworks.

Feature Valkey or Redis + Redisson Hazelcast
Micronaut Session
Tomcat Session Manager
Spring Session

Services

Redisson and Hazelcast both provide Java developers with distributed services to simplify computations, schedule tasks, and interact with data in sophisticated ways. However, only Redisson supports remote procedure calls (RPCs) with its RemoteService and live Java objects via the LiveObjectService.

Feature Valkey or Redis + Redisson Hazelcast
ExecutorService
MapReduce
SchedulerService
Search capabilities
RemoteService
LiveObjectService

Security

Both Redisson PRO and Hazelcast support standard security mechanisms such as authentication, password encryption, and SSL.

Feature Valkey or Redis + Redisson Hazelcast
Authentication
Authorization
SSL support
Passwords encryption

Data Serialization

The ability to serialize data is important for distributed applications, as it increases efficiency, reduces network bandwidth, and requires less storage. Redisson offers an extensive range of built-in codecs, giving developers more flexibility in the formats they can work with. Hazelcast supports the JSON codec but relies on its own serialization methods.

Feature Valkey or Redis + Redisson Hazelcast
JSON codec
JDK Serialization
Avro codec
Apache Fury codec
Smile codec
CBOR codec
MsgPack codec
Kryo codec
Protobuf codec
LZ4 compression codec
ZStandard compression codec
Snappy compression codec

Stability and Ease of Use

Developers must have stable tools that are easy to use. The list of features, no matter how long or varied, is not important if the software is not dependable or doesn't fit into a developer's tech stack. While both Redisson and Hazelcast are intuitive for Java developers, Redisson offers more flexible deployment options.

With support for all popular managed services, like AWS Elasticache and Azure Cache, Redisson is ready for nearly any development environment. Hazelcast users, on the other hand, are limited to the Hazelcast Cloud. And when it comes to handling large amounts of memory, Hazelcast's open source version has some limitations, while Redisson has no issues.

Feature Valkey or Redis + Redisson Hazelcast
Fully-managed services support (AWS Elasticache, Azure Cache...) Hazelcast Cloud
Large memory amount handling Open-source version has limitations

Valkey/Redis vs. Hazelcast: Who is the Winner?

Both Redisson, backed by Valkey or Redis, and Hazelcast offer Java developers familiar tools for building distributed applications around high-performance data stores. But, as this feature comparison shows, Redisson provides more features and flexibility. For most Java developers, the combination of Redisson and Valkey/Redis will be the clear winner.

Redis image

62% faster than every other vector database

Tired of slow, inaccurate vector search?
Redis delivers top recall and low latency, outperforming leading vector databases in recent benchmarks. With built-in ANN and easy scaling, it’s a fast, reliable choice for real-time AI apps.

Get started

Top comments (0)