Hacker News new | ask | show | jobs
by alfiedotwtf 15 days ago
Depends on the architecture..

They could have one SQLite instance per user and then have a single sweeper that goes through all last writes and then replicates it to the main instance - eventual consistency fanned out across files

1 comments

So now you're introducing even more processes, even more latency and complexity, and for what benefit?

Eventual consistency on users would make it difficult to do things like "WHERE !user.is_banned" when getting the stories, so you need to keep your users database tightly synchronised. Sure, you could pro-actively delete or mark comments when deleting users, but now you're risking having the ban itself fail, and have also now added a much longer write operation, as you have to mark all those comments deleted. And long running writes is the one thing you desperately need to avoid in SQLite.

And why go to all that effort when you could avoid all that effort by running a database which allows concurrent writes on the machine local to the web application?

All the benefits of machine-local latency, and all the benefits of concurrent writers and transaction isolation.