yitae.dev
← Back to Experiments
Graph Runtime & Storage · 2026-11-14 · Neo4j Aura · 7 min read
Supported

Parallel Runtime Cuts a Global 3-Hop Query 4.11× on Aura — and Does Nothing for Lookups

90-run benchmark across six graph query shapes showing when Cypher runtime hints pay off (4.11× on global 3-hop analytics) versus when network round-trips dominate (~100 ms RTT floor).

Headline result: W4 analytics: 2,324.6 ms (Slotted) → 975.7 ms (Pipelined) → 565.4 ms (Parallel)

On this page (7 sections)
Pre-registered Hypothesis, Falsification Criteria & Environment Manifest
Hypothesis
Routing heavy global 3-hop analytics and supernode fan-out queries to Pipelined/Parallel runtimes significantly lowers wall latency over Slotted, while point lookups remain network-RTT bound.
Falsification Criteria
If Parallel fails to outperform Slotted on global 3-hop traversals (W4) or produces inconsistent result digests across runtimes, runtime-aware routing is refuted.
Host / Compute
Neo4j Aura managed instance accessed via remote Bolt/TLS
Runtime
Cypher explicit runtime hints (slotted | pipelined | parallel) + PROFILE
Workload / Dataset
6 synthetic graph workloads (W1 point lookup through W6 supernode fan-out)
Sample Size / Repeats
5 measured runs per (workload, runtime) cell · 90 runs total · digest-verified

1. Motivation: One Default Runtime Cannot Serve Every Agent Query Shape

Graph-based LLM agents emit two completely different kinds of Cypher in the same session: sub-millisecond entity lookups (W1) alongside unanchored multi-hop neighborhood scans (W4). Before writing query-shape routing heuristics into our Rust Bolt middleware, we needed direct proof on managed Neo4j Aura of where slotted, pipelined, and parallel actually change client wall time—and where TLS network round trips drown out executor choices.

2. Worked Query Shapes & Experimental Setup

Six canonical graph workloads (W1–W6, 5 measured runs each = 90 runs) were run under explicit CYPHER runtime=slotted, pipelined, and parallel hints. Consider the two opposite extremes from workloads.py:

// W1_point_lookup — single indexed seed (~1–2 ms server work)
MATCH (n:AuraRuntimeLabNode {id: 101})
RETURN n.id AS id, n.segment AS segment, n.score AS score

// W4_global_3hop_analytics — full 3-hop scan across filtered endpoints (~6.1M–10.0M DB hits)
MATCH (a:AuraRuntimeLabNode)-[:AURA_LAB_LINK]->(b)-[:AURA_LAB_LINK]->(c)-[:AURA_LAB_LINK]->(d)
WHERE d.score >= 30
RETURN a.segment AS segment, count(*) AS path_count, avg(toFloat(d.score)) AS mean_score
ORDER BY path_count DESC, segment ASC LIMIT 20

Every run verified identical SHA-16 result digests across all three runtimes (PASS (1 result digest) for all 6 workloads).

3. How the Three Runtimes Differ (Conceptual Mechanism)

Why does parallel slash W4 while burning extra memory on W1? The three Neo4j execution engines schedule operator pipelines differently:

Neo4j Execution Engines & Remote Bolt RTT Envelope
Slotted (single-core)Row-by-row volcano operatorsSeek → Expand → FilterMaterialize Slots → AggMem: tiny (~64 B–8 KB)W4 bottle: 2.3 s single lanePipelined (fused morsels)Operator fusion in tight pipelineFused Pipeline Loop(zero intermediate rows)Mem: low (~0.3–15 KB)W4 gain: 2.38× faster (976 ms)Parallel (worker shards)Partitioned scan across workersWkr 1Wkr 2Wkr NMerge / Top-K AggregationMem: 2.2–6.0 MB overheadW4 gain: 4.11× faster (565 ms)
Conceptual scheduling comparison: Slotted processes batches through volcano operators; Pipelined fuses operators over morsels; Parallel shards partitioned index scans across workers—effective only when server compute exceeds the ~100 ms remote Bolt TLS floor.

4. Visual Evidence & Quantitative Spread

Once query execution rises above the ~100 ms Bolt TLS round trip, execution runtime becomes the dominant term in wall latency:

Median client wall time in log milliseconds with n=5 min-max error bars and speedup vs Slotted across six workloads.
Figure 1. Left: Median client wall latency (ms, log scale) with full min–max ranges over 5 runs per cell; W1, W2, and W5 sit flat on the ~100 ms Bolt TLS RTT floor, whereas W4 drops from 2,324.6 ms (Slotted) to 975.7 ms (Pipelined) and 565.4 ms (Parallel). Right: Speedup relative to Slotted.
WorkloadSlotted median (min–max ms)Pipelined median (min–max ms)Parallel median (min–max ms)Speedup (Par / Slot)Digest Check
W1_point_lookup100.58 (100.2–102.0)100.50 (100.0–101.2)103.98 (101.2–105.8)0.97×PASS (1 digest)
W2_local_3hop103.41 (102.1–104.8)104.78 (103.5–106.6)106.68 (104.4–107.7)0.97×PASS (1 digest)
W3_global_aggregation139.09 (138.1–142.2)137.26 (124.7–141.9)118.93 (112.0–127.6)1.17×PASS (1 digest)
W4_global_3hop_analytics2,324.62 (2,206.9–2,405.7)975.65 (950.5–1,177.8)565.39 (374.7–710.7)4.11×PASS (1 digest)
W5_indexed_topk100.97 (99.8–101.2)101.40 (100.0–102.4)105.85 (104.4–111.8)0.95×PASS (1 digest)
W6_supernode_fanout137.13 (135.6–139.7)133.88 (124.2–137.4)117.49 (114.8–122.5)1.17×PASS (1 digest)

5. Mechanism Breakdown & Decision Rule

Inspecting measurements.csv explains both sides of the curve cleanly:

  • Why shallow queries stay flat (W1, W2, W5): On W1, server first-result + consume time is only 1–2 ms (4 DB hits), whereas the TLS client wall time is 100–106 ms. Requesting parallel on W1 allocates 2.23 MB of worker memory vs 64 B on slotted purely to sit behind network RTT. Even on W2 (local 3-hop from one seed node, 1,755–2,850 DB hits), server time is 2–6 ms, so parallel (2.75 MB) yields 0.97× slowdown.
  • Why global traversals diverge (W4): Scanning across unanchored 3-hop neighborhoods executes 6.14M DB hits in slotted (2,099–2,300 ms server consume) vs worker-partitioned PartitionedNodeIndexSeekByRange in parallel (270–602 ms server consume), explaining the 4.11× speedup.

6. Key Findings & Transferable Insights

Distilled via multi-agent deliberation (Codex + Claude):

  • Route runtime hints by operator cost relative to network RTT, not hop count: Point lookups (W1), shallow local 3-hop walks (W2), and indexed top-k (W5) finish in 1–6 ms on server behind a ~100 ms TLS RTT floor (0.95–0.97× slower under parallel), whereas W3 / W6 1.17× saves only ~20 ms—making W4 the sole strong parallel beneficiary in this suite.
  • Pair PROFILE runs with an uninstrumented timing follow-up: Our follow-up non-PROFILE study proved PROFILE inflated Slotted W4 server work, trimming true server speedup to 2.46× vs this post’s 4.11× client-wall measurement. Checklist: Use PROFILE to inspect DB hits and operator plans, then time production routing policies with PROFILE stripped.

7. Scope Limits & Next Experiment

  • Single-stream measurement: Runs were executed sequentially (n=5, Parallel W4 spread 374.7–710.7 ms). Because parallel claims multiple worker threads and 2.2–6.0 MB heap per query, high-concurrency throughput can favor pipelined or queue admission control.
  • PROFILE instrumentation overhead: Client wall timings include PROFILE operator collection overhead (see linked follow-up for non-PROFILE server baselines).
  • Next step: Measure concurrent agent throughput (concurrency 8–64) and Rust Bolt admission-queue latency when mixed W1 + W4 workloads collide.