News for hackers. Stuff that matters.
Re:SQLite 3.32 by jventura on Saturday May 23, 2020 @09:10AM (#23282629)
Most of my web apps’ databases are an SQLite file. It’s more than enough for the ammount of traffic they serve and the db files are easy to set up and backup..
Re:SQLite 3.32 by eska on Saturday May 23, 2020 @11:48AM (#23283883)
I also always wondered why sqlite isn't used more in websites. Especially if you split heavy write workloads to a separate database file it scales quite far.
Re:SQLite 3.32 by qes on Saturday May 23, 2020 @12:30PM (#23284267)
There's no reasonable way to share a SQLite database between processes on separate machines or VMs.. What website doesn't use at least 2 instances for HA?

How do you make sure you don't lose data in a SQLite DB?

Re:SQLite 3.32 by freedomben on Saturday May 23, 2020 @02:20PM (#23285133)
I throw together plenty of simple sites intended for personal use or just a small group. I don't need nor want the added complexity of going for HA. I can easily spin up a cheap VPS with an SSD and scale amazingly far with one instance and a SQLite DB. When it's for personal use or small group it's not a problem to take it offline for maintenance/deploys. I don't even use a load balancer (tho I often throw nginx in front to do mTLS and compression). I can build a site like that in 30 minutes.

I deal with massive scale all day every day for work (kuberntes/openshift/public clouds) so I find the simplicity amazingly refreshing.

I might also say the performance of my "single box" websites is also amazingly good. I've had even developer friends ask me how I get response times so fast, and they are often surprised when I tell them.

Re:SQLite 3.32 by detaro on Saturday May 23, 2020 @01:50PM (#23284919)
Many websites just run on a single machine somewhere, with maybe some caching in front or off-loaded static files. Even HN is as far as I know still just a single box.
Re:SQLite 3.32 by samtho on Saturday May 23, 2020 @12:56PM (#23284489)
Not sure about parent’s case, but I’ve used it for small blog-type applications where the only writes are from me (the admin) creating new entries. The rest is read only and behind caches, cdns, etc. The blog is effectively a singleton. Analytics and comments are handled by 3rd party providers.
Re:SQLite 3.32 by emadda on Saturday May 23, 2020 @07:26PM (#23287558)
You can use a regional GCP disk that replicates over all zones in a region (https://cloud.google.com/compute/docs/disks#repds). You cannot mount the same disk to many VMs, but you can force mount the disk to a new VM.
Re:SQLite 3.32 by ww520 on Saturday May 23, 2020 @04:59PM (#23286382)
Just use DRDB and Linux-HA to replicate the disks hosting the master SQLite database and the standby database.
Re:SQLite 3.32 by presumably on Saturday May 23, 2020 @12:51PM (#23284433)
What’s not reasonable about TiDB?
Re:SQLite 3.32 by lenkite on Saturday May 23, 2020 @12:10PM (#23284077)
How do you architect this ? This works only for single process web-apps right ? With no HA or failover ?
Re:SQLite 3.32 by jventura on Saturday May 23, 2020 @12:28PM (#23284254)
Right! But as I said, the low traffic volume doesn’t require more than this kind of architecture.

I do regular file backups and have a cron job restarting the web apps each 20 minutes, it’s enough for now. I would love to have a more solid architecture, but it matches the traffic volume and it’s good enough..

Re:SQLite 3.32 by duskwuff on Saturday May 23, 2020 @07:12PM (#23287472)
TBH, it'll work for a lot of multi-process apps, so long as the app runs on a single server and the app doesn't do anything foolish like write to the database on every page hit. For read-mostly applications -- like a blog, wiki, or even a small web forum -- SQLite is a surprisingly adequate database.