Databases have traditionally been expensive. What if we could change that?

Build multitenant SaaSes (with a database per tenant, user, location) and deploy databases anywhere including embedded in your own infrastructure. This and more is what having a legendary amount of databases can do for you.

Cover image for Databases have traditionally been expensive. What if we could change that?

We have just benchmarked a single instance libsql-server, the Open Source component powering Turso, to 100,000 (yes, you read that right) databases, with all databases taking queries in a loop, to a maximum memory usage of 1.6GB:

#So what?

Despite the excitement that the tweet generated, it's important to ask: So what?

To understand that, let's take a step back for a moment.

Chances are the last time you saw something curious on your way back home, you just snapped a picture of it. You may have taken 10 pictures of it, just to be sure you captured the best angle. In fact, taking pictures of things is such an inconsequential act, that you may have done it, shared it with your friends, and forgotten about it.

But it wasn't always like that. In my teens, if you wanted to take a picture, you needed something like this:

A roll of film like this cost around $36 (for simplicity) in today's dollars, or $1.00 per shot. You still had to pay someone to develop it, and since it was also less automatic than snapping a picture today, chances are you would just get a bunch of blurry, out of focus, or otherwise unusable images.

Which is why for some personal trips you could get a camera like that– our family had one that I recall using many times in trips to the zoo, but if you were in an situation where you really wanted to make sure things were done right, you wouldn't risk it, and let a skilled photographer take the helm.

We see similar patterns playing out throughout history.

Computers were initially very expensive and huge, and you had people especially tasked with taking care of them. Today they fit into your pocket.

Even creating branches in a version control system. If you grew up with Git, take a moment to research how things were done in the CVS/SVN days 🙂

#What happens when things are expensive?

The most obvious consequence of something being expensive, is that you use it less. In search of efficiency, expensive things are turned into a shared resource.

Access to it is better off mediated. You need specialized training, and specialized knowledge. You need someone with great powers, and great responsibilities.

When things are cheap, mediating access or sharing it is just not worth the cost. The trend moves toward individual use.

Without the mediator, simplicity, automation and abstraction all grow in importance.

#Databases are traditionally expensive

Databases have been traditionally expensive. They have been hard to operate, hard to scale, hard to get right.

You have a big one somewhere central, as a shared resource, mediated by a professional ~~photographer~~ databaser. That is true even for Cloud offerings, where a large part of the burden is carried by the cloud provider: one wrong move, and your entire application is down. Get that pro.

But much like technological advancements made photography virtually free, we're doing the same thing to databases.

#It's time for SQLite.

SQLite can change this game. A database in SQLite is just a file, and uses very little resources. People at the bleeding edge have been already using this fact to ask themselves: “If each database is so cheap, why don't I just create millions of them?”

The main problem lies in the fact that productizing SQLite was hard. Yes, your database is just a file, but to power a production application you need more than that. You need this file to be accessible by multiple services, replication, availability, backups, and all of that.

#Turso solves that

Turso brings the joy of SQLite to modern applications. It allows you to create an uncanny amount of databases for cheap: in fact, your first 500 are totally free. It allows you to replicate each database individually, wherever you see fit (even all the way to a user's device), and is totally managed, including backups.

Turso is built on libSQL, the open source contribution of SQLite. It ships with a server mode that you can use to manage, replicate and backup your databases.

It is also very easy to see where the fundamental efficiency that allows databases to become so cheap comes from.

We have recently benchmarked a server with 100,000 databases, all taking queries in a loop. The memory usage on the server never exceeded 1.6GB:

#What can you do with that many databases?

Have a million users? Isolate them fully: give each of them their own, isolated database.

Fancy the document model? You can do that, and still retain SQL: make each database its own collection, with its own schema.

Want to move faster? Segregate your data,and replicate the relevant parts inside each application server. Queries in these replicas will not affect your main copy, so each one of your developers can do whatever they want.

Unleash your imagination What would you do, if you could get millions of databases for cheap?

#And you can start free today

Ready to explore the power that a legendary amount of databases provides? Start free today, at https://turso.tech.

scarf