Performance Comparison: Neo4j vs Nebula Graph vs JanusGraph

Tencent Cloud Team

Performance Comparison: Neo4j vs Nebula Graph vs JanusGraph

Who Did the Comparison

This article describes how the Tencent Cloud team compares Nebula Graph with two other popular graph databases on the market from several perspectives.

By their nature of dealing with interconnections, graph databases are perfect for fraud detection and building knowledge graphs in the security field. To better serve the Tencent Cloud business scenarios, the Tencent Cloud Security team has to select a highly performant graph database which fits the business development well, which is how this performance comparison comes into play.

Whom to Compare With


Neo4j is the most widely adopted graph database in the industrial world. It has a Community edition and an Enterprise edition. For comparison in this article, the team has chosen the Community edition.

HugeGraph (A fork of JanusGraph)

HugeGraph is a distributed graph database developed by Baidu. It is forked from JanusGraph. HugeGraph is developed to address the needs of anti-fraud, threat intelligence collection, and underground economy attack with graph storage and analysis capabilities. It has pretty good read and write performance.

Nebula Graph

Nebula Graph is an open source distributed graph database developed by vesoft inc. It features the capability of dealing with super large datasets with hundreds of billions of vertices and trillions of edges.

Hardware Environments

CPUIntel Xeon(R) Gold 6133 CPU @ 2.5GHz X86_64
# of Physical CPUs2
# of Physical Cores20
# of Logical CPUs80
Memory260 GB

Test Results

The Tencent Cloud Security team has used graph data at different orders of magnitudes for testing purpose. The test has been performed against various metrics, including data import efficiency, one-hop query, two-hop query, and shared friends query.

The results are as below:

Graph Data SizePlatformData ImportOne-Hop QueryTwo-Hop QueryShared Friends Query
10 Million EdgesNeo4j26s6.618s6.644s6.661s
Nebula Graph32.63s1.482ms3.095ms0.994ms
100 Million EdgesNeo4j1min21s42.921s43.332s44.072s
Nebula Graph3min52s1.971ms4.34ms4.147ms
1 Billion EdgesNeo4j8min34s165.397s176.272s168.256s
Nebula Graph29min35s2.035s22.48ms1.761ms
8 Billion EdgesNeo4j1h23min314.34s393.18s608.27s
Nebula Graph~30minLess than 1sLess than 5sLess than 1s

Seen from the above table, in terms of data import, Nebula Graph is a bit slower than Neo4j when the data size is small. However, when the data size is large, Nebula Graph is much faster than the other two. For the three graph queries, Nebula Graph shows clearly better performance compared to Neo4j and HugeGraph.

Here is a chart overview of the comparison:

Graph Database Performance Comparison Chart

Graph Query Language Comparison

Neo4j Cypher

One-Hop Friends Query

match ({vid:11111}) -> (u)
return u;

Two-Hop Friends Query

match ({vid:11111}) -> () -> u
return u;

Shared Friends Query

match ({vid:11111}) -> (u) <- ({vid:22222})
return u;

Nebula Graph nGQL

One-Hop Friends Query

GO FROM 11111 OVER relation

Two-Hop Friends Query

GO 2 STEPS FROM 11111 OVER relation

Shared Friends Query

GO FROM 11111 OVER relation
GO FROM 22222 OVER relation

HugeGraph gremlin

One-Hop Friends Query

g.V ().has ('vid', 'attr', '11111'). both E ().otherV ().dedup ().count ()

Two-Hop Friends Query

g.V ().has ('vid', 'attr', '11111'). both E ().otherV ().dedup ().both E ().otherV ().count ()

Shared Friends Query

g.V ().has ('vid', 'attr', '11111'). both E ().otherV ().aggregate('x').has('vid', 'attr', '22222').bothE().otherV().where(within('x')).dedup().count()

From the graph query language point of view, gremlin is complex and nGQL and Cypher are simple and neat. From the readability point of view, nGQL is similar to SQL and the learning curve should be shorter.

Graph Visualization Comparison

PlatformSupport LayoutFluencySupport Exploration from a Selected NodeSupport Query in BatchSupport Node Style Customization
Neo4jYesFluent for one-hop queryNoYesYes
HugeGraphNoFluent for one-hop queryNoNoYes
Nebula GraphYesFluent for one-hop queryYesYesNo

In terms of graph visualization, it is safe to say that all the mentioned platforms are just available for use. Nebula Graph supports exploration from a selected node, which is a plus. However, there is still room for improvement for the smoothness of two-hop friends query results layout and node style customization.

After comparing multiple widely adopted open source graph databases and taking into consideration of factors such as performance, learning curve, and fitness to the business scenarios, the Tencent Cloud Security team has finally selected Nebula Graph, a highly performant and easy-to-use graph database.

Get started with Nebula Graph now!

This article is written by Li Hangyu and Deng Changbo from the Tencent Cloud Security team.

You might also like:

  1. Nebula Graph Architecture — A Bird’s Eye View
  2. An Introduction to Nebula Graph’s Storage Engine
  3. An Introduction to Nebula Graph’s Query Engine
Like what we do ? Star us on GitHub.