Spyglass CPU usage on Pi5 (8Gb).
The CPU usage of Spyglass on my pi5 + Picam3 is steadily sitting between 65-90% with 20-ish spyglass processes running when printer is idle. I used KIAUH and installed spyglass per instruction from the repo.
This doesn't seem right, see the screenshot.
Spyglass: 0.16.2-0-g54930cf9
Moonraker: v0.9.3-64-g4889a2dd
Klipper: v0.12.0-446-g98068bec
Klipperscreen: v0.4.5-52-g68fe1b0e
Mainsail: v2.13.2
#Spyglass CPU usage on Pi5 (8Gb).
45 messages · Page 1 of 1 (latest)
Ahoi @cinder vessel!
It looks like you did not provide all the necessary information we need to help you.
Please upload your logfiles and a detailed description of your problem.
For further information see: https://docs.mainsail.xyz/faq/getting-help/discord#provide-information
Note: We only accept .log and .txt files as log files.
This is an automated message
I recommend to disable WebRTC
You can do that in your spyglass.conf, if you uncomment DISABLE_WEBRTC="true"
The problem is that a Pi5 is encoding WebRTC on the CPU. This creates high loads
I will make sure to update my guide that I post in future for the Pi5, but overall I don't want to disable WebRTC by default
WebRTC is disabled
The Pi5 will get it's own section in the Readme on the repo soon, that people will see it more easily
With WebRTC disabled you shouldn't have such high CPU usage
Can you scroll to the side on the htop output?
Just so that I can see all the used parameters
Sure, just a sec...
Fyi, I testedit real quick on my Pi5 and it's indeed way lower. It's sitting at 85%/400%
So like 21% if you go by your measures
The amount of processes is normal. Nothing I can do about that
Even with 30fps I only get up to 180%/400%
Is it normal to have so many processes?
Yep, it's nothing I can control
Those come from picamera2, the libcamera library we are using
I recommend to reduce the fps to 15. My tests are done with a picam v1 and v2, but I don't get to 288% unless I increase the fps to like 60fps
I will try the picam v3 later, to see if it's better or worse
Also something else you can do, to improve performance is to change from picamera2.encoders import MJPEGEncoder, H264Encoder to from picamera2.encoders import JpegEncoder as MJPEGEncoder, H264Encoder inside spyglass/camera/csi.py
Are you using adaptive mjpg service?
Maybe that's increasing the load
UV4L-MJPEG
ahhhh..haha
Apply the change I mentioned here: #1344753215975198730 message
I will add some parameter to apply that automatically soon
UV4L-MJPEG, 1920x1080, 15fps = 25-30% CPU
That seems more reasonable and closer to my values
Overall the only way to get further down is either drop resolution or fps
Or don't use a Pi5
I'm fine with this.
Perfect, if you don't have any further questions, please close this post