Skip to content

Monitor contention in tokio threadpool #917

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

Merged
merged 3 commits into from
May 8, 2019
Merged

Conversation

leoyvens
Copy link
Collaborator

@leoyvens leoyvens commented May 8, 2019

A simple mechanism that periodically checks the threadpool responsiveness. Part of the investigation for #856.

@leoyvens leoyvens requested a review from a team May 8, 2019 13:32
@leoyvens leoyvens self-assigned this May 8, 2019
@ghost ghost added the pending review label May 8, 2019
@@ -64,7 +63,6 @@ lazy_static! {
git_testament!(TESTAMENT);

fn main() {
println!("REORG_THRESHOLD = {:#?}", *REORG_THRESHOLD);
Copy link

Choose a reason for hiding this comment

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

👍

node/src/main.rs Outdated
);
let contention_logger = logger.clone();
std::thread::spawn(move || loop {
std::thread::sleep(Duration::from_secs(10));
Copy link

Choose a reason for hiding this comment

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

My gut is telling me that 10 seconds is too sparse, contention could come and go during that window.

This seems cheap enough to run every 10ms - 100ms. Is that the case?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Agreed, I'll lower to 100ms.

ping_send.clone().send(pong_send).wait().unwrap();
let mut timeout = Duration::from_millis(1);
while pong_receive.recv_timeout(timeout).is_err() {
warn!(contention_logger, "Possible contention in tokio threadpool";
Copy link

Choose a reason for hiding this comment

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

If add a LogCode here, that would help in making a Grafana panel + alert for this

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'll add a code, but we should probably alert on any warn level log.

@leoyvens leoyvens merged commit 609dae9 into master May 8, 2019
@leoyvens leoyvens deleted the leo/monitor-contention branch May 8, 2019 20:30
@ghost ghost removed the pending review label May 8, 2019
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.

1 participant