-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Python program running slower inside Gvisor sandbox with ARM64 #10487
Comments
After some investigation, I found one potential cause of this is that with Gvisor, Sentry implements its own This seems not be directly related to Gvisor, as after the initial page fault after mmap, the memory access should be consistent with native linux kernel. However, the issue is |
@sfc-gh-jyin I think I found the real root cause of this issue. gVisor never sets the SSBS bit in pstate. With the next patch, I get same results in gVisor and without it:
This isn't a proper fix. We need to figure out when SSBS should be set. |
Thank you @avagin! I tried your patch and it did help! Can we get this fix merged in main? Also, do you know why this issue did not manifest at similar degree for c7gd instances? |
@avagin I have another question... Based on my understanding, |
Further, adding to @sfc-gh-jyin's questions, is there a reason that c7 instances would not experience this slowdown? I believe c6 are Graviton2 (Neoverse N1) and c7 are Graviton3 (Neoverse V1). |
@sfc-gh-jyin it isn't only about gvisor. When you run you test on LInux, this bit is set in pstate and this is why you see a better performance. If you care about security and want to be safe from ssb, you probably want to disable PR_SPEC_STORE_BYPASS that is effectively drops PSR_SSBS_BIT from pstate. More info about the meaning of this bit can be found here: https://developer.arm.com/documentation/ddi0595/2020-12/AArch64-Registers/SSBS--Speculative-Store-Bypass-Safe. The last line in my previous comment says that the patch isn't a fix and it is just there for explaining what is going on. We need to figure out when we can/need to set this bit. It should not be set by default to protect against SSB. |
@jaingaurav My guess is that they found another way to mitigate SSB in these cpu-s. |
Description
Hello,
We are currently benchmarking the cpu performance of gvisor compared to normal docker, and found out that same Python program running in gvisor is consistently slower compared to running on native kernel, or even with docker.
Note that we are aware of overhead introduced by additional hook for syscalls, but we are testing the cpu performance, and our test script does not issue syscalls.
The largest difference we observed so far are running on AWS
c6gd.2xlarge
instance. However, when running same suite on c7 instance family, the performance of gvisor is close to native kernel. Thus we are wondering what might be the rootcause of this, and how can we configure gvisor to make it perform better.Test Environment: AWS
c6gd.2xlarge
instance with AL2 ami. Python. Python version: 3.7.16Test script (Very simple pi calculation):
Running on native kernel:
Running with docker container:
Running with runsc:
In all three cases, the process is consuming nearly 100% of cpu all time. However, when I use
perf
tool to check the stats, it shows that process started by gvisor runs with around 10~15% slower in terms oninstructions per cycle
:We suspect that this could be due to memory access delay as on Gvisor case
stalled-cycles-backend
is significantly higher compared to other cases.Steps to reproduce
c6gd.2xlarge
runsc version
docker version (if using docker)
No response
uname
5.10.216-204.855.amzn2.aarch64 #1 SMP Sat May 4 16:53:24 UTC 2024 aarch64 aarch64 aarch64 GNU/Linux
kubectl (if using Kubernetes)
No response
repo state (if built from source)
No response
runsc debug logs (if available)
No response
The text was updated successfully, but these errors were encountered: