Partitioned Clustered Space

The partitioned space provides the ability to form a space that has unlimited data storage capacity. A replicated space instance is limited in the amount of data it can store by the capacity of a single node JVM heap size. In many cases, it is desirable to combine the memory of separate space instances and to make them behave as a single large space. This can be achieved by partitioning the data among the different instances to have only a portion of the data in each instance. The application will view the clustered spaces as one space, where the space proxy running at the client, routes each operation call to the correct space instance to fetch/store the object.

 

 

Maximum scalability is achieved when your application is multithreaded allowing the partitioned space to handle client requests in parallel.

 

For more information about the load balancing and partitioning options, see the Load balancing group section.

Running Partitioned Space

To set up a partitioned space, you should use the partitioned cluster schema as part of the space URL that starts the space, together with the total cluster members and space instance member ID.

 

To start partitioned space where each partition runs as a stand alone process with 3 partitions, you should have the following setup:

 

JavaSpace API:

Member1

gsServer "/./mySpace?schema=defualt&cluster_schema=partitioned&total_members=3&id=1"

Member 2

gsServer "/./mySpace?schema=defualt&cluster_schema=partitioned&total_members=3&id=2"

Member 3

gsServer "/./mySpace?schema=defualt&cluster_schema=partitioned&total_members=3&id=3"

 

Map API:

Member1

gsServer "/./myCache?schema=cache&cluster_schema=partitioned&total_members=3&id=1"

Member 2

gsServer "/./myCache?schema=cache&cluster_schema=partitioned&total_members=3&id=2"

Member 3

gsServer "/./myCache?schema=cache&cluster_schema=partitioned&total_members=3&id=3"

 

To access the partitioned space from the application have the following as part of your code:

JavaSpace API:

IJSpace space =( IJSpace)SpaceFinder.find("jini://*/*/mySpace");

 

Map API:

IMap cache =(IMap)CacheFinder.find("jini://*/*/myCache");

 

Adding backup to each partition

In partitioned space topology, each space instance contains a different portion of the application data. Every space instance can be brought down or fail. To ensure the high availability of each partition, a backup instance should be set for each space partition. In this case you should use the partitioned-sync2backup schema.

 

 

 

When writing data into the partitioned space, each space replicates the data to its backup space.

 

 

Setting up a partitioned space with two primary partitions and one backup per primary partition is done using the following setup:

Partition 1

gsServer "/./mySpace?cluster_schema=partitioned-sync2backup&total_members=2,1&id=1"

 

Partition 2

gsServer "/./mySpace?cluster_schema=partitioned-sync2backup&total_members=2,1&id=2"

 

Partition 1 backup

gsServer "/./mySpace?cluster_schema=partitioned-sync2backup&total_members=2,1&id=1&backup_id=1"

 

Partition 2 backup

gsServer "/./mySpace?cluster_schema=partitioned-sync2backup&total_members=2,1&id=2&backup_id=1"

 

total_members={number of primary instances, number of backup instances per primary} - e.g., total_members=2,1, means that this cluster contains two partitions having one backup instance each.

The backup_id is used to define whether the instance is a backup instance or not. If this attribute is not defined, the instance will be considered a primary instance.

The container name will be translated in this case to <space name>_container<id>_<backup_id>. e.g., mySpace_container1_1.

Fail-over of a Partitioned Space with Backup

When running a partitioned space with backups, and one of the partitions fails or shuts down, the backup instance moves from standby mode into active mode take over. All operations are routed into the backup instance. When the master is running in transient mode and restarted, it will recover its data from its backup instance. If the master is running in persistent mode you may recover all its data from its backup partner, or use its persistent data source to recover and get only the updates from the time it failed from its backup instance - see the <force-cold-init> parameter as part of the space schema file <persistent>tag. After the original space completes the recovery phase, it is not available for clients (standby mode) until its turn to be the active space - i.e. the current backup that is running in active mode will continue to serve the clients even after the original master has fully recovered. You may change this behavior and let the original master move into active mode immediately after completing the recovery using the <fail-back> cluster schema fail over group configuration.

 

 

 

Partitioned Space with Backup and Local space

The Partitioned Space with Backup and Local space topology allows you to store unlimited amount of data within a remote partitioned cache while having a local cache running at the client side. The local cache is updated with the master partitioned space changes via a push or pull update mechanism. Data from the client local cache is evicted based on the selected policy. This topology is optimal when your application is read mostly - i.e. 80% read and 20% updates. Please note that only changes to objects at the master spaces are propagated into the client local cache. New objects are not pushed into the local cache. When one of the partitioned spaces fails, its backup space takes over.

 

 

To set up a partitioned space with a local cache, you should use the partitioned cluster schema as part of the space URL that starts the space together with the total cluster members and space instance member ID.

 

To start partitioned space where each partition runs as a stand alone process with 3 partitions, you should have the following setup:

 

JavaSpace API:

Member1

gsServer "/./mySpace?schema=defualt&cluster_schema=partitioned&total_members=3&id=1"

Member 2

gsServer "/./mySpace?schema=defualt&cluster_schema=partitioned&total_members=3&id=2"

Member 3

gsServer "/./mySpace?schema=defualt&cluster_schema=partitioned&total_members=3&id=3"

 

Map API:

Member1

gsServer "/./myCache?schema=cache&cluster_schema=partitioned&total_members=3&id=1"

Member 2

gsServer "/./myCache?schema=cache&cluster_schema=partitioned&total_members=3&id=2"

Member 3

gsServer "/./myCache?schema=cache&cluster_schema=partitioned&total_members=3&id=3"

 

To access the partitioned space from the application, have the following as part of your code:

JavaSpace API:

IJSpace space =( IJSpace)SpaceFinder.find("jini://*/*/mySpace?useLocalCache");

 

Map API:

IMap cache =(IMap)CacheFinder.find("jini://*/*/myCache?useLocalCache");