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

abstract: reduced increased CPU consumption #192

Merged
merged 1 commit into from
Oct 26, 2022

Conversation

GRISHNOV
Copy link
Contributor

@GRISHNOV GRISHNOV commented Sep 27, 2022

Due to the fact that queue_state_fiber called box.ctrl.wait_r* every millisecond, the idle queue consumed more than 10% of CPU.

The proposed solution makes calls to box.ctrl.wait_r* blocking until the read/write mode is changed.
Thus, CPU consumption is reduced to about ~1%.

Below is a performance comparison using a script t/benchmark/multi_consumer_work.lua whith params consumers-count = 650 and batch-size = 5000 on CPU AMD Ryzen 5 5600U.

For comparison, consider three commits.
The first column is commit (9ff105b) before implementing queue_state_fiber.
The second column is commit (159a43d) before implementation of the described proposal. That is, queue_state_fiber calls box.ctrl.wait_r* every millisecond.
The third column (offered) is the current offer, the box.ctrl.wait_r* blocking call.

The data is given as an arithmetic mean of 25 measurement points:

[time\commit] 9ff105b 159a43d offered
fill queue 8 197 452 8 567 415 8 751 545
task confirm 49 817 371 52 203 080 53 020 243

Final performance comparison as a percentage:

% down 9ff105b->159a43d 159a43d->offered 9ff105b->offered
fill queue 4.513% down 2.149% down 6.759% down
task confirm 4.788% down 1.565% down 6.429% down

As a result, the proposed solution causes a decrease in performance for fill queue 2.149% and task confirm 1.565%.

Closes #183

@GRISHNOV GRISHNOV force-pushed the igrishnov/gh-183-increased-cpu-consumption branch 5 times, most recently from bfa53eb to 30bb79b Compare September 28, 2022 12:32
GRISHNOV added a commit that referenced this pull request Oct 25, 2022
Due to the fact that queue_state_fiber called box.ctrl.wait_r*
every millisecond, the idle queue consumed more than 10% of CPU.

The proposed solution makes calls to box.ctrl.wait_r* blocking
until the read/write mode is changed.
Thus, CPU consumption is reduced to about ~1%.

More detailed measurements are described in [1].

1. #192

Closes #183
@GRISHNOV GRISHNOV force-pushed the igrishnov/gh-183-increased-cpu-consumption branch from 30bb79b to 7e19753 Compare October 25, 2022 17:32
Due to the fact that queue_state_fiber called box.ctrl.wait_r*
every millisecond, the idle queue consumed more than 10% of CPU.

The proposed solution makes calls to box.ctrl.wait_r* blocking
until the read/write mode is changed. As a result, in idle mode,
the queue_state_faber is in the suspended state, while the main
fiber (for example, interactive in interactive-mode) is in the
running state.
Thus, CPU consumption is reduced to about ~1%.

More detailed measurements are described in [1].

1. #192

Closes #183
@GRISHNOV GRISHNOV force-pushed the igrishnov/gh-183-increased-cpu-consumption branch from 7e19753 to c9d3bac Compare October 26, 2022 08:25
@GRISHNOV GRISHNOV marked this pull request as ready for review October 26, 2022 08:33
Copy link
Contributor

@LeonidVas LeonidVas left a comment

Choose a reason for hiding this comment

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

LGTM

@LeonidVas LeonidVas merged commit df94d6d into master Oct 26, 2022
@LeonidVas LeonidVas deleted the igrishnov/gh-183-increased-cpu-consumption branch October 26, 2022 12:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Increased CPU consumption
2 participants