Up to date RAM requirement calculation.

Discussions related to the 1.36.x series of ZoneMinder
Post Reply
User6677
Posts: 17
Joined: Sat Dec 24, 2022 9:32 am

Up to date RAM requirement calculation.

Post by User6677 »

I've read the part of the faq on memory calculation. And in default settings, no analysis, (mocord setting with no frames stored, pass through storage, 3 buffers). The way I read it, it seems to say one 4K 32bit camera requires

(in bytes)
Resolution times color space
3840*2160*4 = 33.2MB

(times 3 buffers, times 1.2 overhead, times 2 for good measure)
33.2*3*1.2*2 = 240MB

One of my 9 monitors is only 5mp,but let's assume it is 4k too to simplify and it seems I need 2.2GB of RAM (no analysis, just camera pass through, h265 @10fps 1s key frames saving at ~250kB/s and playback).

This is most definitely not the case. My ZM consumes ~19GB of the 32GB total (sql uses around 1GB). It was eating all of it when I had streams at 15fps at 80 key frame interval.

I read somewhere, ZM also caches as many frames in a stream as there are between key frames. Is that true? It seems plausible. If I multiply that ram by 10 frames (as I now set my cameras to output key frames every 10 frames) this shows about 21GB I'm actually seeing.

So if the above is correct I have some way to estimate RAM required for pass through recording and playback.

Then, enters analysis. The wiki says, just multiply it by the nuber of buffers, but what about that keyframe overhead?

Let's say I want to use secondary streams of my cameras (running at only 720p) for motion detect (and more advanced ai detection). Do I have to multiply my ram required by the keyframe interval?

My server has 32gb now, I'm getting 64gb extra. I'd love to be able to predict how much of it I might need. Also, is there any benefit setting secondary streams to h264?
User avatar
Andyrh
Posts: 247
Joined: Sat Oct 28, 2017 3:55 am

Re: Up to date RAM requirement calculation.

Post by Andyrh »

Predicting memory usage is beyond me. What I do not understand is why some systems use huge amounts of RAM and mine does not.
I have 9 cameras, from 2mp to 8mp. I am doing modect on 6 hi-res streams and I am recording 6 low-res streams. 3 cameras (6 streams) have not been deployed and are currently in monitor mode. I have 7GB of RAM available and only 16GB installed.
My frame rates vary but are 5FPS to 10FPS. Keyframes are the lowest setting, which is 1 per second.

I am guessing my DB is of moderate size with 126k events stored.

Code: Select all

free -m
               total        used        free      shared  buff/cache   available
Mem:           15897        7310         319         481        8266        7767
Swap:           4095        1966        2129
If there is a formula that should work, I can test against my varied collection of cameras.
Andy
o||||o

Ubuntu 22.04
ZM 1.36.33
E5-1650-v4 Xeon
16 GB RAM
6 cameras -> 54 FPS modect
User avatar
iconnor
Posts: 2904
Joined: Fri Oct 29, 2010 1:43 am
Location: Toronto
Contact:

Re: Up to date RAM requirement calculation.

Post by iconnor »

We definitely do see some weird behaviours, but it almost always is because something can't keep up and people ignore their logs which are screaming full of warnings and errors.
Post Reply