More and more I've been thinking about changing the way I interact with the information that's most important to my daily life. I've started to look for ways – just as one example – to get notifications when the shit is getting very close to the fan so that I can do something about it when it finally hits it. One of the most stressful examples if Phonemica. As it goes, we're running a couple hundred simultaneous users when there's absolutely no recent press coverage. But then all it takes is one semi-big article, or even not so big blog post, and now we're up to 500 simultaneous users and whatever the last upgrade I made a couple months back was, it's now starting to fall apart at the seams. Running a site in China isn't low volume by any means. It might be quiet most of the time, but when it gets loud, it can be deafening.
After the most recent spike, I decided it was time to do something about it. Not that the site itself can't really handle the traffit, but I still like to be informed so that if there's some sort of traffic control that might be useful, I have the option to jump on in and do it. We are on the cheapest hosting possible, after all, so sometimes that's required. So to combat this sort of thing, I threw together this:
using an Arduino board, in this case an Intel Galileo Rev 2, I put together a quick sketch that gets the number of current users from Google Analytics and displays it on a 16x2 LCD screen. I've since moved it off the Galileo and on to a Leonardo with ethernet access, but the purpose is the same: I have a constantly available up-to-date display of how many users are on the site at a given moment.
It also keeps a log of traffic over the past 30 minutes (or hour) which can also be displayed so that if I want to see what the current trend is. If it's at 400 and the numbers are steadily going up, I might want to make sure the server is doing okay. Again, shared hosting on the cheap.
Unfortunately there's a wiring issue with this particular display, and everyone in town that sells 16x2 displays sells this exact model, so I've actually wired up an alternative way to get the information so I don't burn out the board. Instead of the LCD it has the option to show the numbers as colour-coded LCDs, with additional audio alerts. This has the benefit of using less power too, so it's something I can throw on a Yún that I can toss on a shelf somewhere.
I actually bought the Galileo for the Intel chip specifically to do a bit of automation on the site, coding a sort of maintenence spider that could get rid of unnecessary files and create them when they're needed (such as cases where we might have ogg and mp3 but no wav files for a given entry). That's still on the to-do list, but will have to wait a couple weeks until I can find a little more free time.