CPU usage problems

Discussions related to the 1.36.x series of ZoneMinder
Post Reply
laureltree
Posts: 4
Joined: Sat Sep 11, 2021 4:50 pm

CPU usage problems

Post by laureltree »

I'm having a problem where ZM's CPU and memory usage is low (enough) until I add 1 more camera, and then it just crushes the system.

The setup

There are 7 Amcrest cameras, all the same model, feeding back 4K, 10 fps, RTSP streams to ZoneMinder. For all of them, the config is:
  • Analysis FPS: 2
  • Save JPEGs: Disabled
  • Video Writer: Camera Passthrough
I'm running ZM v1.36.5 via the Docker thing on a system with 16 CPUs and 16GB RAM.

I start with Function=None on all the cameras. As I enable Modect on each camera, each one adds about 1GB of RAM and its zmc process uses 50% of a CPU.

But, when I add the 5th or 6th camera, EVERY zmc process' CPU usage jumps up to 150%. So there's this sudden jump from:

* 4 cameras x 50% of a CPU each = 2 CPUs used total
* 5 cameras x 150% of a CPU each = 7.5 CPUs used total

I also see memory spikes like this too. There's some threshold number of cameras set to Modect where the memory usage suddenly spikes from 7GB to 16GB + all my swap space. Setting "enough" cameras back to Function=None fixes it.

I don't see anything telling in the logs. I can't pin this one any specific camera. I can enable them in any order and things are fine until I get to 5 or 6 cameras.

Any idea what's going on here? Why would setting Function=Modect on a 5th or 6th camera cause all the _other_ cameras' CPU usage to triple?

I really can't use ZM under these circumstances because it just kills whatever hardware I throw at it.
laureltree
Posts: 4
Joined: Sat Sep 11, 2021 4:50 pm

Re: CPU usage problems

Post by laureltree »

I've noticed also that after I get a certain number of cameras enabled, ZM creates a second zmdc process under the parent zmdc process. This doesn't seem like it's the thing triggering the CPU usage spike though - that can happen whether or not I see that second zmdc process appear.
User avatar
iconnor
Posts: 2881
Joined: Fri Oct 29, 2010 1:43 am
Location: Toronto
Contact:

Re: CPU usage problems

Post by iconnor »

They thing here is 4k.

decoding a 4K cam takes 50% cpu (on my system). Adding motion detection, etc. No way. Forget it. Drop it to 1080p. Even 1080p is ridiculous.
User avatar
iconnor
Posts: 2881
Joined: Fri Oct 29, 2010 1:43 am
Location: Toronto
Contact:

Re: CPU usage problems

Post by iconnor »

1.36.7 cuts cpu for motion detection dramatically. Give it a whirl.
Post Reply