abstract: reduced increased CPU consumption #192
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:
Final performance comparison as a percentage:
As a result, the proposed solution causes a decrease in performance for fill queue 2.149% and task confirm 1.565%.
Closes #183