logoalt Hacker News

Panzerschrek • today at 4:59 PM • 5 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

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).

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.

tomjen3 • today at 9:10 PM

In Wal mode you can have multiple readers. Writers block, but because there is no network traffic, the writers finish very quickly, so in practice you don't usually wait that long.

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.

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 2 replies