Earlier quoted context omitted.
I never questioned whether it was faster or had more features. My whole point is maybe a lot of programs don't need what it offers.
Most people don't need everything SQLite offers, but almost all programs needs some of its features. And even if you literally do nothing more than storing rows of text, the API SQLite offers is still more convenient than most filesystem API's once you go beyond the bare minimum. That is to say that there are remarkably few usecases where SQLite isn't better than plain file access.
Consider SQLite
251–260 of 274 posts
Re: Consider SQLite
#252Earlier quoted context omitted.
Do you have an example of a problem I'm likely to encounter at the scale I described in my comment?
If you are doing IO in a non-atomic manner (seems probable), it’s a matter of time before something happens and a file gets messed up. The frequency of that occurring is certainly a function of scale, but I would argue it’s always a bad idea to deal with your persistent state non-atomically. Additionally, having a schema (even if it’s trivial) protects you from other software problems. It’s much easier to reason abou…
No. I typically use a single mutex for the entire database, and as I said haven't had any performance issues. I'm confident for many classes of software this can scale to at least 100 users (maybe with some slight performance tweaks), which is sufficient for many federated services.
Re: Consider SQLite
#253Am I the only one who thinks SQLite is still too complicated for many programs? Maybe it's just the particular type of software I normally work on, which tends towards small, self-hosted networking services[0] that would often have a single user, or maybe federated with Now obviously if I wanted to scale up, at some point you would have too many users to fit in memory. But do programs at that scale actually need to e…
There is a key difference. With the JSON version you are constantly serialising and parsing the entire file, even if you need to write just a single byte. With SQLite, you can read or write a few bytes without having to process the others. Also, SQLite would allow observing the current state by querying the file, with the JSON version you would need to keep dumping the state every few seconds. But I agree with you th…
Only serializing. The db is kept in memory, and only deserialized on startup.
But why is this a problem at the scale I'm working with?
Re: Consider SQLite
#254Earlier quoted context omitted.
The stigma of using the most popular database in existence?
For the domain of webapps, where multiple concurrent writers are often expected, yes, I would say it's a stigma.
Re: Consider SQLite
#255Earlier quoted context omitted.
There is a key difference. With the JSON version you are constantly serialising and parsing the entire file, even if you need to write just a single byte. With SQLite, you can read or write a few bytes without having to process the others. Also, SQLite would allow observing the current state by querying the file, with the JSON version you would need to keep dumping the state every few seconds. But I agree with you th…
> There is a key difference. With the JSON version you are constantly serialising and parsing the entire file Only serializing. The db is kept in memory, and only deserialized on startup. But why is this a problem at the scale I'm working with?
Re: Consider SQLite
#256Earlier quoted context omitted.
You can run it on AWS Lambda and store the SQLite file(s) on EBS [1]. [1] https://aws.amazon.com/blogs/compute/using-amazon-efs-for-aw...
That's EFS, not EBS. EFS is file-level storage (i.e., NFS); EBS is block-level storage (SAN). AWS Lambda only supports EFS.
Re: Consider SQLite
#257Earlier quoted context omitted.
You can run it on AWS Lambda and store the SQLite file(s) on EBS [1]. [1] https://aws.amazon.com/blogs/compute/using-amazon-efs-for-aw...
I wouldn’t use a SQLite file over NFS. It has caused me locking problems when used by multiple clients.
Having clients running on read-only mode, when possible, can help.
Also partitioning the database can help, but then it's too much trouble already.
Re: Consider SQLite
#258Earlier quoted context omitted.
If you are doing IO in a non-atomic manner (seems probable), it’s a matter of time before something happens and a file gets messed up. The frequency of that occurring is certainly a function of scale, but I would argue it’s always a bad idea to deal with your persistent state non-atomically. Additionally, having a schema (even if it’s trivial) protects you from other software problems. It’s much easier to reason abou…
> If you are doing IO in a non-atomic manner (seems probable) No. I typically use a single mutex for the entire database, and as I said haven't had any performance issues. I'm confident for many classes of software this can scale to at least 100 users (maybe with some slight performance tweaks), which is sufficient for many federated services.
Re: Consider SQLite
#259Am I the only one who thinks SQLite is still too complicated for many programs? Maybe it's just the particular type of software I normally work on, which tends towards small, self-hosted networking services[0] that would often have a single user, or maybe federated with Now obviously if I wanted to scale up, at some point you would have too many users to fit in memory. But do programs at that scale actually need to e…
Re: Consider SQLite
#260Earlier quoted context omitted.
If you have PostgreSQL or MySQL on the same machine as your application, you can use UNIX sockets; they won't have much latency at all (I think Linux also optimizes TCP on localhost to skip all the pointless protocol overhead). In terms of latency it'll still be difficult to beat a database that lives in the same process as your application, but it won't be as bad as going over the network might be.
> If you have PostgreSQL or MySQL on the same machine as your application, you can use UNIX sockets; they won't have much latency at all (I think Linux also optimizes TCP on localhost to skip all the pointless protocol overhead). Sounds like a nice topic for a study; I'd expect the latency using local sockets to connect to a DB server to be about 3x as much, minimum, as the latency to simply write to a file. Writing…
A program error might still make you issue the wrong command or write corrupt data, but you shouldn't corrupt the internals with process isolation.