Hazelcast Replacement:
Why Redisson is the Best Hazelcast Alternative
Hazelcast bills itself as "the industry's most comprehensive in-memory computing platform." Based on the Java programming language, Hazelcast is commonly used to implement distributed data stores and databases.
While Hazelcast is both a popular and feature-rich choice, it's not always the best solution for every user. Redis, in particular, presents a highly appealing alternative to Hazelcast.
Redis is an in-memory data structure store for building distributed databases, and also includes extensive support for Java. What's more, you can further enhance the capabilities of Redis with a third-party Redis Java client like Redisson.
Below, we'll go over why using Redis and Redisson may be the best replacement for Hazelcast in your IT environment.
Hazelcast vs. Redis (with Redisson)
As mentioned above, both Redis and Hazelcast let users build distributed data stores and databases in Java. In terms of performance, both Redis and Hazelcast have published their own benchmarks showing that their own solution comes out on top.
Third-party Java clients like Redisson can boost the already excellent performance of Redis. Udi Kidron, research & development leader at Datorama, has written of the improvements his team saw when moving from Hazelcast to Redis+Redisson.
Although the near cache in the base version of Redis was slower than that of Hazelcast, he found that installing Redisson made Redis faster than Hazelcast. In addition, "our production environment remained 100 percent stable with much less manual operation effort."
There are three main differences between Hazelcast and Redis in terms of technical implementation:
- Threading: Redis is single-threaded with a high-performance core, while Hazelcast is multi-threaded. Being single-threaded allows you to run multiple instances of Redis using different CPU cores. In addition, single-threaded platforms such as Redis do not have to deal with the "split-brain" problem, in which nodes lose their network connections to each other and come into conflict.
- Clustering: Hazelcast automatically discovers multicast routers through the UDP protocol, while Redis does not. This is because Redis developers believe that the time saved by automatic discovery is not worth the costs of troubleshooting and administering the full environment.
- Memory handling: Redis uses the jemalloc to easily handle even terabytes of RAM and efficiently manage data types such as lists, sets, and hashes. The open-source version of Hazelcast stores distributed data on the heap, which may affect application performance as the volume of data increases.
These technical differences are significant, but they can be chalked up to differences in development philosophies. In the next section, we'll discuss a few ways in which Redis+Redisson is clearly better than Hazelcast.
Why Redisson is the Best Hazelcast Replacement
1. Distributed objects, collections, and locks and synchronizers
Both Hazelcast and Redisson implement Java distributed objects, collections, and locks and synchronizers. However, Redisson has significantly more to offer in this regard.
Hazelcast supports the following Java classes:
- Map
- Multimap
- Set
- List
- Queue
- RingBuffer
- Lock
- Semaphore
- CountDownLatch
- Object holder
- AtomicLong
- Publish/Subscribe
- HyperLogLog
Meanwhile, Redisson includes all of the above classes and more:
- Deque
- SortedSet
- ScoredSortedSet
- PriorityQueue
- PriorityDeque
- DelayedQueue
- TransferQueue
- RingBuffer
- FairLock
- MultiLock
- ReadWriteLock
- PermitExpirableSemaphore
- AtomicDouble
- Geospatial
- BitSet
- BloomFilter
- BinaryStream
- RateLimiter
2. API architecture
Programming models such as asynchronous, reactive, and RxJava2 make it easier to perform asynchronous and parallel programming in Java. However, both Hazelcast and base Redis are limited in their support for these paradigms. Hazelcast has only partial support for asynchronous programming, while Redis has no support for any of the three.
The outlook dramatically improves when you install Redisson, which has full support for the asynchronous, reactive, and RxJava2 programming models.
3. Custom data serialization
In general, objects stored in a Redis database must be serialized and deserialized when saving to and loading from the database. That's why Redisson includes a variety of different custom data serialization codecs: JDK, JSON, Avro, Smile, CBOR, MsgPack, Kryo, FST, LZ4 compression, and Snappy compression.
Hazelcast, on the other hand, does not have built-in support for data serialization, which means that you'll have to custom-code these implementations yourself.
4. Fully managed services
Redis+Redisson is available as a fully managed cloud service from multiple cloud providers, including:
- Amazon ElastiCache for Redis
- Azure Cache for Redis
- IBM Cloud Databases for Redis
- ObjectRocket for Redis
As of writing, Hazelcast Cloud, a fully managed Hazelcast solution, is only available on Amazon Web Services. However, the Hazelcast Cloud announcement does mention that the service plans to expand to other clouds in the future, such as Microsoft Azure and Google Cloud Platform.