Page 1 of 1

How to calculate RAM

Posted: Tue Apr 05, 2011 3:38 pm
by rokycky
First, sorry for my english, I'm from Poland.
Second, thanks for people who made this software, great job.

My question is, is there any way to calculate how many RAM memory do I need? For example if I know that my system will be 6 IP cams at 640x480 resolution @6fps with motion detection. I know I can run it and try, but better way is to know it before :)
Second question is the same for CPU.

I hope I say it cleary what i need to know, Thanks

Re: How to calculate RAM

Posted: Tue Apr 05, 2011 8:33 pm
by PacoLM
Hi,

Are you talking about RAM or shared memory?. If you need some help in calculate your shared memory, take this script, that is a modified version of the script the user Pada (credits to him), that only calculates the values for shared memory:

Code: Select all

#!/bin/sh
# Copyright (C) 2010 Chris "Pada" Kistner
# Modified by PacoLM to check only shared memory settings
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.

# NOTE: -f you find errors, check that coreutils are installed, if not, run the command below
# apt-get -y install coreutils bc

echo "--- Checking memory setting..."
page_size=$(getconf PAGE_SIZE)
mem_bytes=$(awk '/MemTotal:/ { printf "%0.f",$2 * 1024}' /proc/meminfo)
mb=1048576
mem_bytes_mb=$(expr $mem_bytes / $mb)
shmmax=$(echo "$mem_bytes * 0.90" | bc | cut -f 1 -d '.')
shmmax_mb=$(expr $shmmax / $mb)
shmall=$(expr $mem_bytes / $page_size)
shmmax_cur=$(sysctl -n kernel.shmmax)
shmmax_cur_mb=$(expr $shmmax_cur / $mb)
shmall_cur=$(sysctl -n kernel.shmall)
echo "-- Total memory = $mem_bytes B = $mem_bytes_mb MB"
echo "-- Page size = $page_size B"
echo "-- Current kernel.shmmax = $shmmax_cur B = $shmmax_cur_mb MB"
echo "-- Current kernel.shmall = $shmall_cur pages"
if [ "$shmmax" -eq "$shmmax_cur" ] && [ "$shmall" -eq "$shmall_cur" ]; then
   echo "-- Recommended shm values already set"
else
   echo "-- Recommended: kernel.shmmax = $shmmax B = $shmmax_mb MB"
   echo "-- Recommended: kernel.shmmall = $shmall pages"
fi
# Done
echo "--- Done."
Hope it helps,

PacoLM

Re: How to calculate RAM

Posted: Wed Apr 06, 2011 5:28 pm
by rokycky
Thanks for answer,
I read about shared memory calculating before, but I mean hardware RAM size and CPU freq.
Right now I'm testing ZM on some older machine with one 640x480 cheap cam and it works fine, but hardware specification is low and CPU is overload sometimes, specialy on motion detect.
The target for me is to make good platform for home ZM server with maybe 6 or 7 1,3Mpix cams and I want to know how to calculate the size and freq of parts I ask.
I dont how to say it better way :)