News for hackers. Stuff that matters.
Re:A SQLite Tutorial with Node.js by le-mark on Thursday May 17, 2018 @12:01PM (#17092494)
I didn't see anything in the code to address database contention for inserts/updates. This is SQLites achilles heel, even in a single process, with multiple writing threads. But it's easily remedied by "serializing" writes with a queue or lock for example. Many claim WAL remedies this, but in my test, WAL still succumbs to contention. Time out and retry is another possible solution.

The other thing is setting the sync and journaling mode on the connection. You have to do that for every connection, if you do want to use WAL mode.

SQLite can be quite high performance if done right.

Re:A SQLite Tutorial with Node.js by samatman on Thursday May 17, 2018 @01:28PM (#17093383)
I don't consider it an Achilles' heel, more like the reason that you want postgres sometimes.

Similarly, I wouldn't say that postgres' Achilles' heel is that you can't just copy the database to a thumb drive.

Agreed that you have to treat SQLite as though you're writing to a single file with all conflict resolution essentially on-disk. Because you are.

Re:A SQLite Tutorial with Node.js by guntars on Thursday May 17, 2018 @02:34PM (#17094080)
You're not likely to run multiple threads in NodeJS. If you do need to scale up to multiple threads or processes, SQLite might not be the right choice, but then again it was never designed for that use case.
Re:A SQLite Tutorial with Node.js by Scarbutt on Thursday May 17, 2018 @02:46PM (#17094221)
You're not likely to run multiple threads in NodeJS.

Nodejs itself won't but libuv will.