-
Notifications
You must be signed in to change notification settings - Fork 439
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
feat: Make number of worker threads in relayer equal to CPU requested #5499
base: main
Are you sure you want to change the base?
Conversation
|
#[tokio::main(flavor = "multi_thread", worker_threads = 20)] | ||
/// Number of worker threads matches the number of CPU requested for relayer | ||
/// https://github.com/hyperlane-xyz/hyperlane-monorepo/blob/4ddbd60e1f2e150e58dfeab72171c4fa88203db4/typescript/infra/config/environments/mainnet3/agent.ts#L595 | ||
#[tokio::main(flavor = "multi_thread", worker_threads = 14)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can just remove worker_threads
as it will default to the number of cores for the architecture it's run on
https://docs.rs/tokio/latest/tokio/runtime/struct.Builder.html#default
#[tokio::main(flavor = "multi_thread", worker_threads = 14)] | |
#[tokio::main(flavor = "multi_thread")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Discussed in person.
Unfortunately, Relayer pod is not isolated in this manner. Currently, Relayer pod sees 32 CPUs while we limit to 14 CPUs. So, tokio will create 32 threads with the default setting.
from lscpu
CPU(s): 32
On-line CPU(s) list: 0-31
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #5499 +/- ##
=======================================
Coverage 77.53% 77.53%
=======================================
Files 103 103
Lines 2110 2110
Branches 190 190
=======================================
Hits 1636 1636
Misses 453 453
Partials 21 21
|
Description
Make number of worker threads in relayer equal to CPU requested.
We request 14 CPUs for Relayer pod. This change makes the number of threads in the tokio runtime equal to the number of CPUs we request for Relayer pod so that threads do not compete for CPU resources.
Related issues
Backward compatibility
Yes
Testing
Will be tested in RC