Shared Memory Question

Support and queries relating to all previous versions of ZoneMinder
Locked
seabro
Posts: 24
Joined: Fri Jan 28, 2005 11:00 pm
Location: Cardiff, Wales. UK

Shared Memory Question

Post by seabro »

Hi,

I can't grasp this shared memory thing. :(

I currently have 512Mb RAM - and the following.

[root@localhost ~]cat /proc/sys/kernel/shmall
2097152

[root@localhost ~]# cat /proc/sys/kernel/shmmax
33554432

Is it easy for you gurus to tell me what is the max I can increase my shared memory to without killing my Asterisk server (running on same box)

or doesn't it work like that?
jameswilson
Posts: 5111
Joined: Wed Jun 08, 2005 8:07 pm
Location: Midlands UK

Post by jameswilson »

how much do you need, ie number of cams, ring buffer size etc
James Wilson

Disclaimer: The above is pure theory and may work on a good day with the wind behind it. etc etc.
http://www.securitywarehouse.co.uk
seabro
Posts: 24
Joined: Fri Jan 28, 2005 11:00 pm
Location: Cardiff, Wales. UK

Post by seabro »

Hi James,

I currently have one cam, running 320x240 but I have another on order.

I would like to run 640x480 if that was possible...

As for buffers, I don't really know. I am running at 3fps normal and 6fps in alarm on MoDect.

Currently, 'Image Buffer Size (frames)' is set to 40 and both 'Pre Event Image Buffer' and 'Post Event Image Buffer' are set to 10

I have been thinking of upgrading to 1Gb, will that change matters? I notice that prior to installing ZM my swap was always 0K but these days there is a small value showing for swap. (Currently 8K).

Thanks for your help!
jameswilson
Posts: 5111
Joined: Wed Jun 08, 2005 8:07 pm
Location: Midlands UK

Post by jameswilson »

have yu followed the guide and the numbers in the faq?
James Wilson

Disclaimer: The above is pure theory and may work on a good day with the wind behind it. etc etc.
http://www.securitywarehouse.co.uk
seabro
Posts: 24
Joined: Fri Jan 28, 2005 11:00 pm
Location: Cardiff, Wales. UK

Post by seabro »

Hi James,

I have had a read but I don't quite understand how shmall and shmax relate to each other, the applicantion(s) and the physical RAM / SWAP space etc, which one I should increase and how high I can increase it based on the physical memory in the system and if / how it will affect other applications running on my system.

And so on.

Any assistance appreciated.
User avatar
ammaross
Posts: 61
Joined: Mon Mar 12, 2007 8:34 pm
Location: Utah, USA

Post by ammaross »

I have a document that I use to store personal notes about ZM (such as patches I applied/wrote, configurations, etc), and I think my section on shared memory may help you.
If you will be using a large number of cameras, or large resolutions (such as multiple 640x480s), you will need to add these two lines to the end of /etc/sysctl.conf:

Code: Select all

kernel.shmall = 32768 
kernel.shmmax = 134217728
Then enter these lines at the command prompt:

Code: Select all

echo 32768 >/proc/sys/kernel/shmall 
echo 134217728 >/proc/sys/kernel/shmmax
*** These figures are based on a 128MB of RAM system. In a system with 1GB of RAM, shmmax should be at least 524288000 (512MB [500*1024*1024]) and shmall should be 128000 (524288000 / 4096).

The procedure is explained here:
http://www.zoneminder.com/index.php?id= ... faq_faq=10
And here:
http://www.zoneminder.com/forums/viewtopic.php?t=9692
Be sure to restart ZM afterward.
So you can see, shmall is the number of 4K blocks you want, which is why I have the / 4096 in the calc. Hope this helps.
Locked