Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support reuse current eventLoop for Deployment #5353

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

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

…er to reuse the current EventLoop instead of using the ThreadModel.
@dreamlike-ocean
Copy link
Author

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

@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