Abstract
This paper introduces the recent work of Nebula Graph, an open-source, distributed, scalable, and native graph database. We present a system design trade-off and a comprehensive overview of Nebula Graph internals, including graph data models, partitioning strategies, secondary indexes, optimizer rules, storage-side transactions, graph query languages, observability, graph processing frameworks, and visualization tool-kits.
Introduction
As our digital world becomes increasingly interconnected, the data we generate—from social media interactions to banking transactions—is less about individual points and more about the relationships between them. Traditional relational databases (RDBMS) often buckle under the weight of "deep" queries that traverse these complex relationships. Nebula Graph is designed to address the "Big Data" problem in graph management, providing a system that is horizontally scalable, highly available, and capable of serving multi-hop queries with millisecond latency.
Architecture and Methods
Nebula Graph employs a shared-nothing architecture characterized by a strict separation of storage and compute. This design allows each layer to scale independently based on workload demands. The system consists of three primary services:
- Graph Service: A stateless query engine responsible for parsing, optimization, and execution. Its stateless nature allows for easy horizontal scaling.
- Storage Service: A distributed store utilizing RocksDB for local key-value storage and the Raft protocol for consensus and high availability.
- Meta Service: Manages metadata, schema operations, and cluster administration.
Key Innovations
To maintain performance at scale, Nebula Graph introduces several specialized mechanisms:
- TOSS (Transaction on Storage Side): Ensuring atomic edge insertions is challenging in a distributed system. Nebula uses a lightweight 2-phase locking (2PL) technique combined with Raft to maintain consistency across partitions without the overhead of full distributed ACID transactions.
- KV-Separation: The system can separate graph structure (keys) from properties (values). This allows the engine to traverse the graph's "skeleton" extremely quickly, loading heavy property data only when necessary.
- Rule-Based Optimization (RBO): The system uses a "cascades" framework to transform initial query plans into efficient physical execution plans, such as pushing filters down to the storage layer to reduce data transfer.
Data Partitioning and Locality
Data is partitioned using a static Vertex ID (VID) hashing strategy. A core design principle of Nebula Graph is maintaining processing locality. By co-locating a vertex and its outgoing edges within the same partition, the system transforms complex global traversals into efficient local key-value scans.
As shown in the storage layout, an edge (EdgeA) is stored twice: once in the partition of the source vertex (as an Out-edge) and once in the partition of the destination vertex (as an In-edge). This redundancy is a deliberate trade-off to ensure that any traversal starting from a vertex can find its neighbors without cross-partition communication for the initial hop.
Performance Evaluation
The system was evaluated using the LDBC-SNB (Social Network Benchmark) at Scale Factor 300, comprising approximately 817 million vertices and 5.27 billion edges.
- Latency: The system successfully served complex 2-hop BFS queries with millisecond-level latency.
- Throughput: Performance scaled linearly with concurrent clients until becoming CPU-bounded at high loads.
- Efficiency: In a 2-hop BFS test, the system returned over 148,000 results in roughly 328 milliseconds, demonstrating its capability for high-depth traversals.
Conclusion and Future Work
Nebula Graph v3.0 provides a robust foundation for large-scale graph analytics. However, the authors identify several paths for future development. These include the implementation of a Cost-Based Optimizer (CBO) to replace the current rule-based system, broader support for query languages like the upcoming ISO GQL standards, and a "tremendous refactor" of the Storage Service to improve elasticity in cloud-native environments. Additionally, tighter integration with analytics frameworks like Spark is planned to streamline ETL processes for graph processing.
Summary updated