High cpu load

Easy to use, 100% Lua-based event scripting framework.

Moderator: leecollings

Post Reply
elgringo
Posts: 102
Joined: Thursday 18 May 2017 8:08
Target OS: Raspberry Pi / ODroid
Domoticz version: Left
Contact:

High cpu load

Post by elgringo »

I run a pi 5, with trixie, domoticz in a docker container, the latest stabel.
The cpu load is about 40%.

I was wondering what is better for the cpu load, trigger dzvents very minute or bij device updates, which most of the time are more than once a minute?

My gut feeling thinks it is caused by dzvents, but I don't know how to find the cause.

The thread with name: MainWorkerRxMsg is causing the high load. What does this thread do?
jannl
Posts: 823
Joined: Thursday 02 October 2014 6:36
Target OS: Raspberry Pi / ODroid
Domoticz version: 2025.5.x
Location: Geleen
Contact:

Re: High cpu load

Post by jannl »

40% seems high on a pi 5. On average on my pi 3b O se around 20% docker for Domoticz, Mosquitto and Zwave
User avatar
waltervl
Posts: 6676
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2025.1
Location: NL
Contact:

Re: High cpu load

Post by waltervl »

You can switch off dzvents/eventsystem completely through the Domoticz settings (tab other).
Or disable all the dzvents scripts manually through the event editor.

What also gives a high load is a P1 smart meter device that has a high update frequency (less than 10 seconds for updates) as it triggers a lot of devices and perhaps a lot of scripts, MQTT messages etc.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
HvdW
Posts: 663
Joined: Sunday 01 November 2015 22:45
Target OS: Raspberry Pi / ODroid
Domoticz version: 2023.2
Location: Twente
Contact:

Re: High cpu load

Post by HvdW »

CPU Temperature....: 42.9'C
Load Averages......: 0.18, 0.08, 0.10
Disk Space.........: Free: 30G | Used: 26G 46%
Memory (RAM).......: Used: 556Mi | Free: 51Mi | Total: 906Mi
RPI3+ heavily in use.

Did you check with htop?
and try these
ps aux --sort=-%cpu | head -n 10
ps aux --sort=-%mem | head -n 10
For cpu and memory as sort factor respectively.
USER | %CPU | %MEM
root | 12.3 | 39.1 - /home/pi/domoticz/domoticz -daemon -www 8383 -sslwww 8443 -log /var/log/domoticz.log
root | 0.0 | 7.5 - /lib/systemd/systemd-journald
root | 0.0 | 3.9
Bugs bug me.
lost
Posts: 699
Joined: Thursday 10 November 2016 9:30
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: High cpu load

Post by lost »

jannl wrote: Monday 05 January 2026 18:43 40% seems high on a pi 5. On average on my pi 3b O se around 20% docker for Domoticz, Mosquitto and Zwave
Also using a PI3B, but mostly in the 2/5% on cpu usage... And to limit heating the PI frequency is setup under max possible frequency so this should be even less.
=> 20% for a PI3 is quite huge so let's not talk about 40% on a PI5!

Well, in my case a raspbian lite base, headless install (no DE/graphic support, only X11 frame-buffer to allow ssh in X11 forwarding mode for a few basic graphic tools that don't bring full-DE dependancies: terminal, using rxvt-unicode or editor, using nedit). No docker, but the PI managing several other services of my own (linked to domoticz) to handle IP cameras, BT presence detection...

The limitation of a PI3 is not the CPU, but the amount or RAM especially if using several tmpfs in order to minimize SD card wear.
elgringo
Posts: 102
Joined: Thursday 18 May 2017 8:08
Target OS: Raspberry Pi / ODroid
Domoticz version: Left
Contact:

Re: High cpu load

Post by elgringo »

My domoticz spikes sometimes at 17 ish %:

Code: Select all

root        1540 17.3  1.8 2501504 150992 ?      Ssl  14:30   4:09 /opt/domoticz/domoticz -www 8080 -noupdates -sslwww 0 -userdata /opt/domoticz/userdata -log /tmp/log/domoticz/domoticz.log
I also have a Hailo 8 in it which analyses frames of camera's, which takes about 8% cpu.
Most of the time the cpu is quite low (8%), but sometimes as high as 18%. I got a lot of switches and sensor on the floorplan, if the webpage is open does this have influence on the cpu load

all threads of domoticz:

Code: Select all

    PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND
   1865 root      20   0 2500480 150496  24368 S   6.2   1.8   1:22.15 MainWorkerRxMsg
   1975 root      20   0 2500480 150496  24368 S   1.2   1.8   0:33.20 EventSystemQueu
   1540 root      20   0 2500480 150496  24368 S   0.0   1.8   0:00.11 domoticz
   1854 root      20   0 2500480 150496  24368 S   0.0   1.8   0:00.41 SQLHelper
   1855 root      20   0 2500480 150496  24368 S   0.0   1.8   0:00.02 PluginMgr
   1856 root      20   0 2500480 150496  24368 S   0.0   1.8   0:00.03 InfluxPush
   1857 root      20   0 2500480 150496  24368 S   0.0   1.8   0:00.03 MQTTPush
   1858 root      20   0 2500480 150496  24368 S   0.0   1.8   0:00.00 Webem_ssncleane
   1859 root      20   0 2500480 150496  24368 S   0.0   1.8   0:09.27 WebServer_8080
   1860 root      20   0 2500480 150496  24368 S   0.0   1.8   0:00.03 Scheduler
   1861 root      20   0 2500480 150496  24368 S   0.0   1.8   0:00.00 TCPServer
   1862 root      20   0 2500480 150496  24368 S   0.0   1.8   0:00.24 mDnsWorker
   1863 root      20   0 2500480 150496  24368 S   0.0   1.8   0:00.00 domoticz
   1864 root      20   0 2500480 150496  24368 S   0.0   1.8   0:01.54 MainWorker
   1866 root      20   0 2500480 150496  24368 S   0.0   1.8   0:00.02 Watchdog
   1875 root      20   0 2500480 150496  24368 S   0.0   1.8   0:00.02 WebServer_8080
   1943 root      20   0 2500480 150496  24368 S   0.0   1.8   0:00.26 MainWorker
   1944 root      20   0 2500480 150496  24368 S   0.0   1.8   0:00.07 Slimme Meter Ka
   1945 root      20   0 2500480 150496  24368 S   0.0   1.8   0:00.38 Led
   1946 root      20   0 2500480 150496  24368 S   0.0   1.8   0:00.41 TV
   1947 root      20   0 2500480 150496  24368 S   0.0   1.8   0:00.07 Domoticz_HBWork
   1948 root      20   0 2500480 150496  24368 S   0.0   1.8   0:00.03 KODI
   1949 root      20   0 2500480 150496  24368 S   0.0   1.8   0:00.07 Domoticz_HBWork
   1950 root      20   0 2500480 150496  24368 S   0.0   1.8   0:00.07 Domoticz_HBWork
   1951 root      20   0 2500480 150496  24368 S   0.0   1.8   0:00.03 Pinger
   1952 root      20   0 2500480 150496  24368 S   0.0   1.8   0:00.58 Zonnepanelen ov
   1953 root      20   0 2500480 150496  24368 S   0.0   1.8   0:00.58 Zonnepanelen da
   1954 root      20   0 2500480 150496  24368 S   0.0   1.8   0:00.42 Marantz
   1957 root      20   0 2500480 150496  24368 S   0.0   1.8   0:00.08 Systeem
   1958 root      20   0 2500480 150496  24368 S   0.0   1.8   0:00.82 KNMI
   1959 root      20   0 2500480 150496  24368 S   0.0   1.8   0:01.26 RTL
   1960 root      20   0 2500480 150496  24368 S   0.0   1.8   0:00.98 Zwave
   1961 root      20   0 2500480 150496  24368 S   0.0   1.8   0:00.06 Domoticz_HBWork
   1962 root      20   0 2500480 150496  24368 S   0.0   1.8   0:01.22 Zigbee
   1963 root      20   0 2500480 150496  24368 S   0.0   1.8   0:00.07 Domoticz_HBWork
   1964 root      20   0 2500480 150496  24368 S   0.0   1.8   0:00.83 MQTT
   1965 root      20   0 2500480 150496  24368 S   0.0   1.8   0:00.07 Domoticz_HBWork
   1966 root      20   0 2500480 150496  24368 S   0.0   1.8   0:05.86 Warmtepomp
   1967 root      20   0 2500480 150496  24368 S   0.0   1.8   0:00.62 UPS
   1968 root      20   0 2500480 150496  24368 S   0.0   1.8   0:00.56 Accu
   1969 root      20   0 2500480 150496  24368 S   0.0   1.8   0:00.00 NotificationSys
   1972 root      20   0 2500480 150496  24368 S   0.0   1.8   0:00.05 KodiNode
   1974 root      20   0 2500480 150496  24368 S   0.0   1.8   0:00.04 EventSystem
   1977 root      20   0 2500480 150496  24368 S   0.0   1.8   0:00.14 Plugin_ASIO
   1980 root      20   0 2500480 150496  24368 S   0.0   1.8   0:00.00 RTL

User avatar
waltervl
Posts: 6676
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2025.1
Location: NL
Contact:

Re: High cpu load

Post by waltervl »

What version of Domoticz are you running? Stable 2025.2 or beta?
MainWorkerRxMsg seems to be the Incoming messages system, so there seems to be a high load somewhere.... What is the refresh rate setting of your smart meter?
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
elgringo
Posts: 102
Joined: Thursday 18 May 2017 8:08
Target OS: Raspberry Pi / ODroid
Domoticz version: Left
Contact:

Re: High cpu load

Post by elgringo »

waltervl wrote: Tuesday 06 January 2026 17:04 What version of Domoticz are you running? Stable 2025.2 or beta?
MainWorkerRxMsg seems to be the Incoming messages system, so there seems to be a high load somewhere.... What is the refresh rate setting of your smart meter?
Stable 2025.2
P1 meter updates every second. I need this for my home battery to control it. The control retrieve p1 meter values via json interface, every second a single call (read total usage and total delivery). No ideal but the control needs a much updates as possible. If I put the control loop in domoticz (a plugin) the load will become even more. Current it is standalone python code.
But this was also the case with my previous pi 4, and it had only a cpu load (total) of 8. So something has changed, but I cannot figure out what.

Is it possible to enable trace/debug logging to see what MainWorkerRxMsg is handling of messages?
zicht
Posts: 300
Joined: Sunday 11 May 2014 11:09
Target OS: Windows
Domoticz version: 2023.1+
Location: NL
Contact:

Re: High cpu load

Post by zicht »

Try to disable dzevents and see what happens.
If that is conclusive rename scripts so the dont run one by one, see what is causing it with dzevents on.
If that is not conclusive try disabling plugins one by one.
if still not found disable all & all scripts and see if its resolved --> if domoticz is the only thing that runs & still high cpu then you have a different problem

i have avg more then 80 devices / minute triggering the event system w/o cpu load problems.
maybe you have introduced some kind of a loop (meaning triggering itself continuesly)
Faulty plugin is less likely
Rpi & Win x64. Using : cam's,RFXCom, LaCrosse, RFY, HuE, google, standard Lua, Tasker, Waze traveltime, NLAlert&grip2+,curtains, vacuum, audioreceiver, smart-heating&cooling + many more (= automate all repetitive simple tasks)
User avatar
jvdz
Posts: 2441
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: High cpu load

Post by jvdz »

One other thing you could check is the mqtt messages to/from domoticz to see which event messages are send/received by domoticz. Maybe there is some looping going on.
User avatar
waltervl
Posts: 6676
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2025.1
Location: NL
Contact:

Re: High cpu load

Post by waltervl »

elgringo wrote: Thursday 08 January 2026 7:47 Is it possible to enable trace/debug logging to see what MainWorkerRxMsg is handling of messages?
You can switch on Domoticz debugging by changing the Docker environment parameter EXTRA_CMD_ARG with debug settings
https://wiki.domoticz.com/Docker#Debugging
I think you should at least add debuglevel "received"
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest