Page 1 of 1

CPU usage problems

Posted: Sat Sep 11, 2021 5:14 pm
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.

Re: CPU usage problems

Posted: Sat Sep 11, 2021 5:25 pm
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.

Re: CPU usage problems

Posted: Sun Sep 12, 2021 1:05 am
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.

Re: CPU usage problems

Posted: Mon Sep 13, 2021 8:18 pm
by iconnor
1.36.7 cuts cpu for motion detection dramatically. Give it a whirl.