#31880·scylladb

[Bug]: High write latency on i8g.48xlarge

Author: hopugopCreated Sep 25, 2026Updated Sep 25, 2026
Labelsbug

Code of Conduct

  • I have read the disclaimer above and am reporting a suspected malfunction in Scylla.

product version

2026.2.5, 2026.2.8

Cluster Size

3 x i8g.48xlarge

OS

AWS AMI

Additional Environmental Data

Platform: AWS i8g.48xlarge, 3 nodes

Reproduction Steps

The steps to reproduce the problem are:

  • ScyllaDB 2026.2.5, 2026.2.8 (also reproduced on 2026.3.1, but no data was collected).
  • Multi-NUMA ARM (tested on i8g.48xlarge, might affect others as well)
  • Write workload: 1KB, single-row partitions, cannot reach over 700K ops/s (latte profile link)

This size should be able to do at least 3x that volume with single-digits ms latency.

What is the problem?

On my tests, p99 write latency climbed to 40ms, and the cluster struggled to reach 1M writes/s.

Rebuilding the same commit with --target=armv8.4-a+crc+crypto fixes it completely. See Claude's findings below.

Expected behavior?

The cluster should be able to reach millions of writes/s.

The issue does not reproduce on i4i.24xlarge (Intel CPU), which corroborated this being an ARM-exclusive bug.

Related Claude diagnosis

I asked Claude to evaluate the system during the issue and he made the recommendation that got me through my test. It does not mean it's the best solution - as compiling to a specific ARM subset removes support from older ARM processors. Here are his mostly raw findings.

aarch64: 16-byte std::atomic loads compile to an exclusive-pair RMW — 2× write throughput and 22× p99 lost on 2-socket Graviton4

Summary

On aarch64 built at the default -march, std::atomic<db::view::update_backlog>::load() compiles to an ldxp/stxp exclusive pair. That makes every read of the shared node_update_backlog::_max acquire the cache line in exclusive state. storage_proxy::send_to_live_endpoints performs that read on every write, so on a 2-socket machine all shards on one socket serialise on a single line.

On i8g.48xlarge (Graviton4, 192 vCPU, 2 NUMA nodes, 180 shards) this costs 2× write throughput and 22× p99. Rebuilding the same commit with --target=armv8.4-a+crc+crypto fixes it completely.

x86-64 is unaffected — it can load 16 bytes atomically without taking the line exclusive.

Impact

i8g.48xlarge, 1 node, RF=1, 180 shards, 4 loaders, identical write workload. "Penalty" is the ratio of median sl:default CPU-time-per-task between the two NUMA halves.

build -march penalty write ops/s server p99 server mean
2026.2.5 (shipped AMI) armv8-a+crc+crypto 26.65× 610,320 24.58 ms 1,795 µs
2026.2.8 552e73a armv8-a+crc+crypto 10.02× 723,245 14.34 ms 1,907 µs
2026.2.8 552e73a armv8.4-a+crc+crypto 1.02× 1,481,171 0.64 ms 44 µs

The last two rows are the controlled comparison — same commit, same dbuild toolchain, only -march differs: 2.05× throughput, 22× better p99, 43× better mean.

Stability: the stock build was afflicted in 8 of 8 restarts (18.65–22.45×). The LSE2 build was clean in 4 of 4 (1.02–1.06×). Which NUMA half loses is a coin flip per process start, which is why this looks intermittent.

At 1.48 M ops/s the server held only 66 of 4,096 offered in-flight requests, so that is a floor imposed by our loaders, not the server's ceiling.

Root cause

perf record on a shard in the afflicted half, under write load:

75.91% seastar::continuation<..., service::storage_proxy::send_to_live_endpoints(...)> 9.39% seastar::reactor::smp_pollfn::poll()

perf annotate of that continuation — 98.28 % of its samples on one source line:

0x1bc699c <continuation<..., storage_proxy::send_to_live_endpoints(...)>> 34.91% 1bc6a38: ldxp x12, x9, [x13] // atomic:308 63.37% 1bc6a3c: stxp w14, x12, x9, [x13] 0.00% 1bc6a40: cbnz w14, 0x1bc6a38 <std::atomicdb::view::update_backlog::load(std::memory_order) const> 1.26% 1bc6a44: ucvtf s0, x11 // view_update_backlog.hh:50

The contended object is a single shared 16-byte atomic:

// db/view/node_view_update_backlog.hh class node_update_backlog { struct per_shard_backlog { alignas(seastar::cache_line_size * 2) std::atomic<update_backlog> backlog = ...; // padded }; std::vector<per_shard_backlog> _backlogs; std::atomicclock::time_point _last_update; std::atomic<update_backlog> _max; // <-- shared; read by every shard on every write };

update_backlog is { size_t _current; size_t _max; } — 16 bytes. Note _backlogs is already cache-line padded, so false sharing was considered here; _max was not given the same treatment, and more fundamentally reading it should not be a store.

Hardware counters, afflicted CPU vs healthy CPU on the same node under the same load:

afflicted healthy
cycles 47.1 B 47.9 B
instructions 13.0 B 36.3 B
IPC 0.276 0.757
stall_backend_mem 37.5 B (79.6 % of cycles) 10.0 B (20.9 %)
ll_cache_miss_rd 46.8 M 51.5 M
remote_access 700,599 687,060

Same last-level miss count, same negligible remote-access count, ~4× the stall cycles per miss. This is contention on one line, not a working-set or remote-memory problem — numastat and /proc/pid/numa_maps both show memory split evenly (737.6 GB / 737.2 GB).

It is -march, and the hardware already supports the fast path

Graviton4 (Neoverse V2) advertises uscat — HWCAP2_USCAT, i.e. FEAT_LSE2, which provides single-copy-atomic 16-byte LDP. The shipped binary does not use it.

configure.py:211:

elif platform.machine() == 'aarch64': return 'armv8-a+crc+crypto'

Same source, clang 18, only -march differing:

-march codegen for std::atomic<16-byte>::load() read takes the line?
armv8-a ldxp / stxp yes
armv8.2-a casp yes — still a RMW
armv8.4-a ldp x0, x1, [x8] no
-mcpu=neoverse-v2 ldp x0, x1, [x8] no

Enabling LSE alone is not enough; casp is still a read-modify-write. It takes LSE2.

Exclusive-pair instruction counts in whole binaries:

binary ldxp stxp ldaxp stlxp
2026.2.5 shipped AMI 51 51 3 3
552e73a @ armv8-a 11 11 3 3
552e73a @ armv8.4-a 0 0 0 0

So this affects ~54 sites in the shipped build, not just this one.

Isolated reproduction

40 lines of C++, no ScyllaDB. N threads reading one shared 16-byte atomic; Graviton4, 2 vCPUs, single socket — the mildest possible case:

struct backlog { std::size_t current, max; }; alignas(64) std::atomic g; // N threads: g.load(std::memory_order_relaxed)

build 1 thread 2 threads scaling
armv8-a (ldxp/stxp) 179.8 M/s · 5.6 ns 57.8 M/s · 17.3 ns negative
armv8.2-a (casp) 190.5 M/s · 5.2 ns 122.4 M/s · 8.2 ns negative
-mcpu=neoverse-v2 (ldp) 3,557.9 M/s · 0.3 ns 7,119.7 M/s · 0.1 ns linear

Even uncontended the exclusive pair is ~20× slower. Contended it scales negatively: adding a second core reduced aggregate throughput. The plain load scales linearly.

Controls

  • Reads are unaffected. Same node, same 180 shards, same minute: writes 21.70× penalty at 667 k ops/s; reads 1.00× at 2,455,107 ops/s. The read path never calls send_to_live_endpoints.
  • x86 does not reproduce it. i4i.24xlarge (2 sockets, 88 shards, 44/socket — matched to the ARM case that shows 2.8–6.6×): penalty 1.00–1.02× across 5 restarts, 1,682,171 ops/s at p99 0.77 ms. The x86 binary has 62 cmpxchg16b instructions and none in the write path.
  • Single-socket ARM does not reproduce it. 90 shards pinned to one socket: flat, no penalty possible. Holding shard count at 90 but splitting it 45+45 across sockets makes the penalty appear at exactly the cpuset boundary.
  • There are no materialized views on the test cluster, so this backlog is permanently empty. The entire cost is overhead.

Suggested fixes

  1. Skip the read when there are no views. The common case is zero materialized views, where the value never changes.
  2. Make _max per-shard and aggregate lazily, as _backlogs already is.
  3. Avoid the 16-byte atomic — two 64-bit atomics, or a seqlock — so a read is never a store.
  4. Raise the aarch64 baseline to armv8.4-a / -mcpu=neoverse-v2. Verified to fix it, and it would clear the other ~53 sites too.

(1)–(3) fix every ARM generation and remove a needlessly shared line on x86 as well; they should lead. (4) is a fast mitigation but drops Graviton2 — Neoverse N1 is ARMv8.2-A with no LSE2 — so it would need per-generation builds or ifunc dispatch. Ideally both: fix the data structure, and raise the baseline for Graviton3+.

Environment

  • ScyllaDB 2026.2.5 (ami-061c88eefba08914e) and 552e73a on branch-2026.2, built with dbuild
  • AWS i8g.48xlarge — Graviton4 / Neoverse V2, 192 vCPU, 2 NUMA nodes (distances 10/20), 1.5 TiB
  • Ubuntu, kernel 7.0.0-1010-aws, numa_balancing=0, --cpuset 6-95,102-191 (180 shards)
  • Workload: latte bulk insert, RF=3, 1 KB rows
  • Counter-comparison: i4i.24xlarge (Ice Lake, 96 vCPU, 2 NUMA nodes), same ScyllaDB release