Live data from Hacker News

SQLite in Production: Lessons from Running a Store on a Single File

ultrathink.art

71–80 of 135 posts

Re: SQLite in Production: Lessons from Running a Store on a Single File

#71
post #63
post #50

Earlier quoted context omitted.

They tell you to use a proper FS, which is largely orthogonal to containerization.

WAL relies on shared memory, so while a proper FS is necessary, it isn't going to help in this case.

Why does it not help if both containers can mmap the same -shm file?

Re: SQLite in Production: Lessons from Running a Store on a Single File

#72

Earlier quoted context omitted.

It's a spectrum. Installing Postgres locally is not 100% future-proofing since you'll still need to migrate your local Postgres to a central Postres. Using Sqlite is not 0% future-proofing since it's still using the SQL standard. If the only argument for a piece of tech in comparison to another one is "future-proofing", that's pretty much acknowledging the other one is simpler to setup and maintain.

> It's a spectrum. For web servers specifically, no, SQLite is not generally part of that spectrum. That makes as much sense as saying that in a kitchen, you want a spectrum of knives from Swiss Army Knives to chef's knives. No -- Swiss Army Knives are not part of the spectrum. For web servers, you do have a wide spectrum of database options from single servers to clusters to multi-region clusters, along with many ot…

OMG, you just killed it.

Re: SQLite in Production: Lessons from Running a Store on a Single File

#77
post #38
post #25

Earlier quoted context omitted.

This is the actual problem: "Kamal runs blue-green deploys — it starts a new container, health-checks it, then stops the old one. During the switchover, both containers are running. Both mount ultrathink_storage. Both have the SQLite files open." WAL mode requires shared access to System V IPC mapped memory. This is unlikely to work across containers. In case anybody needs a refresher: https://en.wikipedia.org/wiki/S…

The SQLite documentation says in strong terms not to do this. https://sqlite.org/howtocorrupt.html#_filesystems_with_broke... See more: https://sqlite.org/wal.html#concurrency

btw nfs that is mentioned here is fine in sync mode. However that is slow.

Re: SQLite in Production: Lessons from Running a Store on a Single File

#78
post #3

> The technical fix was embarrassingly simple: stop pushing to main every ten minutes. Wait, you push straight to main? > We added a rule — batch related changes, avoid rapid-fire pushes. It's in our CLAUDE.md (the governance file that all our AI agents follow): > Avoid rapid-fire pushes to main — 11 pushes in 2h caused overlapping Kamal deploys with concurrent SQLite access. Wait, you let _Claude_ push your e-commer…

> Wait, you let _Claude_ push your e-commerce code straight to main which immediately results in a production deploy?

Yikes. Thank you I'm not going to read “Lessons learned” by someone this careless.

Post reply on HN