You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by Bob Newcomer <bo...@badte.ch> on 2018/11/17 19:27:54 UTC

Local messaging not happening asynchronously

Hello,

I have a distributed app that has an ignite client instance connected to
a grid. Every app registers for the same topic and uses it to broadcast
information to its peers and itself to perform async work in the ignite
thread pool. The handler for this topic may take several minutes to
perform its job, but I thought this would be OK because the docs for
sendOrdered say:
Note that local listeners are always executed in public thread pool, no
matter default or withAsync()[1] mode is used. [1]
[1] -
    https://ignite.apache.org/releases/latest/javadoc/org/apache/ignite/IgniteMessaging.html#sendOrdered-java.lang.Object-java.lang.Object-long-
However, in my testing when I send to the whole cluster, the message
sent to the local listener (the message topic handler registered in the
same ignite client instance as the one sending) gets handled in the same
thread as sendOrdered() and blocks the sendOrdered() until it has been
completed.
I had a look through the code and could not see an obvious way to make
the local handler happen on an ignite thread pool instead of blocking
the sender. How can I make the local handler get called in an ignite
thread pool?
Appreciate any assistance.

Links:

  1. https://ignite.apache.org/releases/latest/javadoc/org/apache/ignite/IgniteMessaging.html#withAsync--

Re: Local messaging not happening asynchronously

Posted by Evgenii Zhuravlev <e....@gmail.com>.
Hi,

It is an optimization, that runs operations which could be executed
locally, in user thread. The same will work for cache operations too.

First of all, do you really need to send a message to all nodes, including
the local? You can send the message to the remote nodes only, it will
automatically resolve your problem.

Additionally, you can create a different thread for such kind of operations
and invoke sending from this pool.

Evgenii

ср, 21 нояб. 2018 г. в 03:06, Bob Newcomer <bo...@badte.ch>:

> Hello, would it be useful if I provided a test-case to help explain the
> situation?
>
>
> On Sat, Nov 17, 2018, at 11:27 AM, Bob Newcomer wrote:
>
> Hello,
>
> I have a distributed app that has an ignite client instance connected to a
> grid. Every app registers for the same topic and uses it to broadcast
> information to its peers and itself to perform async work in the ignite
> thread pool. The handler for this topic may take several minutes to perform
> its job, but I thought this would be OK because the docs for sendOrdered
> say:
>
> Note that local listeners are always executed in public thread pool, no
> matter default or withAsync()
> <https://ignite.apache.org/releases/latest/javadoc/org/apache/ignite/IgniteMessaging.html#withAsync-->
> mode is used. [1]
>
> [1] -
> https://ignite.apache.org/releases/latest/javadoc/org/apache/ignite/IgniteMessaging.html#sendOrdered-java.lang.Object-java.lang.Object-long-
>
> However, in my testing when I send to the whole cluster, the message sent
> to the local listener (the message topic handler registered in the same
> ignite client instance as the one sending) gets handled in the same thread
> as sendOrdered() and blocks the sendOrdered() until it has been completed.
>
> I had a look through the code and could not see an obvious way to make the
> local handler happen on an ignite thread pool instead of blocking the
> sender. How can I make the local handler get called in an ignite thread
> pool?
>
> Appreciate any assistance.
>
>
>

Re: Local messaging not happening asynchronously

Posted by Bob Newcomer <bo...@badte.ch>.
Hello, would it be useful if I provided a test-case to help explain the
situation?

On Sat, Nov 17, 2018, at 11:27 AM, Bob Newcomer wrote:
> Hello,
> 
> I have a distributed app that has an ignite client instance connected
> to a grid. Every app registers for the same topic and uses it to
> broadcast information to its peers and itself to perform async work in
> the ignite thread pool. The handler for this topic may take several
> minutes to perform its job, but I thought this would be OK because the
> docs for sendOrdered say:> 
> Note that local listeners are always executed in public thread pool,
> no matter default or withAsync()[1] mode is used. [1]> 
> [1] -
>     https://ignite.apache.org/releases/latest/javadoc/org/apache/ignite/IgniteMessaging.html#sendOrdered-java.lang.Object-java.lang.Object-long-> 
> However, in my testing when I send to the whole cluster, the message
> sent to the local listener (the message topic handler registered in
> the same ignite client instance as the one sending) gets handled in
> the same thread as sendOrdered() and blocks the sendOrdered() until it
> has been completed.> 
> I had a look through the code and could not see an obvious way to make
> the local handler happen on an ignite thread pool instead of blocking
> the sender. How can I make the local handler get called in an ignite
> thread pool?> 
> Appreciate any assistance.


Links:

  1. https://ignite.apache.org/releases/latest/javadoc/org/apache/ignite/IgniteMessaging.html#withAsync--