free-ekanayaka
Joined 8 years ago
Joined 8 years ago
If you want light-speed insert/delete, you could probably don't use the disk at all: as long as a majority of your nodes don't die, you won't lose any data. You can also go somewhere in between and save to disk only at specific intervals.
There is now a new async I/O API available in Linux (I'm not remembering the name right now, but it was developed by folks at Facebook). It looks promising so I'll check it at some point. (dqlite author here)
I added answers to your other questions to the FAQ:
https://github.com/canonical/dqlite/blob/master/doc/faq.md#w...
https://github.com/canonical/dqlite/blob/master/doc/faq.md#w...
https://github.com/canonical/dqlite/blob/master/doc/faq.md#i...
- faulty node replacement: you can take any node off (or any node can crash) at any time. As long as there are enough nodes left to reach a quorum, your system will be available. If there are not enough nodes left, your system will be unavailable (but keep consistency)
- re-syncs, snapshots and the rest are all covered in the raft paper
- clients wanting to perform writes always talk to the node that is currently the leader, that node fails, clients will look for next leader (which will be eventually elected as long as there's a quorum of surviving nodes)
- overwhelming a system is a different concern, raft writes are serialized so the goal is usually not throughput (for that you might look at AP/AC storage solutions in the CAP spectrum, raft is CP). Designs that need high write throughput might still use raft as internal building block for coordination.
when you perform a SQLite write, SQLite writes a new page on disk to the its write-ahead log. dqlite needs to replicate that page write across all nodes. A page is typically 4kb, so when you do a write on the leader node you need to transfer 4kb across the wire to all other follower nodes and wait for a quorum of them to come back and say "I got it" (which includes writing the page to disk). On the contrary rqlite just needs to transfer and store the SQL text, which is typically less than 4kb.
In practice it's still pretty performant, but I'll publish benchmarks later on.
I plan to submit the patch to SQLite upstream too, yes.
Hardware does not matter that much, since SQLite is pretty hardened for handling any possible hardware failure (out of memory, out of disk space, memory/disk corruption) and propagate that to client code (including dqlite). Regarding network failures (hardware-related or not), raft guards you against them, and it's formally proved.
If you don't have those requirements, dqlite or rqlite might get the job done with less moving parts and operational overhead.
It's pretty much the same argument of using SQLite vs (say) PostgreSQL, but translated into distributed systems. See:
I think the best explanation of why you'd use it over PG or MySQL is the same as why you'd use SQLite over them:
https://www.sqlite.org/whentouse.html
With dqlite you also get HA, fault-tolerance and transparent failover, if you're willing to trade it with a bit of performance.