-
-
Notifications
You must be signed in to change notification settings - Fork 586
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 with docker #6612
Comments
@Giel538 By checking changes on my side most things are related to build stuff so nothing that could cause such cpu increese. Are you able to detect the exact version that causes this? I mean dis you switched from 5.1.0 to 9.6.2? Could you try doing a granular switch between version and tell me the exact version that introduced this issue? cc @AlCalzone |
Also driver logs on level debug could be helpful. |
I am running HAOS in a VM as well; also my controller is an AEON Labs | Z‐Stick Gen5 USB as well, but I connected it to the host machine and pass it through to the VM. zwavejs2 is also leading my docker stats by far ( 7 devices are in my network, with one of them reporting every few seconds and quite some data to unpack (a metering plug - Node 7 in my attached logs). Happy to provide anything that can help narrowing this down! EDIT: Attached driver logs on level debug This might be related to zwave-js/zwave-js-ui#3323 |
Hmm i feel a bit stupid... Downgrading to older versions did not seem to help. I got triggered by the post from @t-o-o-m. It seems like that at the exact same date i created an automation in home assistant to force my zwave wall plug to send an update of the actual power usage everey 2 seconds. I use zwave_js.refresh.value for this action. I needed a fast update cycle because the power usage is changing a lot in a small area (between 7 and 12 W). |
Could be related to our power metering devices, yes. But just to put things into perspective: my zigbee network has 23 nodes, not 7, and a few of those have ridiculous reporting intervals as well. Zigbee2mqtt hovers around 0.01% usage with peaks at 0.05%, though. |
Anyone with this problem able to capture a Node.js CPU profile? |
I have a feel this could be a possible reason but only a CPU profile could help understanding what's going on there... |
I tried to stop the add-on and call the command mentioned here: Should I assemble a docker compose file taking care of that? Would that work together with the supervisor? |
Can't speak for the addon side but you should lunch the nodejs process with
|
Created a separate VM and passed my ZWave stick through. Profiled it for a while - attached the processed tick file. Can also run any command and use the inspect port if you need me to. |
IF i run this command it stops at this line: 2024-01-15 18:29:54.714 WARN Z-WAVE: Z-Wave driver not inited, no port configured How can i attach a ser2net device to docker run? Or is this not possible? Otherwise i have to place my stick temporary in the right computer. |
I guess you have to also export port 8091 Or it's probably sufficient to mount your current config into the container, like you did in the docker compose config you posted |
@Giel538 Yeah you should mount the volume, or just edit your actual docker-compose file and add |
@robertsLando @AlCalzone: did you take a look at the CPU profile posted above? Can you deduct anything from it? It looks quite similar to the one provided in zwave-js/zwave-js-ui#3323 Happy to provide other things - also whatever stuff is possible through the inspect port. |
I checked it but I don't find anything that points to something on z-ui side, I see many entries from node_modules/@zwave-js so it could be likely something on driver side... @AlCalzone just throwing some ideas, could it be the jsonl db? @t-o-o-m just to discard a possible issue, could you disable logging to file to see if that keeps the cpu high? |
Completely disabled logs - tick analysis: processed_no_logs.txt |
@t-o-o-m Do you still see high usage? Now I check the logs |
@robertsLando Yes, still high. Edit: disconnected the Z-Wave stick - the CPU usage immediately dropped to ~0%. So I guess this excludes all kinds of infinite loops :) |
While this does loop quite a bit, most of the time should be spent sleeping. And it's only 50 of ~18000 total ticks. @t-o-o-m you could try editing /usr/src/app/node_modules/@alcalzone/jsonl-db/build/lib/db.js line 592 for a test: - const sleepDuration = 20; // ms
+ const sleepDuration = 250; // ms for example. |
Humm this is interesting, try making the change @AlCalzone suggested if you can |
Disconnecting the stick destroys the driver. So it should exclude the UI from the list of potential reasons. |
Have we considered serialport yet? |
we didn't checked that on the other issue, it could be BTW! I could try creating a test container running on node 20.2 maybe? |
@AlCalzone Images are using nodejs 18.18.2-r0 : https://github.com/zwave-js/zwave-js-ui/blob/76802d575081127ec02f3860b22efbc1d73a01d4/docker/Dockerfile#L10 |
Tried this now - this brings the CPU usage down to the realm of 0.xx%; at least using the standalone container without HA 🎉. Would love to try this within HA as well! Edit: also seems to work with the HA community addon. Just had to edit Thanks for sticking with me on this! It was never really a big issue but I kinda am hunting down any Watt I can save :D |
Huh, guess I'll have to rework that function then. |
Huh seems we find it so, @AlCalzone do you want me to submit a PR? I think it may be worth a patch release of zwave-js before your return :) |
I'm not sure I like the solution we tried here. Might have to do something a little more complicated. |
@robertsLando Can you transfer to node-zwave-js please? |
Hi. I can also confirm that this is working for me as well. |
Hi guys, could you give a try to |
Can confirm low idle CPU usage on the |
Checklist
Deploy method
Docker
Z-Wave JS UI version
9.6.2.6e369a1
ZwaveJS version
12.4.1
Describe the bug
I am running all my smart home stuff inside a debian virtual machine. It was almost using 2% cpu power steady for months. Since the update from Zwavejs UI to 9.6.0 my cpu usage is increased to 3.1%. I know it is still low in absolute value but it is still almost 35%! The vm is using 2 cores from my intel i5 13500 cpu. May be other people who are using a rpi or similar systems are have more problems with the increased cpu usage.
ZwaveJS is using the most cpu power from all my docker containers. Even more then Home Assistant or Zigbee2mqtt (which has a lot more devices).
I checked the change log but i don't know what is changed what can cause a higher cpu usage
To Reproduce
I restarted the container a few times but it is still the same. When i stop the container the cpu usage is back to 2%.
Expected behavior
I expect after a "small" update that the cpu usage is not changing this much.
Additional context
I am using AEON Labs | Z‐Stick Gen5 USB Controller but it is connected via ser2net via another computer.
This is my docker stack:
The text was updated successfully, but these errors were encountered: