(no title)
throwaway38375 | 1 year ago
I've never seen SQLite used in a setup which multiple machines connect to the same database over a network.
For example: A web application with a web server, a worker/job server, and a database server.
In these instances MySQL or PostgreSQL seem to be much better choices.
So will SQLite ever be able to "take over" in these scenarios?
karmarepellent|1 year ago
A lot of factors play into this and it certainly does not work in every case. But I recently got to re-write an application at work in that way and was baffled how simple the application could be if I did not outright overengineer it from the start.
That is just anecdata. But my guess is that this applies to a lot of applications out there. The choice is not between PostgreSQL/MySQL and SQLite, but between choosing a single node to host your application or splitting them between multiple servers for load balancing or other reasons. So the choice is architectural in nature.
sgbeal|1 year ago
Noting that the sqlite developers recommend against such usage:
https://sqlite.org/whentouse.html
Section 3 says:
3. Checklist For Choosing The Right Database Engine
- Is the data separated from the application by a network? → choose client/server
gwd|1 year ago
If you actually mean "database server", i.e., SQL is going over the wire, I don't see why you'd ever structure things that way. You lose both SQLite's advantages (same address space, no network round-trip, no need to manage a "database server") and also lose traditional RDBMS advantages (decades of experience doing multiple users, authentication, efficient wire transfer, stored procedures, efficient multiple-writer transactions, etc).
Assuming that it's the worker / job server which is primarily issuing SQL queries, what you'd do is move the data to the appropriate server and integrate SQLite into those processes. (ETA: Or to think about it differently, you'd move anything that needs to issue SQL queries onto the "database server" and have them access the data directly.) You'd lose efficient multiple-writer transactions, but potentially get much lower latency and much simpler deployment and testing.
rmbyrro|1 year ago
But...
Many projects won't ever need that. A bare metal machine can give you dozens of cores handling thousands of requests per second, for a fraction of the cost of cloud servers. And a fraction of the operational complexity.
Single point of failure is really problematic if your system is mission critical. If not, most apps can live with the possibility of a few minutes of downtime to spin up a fail over machine.
dlisboa|1 year ago
xenodium|1 year ago
Cloudflare D1 https://developers.cloudflare.com/d1 offers cloud SQLite databases.
> For example: A web application with a web server, a worker/job server, and a database server.
I've been giving it a run on a blogging service https://lmno.lol. Here's my blog on it https://lmno.lol/alvaro.
masfoobar|1 year ago
SQlite, generally speaking, is a FANTASTIC local database solution, like for use in an application.
throwaway290|1 year ago
colechristensen|1 year ago
shiroiushi|1 year ago
jddj|1 year ago
The "one writer at a time and the rest queue" caveat is fine for most web applications when writes happen in single digit / low 10s of ms
BaculumMeumEst|1 year ago
Sammi|1 year ago
I mean look at the prices from Hetzner.com.
The amount of stuff you can run for peanuts. It's amazing.