krotik / eliasdb

EliasDB a graph-based database.
Mozilla Public License 2.0
994 stars 49 forks source link

Why not BoltDB or something? #1

Open abourget opened 7 years ago

abourget commented 7 years ago

Was there a need to have zero + zero dependencies?

I'm curious about the story behind this DB.. Why it was written and what sets it apart from Cayley and Dgraph?

krotik commented 7 years ago

Hi there,

thanks for asking. EliasDB is actually a rewrite of a similar DB design which I previously did in Java. The Java thing started as a learning experience of what key-value stores do, how to build an abstract data model, how to model a query language, etc. As a result I now know the flow of a single byte from when it is received to where it is stored and all the design decisions along the way. When tweaking performance or other storage related things this is very handy - also there is no excuse for bugs :-) I also believe that the best pieces of software you write when you write it for the second time.

To answer your question if there was a need for zero dependencies: no, there was none. I am sure with a bit of refactoring you could easily use BoltDB as underlying key-value store. For this you could tweak the graph.Manager code or just create a special graphstorage.GraphStorage. However, having an own implementation for this gives me a lot of freedom for fine tuning. I know exactly where locking occurs and how transactions work. If there is a bug I can pick the whole thing apart if this is required :-)

Here a few thoughts on Cayley and Dgraph. Both datastores are really impressive pieces of work.

Dgraph

Caylay

EliasDB

EliasDB's intention is to give you a small, really really easy-to-use datastores solution. At the moment it is a single executable. If you are, for example, a web developer you can just build a small web application demo and give it to your customers on a USB stick. You click on it and it "just works". That is, of course, not to say that you can only use it for toy applications. As with other datastores EliasDB can store large amounts of data. There are a lot of features I would like to explore and eventually implement. However, my premise for EliasDB remains: "keep it as simple as possible".

abourget commented 7 years ago

Wow great answer :-) let's leave this issue open for a small while so others can read it too.

Thanks!

jracabado commented 7 years ago

Hi,

This looks really good. You refer turning it distributed. For read intensive usage what would be the most straigh-forward way to have a setup with some redundancy?

The top priority would be making sure that there is no data loss, so some kind of replication of the data store must be involved.

Just come to my mind that etcd could be used for master/slave election and as a way to replicate data over different instances. It might be somewhat slow on writes but as long as stale reads are allowed it shouldn't matter too much. The good thing about it would be keeping EliasDB simple. Thoughts on that?

krotik commented 7 years ago

Hey,

etcd with its raft implementation looks good indeed. A very simple way to get EliasDB distributed would be to use etcd's key-value storage to model a distributed graph storage with it. You would need an object which satisfies the graphstorage.Storage interface. I could imagine that read performance would be quite reasonable.

However, I had something more "low-level" in mind for distributing EliasDB. I would imagine a "wrapper" object for a graphstorage.Storage implementation. This wrapper would use the wrapped storage for local storage and would add the distribution functionality. This means your could have normal disk storage or a cluster with memory-only storage which would be REALLY fast. I think the Dynamo paper from Amazon is a good starting point for research. I imagine:

faddat commented 7 years ago

Alright now I've got to give this a shot.

Nice backstory!

ghost commented 7 years ago

Check buntdb . It's hot a nice raft backend to replicate. Also it runs in memory with file backing. This is great feature for speed.

ghost commented 7 years ago

https://github.com/tidwall/buntdb