Skip to content

Conversation

dreamlike-ocean
Copy link

add new ThreadingModel to support reuse current eventLoop for deploying verticle

Motivation:

Sometimes we expect to deploy child verticles using the current EventLoop. This can ensure the affinity between multiple child verticles and the parent verticle.

Moreover, when deploying a large number of verticles, if the current EventLoop cannot be reused, it will generate a large amount of system call overhead caused by selector::wakeup.

directly deploy verticle:
directly deploy verticle

reuse eventLoop for deploying verticle
reuse eventLoop for deploying verticle

So I provided a new ThreadingModel enum and made some compatibility. When creating an eventLoopContext, the EventLoop corresponding to the current Context will be used as the EventLoop of the new eventLoopContext.

Conformance:
I have signed Eclipse Contributor Agreement.

* Tasks are scheduled on the current event-loop thread.
*/
CURRENT_EVENT_LOOP,

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

current event loop is not a threading model

@vietj
Copy link
Member

vietj commented Oct 12, 2024

I think we should find another way to provide this, e.g. a deployment option boolean that says to reuse the current event loop or something else

@dreamlike-ocean
Copy link
Author

I think we should find another way to provide this, e.g. a deployment option boolean that says to reuse the current event loop or something else

I think this is a good idea.let me try

@dreamlike-ocean
Copy link
Author

I have reimplemented it according to your idea. Please take a look again.

@dreamlike-ocean dreamlike-ocean requested a review from vietj October 12, 2024 14:15
@vietj
Copy link
Member

vietj commented Oct 13, 2024

@dreamlike-ocean thanks I am still wondering if that should not be done diffently using a deployment builder like structure that would allow to pass a context explicitely instead

@dreamlike-ocean
Copy link
Author

@dreamlike-ocean thanks I am still wondering if that should not be done diffently using a deployment builder like structure that would allow to pass a context explicitely instead

What if it is implemented using a special verticle type? For example, we can provide an “abstract class ResuseEventLoopVerticle extends AbstractVerticle” type?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants