Tee8z

Hello World

Hello world, an introduction, and why sqlite's hard constraints are worth working around.

Published

Authored

May I be so bold to make yet another blog for the world? Will this be left to the void, few to see it? Possibly, but much of what is worth doing happens with little audience. And with that, a small call goes out 'hello world' that yes I am here and yes have something to say.

You may wonder who is 'tee8z', and how the heck is that name pronounced? Well, I am a software engineer with over 10yrs experience working at companies of varying sizes. Most recently at Voltage building their payments product and other core systems. My experience mainly in database/data and system architecture around financial transactions. I dabble in tools and technologies to build scalable and reliable systems. With this experience I have seen a thing or two, and have come across some techniques and ideas that others may find interesting.

As far as how to pronounce 'tee8z', it is pronounced 'tee-bz'. I know it is a bit odd, but it comes from an old nickname I used to have and lets me remember some fond memories. If you would like to call me by another name, I will answer to 'John'.

With my introduction out of the way, first I'd like to direct you to one approach in making tiny, easy to run, servers that can be deployed anywhere cheaply. It all starts with the database technology, sqlite.

Time and again people have brought up sqlite as a database solution that lets you have all the power of a database without the hassle of setting up a server.

Now, that is correct, but it comes with some hard constraints:

  1. Only one writer at a time
  2. Should NOT be used on a shared file system
  3. WAL mode needs special handling

What is interesting, those constraints are not terribly hard to build around into a server which is highly concurrent. The trick is to serialize the writer, have only one binary that writes to the file, and let the readers hit the db directly.

How do you serialize writes? Using channels of course!

I wrote that up properly in Serializing SQLite Writes With a Channel, which builds the whole thing from an empty cargo project up to a running server.

If ideas like this interest you, I plan to share more, but I do not promise a set schedule. They will come as they are ready and I find something worth saying. All the best, and enjoy your tinkering.