increasing analysis backlog or zmc dying - possible solution
Posted: Sat Nov 26, 2022 2:20 am
Hi all
YMMV, do not just blindly copy the 98-zoneminder.conf shown below. You will need make adjustments based on your PC memory and # cpu's as well as number of cameras!!
I got tired of zmc processes dying due to insufficient free memory and messages in zm log stating that the analysis of images were progressively getting further behind. The top command would show free memory near 0 or swap free near 0. The load average would get near 6 or 7 when zmaudit.pl was running (on a 4 cpu PC with 4 cameras). Rather than trying to adjust parms in ZM, based on my past experiences with memory issues on other servers, I created the following file based on my computer that has 64 GB of RAM and then rebooted:
[~]$ cd /etc/sysctl.d
[sysctl.d]$ ls
98-zoneminder.conf 99-sysctl.conf
[sysctl.d]$ cat 98-zoneminder.conf
# 98-zoneminder.conf
# control minimum free KB so cameras have enough memory in buffers
vm.min_free_kbytes=4194304
vm.dirty_background_ratio=5
I have been running with the above file for about a month without issues. You should try adjusting the parms in this file for your installation. vm.min_free_kbytes controls the minimum amount of free RAM. vm.dirty_background_ratio controls the amount of free swap space as a ratio.
Here is an example run of top after making the 98-zoneminder.conf, I hope this helps someone struggling with these issues.
$ top
top - 18:19:10 up 5:07, 2 users, load average: 2.57, 2.49, 2.35
Tasks: 197 total, 1 running, 196 sleeping, 0 stopped, 0 zombie
%Cpu(s): 50.6 us, 0.7 sy, 0.0 ni, 47.7 id, 0.3 wa, 0.4 hi, 0.3 si, 0.0 st
MiB Mem : 31760.7 total, 5498.6 free, 8648.2 used, 17613.9 buff/cache
MiB Swap: 24256.0 total, 23985.7 free, 270.2 used. 8440.8 avail Mem
YMMV, do not just blindly copy the 98-zoneminder.conf shown below. You will need make adjustments based on your PC memory and # cpu's as well as number of cameras!!
I got tired of zmc processes dying due to insufficient free memory and messages in zm log stating that the analysis of images were progressively getting further behind. The top command would show free memory near 0 or swap free near 0. The load average would get near 6 or 7 when zmaudit.pl was running (on a 4 cpu PC with 4 cameras). Rather than trying to adjust parms in ZM, based on my past experiences with memory issues on other servers, I created the following file based on my computer that has 64 GB of RAM and then rebooted:
[~]$ cd /etc/sysctl.d
[sysctl.d]$ ls
98-zoneminder.conf 99-sysctl.conf
[sysctl.d]$ cat 98-zoneminder.conf
# 98-zoneminder.conf
# control minimum free KB so cameras have enough memory in buffers
vm.min_free_kbytes=4194304
vm.dirty_background_ratio=5
I have been running with the above file for about a month without issues. You should try adjusting the parms in this file for your installation. vm.min_free_kbytes controls the minimum amount of free RAM. vm.dirty_background_ratio controls the amount of free swap space as a ratio.
Here is an example run of top after making the 98-zoneminder.conf, I hope this helps someone struggling with these issues.
$ top
top - 18:19:10 up 5:07, 2 users, load average: 2.57, 2.49, 2.35
Tasks: 197 total, 1 running, 196 sleeping, 0 stopped, 0 zombie
%Cpu(s): 50.6 us, 0.7 sy, 0.0 ni, 47.7 id, 0.3 wa, 0.4 hi, 0.3 si, 0.0 st
MiB Mem : 31760.7 total, 5498.6 free, 8648.2 used, 17613.9 buff/cache
MiB Swap: 24256.0 total, 23985.7 free, 270.2 used. 8440.8 avail Mem