Number of servers and lambdas ?

classic Classic list List threaded Threaded
2 messages Options
limabean limabean
Reply | Threaded
Open this post in threaded view
|

Number of servers and lambdas ?

This post has NOT been accepted by the mailing list yet.
I have a question about lambdas and Ignite servers.
Running one of the lambda example from the Ignite tutorials:

          String a[] = new String[]{"abc","klm","xyz","pqr"};
          List lst = Arrays.asList(a);
          ............

           while (true)
            {
                Collection<Integer> coll = compute.apply(
                        (String w) -> {
                            System.out.println("Executing word: " + w);
                            return w.length();
                        }, lst);


                int sum = coll.stream().mapToInt(i -> i).sum();
                System.out.println("Sum is: " + sum);

                Thread.sleep(2000);
            }

causes 4 servers to be started - one for each word in the string array passed in.

I already had a cluster of 2 servers running and then the program running
the code pasted above starts a 3rd server.  I expected one of the servers
to handle 2 words, similar to the "fault tolerance" demo where shutting
down 1 server causes work to be shifted between the remaining servers.

Instead, what happens is a fourth server is started for the 4th word:

[13:55:58] Topology snapshot [ver=26, servers=4, clients=0, CPUs=8, heap=9.1GB]

Is this expected and could someone explain why the initial start up scenario
behaves this way instead of the way the  "fault tolerant" scenario is handled
with respect to how words are handed to servers ?

Thank you,
vkulichenko vkulichenko
Reply | Threaded
Open this post in threaded view
|

Re: Number of servers and lambdas ?

Hi,

Can you please properly subscribe to the mailing list so that the community receives email notifications? Here is the instruction: http://apache-ignite-users.70518.x6.nabble.com/mailing_list/MailingListOptions.jtp?forum=1

limabean wrote
I have a question about lambdas and Ignite servers.
Running one of the lambda example from the Ignite tutorials:

          String a[] = new String[]{"abc","klm","xyz","pqr"};
          List lst = Arrays.asList(a);
          ............

           while (true)
            {
                Collection<Integer> coll = compute.apply(
                        (String w) -> {
                            System.out.println("Executing word: " + w);
                            return w.length();
                        }, lst);


                int sum = coll.stream().mapToInt(i -> i).sum();
                System.out.println("Sum is: " + sum);

                Thread.sleep(2000);
            }

causes 4 servers to be started - one for each word in the string array passed in.

I already had a cluster of 2 servers running and then the program running
the code pasted above starts a 3rd server.  I expected one of the servers
to handle 2 words, similar to the "fault tolerance" demo where shutting
down 1 server causes work to be shifted between the remaining servers.

Instead, what happens is a fourth server is started for the 4th word:

[13:55:58] Topology snapshot [ver=26, servers=4, clients=0, CPUs=8, heap=9.1GB]

Is this expected and could someone explain why the initial start up scenario
behaves this way instead of the way the  "fault tolerant" scenario is handled
with respect to how words are handed to servers ?

Thank you,
A node (either server or client) can be started only if you explicitly execute ignite.sh script or call Ignition.start() within the application. Nodes are never started automatically for the closure execution. Can you double-check your code?

-Val