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

rt: Change max_threads to max_blocking_threads #3287

Merged
merged 3 commits into from Dec 19, 2020

Conversation

LucioFranco
Copy link
Member

Closes #2802

@LucioFranco LucioFranco added the M-runtime Module: tokio/runtime label Dec 17, 2020
@LucioFranco LucioFranco added this to the v1.0 milestone Dec 17, 2020
@Darksonn Darksonn added the A-tokio Area: The main tokio crate label Dec 17, 2020
tokio/src/runtime/builder.rs Outdated Show resolved Hide resolved
Comment on lines 504 to 498
let blocking_pool = blocking::create_blocking_pool(self, self.max_threads);
let blocking_pool = blocking::create_blocking_pool(self, self.max_blocking_threads);
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems like we need an additional change to the blocking pool. Maybe you need to add the number of worker threads to this one, or change the blocking pool itself?

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't see anywhere where we do worker_threads - max_threads to get the cap. Maybe @carllerche can chime in here?

Copy link
Member

Choose a reason for hiding this comment

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

This should be worker_threads + max_blocking_threads I think.

Copy link
Member

Choose a reason for hiding this comment

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

Eventually, we will create a special path for worker calls to spawn_blocking, but we don't have that yet.

tokio/src/runtime/builder.rs Outdated Show resolved Hide resolved
tokio/tests/rt_threaded.rs Outdated Show resolved Hide resolved
@LucioFranco
Copy link
Member Author

@carllerche I made the change you requested.

Copy link
Contributor

@Darksonn Darksonn left a comment

Choose a reason for hiding this comment

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

This looks good for now. We can look into an option to disable spawn_blocking in a follow-up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-tokio Area: The main tokio crate M-runtime Module: tokio/runtime
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Change max_threads to max_blocking_threads
4 participants