Low Power Computing with Raspberry Pi
It's no secret that I love the Raspberry Pi.
Earlier this year I wrote about using osm2pgsql
on a Raspberry Pi
to load OpenStreetMap data to PostgreSQL. Less than a year ago I released
the PiWS, an open source weather station based around
the Raspberry Pi. In fact, my first test PiWS was setup almost exactly one year ago
on a single-core, 512 MB RAM
Raspberry Pi Zero W
and it is still running today.
Since publishing this post, I have also tested PostgreSQL performance on the Pi. Parts One and Two.
Anyway, the point of this post is to explain why I think the Pi is so awesome, why I continue to chose it over other competing hardware available today, and why I think the challenge of developing for low-power devices is so valuable.
If I were Twelve today...
If I were twelve years old today (or even a few years ago), I would definitely have at least one Raspberry Pi. The great thing about the Pi, is even given the same small allowance I received more than two decades ago, I could still save up for a full Pi-based system in a few months. When I got the Sense Hat in 2017 I sure felt like I was twelve again, programming the display with a red heart for my wife made me giddy!
Raspberry Pi Foundation
Part of why I like the Pi so much is because of the culture and strategy of the Raspberry Pi Foundation. A few points from their 2018 - 2020 strategy document that resonate with me are:
- We believe that the best way to learn computing is through making something that you care about and sharing it with others. We call that digital making, and we think everyone should have the opportunity to do it.
- To make computing and digital making accessible to all through providing low-cost, high-performance single board computers and free software.
- To provide engaging, rigorous, and free educational resources that are used by millions of people to learn computing and digital making skills.
- To mobilise and support a huge community of educators, volunteers, and parents who want to help young people learn computing and digital making skills.
- We’re passionate about making computing relevant and accessible to young people from all backgrounds.
I started the RustProof Labs blog in 2013 because I had a great appreciation for the amount of learning I had been able to accomplish, mostly through free resources. The continued focus on remaining affordable and promoting the education of technology is a winning strategy!
Databases and education
News flash: relational databases aren't going anywhere! Postgres continues to grow in popularity, and it runs perfectly well on a Pi! Add in PostGIS and load in some OpenStreetMap data and you have a functional GIS server for well under $100. I think it's a a good opportunity for the Postgres community to grow by engaging the upcoming generation of developers.
I plan to continue writing about the Raspberry Pi, specifically focusing on running and using PostgreSQL on the Pi. If a few more kids learn PostgreSQL today while they're young, five years from now they could be core contributors to the project.
See my
pgbench
test results for more insight to PostgreSQL performance on the Pi.
Why develop for low power?
My initial reason for developing on low power systems was to keep my budget as close to zero ($0) as possible. For a couple years I ran Jira on a Budget on a $5/month server (1 CPU, 512 MB RAM).
Now, I find the challenge of severe I/O and CPU limitations forces me to continuously learn more about the inner workings of PostgreSQL. It forces me to become a better administrator. It forces me to become a better developer. I do like learning...
Amplifies mistakes
If you're forced to work with less power you have to find ways to make the system or process more efficient. There are limits to this, but working on low power hardware makes it harder to ignore database anti-patterns. Problems manifest sooner and you become more aware of where and why bottlenecks are hit.
Power consumption matters
I pride myself on developing and maintaining fast systems. I'm impatient and get distracted easily if I'm forced to wait long, so that's a core driver for good performance. That said, my preference is to keep servers as small as possible. Throwing more power at performance problems typically addresses a symptom (bad performance) without fixing the problem (bad architecture).
Running a bigger server takes more power, more power requires more cooling, and so on. It's for these reasons that I enjoy the challenge of running fast systems on the Raspberry Pi. If I can run it there, I can run it on a tiny amount of cloud resources.
My uses for Pi
Here are a few of the regular tasks I put my various Pis to.
- PiWS
- Process OpenStreetMap data
- PostgreSQL, PgBackRest, replication, etc.
- Metasploit (also uses Postgres)
- Web/App server (Nginx / Flask)
- Pi-Hole
Conclusion
This post went over some reasons why I think the Pi is awesome. It's under a great organization, a cool product... and runs Postgres! Overall, the Pi makes it easier to learn about technology. That is a good thing.
Need help with your PostgreSQL servers or databases? Contact us to start the conversation!