Raspberry Pi Cluster — “Why To” Guide

This will be more of a “why to” guide and not so much of a “how to”, and certainly not a step-by-step on the setup of an individual pi. A good place to start for setting up and individual pi is the Raspberry Pi sit at: https://www.raspberrypi.org

A single Raspberry Pi v3 has enough compute power to be a decent general purpose Linux box, run a Linux Apache MySQL PHP (LAMP) stack to run a website, or be a streaming media server by running OSMC. But what a single Pi can’t do is all of the above at the same time handling a respectable workload.

Back in the day, techies would run a few Linux boxes in their den  or closet, usually re-purposed desktop PCs that were once very powerful desktop or gaming systems but then became inadequate for those purposes. While you can still do this today, you have to consider the cost of powering a full desktop or gaming PC 24/7. When you consider that, plus the cost of the air conditioning, and the noise, and the physical footprint these antiquated PCs take up, it no longer makes sense to do that.

Also, in the event of an extended power outage — such as what we experienced with Hurricane Sandy — you need your infrastructure to take up as little electrical power as possible. Running your services on low powered Pis versus antiquated desktops, you can run longer on UPS; and if you end up living on generator for weeks, your stack of Pi’s will take up negligible load on your generator.

I should clarify that the word “cluster” in the context of multiple Pi’s doesn’t end up being one big Linux box that runs across the Pi’s. It is simply a handful of Pi’s with services distributed across them.

I run three Pi’s, or now I suppose four as of today, with the workloads split out as follows:

  1. One Pi V3 running OSMC acts as the streaming media server for the living room entertainment center.
  2. One Pi V2 running a LAMP stack, plus wordpress, and is what is serving up this page right now for you.
  3. One RP V2 running RasPBX , which is a distribution that specializes in making your Pi run Asterisk and FreePBX  so you can have a full enterprise level phone system, complete with voicemail, conference bridges, etc.
  4. My newest Pi V3 will be a general purpose box and playpen.

Usually you acquire multiple Pis over time buying one, then another, then another, etc. Over time you end up with a pile of Pis just hanging about and a mess of cables. Or perhaps you bought a case for each one, but you find they don’t stack well and still are a mess that is hard to manage.

To solve that problem, I recommend the Dog Bone case by Geaux Robot, sold at Amazon here: https://www.amazon.com/GeauxRobot-Raspberry-Model-4-layer-Enclosure/dp/B00MYFAAPO

This case will accommodate four (4) Raspberry Pi’s model 2 or 3. They also offer a 2-pi or 3-pi version. This will keep your Pi’s stacked neatly and nicely as a single unit, while providing good airflow for cooling and it looks nice and techy.

Next, you need to consolidate all those power cords. If you bought a power cord for each Pi, then you find that they don’t work nicely with a UPS power strip and take up too many slots. Now, you do need a UPS, but there will be more on that later. If you buy a powered USB hub that can provide 2A of power to each port, then you can plug that USB hub into your UPS, and plug the pi’s into that via UPS cords. The net result is you end up with only one power port on your UPS for the entire stack of Pis.

I used this, which is a power port designed for delivering power, not a USB hub: https://www.amazon.com/gp/product/B0115MVRO4

I condensed my stack of Pi’s onto this power source as well as three NetGear switches, so that all of those devices consume only one port on my UPS.

Why do you need a UPS? Because the Raspberry Pi ‘s SD card can become corrupt if power is cut without a graceful system shutdown. What that means is if you lose power, your Pi may not boot and you have to spend time recovering the image — or starting with a new one and reconfiguring your services.  Plus, your Pi’s will become an integral part of your home infrastructure which you don’t want to lose service if it can be avoided.

Before I move off the topic of power, it is important to point out that stable power is critical. If your power source cannot provide at least 15.A  to each Pi, you run the risk of the Pi locking up, crashing, rebooting, etc. Again, this would run the risk of corrupting the SD card of the Pi, because the reboot would be without a graceful shutdown.

For the network, you really should get a 5 or 6 port gigabit switch. That would be 4 ports for the Pi’s and another that uplinks to your other switches. You can, of course, just plug the Pi’s into an existing switch if you happen to have enough ports available. But segregating the Pi’s onto their own small switch is cleaner because you can strap the dog bone case to the switch and handle and manage as a single unit. Usually you buy, or make your own, very short patch cords.

A word about wireless — avoid it if you can. You can use it of course, but each Pi will lose signal every so often, or you will end up with your wireless net oversaturated. Over the past couple years I have re-worked my home infrastructure to put all infrastructure back on wired Gig-E, as well as networked cameras and desktop PCs and gaming rigs, and the only things consuming wireless are the mobile devices and everyone is happy and fast.

I recommend using the “Raspian Lite” image instead of the default image, which includes the X windows GUI and desktop environment. If you install that, you will play with it long enough to realize it isn’t a viable desktop environment for everyday use, and then you spend time figuring out how to uninstall all that bloat. I recommend to install the lite version and then only install on top of that the services you really want and need.

Typically the only thing I install, other than the packages required for the services planned (Apache Httpd, MySQL, etc.) is webmin in order to  manage and administer the system.

You may have picked up that I do not have firewall services running on any of the Pis. I love pfSense, but as far as I am aware it still is next to impossible to make run on an ARM based Pi. It might be possible these days, but just not something I want to spend time on. I run pfSense on a dedicated Zotac C Series CI323, which is a mini x86 system that is fanless and draws little power.

None of my Pi’s are directly on the public Internet, but I do have firewall rules to pass the traffic that is appropriate to each service on the pfSense firewall.  Therefore I do not talk much about security here, but it is very important to consider. I personally would not put a Pi directly onto the public Internet, but that doesn’t mean it can’t or shouldn’t be done. But if you go that route, be extremely diligent managing and applying patches and hotfixes, strong password, and some form of protection like fail2ban.

PC Gaming Master Class: Tips for Running Assassin’s Creed Unity

Gaming concept.
The release of “Assassin’s Creed Unity” (ACU) on the PC platform has been met with a frustrated user base that finds the performance of the game to be unacceptable. This is very common when a game is released which marks the transition to the next generation in 3D gaming. Having over 20 years experience with PC gaming, hardware, and tweaks & hacks, I’ll offer my advice.

The fundamental problem is that ACU isn’t developed based on 5-10 year old 3D game engine technology, and therefore people who try to run it on hardware that is technology 5 years old find it doesn’t run very well, and in order to run the game with the highest graphics settings today you need high-end hardware.

First and foremost, set realistic expectations. This game is visually stunning and the level of detail and number of objects on the screen are incredibly high. Every one of those objects — from the NPC’s, inanimate objects, to the leaves on the trees are made up of hundreds of thousands of polygons, which your graphics card has to compute based on the viewpoint, and render with the textures, and then apply lighting & showing etc. Your CPU has to feed your GPU the necessary data in order for the GPU to do it’s job — like calculate the movement of the NPC’s, (non-player characters), the leaves blowing in the wind, your character movement, etc. And all this takes RAM as well — both in your graphics card and on your motherboard.

Each scene in ACU has 50-100 NPC’s on screen at any given time, and each of those takes CPU and GPU cycles. Contrast that with, say Grand Theft Auto IV, which has 5-10 NPC’s in view at any given time.

GTA4 is a good example to make a few points. When GTA4 was released circa 2008, it met with similar performance issues upon release, because people with the best systems of that era found for the first time they couldn’t play at max graphics settings. It took a few patches to ring out the issues and many years for the technology of the average PC user increased to the point that the game was no longer such a GPU/CPU hog. The cost of CPU/GPU/Memory required to run GTA4 well in 2008 would have cost $8,000, and over the course of a few years that same compute power is found in $799 department store PCs.

So as frustrated as we are that we can’t set everything to max quality, we have to set the graphics quality to run on what we have today. If it is any consolation, the people that don’t abandon this game now out of frustration can look forward to this game being relevant for the next 10 years. That is about how long it till take before new games start making ACU look like yesterdays 3D gaming technology.

All that being said, let me make some suggestions….

1) Stability & Heat/Power – Make sure your PC is stable to begin with. The fact that you haven’t had issues doesn’t mean much, because you haven’t pushed your CPU/GPU/MB this hard — ever. You may have heat dissipation issues or an underpowered power supply, which has never materialized into issues because nothing has pushed it hard enough.

Download FurMark 3D burin-in/benchmark test, and OpenHardware Monitor. Use Furmark to push your GPU & CPU to max for as long as you typically play (hours) and use OpenHardware Monitor to make sure that your CPU/MB/GPU temps remain stable, and the various voltages remain stable. If you see temps just keep rising, then you have a heat dissipation problem. You will need to look at a better heat sink & fan for the CPU, better ventaled case with plenty of additional fans. If you see voltages are unstable, then you have a power supply issue. Either of these issues are going to make your PC unstable.

2) Video Drivers — It is fairly obvious that NVidia is in a partnership with Ubisoft (and everyone else) and you can bet the development and testing was targeted at NVidia first, and everyone else second. If you have an NVidia card, you are probably going to be better off with this game (and many others). The game is develop0ed against DirectX 10 (IIRC) and should work with any vendor’s card that also conforms to that spec. But in reality, we often find that vendors interpret standards differently, etc.

That being said, even if you are running and NVidia card, you might have some issues. First, you need to be on the latest driver (344.75 IIRC). I am surprised at the number of people on Ubisoft’s forums were running old versions, then upon suggestion to update the driver, they said it helped a lot. Updating your drivers should be something you consider doing anytime a new driver is out — and especially when you are running a new release and having issues.

That being said…. I have found some issues with NVidia’s stack related to stability. I was working on a system that had lockups in 3D games, and found that removing the drivers and re-installing but not installing NVidia Game Experience resolved the issues. When I was troubleshooting this, I found hits on the net that indicated a certain process was known to have memory leaks, and I looked at that process and it was growing in memory consumption. I don’t recall what the process was named specifically, but I think it has to do with NVidia streaming and is part of the Gaming Experience software, so I don’t run that. Yes, I know if I had an NVidia Shield I’d be in a pickle. Run the driver only and see if stability improves, and if you need functionality that Game Experience provides then contact NVidia and put the onus on them to resolve why stability decreased when you install Gaming Experience.

Also, in late October and into early November NVidia released driver updates like every few days. I would venture a guess that was related to this game and issues identified in testing that required driver fixes. So I doubt anything less than 344.75 can be expected to work.

NOTE – It looks like Nvidia released 347.09 on 12/23 which I was not aware of and will test next.

Some people will find that other older games may not work well with anything newer than a legacy version. There isn’t much you can do about that, and the avenue for resolving that issue is with the maker of the other game which doesn’t work on new drivers.

I am sure that those running other video card makes will also benefit from using the latest drivers, and probably also should install the driver only and not the additional crap the vendor includes.

3) Video Card Hardware – I run ACU on a GTX760 based system, and a GTX750 based system. It is doubtful that a good gaming experience can happen with a GTX6xx series video card — even though I am sure the system requirements say that will work.

4) Memory — you need a lot of it and it needs to be top notch. Good experienced system builders know that stability is often impacted by memory chips that should work fine in the motherboard but just don’t. Mixing and matching brands/types should be avoided. If your system came with 8GB of generic memory, and you want to upgrade it to 16MB, for best results you should avoid keeping the existing 8GB and adding another 8GB of another brand, type, or frequency. For best results, run memory that is specifically listed by your system or motherboard maker as being compatible. This memory will typically cost more, but that is the price you pay for the best stability and performance. You can try running other memory or combinations, and you might find success or not.

5) BIOS Firmware – If your system has a newer BIOS firmware than what you are running, you should upgrade. Firmware releases typically address stability issues discovered with certain memory brands/types. If you are running memory not listed as specifically compatible, this might just make your memory work.

6) CPU — Using an Intel CPU typically will result in the best compatibility. AMD makes a fine CPU, but it is not unheard of that issues are related to the CPU. You can count on the majority of development & testing is on Intel CPU, so while using AMD might save a few bucks you pay for possibly being impacted by issues.

That being said, you need a powerful CPU. Yes, the graphics card bears the brunt of the abuse in a 3D game, but the CPU needs to track & manage all the objects and such.

7) System Overclocking – It should go without saying that overclocking is done at one’s own risk. If you are overclocking, and even if you have never had any issues before, go back to default settings and make sure overclocking isn’t your culprit.

8) Graphics Settings — Set them to low and see if your gaming experience and stability improves. Yes, we all want to run on high, but be realistic. You can use FRAPS to see what your frame rate is. Use advanced graphics settings to change one thing at a time, and examine how that improves the visuals and what it does to the frame rate. Pick the combination that gives the best look but keeps FPS at 30. I am currently running with everything set fairly high, but anti-aliasing is set low. For me, this is what kills frame rate — and not just in this game.

Best of luck, happy gaming, and patience!

Tom C