Pi zero - high CPU usage even without any service running

Hi all,

I’m currently setting up a master+satellite rhasspy configuration. The master runs in a proxmox VM with docker container.
For the satellite, I have setup a new PI zero W + Jabra 410 and I have installed rhasspy-satellite.

Even after removing ~/.config/rhasspy directory and starting bin/rhasspy-satellite --profile fr I notice a high CPU usage of the rhasspyserver_hermes (around 50% in average) despite it’s doing nothing (nothing configured at this stage).

Did you notice the same behaviour? Any clue on the way to trace what is being done?

fx

Hi again,

Let me share additional inputs…

I’m running 2.5.0pre and I notice the high CPU usage with both docker container and rhasspy-satellite venv setups.
I’m wondering if there is any way to trace what’s happening in the server to explain this high load.

I also experience ramdom responsiveness of snowboy wakeword and I’m wordering if this could be related. Maybe I have to use personal wake words to improve the speed. I’ll see that later.

Otherwise (and it’s worth writing it), I’m quite happy with the environment (as a former snips user), the configuration flexibility and the ASR results with kaldi :slight_smile:

fx

My Pi Zeros tend to be the same way - about 60-70% CPU usage with only record/play and and snowboy configured. It’s only a single core CPU, so I can understand some more usage (at least compared to my Pi 3B+, which is really responsive and uses only ~5% CPU). But I was surprised at how much CPU it utilized just sitting idle as well.

Maybe @synesthesiam can explain more?

I experience the same issue with my pi zero satellite (tried docker and venv). I don’t have this kind of problems with my pi 3A+ satellite.

I also suspect snowboy to be the origin of the problem. Depending on the wakeword I use, the behavior is different. If I use jarvis.umdl, I have something like 10s latency to get the bip allowing me to say my command. With snowboy or my custom wakeword, it is quick and usable.

Nevertheless, after some time, snowboy doesn’t answer anymore and I need to restart rhasppy.

I am not sure why this is a surprise the difference between a zero and 3 is approx x10? Think that is on a single core.

Not sure why its high with supposedly nothing running but always presumed enough of its level that never even bothered on the zero.
Maybe try just a RTP audio satelite?

Even MagicMirror which is just a webserver really doesn’t run all that well on a zero.

Apparently there are some issues over at Snowboy about this aswell

Going deeper in the investigation with my limited skills…

The high CPU load clearly comes from the web server itself. If I comment out the following (in rhasspyserver_hermes/main.py)
app.run(
host=_ARGS.host,
port=_ARGS.port,
certfile=_ARGS.certfile,
keyfile=_ARGS.keyfile,
loop=_LOOP,
)

Then the load becomes almost neglictible (keep in mind that I have no service running so far)… Obviously, I can no more configure the satellite but as soon as the config is good, I don’t need to have it running all the time :slight_smile:

Any clue why the webserver is taking so much even if there is no client connected?

fx

4 Likes

I have used Snowboy on a Pi Zero with my own code before and had very low resource usage. Additionally, Rhasspy still uses a ton of CPU on the Zero even with different wakeword engines.

Maybe @tuxedo78 is on to something?

Looks very like he has found where the load is and well tracked down.

I can confirm that commenting the same lines on one of my Pi Zeros has reduced CPU usage significantly. My Snowboy wakeword and audio record/play still works great and all seems more responsive as a result.

Going 1 step further…

With the webserver not running (as explained above), I now have my CPU fully eaten by snowboy… Following the advice of @3issa, I move to snowboy wakeword instead of jarvis… and it makes a BIG difference :slight_smile: Faster and more responsive while I have random responsiveness with jarvis.umdl. Thanks for the good tip :slight_smile:

Now I’ll move to using custom wake word in order to try optimizing further…

By the way I don’t observe relevant performance difference between docker and venv, only some difference in Pyaudio config for my Jabra 410. Therefore, I’ll start using only the docker container as I find it easier to manage for auto-start when the Pi zero starts up.

fx

Interesting. I am using a custom wakeword with snowboy (.pmdl) instead of one of their universal models and I have low CPU usage (~10% when the Rhasspy webserver is disabled). Maybe that makes a difference?

There certainly is a difference between pmdl and umdl wakeword. Jarvis.umdl size is 3.5MB, my personnal wakeword size is about 10kB. Jarvis has multiple embedded hotwords that makes it heavier.

Thanks to @tuxedo78 for his useful workaround, that makes a big difference. With 2 personnal wakewords my rpi zero now runs with about 25 % CPU load.

@synesthesiam is it possible to have a way to enable/disable the webserver through commandline for future versions? That would really help for Pi-zero… And by leaving more CPU cycles to wakeword (especially for snowboy), I really think that it should improve wakeword detection performance.

fx

1 Like

+1 for this for 2.5, if possible @synesthesiam. Even an environment variable or command line argument or something that could be included in my docker-compose.yaml to disable the webserver would be amazing. Once I have everything on my Pi Zero satellite configured (using external MQTT), there’s no need for me to be running the web server.

Hello,
Yes, I do not understand this saturation, when:
mosquitto_sub -v -h “localhost” -p 12183 -t “#”

2.5 on Odroid xu4

@synesthesiam do you have any clue on this? should I fill a github issue?

I’ll add an option to rhasspy-voltron to disable the web server. Let’s see if that helps. I’ve also noticed supervisord sometimes leaves behind running Rhasspy processes. Do you see anything after exiting with ps -ef | grep rhasspy?

All my sites (Pi0, Pi3B+ and VM/master) run in Docker and I have never observed processes still running after stop.

Regarding this option, please could you elaborate the exact impacts of disabling the web server? Is it pure configuration stuff (need to change profile.json manually which is quite OK) or does it impact binding with external programs like Jeedom?

Well I checked and disabling web server will completly break Jeedom interface so not an option for me :frowning: