I tested the fix image gladysassistant/gladys:fix-nuki-home-assistant-wildcard-listen but unfortunately the CPU usage is still at ~60-70%.
No NotFoundError in the logs anymore (the retained messages race condition seems resolved), but the high CPU persists.
I also noticed that the LAN Manager presence scanner keeps calling ip neigh show even when set to « disabled » in the UI — but that’s likely not the main cause since the call frequency is low.
Any further ideas what could be causing constant high CPU at only ~0.8 msg/s MQTT throughput?
That’s it! When I disable Apple HomeKit in dashboard/settings/service, and restart the gladys container (the fix_nuki one AND latest, as of now, v4.71.0), CPU time goes way down, container cpu 0.3%
I do have apple devices, but i don’t run Apple home Kit devices anyway so FOR ME the problem is solved.
I assume this leaves you to figure out the cause for your other users. If I can provide sth that could help you, I’ll glady do so.
Hi, I’m glad you were able to resolve your issue. If it’s related to the HomeKit integration, I’ll look into it. I’m pretty sure it’s an issue related to mdns, I’ve already mentioned it here: Installer Gladys sur NAS Qnap - #13 par bertrandda. The latest version of the dependency we’re using makes quite a few changes to it, and it seems to be causing issues with Docker.
I couldn’t reproduce issue on my Mac, but I’ve picked up a Linux PC to investigate. I am on it!
Sorry I didn’t realize it could be a problem. Your PR is fine thx and a nice way to do for further mqtt scanning. I would like to add another correction in the PR, but I do not know how to do that.
I just realize that ‘device.get’ is not taking ‘service_id’ as parameter, it has to be ‘device.get({ service: ‹ nuki ›, });’ in nuki.mqtt.connect.js and nuki.mqtt.disconnect.js
I’ve tried everything, but I couldn’t reproduce what’s causing the CPU spike. I’ve tried to add a select on the Homekit integration configuration page to change the mDNS (which is what Homebridge does). If as I suspect, it’s an mDNS issue, that should do the trick.
A Docker image is available: bertrandda/gladys:homekit-mdns. Normally, the default is CIAO. @bamboleate could you please test each available mDNS and check the CPU usage? Once the configuration has been saved, you’ll need to wait a few seconds for the service to reload.
@bertrandda I noticed there’s a new version of @homebridge/hap-nodejs. Have you tried upgrading to the latest release?
Another idea: @bamboleate’s MQTT devices send roughly 1 message per second. Have you tried simulating a similar load by publishing MQTT messages at that rate to your instance? It could help confirm whether the HomeKit listener (which reacts to all state changes) has become too heavy and is causing the CPU spike.
Sooooo, I finally had the time to fiddle a little with the container bertrandda/gladys:homekit-mdns, and here is what I found
CPU % goes up immediately, when I start Apple homeKit Service/I click on the button in dashboard/settings/service
initially it was set to CIAO
Set to AVAHI, I had a feeling of even a slight increase in CPU % compared to CIAO, but that could be me
Set to BONJOUR CPU% went down to normal values!!!
Set to RESOLVED the CPU% was up like the other three
Mind you, since I tinkered with networking, a server and Pis and stuff, I like my apple devices to be visible and not some kind of obscurely hidden by any “service” apple provides, so I tried to disable all that, and that maybe is a cause of this issue? Wouldn’t have believed it, but here we are…
I have disabled Apple’s ‹ Limit Tracking › option on my devices (which rotates IPs/MAC addresses), and my DNS runs on PiHole. Not sure if that’s related, but it might explain why BONJOUR works best in my setup. Currently running with BONJOUR and CPU is stable.
Hope this helps
EDIT: I forgot to mention that with the container bertrandda/gladys:homekit-mdns, CPU% went down immediately when I disable Apple Home Kit in dashboard/settings/service, while it stays up until I reload the container when it’s gladysassistant/gladys:latest, could be relevant to you as well
Thank you so much @bamboleate it’s exactly what I need to know.
I am going to set Bonjour as default mDNS. It was the legacy advertiser which was used with beta version of library.
We can see here mDNS Options · homebridge/homebridge Wiki · GitHub that for docker, avahi is recommended but need more configuration in docker, not sure that migration is possible for all existing Gladys instances. Bonjour advertiser should work for all configurations and if users want to optimize their configuration they can.
Yes, I added a correct stop function in this image that stop Homekit integration immediately, thank’s, you just confirmed that it works!
Yes the new version is in bertrandda/gladys:homekit-mdns image