Hazelcast® is an ideal Couchbase Replacement. Couchbase server supports built-in clustering data replication with auto-failover. It partitions data to nodes in a similar manner to Hazelcast: it stores data in-memory and persists it to a disk.
Hazelcast and Couchbase have some similar features:
- They are Apache 2 Open Source projects, with Professional Support and Enterprise editions
- They have data distribution using partitions
- They have horizontal scalability
- They provide optimistic and pessimistic locking
- Both are often used as in-memory key-values stores
With Hazelcast, you can achieve data consistency and availability with synchronous backups (replicas), although you also can go for asynchronous replicas for performance (which sacrifices consistency). However, with Couchbase, where replicas are only eventually consistent, replicas are streamed to a queue and then are written over to another node in the cluster.
Hazelcast Has Serialization
Hazelcast stores objects that are serialized and deserialized as they move over the wire to the cluster nodes, both keys and values. Different serialization options are available with Hazelcast. Couchbase stores data as primitive types and complex types as JSON documents and stores keys as strings.
Hazelcast and Couchbase Use Cases
Developers typically use Couchbase for the following use cases, which Hazelcast also supports:
- High-availability and in-memory caching of data
- Content and metadata store
- Memcached replacement
Among these use cases, here are a few that distinguish Hazelcast from Couchbase.
- Messaging – Hazelcast can be used as a distributed publish/subscribe messaging middleware
- Event-driven programming model – user code can be triggered by specific changes to the dataset. Clients do not have to poll the cluster in order to detect the change
- Server-side computing – computing tasks can be executed close to the data. Data doesn’t have to be retrieved to the client in order to be processed
- Caching middleware covering multiple databases or enterprise systems
- Hazelcast is cloud-ready – Download the Amazon EC2 Deployment Guide
For a comprehensive list of Hazelcast use cases, refer to Hazelcast’s use case web page.
|Licensing||Apache v2||Apache v2|
|Implementation Language||Erlang, C Couchbase uses C for the Memory Cache (based on Memcached), Erlang for the Communications Manager.||Java|
|Stored Structures||Key-value, Document Map, List, Queue, Set||Multiple storage structures. Key/Value (Map, MultiMap), Queue, Set, List, Topic, Ring Buffer.|
|Distributed toolkit||Atomic counter||AtomicLong HyperLogLog Lock Semaphore IdGenerator CountDownLatch AtomicReference|
|Distributed computation||Incremental Data Views Aggregations (via SQL)||Entry Processor Execution Service Aggregations* Hazelcast Jet®|
|Persistence||Yes Tiered storage||Yes The Java Interface in which Cache Misses and Puts can be coded against any backing store: for example, another RDBMS, NoSQL, HDFS, or network.|
|Memcached Protocol||Yes||Yes Text-based version of a protocol only|
|Messaging||No||Yes Distributed Events. Queues / Topics.|
|Query Language||PUT/GET constructs, REST API||Java APIs, SQL Using SqlPredicate, it is possible to query IMaps with SQL-like syntax.|
Hazelcast Acts as Middleware
What distinguishes Hazelcast from NoSQL stores is that Hazelcast acts as middleware. Data can be persisted to any database, NoSQL (including Couchbase) or RDBMS or HDFS.
Hazelcast Uses Standard Java Collections API
The learning curve for Hazelcast can be very low because Hazelcast implements the standard Java Collections API that most Java developers are familiar with. Underneath, Hazelcast is distributed. Moreover, you can leverage advanced features for distributed computing like ExecutorService and EntityProcessor (which supports delta-updates without moving the object across network), and MapReduce API. Hazelcast has a mature production-ready clustering / replication functionality (including WAN replication).
Also, for Java-based caching, you don’t have to stick with proprietary APIs and clients: rather, you use the standard JCache API (JSR-107).
Hazelcast Supports Client/Server and Embedded Models
Couchbase follows a traditional Client/Server model. Hazelcast supports client/server and embedded models. With embedded Hazelcast, you don’t need to maintain separate infrastructure for data grid servers because each instance of the application that contains the Hazelcast jar essentially becomes a member of a cluster.