Custom thread pools for compute tasks

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

Custom thread pools for compute tasks

Vladimir Ozerov
Igniters,

We have one well-known limitation: one distributed opeartion cannot be
executed from within another if they both end up in the same pool, because
it will lead to starvation and hang. Most notable example - running data
streamer from compute task.

Users with complex logic will have the same issue if they want to execute
one job from another. I think it could be resolved with introduction of
custom executors and routing computing jobs to them.

Config:
ExecutorConfiguration execCfg = new
ExecutorConfiguration().setName("myExecutor").setThreads(8);

Starting MR:
ignite.compute().withExecutor("myExecutor").execute(...);

Another improvement we can apply here is managed blockers, similar to
ForkJoinPool.ManagedBlocker [1]. If user is to execute distributed
operation, he can infrom us about it, and we will compensate blocked thread
with a new one.

Thoughts?

[1]
https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/ForkJoinPool.ManagedBlocker.html
Reply | Threaded
Open this post in threaded view
|

Re: Custom thread pools for compute tasks

Alexey Goncharuk
Vladimir,

I like the idea of compensating threads with new ones. However, I do not
see why users should notify Ignite when a new distributed operation is
started because Ignite already is the task executor. We can intercept
(virtually) all such calls and adjust pool size automatically. No need to
introduce ManagedBlocker.

--AG

2017-02-11 23:43 GMT+03:00 Vladimir Ozerov <[hidden email]>:

> Igniters,
>
> We have one well-known limitation: one distributed opeartion cannot be
> executed from within another if they both end up in the same pool, because
> it will lead to starvation and hang. Most notable example - running data
> streamer from compute task.
>
> Users with complex logic will have the same issue if they want to execute
> one job from another. I think it could be resolved with introduction of
> custom executors and routing computing jobs to them.
>
> Config:
> ExecutorConfiguration execCfg = new
> ExecutorConfiguration().setName("myExecutor").setThreads(8);
>
> Starting MR:
> ignite.compute().withExecutor("myExecutor").execute(...);
>
> Another improvement we can apply here is managed blockers, similar to
> ForkJoinPool.ManagedBlocker [1]. If user is to execute distributed
> operation, he can infrom us about it, and we will compensate blocked thread
> with a new one.
>
> Thoughts?
>
> [1]
> https://docs.oracle.com/javase/8/docs/api/java/util/
> concurrent/ForkJoinPool.ManagedBlocker.html
>
Reply | Threaded
Open this post in threaded view
|

Re: Custom thread pools for compute tasks

dsetrakyan
We cannot compensate blocked threads with new ones forever. At some point
we will have to limit new threads which will bring us to the same problem,
no?

I do like the idea, however, of users creating their own thread pools and
utilizing them for execution, as proposed by Vladimir.

D.

On Mon, Feb 13, 2017 at 6:37 AM, Alexey Goncharuk <
[hidden email]> wrote:

> Vladimir,
>
> I like the idea of compensating threads with new ones. However, I do not
> see why users should notify Ignite when a new distributed operation is
> started because Ignite already is the task executor. We can intercept
> (virtually) all such calls and adjust pool size automatically. No need to
> introduce ManagedBlocker.
>
> --AG
>
> 2017-02-11 23:43 GMT+03:00 Vladimir Ozerov <[hidden email]>:
>
> > Igniters,
> >
> > We have one well-known limitation: one distributed opeartion cannot be
> > executed from within another if they both end up in the same pool,
> because
> > it will lead to starvation and hang. Most notable example - running data
> > streamer from compute task.
> >
> > Users with complex logic will have the same issue if they want to execute
> > one job from another. I think it could be resolved with introduction of
> > custom executors and routing computing jobs to them.
> >
> > Config:
> > ExecutorConfiguration execCfg = new
> > ExecutorConfiguration().setName("myExecutor").setThreads(8);
> >
> > Starting MR:
> > ignite.compute().withExecutor("myExecutor").execute(...);
> >
> > Another improvement we can apply here is managed blockers, similar to
> > ForkJoinPool.ManagedBlocker [1]. If user is to execute distributed
> > operation, he can infrom us about it, and we will compensate blocked
> thread
> > with a new one.
> >
> > Thoughts?
> >
> > [1]
> > https://docs.oracle.com/javase/8/docs/api/java/util/
> > concurrent/ForkJoinPool.ManagedBlocker.html
> >
>
Reply | Threaded
Open this post in threaded view
|

Re: Custom thread pools for compute tasks

Alexey Goncharuk
>
> We cannot compensate blocked threads with new ones forever. At some point
> we will have to limit new threads which will bring us to the same problem,
> no?
>

This means that a user recursively trying to call blocking tasks inside of
blocking tasks. We can as well detect this and fail with an analogue of
StackOverflowError (and emit a warning in the log in advance).
Reply | Threaded
Open this post in threaded view
|

Re: Custom thread pools for compute tasks

dsetrakyan
On Mon, Feb 13, 2017 at 8:18 AM, Alexey Goncharuk <
[hidden email]> wrote:

> >
> > We cannot compensate blocked threads with new ones forever. At some point
> > we will have to limit new threads which will bring us to the same
> problem,
> > no?
> >
>
> This means that a user recursively trying to call blocking tasks inside of
> blocking tasks. We can as well detect this and fail with an analogue of
> StackOverflowError (and emit a warning in the log in advance).
>

Got it. Agree.
Reply | Threaded
Open this post in threaded view
|

Re: Custom thread pools for compute tasks

afedotov
Is it feasible to implement a saturation policy like CallerRunsPolicy? It
would allow for graceful degradation.

On Mon, Feb 13, 2017 at 8:45 PM, Dmitriy Setrakyan <[hidden email]>
wrote:

> On Mon, Feb 13, 2017 at 8:18 AM, Alexey Goncharuk <
> [hidden email]> wrote:
>
> > >
> > > We cannot compensate blocked threads with new ones forever. At some
> point
> > > we will have to limit new threads which will bring us to the same
> > problem,
> > > no?
> > >
> >
> > This means that a user recursively trying to call blocking tasks inside
> of
> > blocking tasks. We can as well detect this and fail with an analogue of
> > StackOverflowError (and emit a warning in the log in advance).
> >
>
> Got it. Agree.
>



--
Kind regards,
Alexander.
Kind regards,
Alexander
Reply | Threaded
Open this post in threaded view
|

Re: Custom thread pools for compute tasks

Vladimir Ozerov
Gents,
I created the ticket for custom executors: IGNITE-4699 [1]

Alexander,
I am not sure it makes sense since we are talking about distributed
operations. CallerRunsPolicy is not suitable where user intentionally asks
for job execution on remote node.

[1] https://issues.apache.org/jira/browse/IGNITE-4699

On Tue, Feb 14, 2017 at 11:22 AM, Alexander Fedotov <
[hidden email]> wrote:

> Is it feasible to implement a saturation policy like CallerRunsPolicy? It
> would allow for graceful degradation.
>
> On Mon, Feb 13, 2017 at 8:45 PM, Dmitriy Setrakyan <[hidden email]>
> wrote:
>
> > On Mon, Feb 13, 2017 at 8:18 AM, Alexey Goncharuk <
> > [hidden email]> wrote:
> >
> > > >
> > > > We cannot compensate blocked threads with new ones forever. At some
> > point
> > > > we will have to limit new threads which will bring us to the same
> > > problem,
> > > > no?
> > > >
> > >
> > > This means that a user recursively trying to call blocking tasks inside
> > of
> > > blocking tasks. We can as well detect this and fail with an analogue of
> > > StackOverflowError (and emit a warning in the log in advance).
> > >
> >
> > Got it. Agree.
> >
>
>
>
> --
> Kind regards,
> Alexander.
>