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

Block broker thread on event queue instead of IO if IO is irrelevant in current state #1870

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

edenhill
Copy link
Contributor

@edenhill edenhill commented Jul 2, 2018

This fixes the case where idle (typically bootstrap) broker threads
are consuming CPU on Windows (with a low socket.blocking.max.ms) due
to aggressively short timeouts on IO.

The drawback is that it might take up to 1000ms to detect disconnects
on idle connections, which should not be a problem in practice.

Related issue:

…in current state

This fixes the case where idle (typically bootstrap) broker threads
are consuming CPU on Windows (with a low socket.blocking.max.ms) due
to aggressively short timeouts on IO.

The drawback is that it might take up to 1000ms to detect disconnects
on idle connections, which should not be a problem in practise.
@edenhill edenhill added the bug label Jul 2, 2018
@edenhill edenhill requested a review from rnpridgeon July 2, 2018 12:27
@edenhill edenhill mentioned this pull request Jul 5, 2018
4 tasks
@wuqingjun
Copy link

Is this PR under review?

Copy link

@rnpridgeon rnpridgeon left a comment

Choose a reason for hiding this comment

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

@edenhill I found it a bit odd to only introduce the 1 second wake-ups when blocking forever. Other than that LGTM

* When blocking on the queue we will want to detect IO disconnects
* eventually.
* 1 wakeup/second is reasonable. */
if (unlikely(remains_ms == RD_POLL_INFINITE))

Choose a reason for hiding this comment

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

Does it make sense to defend against all 'excessive' values for abs_timeout as opposed to just RD_POLL_INFINITE? A value of 300000ms still seems fairly intrusive given we would wakeup infinite blocking calls every 1 second.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right, so a MIN(remains_ms, 1000) makes sense!

@edenhill
Copy link
Contributor Author

I'm not sure this is the best approach.
We should considering using forwardable condvars, rather than the entire queue, but that's a bigger change.

PR #1930 enables low-latency wakeups on Windows by using TCP sockets, so that might a better way forward now.

@rnpridgeon
Copy link

Is this still needed since the merger of #1930? If not should we go ahead and close this one out

@edenhill
Copy link
Contributor Author

I'm keeping this open as a reminder to check if it still applies

@cla-assistant
Copy link

cla-assistant bot commented Aug 21, 2023

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants