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

Ask Your Question
0

Collocated Event Listener

Hi there,

As a part of our solution, we will be implementing an event driven listener which would need to have very high performance under a large volume of traffic. As you know, one amongst the many performance tweaks that can be made to a listener directly/indirectly (directly in this case) is to collocate the listeners with the the PU that creates the embedded source space to vastly reduce the latency between the listeners and the source PU (reduces serialization and remote calls between JVMs).

Therefore, upon reading the Gigaspace forum thread //question/213/deployment-of-multiple-pu-and-dynamic-template/&tstart=0 that "by default your notify container if it is embedded in the space will only get notifications for changes on its partition.", we tested this out locally and it seems to work alright (listener only gets fired once per object write on a space with many partitions in a round-robin manner) but I'd be gratfeul if this could be officially confirmed? If it's not the correct, we will likely following something similar to the Parrallel Queue Pattern (http://wiki.gigaspaces.com/wiki/display/SBP/ParallelQueuePattern) to achieve low-lency event driven listeners but I'm hoping that's not the case.

Kind regards, Tom

This thread was imported from the previous forum.
For your reference, the original is available here

asked 2013-07-30 08:33:33 -0500

coleman5 gravatar image

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

jaissefsfex gravatar image
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

Tom,
As long as you inject an embedded non-clustered Gigaspace (/./space-name) the notify container will be triggered when the collocated space partition will have matching events.

You will have to explicitly specify a clustered GigaSpace if you want your notify container to be triggered when every partition will have a matching event.
See: http://wiki.gigaspaces.com/wiki/display/XAP96/TheGigaSpaceInterface#TheGigaSpaceInterface-ClusteredFlag

<os-core:giga-space id="clusteredGigaSpace" space="space" clustered="true"/>

You might want to use batching mode to improve the notification behavior. See the pass-array-as-is option: http://wiki.gigaspaces.com/wiki/display/XAP9/NotifyContainer#NotifyContainer-BatchEvents

@EventDriven @Notify
@NotifyBatch(size = 10, time = 5000, passArrayAsIs = true)
public class SimpleListener {
    @EventTemplate
    Data unprocessedData() {
        Data template = new Data();
        template.setProcessed(false);
        return template;
    }
    @SpaceDataEvent
    public Data eventListener(Object[] events) {
        //Convert events to Data[] and process here
    }
}

The parallel queue pattern can be implemented today in a better way using the fifo grouping option.

Regards
Shay

answered 2013-07-30 09:37:13 -0500

shay hassidim gravatar image
edit flag offensive delete link more

Comments

Thanks Shay, much appreciated.

coleman5 gravatar imagecoleman5 ( 2013-07-31 10:28:00 -0500 )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

Stats

Asked: 2013-07-30 08:33:33 -0500

Seen: 163 times

Last updated: Jul 30 '13