Menu

Cassandra and Mongo and SQLite and databases oh my!

Q: Why do you have three different versions of the wxWeb server code in this project?
A: It's a learning exercise!

I started this project with Cassandra, because it's what I'm using for my current project at $DAYJOB. Getting Cassandra to run on Pi grade hardware is tricky, I'll blog about that in a later post. Know that the current Cassandra database I'm using is running on an ASUS Tinker Board because I had one available, and it has 2GB RAM. That will change in the future, with the Raspberry Pi 4 out now and available with 4GB RAM. Well, someday soon.

I did the MongoDB implementation because MongoDB is widely used as a telemetry database. In fact, we did exactly that on my previous project at $DAYJOB. I'm still fairly fluent in MongoDB, but I never really got comfortable with it. Getting MongoDB to run in a Pi is an interesting hurdle too, as most recent versions of MongoDB will not build on a 32-bit OS and compiler. My MongoDB instance is running on Ubuntu on a Pi 3B+. If this were going to become a production system, I would migrate that to a Pi 4 as well.

And finally we have SQLite. For me, SQLite has always been a joy to work with. It's reliable, it's dead-bang simple, there is no server administration of any sort, it just works. Right up until it doesn't, but the performance corner cases that make SQLite not suitable for heavy duty database use aren't likely to happen in collecting sensor data from a small handful (currently two) sensors, and the occasional call to read out some of the historical data.

Why not MySQL, or PostgreSQL? My SQLite example covers the SQL style databases. If I were making this a production system, I would probably use PostgreSQL; I've used PostgreSQL professionally for over 20 years now, including in internet-scale applications, and it hasn't bitten me yet. If someone wants to contribute a MySQL or PostgreSQL (or DynamoDB or Firebase or whater) implementation based on the SQLite version, send me a pull request, I'll happily take it. Put it alongside MongoDB and SQLite.

If one of you intrepid RPi'ers out there wants to write wxWeb in .NET with SQL Server on Windows 10 on the Pi, I'll happily take that too.

Posted by Wes Peters 2019-08-07 Labels: cassandra mongodb sqlite postgresql mysql

Log in to post a comment.