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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix high CPU usage of idle workers #136

Merged
merged 3 commits into from
May 30, 2022
Merged

Fix high CPU usage of idle workers #136

merged 3 commits into from
May 30, 2022

Conversation

adzialocha
Copy link
Member

@adzialocha adzialocha commented May 27, 2022

This uses deadqueue, a FIFO-queue implementation wrapping crossbeam_queue::SegQueue. It extends it with a future on pop which uses a nice semaphore logic internally allowing us to await on it. This gives us exactly what we need to not naively unblock the async task and retry the queue manually on every loop cycle, as there was otherwise no future to wait for before. This led originally to unnecessary waking of the runtime even when there was nothing to do, wasting CPU resources. With the new await / future on the queue we have a chance now to do something else in the async runtime and come back as soon as there is something to do again.

Closes: #127

馃搵 Checklist

  • Add tests that cover your changes
  • Add this PR to the Unreleased section in CHANGELOG.md
  • Link this PR to any issues it closes
  • New files contain a SPDX license header

@adzialocha adzialocha requested review from sandreae and cafca May 27, 2022 18:06
@adzialocha
Copy link
Member Author

Doggo not working so hard anymore 馃ゲ

screenshot-2022-05-27T20:07:21

Copy link
Member

@sandreae sandreae left a comment

Choose a reason for hiding this comment

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

Looks like a very neat solution 馃憤 and thanks for tidying up the PR hash prefixes ;-p

@adzialocha adzialocha merged commit 8106848 into development May 30, 2022
@adzialocha adzialocha deleted the worker-cpu-fix branch May 30, 2022 16:53
adzialocha added a commit that referenced this pull request May 31, 2022
* development:
  Make clippy happy
  We can't drop a reference
  Fix merge conflict
  Doc strings for entry and log store structs (#126)
  Improve CI, track test coverage (#139)
  Fix high CPU usage of idle workers (#136)
adzialocha added a commit that referenced this pull request May 31, 2022
* development:
  Make clippy happy
  We can't drop a reference
  Fix merge conflict
  Doc strings for entry and log store structs (#126)
  Improve CI, track test coverage (#139)
  Fix high CPU usage of idle workers (#136)
adzialocha added a commit that referenced this pull request May 31, 2022
* development:
  Make clippy happy
  We can't drop a reference
  Fix merge conflict
  Doc strings for entry and log store structs (#126)
  Improve CI, track test coverage (#139)
  Fix high CPU usage of idle workers (#136)
adzialocha added a commit that referenced this pull request May 31, 2022
* development:
  Make clippy happy
  We can't drop a reference
  Fix merge conflict
  Doc strings for entry and log store structs (#126)
  Improve CI, track test coverage (#139)
  Fix high CPU usage of idle workers (#136)
  Define and implement `OperationStore` (#103)
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.

None yet

2 participants