Welcome to the new Gigaspaces XAP forum. To recover your account, please follow these instructions.

Ask Your Question

Clustered Partitioned Space does not seem to work as advertised?

I have an OpenSpaces application that is basically split into two parts:

Loader: loads the POJOs into the GigaSpace cluster based on real time events from outside systems, also writes calculation orders to the space. Calculator: Picks up calculation orders using a notify container and loads POJOs and uses them to calculate.

Here is the command that I use to start the application in the gs.bat script:

pudeploy -cluster schema=partitioned total_members=2 calculator pudeploy loader

The POJOs I am talking about are using a single key field with both @SpaceId and @SpaceRouting, similar to the following:

@SpaceClass class DataItem { private String mItemId; private Double mValue;

   public DataItem( String itemId, Double val ) { mItemId = itemId; mValue = val; }

@SpaceId @SpaceRouting public String getItemId() { return mItemId; } }

The calculator knows a set of ItemIds it wants to calculate, so in the process method it iterates through the ItemId's getting each one from the space like so:

double total = 0.0; for( String currentItemId : itemIds ) {

DataItem template = new DataItem( currentItemId, null ); DataItem actualItem = gigaSpace.readIfExists( template, IJSpace.NO_WAIT, gigaSpace.getModifiersForIsolationLevel()); if ( actualItem != null ) { total += actualItem.getValue() } }

Of course this is an oversimplifcation of what I am doing but the concept is the same. The problem is that I only get half the data items that are written to the space. Similarly when I try set a break point in the debugger and add a watch on gigaSpace.readMultiple( new DataItem( null, null ) ) I only see half the ones that were written.

According to the documentation on the Wiki I thought that readIfExists and readMultiple were cluster aware operations and would transparently get the POJO from the space regardless of what node in the cluster the code was running in. I could see readIfExists not working, but I thought that readMultiple was a batch operation that would execute a query in all spaces. Am I misreading something?

I know that this is a clustering problem because when I change my deployment command to:

pudeploy -cluster schema=async_replicated total_members=2 calculator

I can see all the data and everything works fine.

I want to use a partitioned space to benefit from scaling the calculation step across multiple CPUs/VMs. Also subsets of the dataItems can be shared between different calculation orders so we cannot group them with a SpaceRouting field that will ensure that the data is in the embedded space of the calculator processing unit.

Does anyone have any ideas of why this feature is not working for me? We are using Gigaspaces 6.0 build 1889, are there known issues with this working in this version?

{quote}This thread was imported from the previous forum. For your reference, the original is [available here|http://forum.openspaces.org/thread.jspa?threadID=1973]{quote}

asked 2008-02-22 12:43:22 -0600

harley gravatar image

updated 2013-08-08 09:52:00 -0600

jaissefsfex gravatar image
edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted


can you please send us your phone number (technicalsupport at gigaspaces.com)


Product Support Engineer
GigaSpaces Technical Support Team

answered 2008-02-22 14:46:14 -0600

bernard gravatar image
edit flag offensive delete link more

In order the readMultiple call will access all partitions you should have the @SpaceRouting field as null.

It seems this is not the case with your code.


answered 2008-02-22 13:34:11 -0600

shay hassidim gravatar image
edit flag offensive delete link more


I remote connect to the 2 GSCs in remote debug mode and set a breakpoint debugger right after the read.

Then I add a watch to the following I still don't see all the items that were written to the space:

gigaSpaces.readMultiple( new DataItem( null, null ) );

also adding a watch to:

gigaSpaces.count( new DataItem( null, null ) )

will return 1/2 of N where N is the number of items written.

harley gravatar imageharley ( 2008-02-22 13:39:30 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2008-02-22 12:43:22 -0600

Seen: 114 times

Last updated: Feb 22 '08