ignite-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ramzinator <rami.hamm...@gmail.com>
Subject Ignite RoundRobinLoadBalancingSpi Per Task not distributing tasks.
Date Thu, 02 Mar 2017 13:47:15 GMT
Hi all, 

I'm trying to use Ignite's RoundRobinLoadBalancingSpi with perTask enabled
to guarantee distribution of tasks to my ignite nodes, but it seems that the
load balancing is not working as expected. 

Consider the following test:

@Test
  public void testRR() {
    Ignite node1 = Ignition.start(igniteConfig("node1"));
    Ignite node2 = Ignition.start(igniteConfig("node2"));
    Ignite node3 = Ignition.start(igniteConfig("node3"));
    Ignite node4 = Ignition.start(igniteConfig("node4"));
    Ignite node5 = Ignition.start(igniteConfig("node5"));

    node1.compute().run(runnable());
    node1.compute().run(runnable());
    node1.compute().run(runnable());
    node1.compute().run(runnable());
    node1.compute().run(runnable());
  }

  public static IgniteConfiguration igniteConfig(String gridName) {
    IgniteConfiguration igniteConfiguration = new IgniteConfiguration();
    RoundRobinLoadBalancingSpi rr = new RoundRobinLoadBalancingSpi();
    rr.setPerTask(true);
    igniteConfiguration.setIncludeEventTypes(EVT_TASK_FAILED,
EVT_TASK_FINISHED, EVT_JOB_MAPPED);
    igniteConfiguration.setLoadBalancingSpi(rr);
    igniteConfiguration.setGridName(gridName);
    return igniteConfiguration;
  }

  private IgniteRunnable runnable() {
    return new IgniteRunnable() {
      @IgniteInstanceResource
      Ignite ignite;

      @Override
      public void run() {
        System.out.println("Executing on node: " + ignite.name());
        System.out.println("Local Node Id: " +
ignite.cluster().localNode().id());
      }
    };
  }

I would expect to see one execution on each of my 5 nodes as stated in the
documentation:
https://apacheignite.readme.io/docs/load-balancing#section-per-task-mode 
However, this is not the case, and the output is as follows:

Executing on node: node4
Local Node Id: 011c1b83-b2fc-4d51-976c-00cc3ddfd27a
Executing on node: node3
Local Node Id: 4593c1bc-d373-41e8-b913-707e8dd96b2c
Executing on node: node3
Local Node Id: 4593c1bc-d373-41e8-b913-707e8dd96b2c
Executing on node: node4
Local Node Id: 011c1b83-b2fc-4d51-976c-00cc3ddfd27a
Executing on node: node2
Local Node Id: a3723772-3fa6-42eb-b578-88e507cf98e8

As you can see nodes 1 and 5 were excluded, and nodes 4 and 3 were used
twice each.
Any explanation why this is? Am I missing any configuration?

Thanks for the help!




--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Ignite-RoundRobinLoadBalancingSpi-Per-Task-not-distributing-tasks-tp10991.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Mime
View raw message