Search code examples
javadatabasegraphhbasetitan

Does TitanDB loads full graph into memory when using g.V() from Tinkerpop?


I‘m using Titan now.

I want to use "g.V().values()" supported by Tinkerpop in my Titan application,achieving a graph traversal.

In my view, Tinkerpop loads global graph into memory when using this iterator.Titan seems like call this method directly and not override.

So,does Titan loads full graph into memory when executing g.V()?

If the answer is true.I'll worry about the memory size when the graph is large enough.


Solution

  • In my view, Tinkerpop loads global graph into memory when using this iterator.

    I'm not sure where you gathered that conclusion from, but the intent of TinkerPop's interfaces is the opposite. Graph databases that implement TinkerPop interfaces should make use of the memory saving capabilities of an Iterator and be smart about how they load data. I write "should" in italics because TinkerPop really has no way to enforce that requirement. There is nothing to stop a graph provider from pulling all the data in their database into memory when g.V() is called.

    That said, I'm not really aware of any persistent (i.e. not in-memory where the graph already resides in memory) TinkerPop implementation that does that, including Titan. Titan would not be able to scale very well if that were the case. Of course, that doesn't mean executing a global retrieval of all vertices in a billion edge graph in an OLTP-style traversal with g.V() would mean that you would get good results. You would wait a long time for that traversal to complete if it returned at all (i.e. timeouts and other environmental problems). For global graph queries, you would look to use titan-hadoop and an OLAP-style traversal in those cases.