5 ms·
Postgres obviously. Sorry, just thought I'd buck the trend and assume a very write-heavy workload with like 64 cores. If you don't have significant write cont
by samatman 4y ago
Postgres obviously.
Sorry, just thought I'd buck the trend and assume a very write-heavy workload with like 64 cores.
If you don't have significant write contention, SQLite every time.
- innocenat 4y agoWhere is write contention coming from if it's operated locally?
- Thaxll 4y agoSQLite is "single" threaded for writes.
- d3nj4l 4y ago... you can get tons of requests on a server?
- dinosaurdynasty 4y agoRedis has the same limitation (only one transaction at a time) and is used a lot for webapps. It solves this by requiring full transactions up front. The ideal case for sqlite for performance is to have only a single process/thread directly interacting with the database and having other process/threads send messages to and from the database process.
- innocenat 4y agoBut that isn't "locally"?
- ledgerdev 4y agoHere's sqlite doing 100 million inserts in 33 seconds which should fit into nearly every workload, though it is batched. https://avi.im/blag/2021/fast-sqlite-inserts/ https://avi.im/blag/2021/fast-sqlite-inserts/ So write contention from multiple connections is what you're talking about, versus a single process using sqlite?
- lvass 4y agoKeyword here is transactions, not processes. You can model any workload to be transaction-efficient, but it might not be easy.
- endisneigh 4y agoNo durability guarantee is a showstopper for any serious use case
- axelthegerman 4y agoNot sure what you mean by durability. Sqlite has WAL that can be replicated (see litestream)
- endisneigh 4y agohttps://en.m.wikipedia.org/wiki/Durability_(database_systems) https://en.m.wikipedia.org/wiki/Durability_(database_systems...
- dinosaurdynasty 4y agohttps://www.sqlite.org/atomiccommit.html https://www.sqlite.org/atomiccommit.html sqlite is as good at durability as any non-replicated database, though you can configure it to be non-durable (most other databases too tbf). https://www.sqlite.org/pragma.html#pragma_synchronous https://www.sqlite.org/pragma.html#pragma_synchronous By default WAL mode can rollback committed transactions in cases of power failure, but you can do `PRAGMA synchronous = FULL` to trade speed for durability.
- endisneigh 4y agoI’m talking about the post I originally commented on. Things were disabled so durability is not guaranteed.
- 4y ago
- dinosaurdynasty 4y agoIf you can have one "database" thread and 63 "worker" threads, send messages back and forth, and don't hold open transactions, this would probably work with sqlite. Aka treat sqlite like redis.
- skyde 4y agoso in your example the database thread is the Redis thread and the worker thread are your http server thread I assume. This is a good analogy, but there are still lot of wire heavy scenario a real database like postgresql or mysql will have better throughput than redis.