high ram usage

Discussions related to the 1.36.x series of ZoneMinder
Post Reply
leksand
Posts: 48
Joined: Thu May 26, 2022 12:03 pm

high ram usage

Post by leksand »

Help to deal with very high memory consumption.
Initially, at startup, the consumption is normal, but then it grows until it eats up all the free memory. Now there are 20 GB for 6! cameras and there are not enough of them.

This is a virtual machine, the record goes to the network storage. I tried to play with the buffer settings, I tried to include camera passthrough instead of frames.

The details are in the screenshots, consumption is just growing and that's it...

Image
Image
Image
Image
Image
Image
Image
Image
leksand
Posts: 48
Joined: Thu May 26, 2022 12:03 pm

Re: high ram usage

Post by leksand »

A little time has passed and all the RAM has been eaten

Image
leksand
Posts: 48
Joined: Thu May 26, 2022 12:03 pm

Re: high ram usage

Post by leksand »

Image
leksand
Posts: 48
Joined: Thu May 26, 2022 12:03 pm

Re: high ram usage

Post by leksand »

changed the monitor settings in storage to camera passthrough. Memory consumption has decreased, but so far 12 GB for 6 cameras! and perhaps it will grow even more

Image
Image
leksand
Posts: 48
Joined: Thu May 26, 2022 12:03 pm

Re: high ram usage

Post by leksand »

All available memory has been eaten up again. And this is for 6 cameras!

Image
Magic919
Posts: 1381
Joined: Wed Sep 18, 2013 6:56 am

Re: high ram usage

Post by Magic919 »

You'll need to have a search and formulate a plan.

Here's what I do - I wouldn't run mine on a VM. I have a machine with a decent number of cores and speeds plus 64GB RAM for 4 cams. I tuned the DB and run it on solid state drive. I reduced analysis FPS. I turned off storing JPEGs. I use local storage. I mostly run with ZM's DB logging off (but it might be ok now I'm on NVME). I have a cron job restarting ZM each night.
-
leksand
Posts: 48
Joined: Thu May 26, 2022 12:03 pm

Re: high ram usage

Post by leksand »

this is too much RAM for nvr and most importantly, there is some kind of incomprehensible increase in memory consumption until all available is eaten up.

please help me figure out what can help - settings or something wrong with zm
User avatar
Andyrh
Posts: 281
Joined: Sat Oct 28, 2017 3:55 am

Re: high ram usage

Post by Andyrh »

I run 6 cameras all modect on 16GB RAM and only restart every few months of OS patching. See signature.
Post a camera configs, maybe it is something there. Also if you could put the pictures in-line, the previous pictures you posted I can not see for some reason.

My system:
up 46 days, 9:36, 1 user, load average: 3.27, 3.99, 4.24
free -m
total used free shared buff/cache available
Mem: 15897 7690 868 384 7338 7485
Swap: 4095 753 3342
Andy
o||||o

Ubuntu 22.04
ZM 1.36.33
E5-1650-v4 Xeon
16 GB RAM
6 cameras -> 54 FPS modect
leksand
Posts: 48
Joined: Thu May 26, 2022 12:03 pm

Re: high ram usage

Post by leksand »

Andyrh wrote: Tue Sep 12, 2023 7:30 pm Post a camera configs, maybe it is something there. Also if you could put the pictures in-line, the previous pictures you posted I can not see for some reason
model Hikvision DS-2CD2122FWD-IS
there are 5 such cameras, the settings are identical and 1 analog - there is a stream from the nvr to which it is connected
Image
User avatar
iconnor
Posts: 3197
Joined: Fri Oct 29, 2010 1:43 am
Location: Toronto
Contact:

Re: high ram usage

Post by iconnor »

iframe interval is 50, which is normal for hikvision. So we need to buffer something like 101 frames (depending on pre-event count).

1920x1080x4x101 = 798Mb... but then there are analysis images, raw decoded frame, etc... we quickly get to 1.5Gb per camera.
jrtaylor71
Posts: 16
Joined: Mon Oct 10, 2022 3:15 pm

Re: high ram usage

Post by jrtaylor71 »

Have a look at this, it might help. I run 16 camera's all running motion detection and recording.

https://wiki.zoneminder.com/MySQL

This is modifications to the mysql config.
max_connections = 2000
query_cache_type = 0
tmp_table_size = 32M
max_heap_table_size = 32M
performance_schema = ON
innodb_log_file_size = 64M
innodb_file_per_table = ON
innodb_buffer_pool_size = 512M
leksand
Posts: 48
Joined: Thu May 26, 2022 12:03 pm

Re: high ram usage

Post by leksand »

iconnor wrote: Thu Sep 14, 2023 2:44 pm iframe interval is 50, which is normal for hikvision. So we need to buffer something like 101 frames (depending on pre-event count).

1920x1080x4x101 = 798Mb... but then there are analysis images, raw decoded frame, etc... we quickly get to 1.5Gb per camera.
Make the maximum size of the image buffer (frames) equal to 101?

I have 20 GB of RAM allocated for 6 cameras and the regular error oom = memory leak.

changed the maximum size of the image buffer (frames) on 101 - everything is the same: memory consumption grows to an oom error
fontiano
Posts: 68
Joined: Wed Dec 25, 2019 10:29 am

Re: high ram usage

Post by fontiano »

I had a similar problem when I used a single SSD disk for the database and recordings

I solved the problem by adding a mechanical disk dedicated to event recording and using the SSD disk for the DB

Don't ask me why but the problem is reproducible
Production: zm 1.34.26 - Debian 11 | Test: zm 1.36.33 - Debian 12
Post Reply