StreamAssist icon indicating copy to clipboard operation
StreamAssist copied to clipboard

Massive CPU consumption increase when StreamAssist is running

Open jxlarrea opened this issue 9 months ago • 9 comments
trafficstars

Hello! Thank you for this amazing solution to Voice Assistant - it is actually viable now.

I did notice that my HA VM CPU consumption skyrocketed after I got StreamAssist up and running. Every component in the pipeline is offloaded to individual containers in my Proxmox host: go2rtc, ollama, whisper, piper and openWakeWord are all running in containers outside of the HA VM. I even made the streams in go2rtc only serve audio so no video data is sent to HA in hopes to reduce the CPU consumption with no luck.

What exactly could be consuming so much CPU within StreamAssist?

Image

jxlarrea avatar Jan 27 '25 20:01 jxlarrea

Please also notice how the CPU usage immediately goes back to normal when StreamAssist is disabled in HomeAssistant.

Image

jxlarrea avatar Jan 27 '25 22:01 jxlarrea

I think what's causing so much CPU consumption is the audio resampling in stream.py.

jxlarrea avatar Jan 28 '25 00:01 jxlarrea

You should use applications like top or htop, to know what software are consuming CPU.

AlexxIT avatar Jan 28 '25 10:01 AlexxIT

You should use applications like top or htop, to know what software are consuming CPU.

It is StreamAssist that's consuming the CPU.

jxlarrea avatar Jan 28 '25 10:01 jxlarrea

Why you think so? StreamAssist it's not even an app. This is the HA module. The CPU can be consumed by the entire HA process.

AlexxIT avatar Jan 28 '25 10:01 AlexxIT

Why you think so? StreamAssist it's not even an app. This is the HA module. The CPU can be consumed by the entire HA process.

Please take a look at the screenshot. It shows a 50% increase in CPU usage when StreamAssist is installed and configured with 2 pipelines. As soon as the StreamAssist instances are disabled within Home Assistant, CPU usage goes back to normal.

The same behavior has been reported before in issue #18 by another user.

Image

jxlarrea avatar Jan 28 '25 17:01 jxlarrea

I'll try to check same situation when have time.

AlexxIT avatar Jan 28 '25 17:01 AlexxIT

I'll try to check same situation when have time.

Thank you, I really appreciate it. StreamAssist is exactly what Voice Assistant should be out of the box. Honestly should be part of HA Core. What you came up with is amazing.

Unfortunately with such increase in CPU usage it makes it not viable at the moment. Hopefully you can pinpoint what's causing it.

jxlarrea avatar Jan 28 '25 17:01 jxlarrea

I think its the wake word handling. I noticed increase power usage and when i checked the add on, the wake word one was using 20% of the cpu. so i turned it all off, and power usage went down.

PetePeter avatar Jan 29 '25 12:01 PetePeter