-
Notifications
You must be signed in to change notification settings - Fork 126
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
fix(1365): CPU bound instances don't spread on all CPU cores #1376
Conversation
…ats event. Also encapsulate the .clone on the wasmtime module. After this two modification the workload spread on all core of the CPU. Relates to issue wasmCloud#1365 Signed-off-by: Julien Teruel <julien.teruel@gmail.com>
Signed-off-by: Julien Teruel <julien.teruel@gmail.com>
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.
Just a few comments I noticed while looking at this. If we do choose to go down this route, I'd really prefer to have comments explaining why this works. I suspect it is because spawn
forces the future to possibly run on a different worker queue, but as far as I could tell, await
should do this too. We're using the multithread tokio runtime, and according to the docs, if a task is on the queue (which is what I assume happens when it yields with await
) it should have the possibility of being stolen by another local queue.
Can you remind me, what operating system does this problem happen on and what are its specs? Edit: found in issue
I still don't quite understand why this is happening because |
@JT117 Even though we aren't quite sure why this works, it does work. Would you mind addressing the comments, rebasing, and marking as ready for review? Then we can get this in to the next patch release |
Signed-off-by: Julien Teruel <julien.teruel@gmail.com>
…ly the instance instead of wrapping the instance's components in a future Signed-off-by: Julien Teruel <julien.teruel@gmail.com>
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.
Thank you so much for adding the comments as well!
Feature or Problem
Fix the cpu spread on all cores.
For me in my mind:
The change for the actor is to put in a spawn the wasmtime module clone, so the clone can happen on any core
The change on the rpc bus is to handle each nats event in a separate spawn in order to spread on all core
Related Issues
#1365
Release Information
next
Consumer Impact
Instances will use 100% of cpu
Testing
none
Unit Test(s)
none
Acceptance or Integration
none
Manual Verification
1/ set the wasmcloud RPC timeout high enough to actually wait for the response :
export WASMCLOUD_RPC_TIMEOUT_MS=10000
2/ start wasmcloud 0.81.0
wash up
3/ deploy the wadm file
wash app deploy hello-world/wadm.yaml
4/ bench with any kind of app
observe the cpu core loads