Dima,

If user call IgniteMessaging.send() in the thread T1, then local message
listeners on this topic will be notified in the same thread before
returning from send() method. This our pseudo-code:

IgniteMessaging.send(Object topic, Object msg) {
    ...
    sendToRemoteNodes(topic, msg);
    ...
    for (Listener lsnr : localTopicListeners)
        lsnr.notify(msg);
}

If user produces a burst of messages in a single thread, he will be very
surprised that remote node process them concurrently and utilize all CPUs,
while local node use only 1 core for this.

Vladimir.

On Fri, Oct 16, 2015 at 11:01 AM, Dmitriy Setrakyan <[email protected]>
wrote:

> On Thu, Oct 15, 2015 at 11:00 PM, Vladimir Ozerov <[email protected]>
> wrote:
>
> > Sorry, not very clear. "same" means the same thread that sent a message.
> > This way if we have a listener and a single thread generating messages
> > locally, only one CPU core will be utilizied.
> >
>
> Still confused. How can the thread that send a message be notified in a
> listener about anything? Are you talking about synchronous
> request-response? In this case it is probably done on purpose.
>
> I am still not sure what the problem is.
>
>
> >
> > On Fri, Oct 16, 2015 at 3:49 AM, Dmitriy Setrakyan <
> [email protected]>
> > wrote:
> >
> > > On Thu, Oct 15, 2015 at 9:59 AM, Vladimir Ozerov <[email protected]
> >
> > > wrote:
> > >
> > > > Folks,
> > > >
> > > > It looks like the problem is deeper and is not limited to futures. It
> > > > relates to any user code. For example:
> > > >
> > > > 1) Register either local or remote message listener:
> > > > Ignite.message().localListen("myTopic", myLsnr);
> > > >
> > > > 2) Send a message to the topic from the same node:
> > > > Ignite.message().send("myTopic", "Hello world!");
> > > >
> > > > As a result, listener will be invoked synchronously from the same
> > thread.
> > > > It means we cannot utilize resources efficiently in case of local
> > > message.
> > > >
> > >
> > > I am a bit confused. Which thread is the "same" thread? Do you mean the
> > > thread that does the listener notification? In that case, I can say
> that
> > I
> > > have performed various benchmarks in the past, and this is the most
> > > performant way, assuming that the listener logic can execute relatively
> > > fast and does not block the calling thread.
> > >
> >
>

Reply via email to