how to reduce cpu load?

Discussions related to the 1.36.x series of ZoneMinder
Cramac1
Posts: 111
Joined: Wed Aug 29, 2018 11:29 am

how to reduce cpu load?

Post by Cramac1 »

Hello.
before:
CPU usage was at 50%.

Added two cameras, restarted zm. CPU became 100%
All cam func - record. Decoding Enabled - checked

how to reduce cpu usage? Need cyclic recording and online
cpu.png
cpu.png (82.13 KiB) Viewed 4334 times
clipo
Posts: 101
Joined: Sat Sep 06, 2008 9:55 am
Location: Manchester, UK
Contact:

Re: how to reduce cpu load?

Post by clipo »

You need to give more details if you want help....

How are you camera setup

What cameras do you have

How are they connected.

Most HD IP Camera give out H264/5 streams and if you're just recording the main stream you should switch off the decode when doing H264 Pass through
Screenshot at 2022-06-11 17-03-11.png
Screenshot at 2022-06-11 17-03-11.png (191.64 KiB) Viewed 4330 times
Screenshot at 2022-06-11 17-03-40.png
Screenshot at 2022-06-11 17-03-40.png (173.32 KiB) Viewed 4330 times
Cramac1
Posts: 111
Joined: Wed Aug 29, 2018 11:29 am

Re: how to reduce cpu load?

Post by Cramac1 »

stood, worked. loading was normal - 50%.
all IP cameras, part x264, part x265

Now I disabled the two added cameras, rebooted the zm, the CPU load did not fall.

All settings are identical.
1.png
1.png (17.84 KiB) Viewed 4325 times
2.png
2.png (28.77 KiB) Viewed 4325 times
3.png
3.png (38.54 KiB) Viewed 4325 times

why an hour ago, before rebooting the zm, the cpu was loaded by 50%, and how it rebooted the zm to 100%
Or some kind of OS update leads to this.
kaltertod
Posts: 38
Joined: Fri Jun 03, 2022 9:42 pm

Re: how to reduce cpu load?

Post by kaltertod »

How much ram does your server have.... Is the swap full? Show us your buffer settings this can have an effect on cpu/ram usage....

P.S. Sanitize your images your are showing user/password/ip info
Cramac1
Posts: 111
Joined: Wed Aug 29, 2018 11:29 am

Re: how to reduce cpu load?

Post by Cramac1 »

in the first message, the swap is empty, operational 48GB
Cramac1
Posts: 111
Joined: Wed Aug 29, 2018 11:29 am

Re: how to reduce cpu load?

Post by Cramac1 »

is there a debug mode? what is using the cpu at 100%
dougmccrary
Posts: 1172
Joined: Sat Aug 31, 2019 7:35 am
Location: San Diego

Re: how to reduce cpu load?

Post by dougmccrary »

Options->Logging

You probably want to look at top or iotop first.
Cramac1
Posts: 111
Joined: Wed Aug 29, 2018 11:29 am

Re: how to reduce cpu load?

Post by Cramac1 »

iotop.png
iotop.png (52.46 KiB) Viewed 4240 times
it remains only to remove the memory that installed
Cramac1
Posts: 111
Joined: Wed Aug 29, 2018 11:29 am

Re: how to reduce cpu load?

Post by Cramac1 »

chart2.png
chart2.png (58.38 KiB) Viewed 4229 times
CPU load before installing additional memory and after
dougmccrary
Posts: 1172
Joined: Sat Aug 31, 2019 7:35 am
Location: San Diego

Re: how to reduce cpu load?

Post by dougmccrary »

What are your buffer settings?
kaltertod
Posts: 38
Joined: Fri Jun 03, 2022 9:42 pm

Re: how to reduce cpu load?

Post by kaltertod »

dougmccrary wrote: Mon Jun 13, 2022 8:30 pm What are your buffer settings?
This ^. If you have very large buffers it will eat up alot of cpu cycles. Are you running this on a mechanical HDD or an SSD just switching to an SSD on my server cut the cpu usages in half over a spinner, RAM usage also went down.

What fps and resolution are your cameras this will also play into cpu usage as every frame is decoded and analyzed by zm
dougmccrary
Posts: 1172
Joined: Sat Aug 31, 2019 7:35 am
Location: San Diego

Re: how to reduce cpu load?

Post by dougmccrary »

Yes. I was thinking the same. If it's spinning rust, either an ssd or perhaps adding another drive to split the load might help.
clipo
Posts: 101
Joined: Sat Sep 06, 2008 9:55 am
Location: Manchester, UK
Contact:

Re: how to reduce cpu load?

Post by clipo »

ZM is heavy on iotop and is mainly database access with the many writes, it's something that need looking at with future versions of ZM.

You might want to look at mysqltuner to see if that can optimise your database.

Looking at smt-mir1 you have decode enabled if this monitor is just recording and you don't need to view then turn off decode, I only decode the low resolution feeds that I run the analysis on and use those for viewing.

Reading this thread you trouble started when you added more ram?
Cramac1
Posts: 111
Joined: Wed Aug 29, 2018 11:29 am

Re: how to reduce cpu load?

Post by Cramac1 »

dougmccrary wrote: Mon Jun 13, 2022 8:30 pm What are your buffer settings?
all cam
buff.png
buff.png (16.03 KiB) Viewed 4115 times
repeat again. before rebooting the server, the load was 50%, rebooted and immediately 100% All settings before and after are the same. Already removed the added cameras. nothing changes.
the version of zm was also not updated, all the packages of the system were updated, except for zm. Base on another server.
dougmccrary
Posts: 1172
Joined: Sat Aug 31, 2019 7:35 am
Location: San Diego

Re: how to reduce cpu load?

Post by dougmccrary »

hmm
Was that a reset type reboot, or power-off?
If reset, I'd try power-off. Seems something went haywire with the disk(s).
Post Reply