logoalt Hacker News

Panzerschrek • today at 4:59 PM • 4 replies • view on HN

> There's no separate database server. You open the database file through SQLite's C API.

> Every request spawns a fresh process.

How does it work when multiple concurrent requests are possible? Does SQLite allow simultaneous write access from multiple processes?


Replies

prophittcorey • today at 5:04 PM

SQLite can handle multiple concurrent requests if it's set to WAL mode. Reading is all non-blocking/concurrent but writing is still synchronous. You should also set the "busy timeout" or else your blocked writes will timeout immediately.

huijzer • today at 6:31 PM

SQLite is a database. The main idea of a database is to support concurrent reads/writes although databases differ in how much concurrency they allow

➕ show 1 reply
citrin_ru • today at 5:07 PM

SQLite does allow write access from mulitple processes - file locks (fcntl) are used to ensure at any given moment only one of processes modifies the database (or WAL if WAL is enabled).

warkdarrior • today at 5:05 PM

Users who send concurrent requests will be summarily banned and their data deleted. It's the only way to be sure.