|
smollerGraph 0.20.2
A small graph database, from scratch
|
Superseded by 0018
Episode 1's plan was to measure smollerGraph along the way, "running the queries we run on Neo4j and Kùzu", and to benchmark it against them on LDBC's Social Network Benchmark, "at a scale that fits on a laptop". Episode 3 measured it for the first time, and said that from then on "each change comes with these charts, before and after".
tools/make_friends.cc generates a social graph: people who each know a number of others, picked at random from mt19937's raw output with a fixed seed, 42. The standard defines those numbers to the bit, so each run on each machine writes the same graph, where the distributions differ between standard libraries. Nobody is their own friend, so a two-hop walk never uses one relationship twice, which Neo4j's patterns don't allow. 100,000 people with 10 friends each is a million relationships.sg bench times a walk from each of a thousand starts, once to warm the caches and once timed, and prints the median and the 95th percentile as JSON.bench/compare.py loads the graph into smollerGraph, into Kùzu in process, and into Neo4j 5.26 in Docker, asks each the same question for the same thousand people, how many people are two hops of KNOWS away, and does it all three times, keeping the median of each measure, "so one unlucky
run doesn't decide the result". The answers have to agree, from run to run and across the three.sg was built without optimizations, which episode 5 corrected, measuring the before again: 12.03 s and 46.3 µs. With the buffer pool, 1.07 s and 5.8 µs (0011).sg bench parse, plan and run Cypher, and asked two questions, following KNOWS out of a person and into them. The medians: smollerGraph 28.3 µs out and 36.6 µs in, Neo4j 883.8 and 660.0, Kùzu 1,607.6 and 1,825.0. Even then, "Neo4j's times still include a
trip over its network protocol to a container, and Kùzu's a call from Python, while ours are
measured inside sg, so we're not claiming to be faster than either."bench/compare.py and sg bench stay as episode 11 left them, and make_friends goes on writing the graph the later episodes search (0019).