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

Regularly yield to other zebrad async tasks #3113

Closed
teor2345 opened this issue Nov 29, 2021 · 2 comments
Closed

Regularly yield to other zebrad async tasks #3113

teor2345 opened this issue Nov 29, 2021 · 2 comments
Labels
C-bug Category: This is a bug I-hang A Zebra component stops responding to requests I-slow Problems with performance or responsiveness S-needs-investigation Status: Needs further investigation

Comments

@teor2345
Copy link
Contributor

teor2345 commented Nov 29, 2021

Motivation

tokio tasks can run for a long time before yielding to other tasks on the same thread. The executor attempts to compensate by adding extra yield points. But the defaults don't always work for Zebra.

This can cause some Zebra tasks to hang for long periods of time. So we might want to add some extra yield points to Zebra.

Tokio Documentation

Summary:
https://docs.rs/tokio/1.14.0/tokio/task/index.html#yield_now

Detailed yield_now documentation:
https://docs.rs/tokio/1.14.0/tokio/task/fn.yield_now.html#non-guarantees

Tasks

Decide where we should add yield points to Zebra.

Some alternatives are:

Network:

  • after sending every network request to the peer - is this too frequent?
  • after processing every network response in Zebra - is this too frequent?
  • after processing every syncer ObtainTips and ExtendTips

Verifiers:

  • after processing every verifier response in the sync downloader, inbound downloader, or mempool downloader
  • after verifying each mined transaction in a block - is this too frequent?

State:

  • after each expensive state operation

Completed Tasks

#3191:

Related Work

@teor2345 teor2345 added C-bug Category: This is a bug S-needs-triage Status: A bug report needs triage S-needs-investigation Status: Needs further investigation P-Medium I-hang A Zebra component stops responding to requests I-slow Problems with performance or responsiveness labels Nov 29, 2021
@mpguerra
Copy link
Contributor

@mpguerra mpguerra removed the S-needs-triage Status: A bug report needs triage label Dec 15, 2021
@teor2345
Copy link
Contributor Author

teor2345 commented Jan 6, 2022

We should identify tasks that run without yielding using tokio-console, then fix those specific bugs.

@teor2345 teor2345 closed this as completed Jan 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug I-hang A Zebra component stops responding to requests I-slow Problems with performance or responsiveness S-needs-investigation Status: Needs further investigation
Projects
None yet
Development

No branches or pull requests

2 participants