RavenDB can run on the Raspberry Pi, it is actually an important use case for us when our users are deploying RavenDB as part of Internet of Things systems. We wanted to showcase RavenDB’s performance and decided that instead of scaling up and showing you how well RavenDB does ridiculous loads, we’ll go the other way around. We’ll go small, and let you directly experience how efficient RavenDB is.
You can look at the demo unit directly on this page.
Just throwing RavenDB on a Raspberry Pi isn’t an actual challenge, however. Most Raspberry Pis are actually amazing machines for their cost, more than powerful enough to power real applications. What we decided to do is to dial it down yet further, and run RavenDB on the Raspberry Pi Zero. That is a computer the size of a cigarette lighter, to give some context. Or, if I’m dating myself by this image, it can comfortably fit on your keychain.
Here is what this actually looks like, with me as a reference for size 🙂.
Just installing RavenDB on the Zero isn’t really that interesting, to be honest. We wanted to do something that would be both fun and useful. One of the features we want users to explore is the ability to run RavenDB in appliance mode. The question is, what sort of an appliance will we build?
A key part of our thinking was that we wanted to show something that works with realistic data sizes. We wanted to have an actual use case for this, beyond just showing a toy. One of the things that I always find maddening about being disconnected is that I feel like half my brain has been cut away.
We set out to fix that, the project is to create a knowledge system inside the Pi Zero that would be truly Plug & Play. That turns out to be quite a challenge, but I think we met it in a very nice manner.
We went to archive.org and got some of the Stack Exchange data sets. In particular, we got the datasets that are most interesting for devops scenarios. In particular, we have raspberrypi.stackexchange.com, unix.stackexchange.com, serverfault.com and superuser.com.
I find it deliciously recursive that we can use the Raspberry Pi Zero to store the dataset about the Raspberry Pi itself. We loaded all those datasets into the Zero, for a total of about 7.5 GB and over 4.2 million documents stored there.
Note that this is using RavenDB’s document compression, which reduced the total size by over 50% over the original dataset size.
Next was the time to actually make this accessible. Just working with RavenDB directly to query the data is cool, for sure, but we wanted to be useful.
So we build a portal to access the data, here is what this looks like when you enter it for the first time:
We offer full search capabilities and complete offline access to all those data sets. Perfect when you are stuck in the middle of nowhere and urgently need to remember that awk syntax or how to configure networking on a stubborn device.
Another aspect that we have to consider is how this can work? The Raspberry Pi Zero is a tiny device, and actually working with can be annoying. It needs Micro-USB power, but has no ethernet or standard USB ports, for display, it uses a mini HDMI port. That means that you can safely assume that you’re likely to have a power cable for it, but not much else.
We want to provide a good solution, what do we do? The Raspberry Pi Zero we use does have a wifi chip, so we took things further and set it up as an access point with a captive portal.
You can read exactly how we configured that in this post.
In other words, the expected deployment model is to plug this into power, wait 30 seconds for the machine to boot and then connect to the “Hugin” wireless network and you’ll land directly into the application, able to deep dive into the questions of your choice.
We have been giving away those appliances in the DevWeek conference, and we got a really good reaction from users. Beyond the coolness factor, the fact that we can run a high performance system on top of a… challenging hardware platform (512MB RAM, 1Ghz RAM, SD Card for disk) and still give you sub 100ms response times is quite amazing.