Hazelcast Topologies
Hazelcast allows you to use it in either embedded mode or client/server mode. The mode you choose has an effect on your applications performance, your ability to scale your cluster, and how you communicate with your cluster.
Embedded Mode
Hazelcast is a Java library, which means that you can embed it into your own distributed application.
To use this mode, you must write your application in Java. |
In this mode, each instance of your application starts a Hazelcast member, and all members automatically form their own cluster. To interact with the cluster, you use a local member in your application.
If you are a Java developer working in an IDE, this is a very convenient way to run a cluster on your development machine. There is nothing stopping you from starting your program several times to get a cluster on the same physical machine.
The main advantage of embedded mode is that all your Java classes are visible to Hazelcast. This way, you don’t need to add classes to your members for tasks such as entry processing or submitting jobs.
Add Hazelcast to your Java project to get started with embedded mode. |
Client/Server Mode
In client/server mode, the Hazelcast cluster is independant of your application, which means that they can be independently created and scaled. To interact with the cluster, you use one of the available clients.
Client/server mode has advantages including more predictable and reliable Hazelcast performance, easier identification of problem causes and, most importantly, better scalability. When you need to scale in this mode, just add more Hazelcast members. You can address client and server scalability concerns separately.
Client/server mode also provides higher availability. If there are any issues in running either your application or Hazelcast members, the issue and any potential failure is isolated from the rest of the application and members.
Download and install the binary to get started with client/server mode. |
Comparing Topologies
Use this table to compare embedded mode and client/server mode in terms of latency, scalability, and available client languages.
Embedded | Client/Server | |
---|---|---|
Low-latency |
Yes |
If used with Near Cache to store frequently used data in the client’s local memory. |
Scalability |
The application and the cluster must be scaled together |
You can scale the cluster independently of your application |
Supported clients |
Java |
|
Development Clusters
You can create a cluster for development and testing purposes. This cluster may have one or multiple members running on a single machine. It does not access the network and offers quickly starting and stopping a member, adding more members, basic operations on various data structures, a minified cluster simulating the production one, etc. See here on how to create a local cluster.
Production Clusters
A production cluster is a network of multiple members that run Hazelcast.
These clusters are accessed and managed as a single group.
Besides having a single production cluster, you can also create multiple clusters, for example to have data centers in different cities, over WAN. In this case, Hazelcast offers its WAN replication feature to synchronize these clusters to the same state. See the Synchronizing Data Across a WAN section for more information.
You also have the option to use the well-known “Blue-Green Deployment”. In this deployment model you have two identical and alive clusters one of which is active (blue) and the other one is idle (green). This way Hazelcast provides a disaster recovery for the client-cluster connections; a client is automatically diverted to another cluster on demand or when the intended cluster becomes unavailable. See the Java client docs for more information.