placeholder

Optimizing SQLite for servers

SQLite is often misconceived as a "toy database", only good for mobile applications and embedded systems because it's default configuration is optimized for embedded use cases, so most people trying it will encounter poor performances and the dreaded SQLITE_BUSY error. But what if I told...

Click to view the original at kerkour.com

Hasnain says:

Love SQLite. I’ll have to take some of these things into account when tuning my apps.

Also love that the author documented these - I think I stumbled upon a few of these best practices by accident, it’s hard to find good material out there.

“But what if I told you that by tuning a few knobs, you can configure SQLite to reach ~8,300 writes / s and ~168,000 read / s concurrently, with 0 errors, on a ~40€ / m commodity virtual server with 4 vCPUs (details and code in the appendix).

Let's say that your server application is making in average 8 database read queries per request, you could, in theory, handle ~21,000 requests per seconds, or ~1,814,300,000 requests per day, for ~40€ per month, bandwidth included, not bad! (In practice you may not be able to do that: the server's bandwidth will be the limiting factor)

And this is before talking about tuning the garbage collector, caching and CDNs.”

Posted on 2024-04-09T05:31:46+0000