For my masters thesis I’ve created a distributed database, which aims to provide strongly consistent data storage for some edge compute applications. It achieves this by giving specific nodes authority over a certain prefix. These nodes can then service reads, writes and create new sub-prefixes without having to communicate with any other nodes. For example, one node might have authority over “/”, another over “/students/” and another over “/professors/”. These nodes oversee the creation of new sub-prefixes on other nodes, such as “/students/Bob/” and “Professors/John/” respectively.
This model also has attractive failure tolerance properties since there’s no centralized entity responsible for prefix distribution.
Clients can query the entire database through a single database node because requests are forwarded to the appropriate node. However, for request forwarding, traveling up the entire prefix hierarchy and back down to the correct node is slow.
To solve this problem, I used libp2p’s gossipsub to spread metadata about which prefixes are stored where. Compared to using a classic pubsub system for this purpose, libp2p lets me simplify the architecture of the entire system, without introducing another point of failure.
The (undocumented) implementation can be found here.
The libp2p part responsible for metadata sharing, utilizing gossipsub with kademlia and Identify for peer discovery can be found here: server/src/metacom/mod.rs · master · Frederik Baetens / scudDB · GitLab
I think this is an interesting use case, because unlike most(?) users of libp2p, no byzantine fault tolerance is required, yet I still benefit from its failure tolerance and relative simplicity.
If anyone has some questions, suggestions, or knows of others building similar systems, I’d love to hear about it! So far I know about Cloudflare workers KV & Durable Objects and some academic databases.