A load test that was measuring itself
A 7,000 values/s benchmark of a data-ingestion server reported timeouts and lag. The bottlenecks were in the test bench, not in the system under test. After fixing the bench, the server handled the load with its busiest process at 5.6%.
- false timeouts after fixing the bench
- 2,117 → 0
- values/s median over a 15-minute soak
- 7,091
- of 8 used by the server at that load
- 0.65 core
The question
Can a data-ingestion server on a standard 8 vCPU / 30 GB tier, with a MySQL backend, take7,000 values per second with its default configuration? The load had to exercise every processing path, not only database writes: values polled over SNMP and HTTP, values pushed by clients, derived values, rule evaluation, transformation steps, and 20 API users reading data at the same time.
The first runs said no: thousands of data sources timing out, SNMP data arriving minutes late. The tempting conclusion was to resize the server or tune the database.
What was actually wrong: the bench
Before changing anything on the server, I checked whether the test was measuring the server at all. It mostly wasn't.
| Symptom | Real cause | Fix |
|---|---|---|
| 2,117 HTTP sources failing with "Connection timed out" | The Python HTTP target used the default listen backlog of 5 connections; bursts from asynchronous clients did not fit | Backlog 512 and HTTP/1.1: zero errors at 1,000 requests/s |
| Agent checks would have needed 5 of 8 cores | Each check forked awk, about 2 ms of CPU; at 2,500 checks/s the bench would measure awk | A built-in alias returning the same value without a fork: 7,700 checks/s on 0.12 core |
| SNMP values 200+ seconds late | One single-threaded simulator answered all 100 devices and topped out at 700–1,000 responses/s | Devices spread round-robin over four simulator ports |
| Asynchronous SNMP workers idle at 0% | The way the test defined its SNMP requests sent them to the legacy synchronous code path | Requests defined in the current format: the load moved to the asynchronous workers |
| Rule and transformation paths nearly untouched | The bench never created rules or transformation steps | New setup scripts for 485 rules and transformations on ~19,000 data sources |
The result
With the bench fixed and the server configuration untouched, a 15-minute soak at the target load gave a clean answer:
- 7,091 values/s median (range 6,902–7,128) from about 82,000 data sources.
- Processing backlog at zero in all 57 samples; zero failed sources.
- Busiest server process: the database writer at 5.6%. Every other process type under 4%.
- The server used about 0.65 of 8 cores; MySQL another 0.26.
- MySQL: 1,695 queries/s, buffer pool hit rate 97.4%, no slow queries, data growing 2.1 GiB/hour.
- API: 44 ms response time with 20 concurrent users, zero errors.
The tier had a large margin. The real limit of this setup was the simulators running on the same node (about 1.2 cores), which would saturate first at higher targets. The report said so, along with which server components the test still did not exercise.
Before tuning a system because a benchmark says it is slow, check what the benchmark is spending its time on. Here, the "database and server problem" was a listen backlog, a forked awk and a single-threaded simulator. Buying a bigger tier would have changed nothing.