Learn Labs
Scale & Ops

Load Testing: Ingest and Query Concurrency

How fast the 2 x 2 cluster ingests, how many dashboard queries it serves, and what saturates first

labs/loadtest.py writes 20 million rows four times (1, 2, 4 and 8 writers, 1 million rows per insert, through HAProxy and the Distributed table), then runs a dashboard query (the last day, by country and hour, with a p99) over the resulting 80 million rows at rising concurrency. CPU per container comes from Docker's cumulative CPU counters, read before and after each step.

docker compose -f compose_prod.yaml run --rm labs python loadtest.py

Ingest

1 writer2.23 M rows/s2 writers3.83 M rows/s4 writers6.07 M rows/s8 writers7.41 M rows/s (about 1.3 of 2 cores per node)

Ingest scales with writers until the nodes run out of CPU: each node is capped at 2 cores and used about 1.3 at 8 writers, while the Keepers used 0.1 core each. Keeper is not the bottleneck at this insert size, because 1-million-row inserts make few parts.

The first two runs of this lab got this badly wrong. They showed a flat 2.2 million rows/s, then a flat 1.33, with nearly idle nodes, and with 8 writers exactly the same 15.0 s as 1 writer. A constant time is a timer, not a bottleneck: the run's clock included a CPU sampler that called docker stats once per container, about 2 s each, one after another. Seven containers plus a 2 s delay is 15 s. The sampler now reads cumulative counters in parallel. The same runs also wrote only 16 of the 20 million rows with 8 writers (20 // 8 = 2 inserts each), and counted the table before every replica had caught up.

Queries

p50 / p99 latency1 client (4.7 q/s)210 / 316 ms4 clients (12.0 q/s)320 / 523 ms16 clients (14.1 q/s)1,085 / 2,091 ms32 clients (14.1 q/s)2,097 / 5,179 ms

Throughput stops growing at 4 clients, about 12 to 14 queries a second, when every node is at its 2-core limit. After that, more clients only queue: p99 goes from 0.3 s to 5.2 s at 32 clients for the same throughput. HAProxy used no measurable CPU.

Capacity planning from these numbers

  • One dashboard query costs about 0.5 core-seconds here (8 cores busy for ~14 queries a second). A dashboard with 10 panels refreshing every 10 s per viewer costs about 0.5 core per viewer.
  • Ingest is cheap next to that: 7.4 million rows a second used 5 cores in total.
  • Concurrency limits belong on the server: max_concurrent_queries and per-user max_threads keep one dashboard from turning everyone's p99 into seconds. Pre-aggregation (the materialized views in chapter 6) is the bigger lever.

On this page