Page 1 of 1
Large IP camera setup
Posted: Wed Mar 21, 2012 7:54 am
by redxiii
I've got a system setup with 9 cameras so far running pretty smoothly, but it needs to be expanded and so the Zoneminder box may need upgrades or a new build altogether.
The rules governing the industry the setup is deployed in requires no less than 640x480 resolution. I got a good deal on some Axis 225 cameras so i've continued to use those as we expanded the system up to 9 cameras. The frame rates for the cameras are between 3-5. They are all set to modect. Zoneminder server has an AMD Phenom II X4 925 quad-core processor and 8G of ram. RAM doesn't seem to be an issue:
Code: Select all
$ free
total used free shared buffers cached
Mem: 8193764 7827032 366732 0 1159792 3724112
-/+ buffers/cache: 2943128 5250636
Swap: 3903480 176 3903304
At night time, when the motion detection is working hardest, system load hovers around 4. During the day the load is close to that too since we have 3 clients viewing a Montage and lots of motion.
So it seem to me CPU is limiting factor. But perhaps there are settings in ZM that can lower the load? I know i can reduce framerate; there's no law dictating that, so it'll be up to us how low we can tolerate. Anything else i can change to reduce load?
Suppose we may want to expand this to 15 cams relatively soon and perhaps 20 cams in the future. I notice there is a 6-core Phenom II processor available. Maybe it is worthwhile to spend 200 bucks and use that as a stepping stone? Or do i need to start planning a whole new server platform with an 8- or 16-core CPU?
Re: Large IP camera setup
Posted: Thu Mar 22, 2012 12:50 am
by vraa
What version of Zoneminder?
Are you using mastertheknife's performance patches?
Are you using libjpeg turbo?
Depending on motherboard and bios, doing a drop in upgrade to 6 core cpu is relatively easy
Re: Large IP camera setup
Posted: Thu Mar 22, 2012 6:06 am
by redxiii
vraa wrote:What version of Zoneminder?
it's ZM 1.24.2
Are you using mastertheknife's performance patches?
o.o what're those?
Are you using libjpeg turbo?
yeah, v 1.1.1
Depending on motherboard and bios, doing a drop in upgrade to 6 core cpu is relatively easy
so do you suppose i could expand to probably ~15 cams without changing anything else, since 6 cores would be 50% more?
Although, it seems like such a system should be able to handle much more....
Re: Large IP camera setup
Posted: Thu Mar 22, 2012 6:42 am
by Flasheart
I have 31 ip cameras on one single-cpu quad-core xeon (a ml115). About half are modect, the rest record. Load hovers around 2. Interestingly, my load is halved at night, unlike yours, but the cams are generally in unlit areas and just have black screens.
There is a lot of tuning you can do to reduce load.
Reduce fps even further, but you may feel that is too much of a compromise.
Install the turbo-jpg libs as documented elsewhere in this forum. (Ubuntu may have them pre-installed now)
Reduce the image size. Axis can be done easily by url. Not often a very good solution.
Change from colour to B&W. As you have axis, this is as simple as adding &color=0 to the url and will reduce the image size and processing requirements by over half, without making a large impact on the usefulness.
Reduce the zone size so less processed, only the relevant areas.
Move the bloody clients off montage! Why have your clients go through zm for viewing? That's adding a significant load to your server and is unneccessary. Write some quick html that loads the streams, give them firefox or chrome and watch your loads come down. A quick guide here;
http://www.zoneminder.com/wiki/index.php/IpCamMontage
Re: Large IP camera setup
Posted: Thu Mar 22, 2012 7:50 pm
by redxiii
Flasheart wrote:I have 31 ip cameras on one single-cpu quad-core xeon (a ml115). About half are modect, the rest record. Load hovers around 2. Interestingly, my load is halved at night, unlike yours, but the cams are generally in unlit areas and just have black screens.
what is the resolution and other settings for your cameras, though? i thought the load goes up during low-light because it is harder to process the motion detection... the cameras iris changes and makes the image grainy in low-light conditions.
i'll look into reducing FPS, not sure how low we can go but might be able to get away with 1-2
i've got the turbojpeg libs installed.
what do you mean by reducing image size? for resolution, we can't go lower than 640x480...
will also look into B&W.
just about all of my cams have one large zone for motion detection, but i can look into reducing those some...
Yeah this might make the most significant improvement. i'm not very good at coding but seems simple enough. although all of the cameras have password-protected view-only accounts, which i guess will have to be specified in plain text in the html code? so something like this for each cam:
Code: Select all
<img src = "http://viewer:password@10.0.0.102/axis-cgi/mjpg/video.cgi?resolution=320x240" width="240" height="180" >
? is this going to show a stream or a still image? or do i need to add a refresh every 0.2 second somewhere in the code to keep up with the stream?
since they are view-only accounts, maybe there isn't much risk in exposing those passwords??
Re: Large IP camera setup
Posted: Fri Mar 23, 2012 6:42 am
by Flasheart
Good point about the iris. I only have a couple of cams (both Axis) with Irises. That said, I do have a few with IR output for monitoring horses and they don't cause that much pixellation or noise. I guess it comes down to the individual camera and nothing you can do about it.
Reducing image size: You can specify much lower resolutions on the url with the axis, but of course you may find that the image becomes significantly less useful! The axis web interface has a useful tool for building these urls by the way, under html something.
Montage; I've never tried it with user/pass combinations, but quite lkely what you suggest would work. And yes, it would mean exposing the passwords in the html. If that is a serious concern, a second zm server with identical camera setups with "monitor" only would remove the load on your main server and still allow users to securely view streams.
You don't need a refresh if you go to the mjpeg feed since that will push as fast as it can. Someone else suggested using static jpgs and forcing a reload every second or two, but I've not experimented with that yet.
Re: Large IP camera setup
Posted: Fri Mar 23, 2012 9:08 am
by mastertheknife
Hi redxiii,
You are welcome to take a look at my project, which focuses on increasing performance, especially of motion detection:
http://www.zoneminder.com/forums/viewto ... =9&t=17652
mastertheknife
Re: Large IP camera setup
Posted: Sun Apr 01, 2012 3:42 am
by redxiii
Simply removing the 3-4 montage viewers and using a simple html page using direct connections to the cams, as suggested, has helped tremendously. Load was reduced by 40-50%! I've got this thread saved and will be sure to check it in the future so i can take in to account all the other tuning that could be done. Thanks, all, so much for your help.
Re: Large IP camera setup
Posted: Sun Apr 01, 2012 7:33 am
by Flasheart
Thanks for the feedback, and great to hear you've resolved your issue.
Re: Large IP camera setup
Posted: Tue May 22, 2012 3:01 pm
by barnabas1969
Hi folks. I'm new here, and I'm planning a pretty similar setup to the OP. I read mastertheknife's thread... and I thought that the ZM dev had already included his performance patches. Is that not correct?
I just installed Ubuntu 11.10 (I chose this version per the advice of a friend) on a PC yesterday and hope to begin installing ZM tonight. I'm a newbie to both ZM and Linux. Any help/advice is appreciated.