Migrating an Embedded Application to Hazelcast Viridian
To migrate an existing application from embedded Hazelcast, you need to refactor your code as well as consider how you migrate any existing data to the cloud.
|For the benefits of migrating your application from an embedded topology to a client/server topology, see this blog.|
Refactoring Code for the Cloud
Applications in Hazelcast Viridian are split into two parts:
The cluster that runs on the Hazelcast Viridian Managed Services.
The client that calls APIs on cluster.
To separate your embedded application into these two parts, see the following checklist:
Deploy cluster-side modules to Hazelcast Viridian. If you use classes such as MapStore or an entry processor, or if you store custom objects in Hazelcast, you need to add those classes to the classpath of the cluster by deploying them as cluster-side modules.
Copy any data structure configuration over to Hazelcast Viridian. Data structures are configured in the Hazelcast Viridian console.Heap memory limits
Viridian Serverless clusters have the following heap memory limits:
Production clusters: 1 GB memory per cluster member
Development clusters: 300 MB per cluster
Exceeding these limits can lead to cluster failure.
Be aware that the following operations use heap memory: writing, caching, or replicating data to data structures other than IMap an JCache.
See Heap Memory Limits of Viridian Serverless Clusters for further details.
Remove member configuration from your code. Hazelcast configures the cluster for the best possible performance. All you need to do is configure the client and any data structures.
If you use the executor service, make sure that you are using the ‘default’ service in both uploaded executor services and client code. You cannot access named executor services in Hazelcast Viridian.
Replace any instance of
HazelcastInstance newHazelcastInstancewith a client.
newHazelcastInstancecreates an instance of a Hazelcast member. Instead, you need to configure a client to connect to the cluster.
Migrating Stateful Data
If you have existing data stored in Hazelcast, consider one of the following ways to migrate that data to your Hazelcast Viridian cluster:
Use WAN Replication.
To use WAN Replication, your need the Hazelcast Enterprise JAR.
Reingest data, using one of the available APIs/tools.