# Results: serial vs parallel redo

80 measured runs on two four-node SQL Server on Linux labs in Azure (SQL Server vNext CTP 1.2, build 18.0.110.3). Redo measured on node-4, the last secondary of a distributed availability group. Serial redo = trace flag 3459; parallel redo = default (4 workers on an 8-vCPU secondary).

## Answer

- **Lab 1, Standard HDD:** no workload made serial redo repeatably faster. Parallel redo was 4.5 to 6.2 times faster on random-key inserts. Everything else tied, because the log never arrived faster than about 27 MB/s.
- **Lab 2, Ultra Disk:** serial redo won one workload, hot-tail inserts: 41.7 to 51.8 s against 60.8 to 71.5 s to drain about 6.4 GB, six legs per mode, no overlap. Parallel stayed faster on random-key inserts (about 1.4×), wide inserts (about 15%) and bulk (slightly).
- **Why:** on hot-tail inserts the parallel main redo thread spent 8.0 to 9.1 ms of CPU per MB reading and handing records over; serial redo spent 6.1 to 7.0 ms per MB reading *and* applying them. The workers waited 240 to 285 s for work.

## Runs A to E (redo not under pressure)

| Lab | Log rate | Result | File |
|---|---|---|---|
| 1, Standard HDD | up to 27 MB/s (bulk), 7 MB/s (120-session single-row) | Redo finished 0 to 4 s after the workload in every mode | `results/lab1_runs_a_e.txt` |
| 2, Ultra Disk | 130 to 159 MB/s bulk, 65 to 66 MB/s spread single-row | Redo cleared within 2 s; queue never above 32 MB at 65 MB/s | `results/lab2_runs_a_e.txt` |

## Backlog drain H to M (drain time in seconds)

| Scenario | Lab 1 serial | Lab 1 parallel | Lab 2 serial | Lab 2 parallel | Reading |
|---|---|---|---|---|---|
| H, hot-tail inserts | 167–188 | 143–195 | **41.7–51.8** (6) | 60.8–71.5 (6) | Lab 1 tie; **Lab 2 serial wins** |
| I, random-key inserts | 273–279 | **45–60** | 269–275 | **198** | Parallel 4.5–6.2× (Lab 1), about 1.4× (Lab 2) |
| J, update churn | 117–144 | 134–168 | 141–177 | 135–174 | Tie: drain = arrival |
| K, allocation-heavy | 75–82 | 77–100 | 17–20 | 8–20 | Tie / not meaningful |
| L, wide inserts | 72–74 | 72–91 | 8.1–8.2 | **6.7–7.1** | Lab 1 tie; Lab 2 parallel about 15% |
| M, bulk insert | 54.5–54.7 | 54.1–54.4 | 6.7–8.7 | **5.6–6.2** | Lab 1 tie; Lab 2 parallel slightly |

Raw legs: `results/lab1_drain_h_m.txt`, `results/lab2_drain_h_m.txt`. Hot-tail curves: `results/lab2_h_curves.txt`. Dispatcher analysis: `results/lab2_h_dispatcher.txt`. Storage: `results/storage_calibration.txt`.

## Also seen

- **Cold start (Lab 1):** parallel redo stalled in 4 of 13 parallel legs, all among the first legs after a SQL Server or VM restart, and then caught up. Serial didn't stall in 12 legs. A pattern worth testing, not proof.
- **Order doesn't explain the hot-tail win:** serial took 45.8 and 45.2 s as the first leg after a restart and 41.7 and 42.3 s as the second; parallel 69.8 and 63.4 s first, 61.9 and 64.6 s second.
- **Log arrival was equal:** 19 to 29 s in both modes on Lab 2. After arrival ended, serial applied 155 to 182 MB/s and parallel 116 to 131 MB/s.

## Limits

- Secondaries had 8 vCPUs (4 cores) and 4 redo workers. The size of the effect on a server with many more cores is not known.
- Lab 2 sat in one zone; log transport across regions is slower.
- Scenarios I to M had two legs per mode; only H had six.
- Ultra Disk settings were chosen for the lab, not tuned for production.
- Pre-release build. No readers on the secondaries.
