# Dgraph and RocksDB

**URL:** <https://discuss.dgraph.io/t/dgraph-and-rocksdb/456>\
**Category:** Users\
**Created:** [June 20, 2016, 11:54pm UTC](https://discuss.dgraph.io/t/dgraph-and-rocksdb/456 "2016-06-20T23:54:24Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mrjn](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/mrjn/32/775_2.png) [@mrjn](https://discuss.dgraph.io/u/mrjn)\
**Post date:** [June 20, 2016, 11:54pm UTC](https://discuss.dgraph.io/t/dgraph-and-rocksdb/456/1 "2016-06-20T23:54:25Z")

</div>

> [@mrjn](#):
>
> Hi Manish,
> 
> Thanks for getting back to me so quickly.
> 
> As I understand that you are currently using RocksDB ([http://rocksdb.org/](http://rocksdb.org/))  
> as the backend then I can see that DGraph is basically the graph layer over  
> it much like Cayley is the graph layer over various configurable backends  
> as well. The advantage of RocksDB though is that it is embedded.
> 
> Given this and from the numerous searching that I have been doing lately, I  
> have come across what might be a very good distributed backend that you  
> may have an interest in as well. It’s called HyperDEX ([http://hyperdex.org/](http://hyperdex.org/))  
> and is supposed to scales extremely well and is used in the Weaver graph  
> database as their backend and might be an option for you to consider  
> although I have not used it yet.
> 
> Cheers,  
> Lonnie

Dgraph uses RocksDB, which is a library to make it easy to store key-value pairs on disk. On a very basic level, it’s no different than any file library, which lets you write bytes to disk and then read them back later. The naming of RocksDB makes it _feel_ like as if it’s a database – but it’s not. It’s just an advanced library.

This is a common source of confusion among people who’re comparing Dgraph against Cayley or other data stores which also use RocksDB (like say CockroachDB). The main difference here is that Dgraph manipulates and manages the data it writes to RocksDB, just like it would treat a file on disk. All of our advanced features like data replication, data sharding, data movement, etc., all are handled at Dgraph layer. RocksDB only enables us an interaction with the local disk – it doesn’t do any of these other things that one would expect from a distributed highly available scalable database.

Cayley doesn’t currently do any of these data management stuff. So, if you want to distribute Cayley among different servers, you’ll have to use something like Cassandra, not RocksDB. Again, this is because RocksDB is just an interface to local disk. So if you’re on a single machine, then using RocksDB with Cayley makes sense. But, not if you want to then distribute the data. Cayley wouldn’t help you there.

To the point about HyperDEX, Dgraph does not use any database below it. Below Dgraph is only local disk. That’s how we can control our network calls, our query latencies and be performant.

Hope that sheds some light on the issue.

---

<div class="post-metadata">

**Author:** ![mrjn](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/mrjn/32/775_2.png) [@mrjn](https://discuss.dgraph.io/u/mrjn)\
**Post date:** [July 20, 2016, 11:54pm UTC](https://discuss.dgraph.io/t/dgraph-and-rocksdb/456/2 "2016-07-20T23:54:28Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
