Help... Zoneminder is very slow

Forum for questions and support relating to the 1.34.x releases only.
Post Reply
Jef Luyckx
Posts: 2
Joined: Thu Dec 16, 2021 10:28 am

Help... Zoneminder is very slow

Post by Jef Luyckx »

We are having frequent dropouts and artifacts on live feed and recorded clips. This happens mostly when there is a lot of movement in front of the cameras.

When we log in to the webinterface of the individual cameras (Hikvision), the feeds are normal and in good quality. The live feeds and recordings in Zoneminder are choppy and in very low FPS (1 to 3 fps). Idle it runs at around 4 to 5 fps. The live feeds also are always 15 to 30 seconds behind the real live events.

We already changed the source method from TCP to UDP, resulting in even worse streams. Resolution of the cameras is set to 1280 x 1024. We had them running at 320 x 240 for a while, but this did not improve anything. Camera function is set to Modect but changing to Monitor does not help.
Cameras and server have their own separate VLAN. Cabling is copper CAT6a.

Video writer is set to X264 Encode (H264 Camera Passthrough was worse). Buffers are set as follows:
Image buffer size: 20
Warmup frames: 5
Pre event image count: 5
Post event image count: 5
Stream replay image buffer: 0
Alarm frame count: 2

The setup is a Ubuntu server 18.04.5 LTS headless running with 6 GB of memory in Hyper-V (Windows Server 2019). There a 6 cameras connected. Storage space is 60 GB (46 GB used) mounted on /mnt/zmdata/

In Hyper-V manager CPU usage is at 9%, HTOP shows values near 100% (user www-data in top place). Memory usage in HTOP is only 2.12GB usage and swp is at 268K / 1.98GB.

The HTOP CPU values are concerning. Strange that Hyper-V shows an almost idle machine. Is there something wrong in my config or does anyone have some other tips that could help me with these problems?

Thanks,
Jef
User avatar
burger
Posts: 390
Joined: Mon May 11, 2020 4:32 pm

Re: Help... Zoneminder is very slow

Post by burger »

Jef Luyckx wrote: Thu Dec 16, 2021 1:39 pm We are having frequent dropouts and artifacts on live feed and recorded clips. This happens mostly when there is a lot of movement in front of the cameras.

When we log in to the webinterface of the individual cameras (Hikvision), the feeds are normal and in good quality. The live feeds and recordings in Zoneminder are choppy and in very low FPS (1 to 3 fps). Idle it runs at around 4 to 5 fps. The live feeds also are always 15 to 30 seconds behind the real live events.
On average this means you are out of resources (usually CPU, but could be RAM).
Jef Luyckx wrote: Thu Dec 16, 2021 1:39 pm Resolution of the cameras is set to 1280 x 1024. We had them running at 320 x 240 for a while, but this did not improve anything. Camera function is set to Modect but changing to Monitor does not help.
This is not expected behaviour. If you lower resolution / fps you should see performance increase. Try disabling cameras (set to function 'none') and see if you can get 1, then 2, then 4 cameras stable. Expect a turning point where the system can't keep up, and framerates go down. That is resource exhaustion.

If you can't get any cameras stable, even at low resolution, then it might be something unrelated to zm. Make sure your hardware is in good condition, e.g. no bad RAM, and that the Host OS isn't mining cryptocurrency or something nefarious.
Jef Luyckx wrote: Thu Dec 16, 2021 1:39 pm Video writer is set to X264 Encode (H264 Camera Passthrough was worse). Buffers are set as follows:
Image buffer size: 20
Warmup frames: 5
Pre event image count: 5
Post event image count: 5
Stream replay image buffer: 0
Alarm frame count: 2

The setup is a Ubuntu server 18.04.5 LTS headless running with 6 GB of memory in Hyper-V (Windows Server 2019). There a 6 cameras connected. Storage space is 60 GB (46 GB used) mounted on /mnt/zmdata/
The default buffers for 1.34 should be adequate. VMs have overhead, so the general forum recommendation is to use a bare metal machine or containerization (e.g. docker). Although, some folks do run VMs.

If you upgrade from 1.34 to 1.36 you may need to adjust one of the buffers. See the note here: viewtopic.php?f=43&t=30785 and also search the forums if necessary.
fastest way to test streams:
ffmpeg -i rtsp://<user>:<pass>@<ipaddress>:554/path ./output.mp4 (if terminal only)
ffplay rtsp://<user>:<pass>@<ipaddress>:554/path (gui)
find paths on ispydb or in zm hcl

If you are new to security software, read:
https://wiki.zoneminder.com/Dummies_Guide
Jef Luyckx
Posts: 2
Joined: Thu Dec 16, 2021 10:28 am

Re: Help... Zoneminder is very slow

Post by Jef Luyckx »

After reading your reply, I have upped the ram to 16 GB and this was a big improvement. The camera capturing the most movement is still suffering.
I am also going to test your other suggestions in the next days, like disabling cameras and looking for a turning point in performance while switching them on. And trying other resolutions.
Don't think it is a hardware issue on the server side. Data disks check out ok. Virtual ram should be ok. Crypto mining or other ram hogging processes seem doubtfull. I did a clean install with the only appliance being ZM. Server is behind Fortigate firewall and only accessible from our internal network.

Thanks for the quick and helpfull reply! Can hopefully post further updates with more improvements!
Grtz,
Jef
Post Reply