-
Notifications
You must be signed in to change notification settings - Fork 315
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
High CPU Usage #2597
Comments
Thanks for the report! This sounds pretty bad, @maiamcc are you able to repro? |
I had trouble getting k3d running but your Tiltfile+chart gives me plenty of Tilt-eating-my-CPU on K8s for Docker for Mac, I'll start looking into it over here. Just to verify I'm not debugging the wrong problem, can you profile your Tilt run for me? See profiling instructions here, and then share the |
That seems to be along the lines of what I saw. I’ll gather some profiling data tomorrow when I’m back on my laptop, thanks for the quick response! |
After some digging, looks like the biggest culprit here is our terminal UI. Try running with |
With I created a quick profile when |
I observed something new. When I run
edit: happens with HUD enabled as well edit: latest version fixes the segfault as described, but the CPU usage stays high. Disabling the hud & closing the browser tab both help reducing the resource consumption, but baseline stays quite high (around 170% on htop with not much action on the terminal) |
Thanks for your profile, I'll take a look!
Unfortunately we're not well set up for profiling when the HUD is disabled. For now, you can use this branch, which waits 15s, then kicks off a 10s profile. Are you comfortable building from source? If not, I can whip you up a binary. |
Here are some runs in a single session: tilt.profile.nohud.zip. I hope this is helpful! |
Thanks, these are great! I think I was mostly barking up the wrong tree -- found a small perf gain that I made a PR for in case, but it probably isn't enough to actually fix your CPU woes. We're all headed for Thanksgiving but I'll take another swing at this on Monday. Thanks for your patience! |
Exploring other avenues could still be worthwhile. Both HUD and websockets seem to affect resource usage, as well as the frontend js. I’d also be happy to try and work around this issue if you have any insight regarding what makes this particular chart expensive to use with Tilt. Happy holidays! |
Hi @osener, sorry for the radio silence, but I think the PR I just merged will help. Whenever you get a chance, install from master and let us know how it goes. There's more context in the PR, but tldr, CPU usage is particularly high for this chart b/c of the number of logs it spews -- roughly speaking, each log event triggers a refresh of the UI (both terminal and web). Terminal UI refresh is expensive because of terminal rendering junk (which is why |
@maiamcc thanks for following up on this. After some seriously annoying debugging I have come to the conclusion it's not purely Tilt's fault it's due to Docker-for-Mac's implementation and how they handle k8s. There are countless reports about the incredibly poor performance of k8s with docker-for-mac. While I don't think this is purely tilt's responsibility to fix or even that the process using the CPU is tilt I suspect most of my ranting and team complaints are because "when they use tilt their CPU goes through the roof". Regardless of the process causing the high CPU. SuggestionsTo help with profiling and fixing this perceived CPU intensive load.
Extra links for high CPU
Some ideas I am going to play around with
|
Thanks for this super detailed breakdown @drubin! In the medium term, we're definitely looking into ways to both improve Tilt's CPU usage, and have Tilt nudge users towards more CPU-efficient workflows even if it's not Tilt itself eating their CPU. I suspect the first thing we'll do in this area is have some way to warn users what's eating their memory/CPU (so, if it's not Tilt, they don't blame us 😅 but also so they can actually debug the problem!) and go from there. Anyway, I'm going to close this ticket on the assumption that @osener can now run this particular chart without prohibitive CPU use, cuz I can--but @osener definitely let me know if it's still giving you trouble as of the latest Tilt release and we'll reopen this investigation. Thank you both! |
I'm getting started Tilt and bumped into a high CPU usage scenario I can reproduce using Gloo helm chart. This consistently gets Tilt to use at least 40% CPU on my 8 core laptop. I'm using Tilt v0.10.21 with k3d on Manjaro Linux.
I'm new to k8s so please let me know if you need more details, but I'm hoping these steps will help you reproduce the issue:
Tiltfile:
In the first run, this chart seems to log a lot of diagnostic errors, but even if I stop tilt & run
tilt up
again it quickly goes back to using a lot of resources even though I don't see much output on the console.The text was updated successfully, but these errors were encountered: