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

Improve CPU usage in tests with IO threads #823

Merged
merged 1 commit into from
Jul 24, 2024

Conversation

uriyage
Copy link
Contributor

@uriyage uriyage commented Jul 24, 2024

Currently, when running tests with IO threads, we set the events-per-io-thread config to 0. This activated IO threads 100% of the time, regardless of the number of IO events.

This is causing issues with tests running multiple server instances, as it drained machine CPU resources. As a result, tests could have very long runtimes, especially on limited instances.
For example, in https://github.com/valkey-io/valkey/actions/runs/10066315827/job/27827426986?pr=804, the Cluster consistency during live resharding test ran for 1 hour and 41 minutes.

This PR addresses the issue by:

  1. Deactivating IO threads when there are no IO events
  2. Continuing to offload all IO events to IO threads

Tested on 16 cores instance, after implementing these changes, the runtime for the Cluster consistency during live resharding test dropped from 7 minutes an 14 seconds to 3 minutes and 28 seconds.

@madolson madolson added the run-extra-tests Run extra tests on this PR (Runs all tests from daily except valgrind and RESP) label Jul 24, 2024
Copy link

codecov bot commented Jul 24, 2024

Codecov Report

Attention: Patch coverage is 0% with 1 line in your changes missing coverage. Please review.

Project coverage is 70.35%. Comparing base (59aa008) to head (f17fd39).
Report is 1 commits behind head on unstable.

Additional details and impacted files
@@             Coverage Diff              @@
##           unstable     #823      +/-   ##
============================================
+ Coverage     70.18%   70.35%   +0.16%     
============================================
  Files           112      112              
  Lines         61311    61310       -1     
============================================
+ Hits          43031    43132     +101     
+ Misses        18280    18178     -102     
Files Coverage Δ
src/io_threads.c 7.90% <0.00%> (+0.03%) ⬆️

... and 7 files with indirect coverage changes

@madolson madolson merged commit 3cca268 into valkey-io:unstable Jul 24, 2024
47 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
run-extra-tests Run extra tests on this PR (Runs all tests from daily except valgrind and RESP)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants