High Swap Memory Use

Discussions related to the 1.36.x series of ZoneMinder
Post Reply
Pembrae
Posts: 14
Joined: Tue Feb 23, 2021 4:05 pm

High Swap Memory Use

Post by Pembrae »

Please can anyone help and advise why my ZoneMinder installation increases its use of swap memory over time making the server and the application slow. I have summarised my installation details below.

version 1.36.13
Installed memory 4GB
3 cameras
5 Monitors in total
3 monitors at 640 x 480 1 zone
1 monitor at 1920 x 1080 1 zone
1 monitor at 1920 x 1080 6 zones
No other programmes running on server other than ZoneMinder

I used the information at the following link to check how much memory I need which worked out at less than 0.1GB which suggests I have ample memory or my calculation is wrong,
https://zoneminder.readthedocs.io/en/1. ... 0all%20set.

When I start ZoneMinder physical memory use increases from 0.51 to 1.74G of the 3.7GB available and swap memory use doesn't change at 670M of 3.71GB available. Over time the Swap memory usage increases and I have seen it as high as 2.74GB. (This does suggest the above calculation is wrong since when I start ZoneMinder is is clearly using the maximum 50% allocation).
Any help would be appreciated.
Maximo1970
Posts: 97
Joined: Sun May 28, 2017 4:29 pm

Re: High Swap Memory Use

Post by Maximo1970 »

I have 3 cameras on one of my servers and found I needed at least 16Gb RAM to cope, swap space is still used but not a massive amount and performance is quite consistent.

There are far too many factors in play to give a definitive RAM requirement, you have to take into account things like location, activity, FPS, Etc. I would suggest you increase the RAM to find that sweet spot.
Magic919
Posts: 1381
Joined: Wed Sep 18, 2013 6:56 am

Re: High Swap Memory Use

Post by Magic919 »

If it's using swap, then it's out of available RAM.

I don't save JPEGs, keep keyframe interval to about a second and don't do any DB logging. Seems those help mine.
-
bbunge
Posts: 2934
Joined: Mon Mar 26, 2012 11:40 am
Location: Pennsylvania

Re: High Swap Memory Use

Post by bbunge »

Pembrae wrote: Thu Apr 07, 2022 1:13 pm Please can anyone help and advise why my ZoneMinder installation increases its use of swap memory over time making the server and the application slow. I have summarised my installation details below.

version 1.36.13
Installed memory 4GB
3 cameras
5 Monitors in total
3 monitors at 640 x 480 1 zone
1 monitor at 1920 x 1080 1 zone
1 monitor at 1920 x 1080 6 zones
No other programmes running on server other than ZoneMinder

I used the information at the following link to check how much memory I need which worked out at less than 0.1GB which suggests I have ample memory or my calculation is wrong,
https://zoneminder.readthedocs.io/en/1. ... 0all%20set.

When I start ZoneMinder physical memory use increases from 0.51 to 1.74G of the 3.7GB available and swap memory use doesn't change at 670M of 3.71GB available. Over time the Swap memory usage increases and I have seen it as high as 2.74GB. (This does suggest the above calculation is wrong since when I start ZoneMinder is is clearly using the maximum 50% allocation).
Any help would be appreciated.
Interesting. I have a setup almost the same as yours except my server has 8 GB RAM. I am running three cams with 5 monitors. Two monitors are low res no recording feeding a web site. The other three are at the same resolution at 10 FPS. I use passthrough recording. Debian 11 with Webmin shows 27% RAM used and 25% swap used. I use Mariadb and have used mysqltuner to adjust the database parameters. I use an SSD for main drive and another M.2 SSD for storage. I keep two weeks of events.

It is likely the memory use is coming from the database. One setting to check is innodb_buffer_pool_size. If your server has been running for a while the ZM database may need maintenance to clear out some bloat which can increase RAM use. Newer versions of Zoneminder are much kinder to RAM use.
Post Reply