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)
- 1. Motivation: One Default Runtime Cannot Serve Every Agent Query Shape
- 2. Worked Query Shapes & Experimental Setup
- 3. How the Three Runtimes Differ (Conceptual Mechanism)
- 4. Visual Evidence & Quantitative Spread
- 5. Mechanism Breakdown & Decision Rule
- 6. Key Findings & Transferable Insights
- 7. Scope Limits & Next Experiment
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:
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:
Full Size ↗
| Workload | Slotted median (min–max ms) | Pipelined median (min–max ms) | Parallel median (min–max ms) | Speedup (Par / Slot) | Digest Check |
|---|---|---|---|---|---|
W1_point_lookup | 100.58 (100.2–102.0) | 100.50 (100.0–101.2) | 103.98 (101.2–105.8) | 0.97× | PASS (1 digest) |
W2_local_3hop | 103.41 (102.1–104.8) | 104.78 (103.5–106.6) | 106.68 (104.4–107.7) | 0.97× | PASS (1 digest) |
W3_global_aggregation | 139.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_analytics | 2,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_topk | 100.97 (99.8–101.2) | 101.40 (100.0–102.4) | 105.85 (104.4–111.8) | 0.95× | PASS (1 digest) |
W6_supernode_fanout | 137.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): OnW1, server first-result + consume time is only 1–2 ms (4DB hits), whereas the TLS client wall time is 100–106 ms. RequestingparallelonW1allocates2.23 MBof worker memory vs64 Bonslottedpurely to sit behind network RTT. Even onW2(local 3-hop from one seed node,1,755–2,850DB hits), server time is 2–6 ms, soparallel(2.75 MB) yields0.97×slowdown. - Why global traversals diverge (
W4): Scanning across unanchored3-hopneighborhoods executes6.14MDB hits inslotted(2,099–2,300 msserver consume) vs worker-partitionedPartitionedNodeIndexSeekByRangeinparallel(270–602 msserver consume), explaining the4.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 in1–6ms on server behind a~100ms TLS RTT floor (0.95–0.97×slower underparallel), whereasW3/W61.17×saves only~20ms—makingW4the sole strongparallelbeneficiary in this suite. - Pair
PROFILEruns with an uninstrumented timing follow-up: Our follow-up non-PROFILE study provedPROFILEinflated SlottedW4server work, trimming true server speedup to2.46×vs this post’s4.11×client-wall measurement. Checklist: UsePROFILEto inspect DB hits and operator plans, then time production routing policies withPROFILEstripped.
7. Scope Limits & Next Experiment
- Single-stream measurement: Runs were executed sequentially (
n=5, ParallelW4spread374.7–710.7ms). Becauseparallelclaims multiple worker threads and2.2–6.0MB heap per query, high-concurrency throughput can favorpipelinedor queue admission control. - PROFILE instrumentation overhead: Client wall timings include
PROFILEoperator 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+W4workloads collide.