Page 1 of 1

Priorities ram? Cores? GPU?

Posted: Fri Oct 26, 2018 7:39 am
by racelife
Starting to look at putting together a system for 6 4mp cameras what should be my priorities? CPU cores Ram or GPU?

Re: Priorities ram? Cores? GPU?

Posted: Fri Nov 02, 2018 5:58 am
by jwarfin
This is just from my experience and knowledge. I'm sure others have different notions on priorities and details. So take what I say here with a few grains of salt.

First priority is motherboard. ZM is IO intensive for ram, disk and network. Much of this IO relies on the PCIe bus(es). If you're doing a pro setup for a business you're probably used to using actual server motherboards and you probably already know what works for you. Otherwise, you're looking to use a consumer/prosumer grade motherboard. In this case, look at quality gaming oriented motherboards - because they're designed for the high IO demands of gaming and this works well for ZM too.

Next priority is actually two things: CPU *AND* memory - the two have inter-dependencies when it comes to performance. Modern CPUs & motherboards usually have very specific compatibility requirements when it comes to memory. If you mis-match you can cripple performance.

A good multi-core multi-thread CPU is a good choice for ZM. 4 cores (with two threads per core) running at 3GHz base clock rate would be worth considering. Naturally, more cores is better, as is higher clock rate. Lots of good prices now on 6 and 8 core CPUs.

8GB of memory is probably fine for a standalone ZM server. Memory should be compatible with the CPU and be reasonably fast. Many CPUs often require DDR4 memory now. Choose memory that's as fast as you can afford AND is compatible with your motherboard/CPU combo. Don't skimp on memory speed and quality, you'll probably regret it later. In any case, when you get memory, take advantage of the multi-channel memory capability of the motherboard. For example: if you need 8GB of memory, get two 4GB sticks. The motherboard manual explains the multi-channel memory features and how to use them.

Memory speed selection can be a tough call, since there's so many variables to consider. Gaming motherboards usually support relatively super fast memory options - but the BIOS is really overclocking the ram to get that speed. This means more heat and higher risk of ram problems. I stick to a pretty simple "rule": if the ram is gaming ram that supports super high speeds, I'll configure it to run at the one of the next two lower speeds. For example, I run my ram on a Ryzen system at 2666ghz - even though I could tweak the BIOS to run it at the ram's max of 3200 (overclocked). The 2666ghz is still quite fast. Basically, on the motherboard, 2666ghz is the fastest non-overclocked ram speed. I just don't like running overclocked ram on servers.

You want reasonably fast disks. I always use mechanical drives. ZM does very frequent disk IO for events and database. Not exactly a good match for SSDs... in my opinion.

Network is the next priority. Most gaming motherboards have reasonable network capability. Adding a quality network PCIe network card is also an option.

Don't scrimp on power supply quality. You probably won't need more than a 500 watt supply - unless you're adding a powerful GPU or other stuff.

Last is GPU. Not a priority unless you plan to somehow use the GPU to offload stream decoding/encoding. I've implemented GPU offload for automatically generating videos of alarm events and replicating them to remote storage. For that, all I needed was a fanless Nvidia GT 730. For more complete GPU offload built-in to newer/future versions of ZM, you might need a GPU with more bandwidth - like an Nvidia 1060 (the 1050 might be too limited).

One last important thing: power envelope. If you want economy, you'll be looking for the balance between performance and CPU/GPU TDP.

Using my Ryzen setup as an example, I specifically chose the Ryzen 5 2600 because of its 65 watt TDP and the Nvidia GT 730 GPU because of its 23 watt TDP. Ram is G-Skill 3200ghz (running at 2666) and a quality 500 watt power supply. Motherboard is MSI X470 Gaming Pro Carbon.

Wow. I wrote way more than I originally intended!

Re: Priorities ram? Cores? GPU?

Posted: Fri Nov 02, 2018 6:56 am
by racelife
Wow thanks for the comprehensive reply! I've been doing some research on the ryzen. What kind of camera setup do you have attached to that system?

Re: Priorities ram? Cores? GPU?

Posted: Fri Nov 02, 2018 8:03 am
by jwarfin
racelife wrote: Fri Nov 02, 2018 6:56 am Wow thanks for the comprehensive reply! I've been doing some research on the ryzen. What kind of camera setup do you have attached to that system?
Currently, 6 1.3MP Trendnet/Hikvision IP cams and an analog BTTV capture card for 3 720x480 B&W analog cams. I'll eventually add 3 more IP cams and maybe one more analog to bring the setup to 13 cams total. IP cams are set at 1280x720. All cams set at 6fps. The analog cams are tiny Sony SuperHAD "lipstick" cams. I use them to fill-in a few small gaps in coverage.

With the current 9 cams (all modect, 1 or 2 zones per cam) the system hovers at a load of around 0.08 to 0.16 when there's no active events.

Multiple simultaneous events across multiple cams will bring the load up to around 0.3. to 0.4.

My auto event video generation & replication code runs via cron every minute. The system is busiest when that code is running and new events are also being handled by ZM, with the load varying from around 0.4 to 0.8 or so. Just depends how many videos are being encoded and replicated to remote storage at the time. If my code didn't use GPU offload to encode the videos (ffmpeg with the h264_nvenc option) load would be crazy high, like 18.0 to 40.0.

I chose an X470 motherboard because - at the time - the Ubuntu 18.04 kernel was rock stable with the X470 chipset. I'd seen a number of problems with the early x370 motherboards on 18.04. I believe most/all x370 problems have been resolved now via BIOS updates and updated kernels. But I have to tell you, some of the early x370 motherboards were terrible. Glad I waited for X470 to start shipping.


Note that I do run the system with the Spectre kernel mitigations turned off to avoid the performance hit. In my case my ZM server is in a isolated private network, so I could afford to take on the added risk. I'm not advocating turning off Spectre mitigations. Just wanted to be up front on my setup and why the load values are what they are.

Re: Priorities ram? Cores? GPU?

Posted: Mon Nov 26, 2018 11:03 am
by konctl
Thanks for all the useful tips jwarfin! Would you mind sharing which hikvision 1.3MP cameras do you use? I am looking for some relatively cheep hikvision bullet cameras to start with.

Re: Priorities ram? Cores? GPU?

Posted: Tue Nov 27, 2018 12:38 am
by jwarfin
Cams are Trendnet TV-IP320PI. These are apparently a re-branded Hikvision DS-2CD2012-I. Look the same & same specs. Supposedly I could install Hikvision's firmware but I'm just sticking with Trendnet's latest firmware (which is fairly recent).

I found mine on Amazon. Trendnet also sells these as a two pack. Back when I bought them, pricing was attractive: $89.99 USD for two pack or $49.99 USD each. Now, pricing is erratic. I've seen two packs listed for well over $200 USD, but single cams still as low as $49.99 USD. At $89.99 USD for a two pack, the cameras are a good value. If they were a lot more expensive I'd likely pass on them as there would be better cams at the higher price point.

Performance and quality of the cams is good. No serious issues to report in that regard. BUT there is one significant limitation: the software to setup the cams only runs on Windows. But once setup they work just fine with a Linux based ZM server.

Other IP cam makes that have worked well for me with ZM are Geovision and Axis cams.

Re: Priorities ram? Cores? GPU?

Posted: Thu Nov 29, 2018 6:33 pm
by dmikester1
Jwarfin,
You said you prefer HDD to SSD because of all the IO that ZM does. Couldn't you install the OS and apps on a fast SSD and configure ZM to use a separate HDD for all its IO?

Re: Priorities ram? Cores? GPU?

Posted: Thu Nov 29, 2018 10:58 pm
by jwarfin
Sure.

But logfile and database IO is substantial on a ZM server monitoring lots of cams, which usually means - for an ssd based root fs - having /var mounted on a mechanical drive too. That is, if you want to greatly reduce numerous small writes to the ssd. That added complexity to run an ssd root fs isn't worth it to me personally. I know I can operate a ZM implementation for several years (4-8 years, in my case) on the same mechanical drive(s). I think I've had only one disk failure on a ZM server over the last 8 years - and that was a gradual cumulative failure that was easy to deal with. So I had time to get a replacement drive and perform the drive replacement without a lot of drama or undue impact to schedules.

I have used ssd storage for other server stuff, which (in general) has given me more mixed results than mechanical drives. In my cases of ssd failure, the ssds mostly failed catastrophically with little or no warning. That's unlike the typical failure I'd see with mechanical drives (eg: SMART starts showing a few sector or other errors which become more numerous over time).

All the above said, there's nothing wrong with running ZM on ssd. The performance benefit could be substantial over hdd. My only suggestion on this is if you go with an ssd root fs, do regular backups (at least weekly) of the system - which I advise whether ssd or hdd.