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

Increased CPU consumption #183

Closed
LeonidVas opened this issue Aug 18, 2022 · 0 comments · Fixed by #192
Closed

Increased CPU consumption #183

LeonidVas opened this issue Aug 18, 2022 · 0 comments · Fixed by #192
Assignees

Comments

@LeonidVas
Copy link
Contributor

LeonidVas commented Aug 18, 2022

As a result of constant requests from fiber queue_state_fiber CPU consumption of tarantool at idle time increased from 12% to 33%. Increasing timeout to 0.1 (

local rc = pcall(box.ctl.wait_ro, 0.001)
) helps.

@LeonidVas LeonidVas added the 2sp label Sep 15, 2022
GRISHNOV added a commit that referenced this issue 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 added a commit that referenced this issue 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 added a commit that referenced this issue 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 added a commit that referenced this issue Sep 28, 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 added a commit that referenced this issue Sep 28, 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 added a commit that referenced this issue Sep 28, 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 added a commit that referenced this issue 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 added a commit that referenced this issue Oct 26, 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. 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
LeonidVas pushed a commit that referenced this issue Oct 26, 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. 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants