ExecutorService clarification

classic Classic list List threaded Threaded
4 messages Options
hueb1 hueb1
Reply | Threaded
Open this post in threaded view
|

ExecutorService clarification

For the ExecutorService Ignite returns, will it run multiple threads on each node in the cluster, or will it execute each thread on a separate node in the cluster?  

For example, Let's say I did the following on a three node cluster

ExecutorService exec = ignite.executorService();

exec.submit(new IgniteRunnable() { ... });  // one
exec.submit(new IgniteRunnable() { ... });  // two
exec.submit(new IgniteRunnable() { ... });  // three

Would it create 3 threads on each node in the cluster for a total of 9 threads, or would it create 3 jobs with 1 job per node?
vkulichenko vkulichenko
Reply | Threaded
Open this post in threaded view
|

Re: ExecutorService clarification

Hi,

Each task submitted to this ExecutorService will be executed only once. Essentially, it will be sent to one of the nodes in the topology and executed in its public thread pool (this is a node-local thread pool used for any task or closure executions). You can control the size of this pool using IgniteConfiguration.setPublicThreadPoolSize(int poolSize) configuration property.

-Val
hueb1 hueb1
Reply | Threaded
Open this post in threaded view
|

Re: ExecutorService clarification

Hi Val,

I ran a test where I set two nodes on two EC2s to have thread pool size of 1.  I then used the ExcecutorService to kick off about 100 jobs.  I could see the results being printed on the two nodes. I then fired up a new node on a new EC2 and saw it join the cluster.  I was expecting to see the distribution of the remaining jobs not yet assigned to a node to propagate to this third node, but it didn't.  Does that mean the ExecutorService does not dynamically assign waiting jobs to new nodes?  If so, is there another way I can do that in Ignite?
vkulichenko vkulichenko
Reply | Threaded
Open this post in threaded view
|

Re: ExecutorService clarification