-
Notifications
You must be signed in to change notification settings - Fork 1.4k
[Strace] gVisor taking extremely longer time with LightGBM training #11431
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
Comments
Thanks a lot for the reproducer, I'll see if I can use it. As to why this is happening: you can look at previous issues we've had on this like #9119. For communicating between the sentry and user processes we try to use the "fast" path as much as possible, which involves spinning; however if we're core-bound this then also prevents other jobs from making progress, which leads to cascading performance losses across all jobs. We have an "intelligent" way of disabling the fast path, but I think we'll have to improve upon it. |
Hi @konstantin-s-bogom , I tried to completely disable fastpath in code and did not see much improvements on it.
I am not 100% sure if the node is overloaded by cpu. If you see the table, when |
I ran some tests with fastpath disabled (remove this line https://cs.opensource.google/gvisor/gvisor/+/master:pkg/sentry/platform/systrap/metrics.go;drc=abde965590349ca06d7cd526ec2d230c756f1697;l=326 for disabling just stub FP for example): Normal:
With sentry fastpath disabled:
With stub fastpath disabled
On my VM I wasn't able to reproduce quite the same magnitude of perf-loss as you have, but based on these results I still think the issue is to do with fastpath enablement -- specifically sentry fastpath because this is a mostly computational workload. Regarding your question about CPU overload -- in both cases there are only 8 active threads because systrap doesn't create more user processes than there are CPUs https://cs.opensource.google/gvisor/gvisor/+/master:pkg/sentry/platform/systrap/systrap.go;drc=3a9ba17351571e343e16caec2e44215d8adc400f;l=250. What I think could be happening is that in the 8 thread case, there is not enough data to disable the sentry fast-path and the sentry just ends up spinning and consuming 1 CPU, so 1 thread doesn't make progress and becomes the bottleneck. With 9 threads there is no enough data to tell the fastpath metric heuristics that the sentry fast-path is causing more harm than good. With 8 threads, there are 7 tasks generating "good" latency results, and only 1 task generating "bad" ones; with 9 threads there would now be 2 tasks generating "bad" results, which tips the scales. Aside from freeing up the 1 core used by the sentry fast-path, it's possible the workload is spread out more evenly and no one thread is the bottleneck anymore? I am not quite sure about that last part... You can try modifying the heuristics in pkg/sentry/platform/systrap/metrics.go and see if you come up with something that works better. I won't be able to get to this for some time, but I am happy to review your code. Something that will help is using these debug metrics to know the fastpath state throughout the runtime https://cs.opensource.google/gvisor/gvisor/+/master:pkg/sentry/platform/systrap/metrics.go;drc=abde965590349ca06d7cd526ec2d230c756f1697;l=573. To use these, compile runsc with
|
Thanks @konstantin-s-bogom for the explanation! That's certainly something I can look into from my end as well to optimize the fastpath code path to make it more "sensitive" to the metrics. I have another quick question... From the table when I set |
For sentry fastpath this is unlikely, because the sentry fastpath only takes one system thread to monitor for events from all stub threads, so it really is all-or-nothing. There maybe something to explore here for stub-thread fastpath, to turn off fastpath only for some of the threads for example... this will be hard to optimize for the general case though, and per our test results above -- not likely related to this particular issue.
Just brainstorming, but maybe we could dynamically change maxSysmsgThreads to account for whether sentry fastpath is on or off? @avagin WDYT? |
Updates #11431 PiperOrigin-RevId: 742876901
Just so we don't repeat work, I tried this out and it didn't seem to help: DNS: Account for systrap dispatcher in maxSysmsgThreads. #11606 |
Description
Hi team,
We have recently found an interesting issue with gVisor. Following is the Python script we ran:
For some reason the runtime largely depends on the
num_jobs
passed to the function. Following is the runtime of this script with thenum_jobs
passed:Running on node with 8 physical cores (c6gd.2xlarge):
Running on node with 16 physical cores (r7gd.4xlarge):
Above numbers are very consistent in our environment.
Observations
num_jobs
is set to equal to the number of physical cores on host.lgb.LGBMClassifier
takes in default value to be same as physical cores. This makes the worst case to be the default caseOMP_THREAD_LIMIT
env variable to 1, even num_jobs is equal to physical cores, the job takes very fast to complete.ptrace
platform, it takes longer to complete in general. However, whennum_jobs
is close to physical cores,ptrace
actually surpassessystrap
. This might indicate some issues insystrap
num_threads=1
, and the issue no longer exists. But it is still not clear if the performance degradation is caused by this issue, as we do not observe same level of degradation with native kernel.Could you please help us understand the degradation we are seeing here, especially the case with # of physical cores is 8 and
num_jobs
is also set to 8? Why would gVisor suddenly takes ~70 times slower than native kernel?Steps to reproduce
Python script to reproduce:
runsc version
docker version (if using docker)
uname
Linux ws-uswest2-2-e20c 5.10.215-203.850.amzn2.aarch64 #1 SMP Tue Apr 23 20:32:21 UTC 2024 aarch64 aarch64 aarch64 GNU/Linux
kubectl (if using Kubernetes)
repo state (if built from source)
No response
runsc debug logs (if available)
The text was updated successfully, but these errors were encountered: