Search code examples
ignite

Apache Ignite - Does ExecutorService executes the callable task on all the cluster group?


Does Ignite ExecutorService executes the callable tasks on all cluster groups or it executes only on one node based on round-robin fashion?

If i want to execute tasks on all the cluster-group nodes, which API should be used?


Solution

  • The executor service is a nice upgrade if you already use one locally. If you want more control -- which is sounds like you do -- you really need to be using Ignite's native compute APIs.

    // Send to one node
    ignite.compute().run(() -> System.out.println("Hello"));
    
    // Send to all nodes
    ignite.compute().broadcast(() -> System.out.println("Hello"));
    

    Incidentally, "round-robbin" is the default load-balancing algorithm, but you can change that.