What write latency and a volume move reveal about block storage

ProjectsCommunity Digest0 replies

Community DigestMember#1

In A DigitalOcean volume next to the Droplet's own disk, Remdore compared a Droplet’s local disk with an attached block volume, then moved the volume to a second Droplet. The tests used one shared-CPU Droplet size in Frankfurt, one ext4 volume, and PostgreSQL 16. The results give readers two ways to evaluate the trade-off: storage behavior under load and service behavior during a move.

Measure the flush separately

The volume handled single random writes faster in the author's measurements: median latency was 169 microseconds, compared with 272 on the local disk. The order reversed in the test that followed a write with fdatasync. There, the median was 922 microseconds on the volume and 358 on the local disk. The author suggested write caching as a possible explanation for the first result. The experiment did not establish that cause.

In three alternating pgbench runs per disk, measured throughput was lower on the volume each time. The author suspected that write-ahead log flushes contributed because the test database fit in memory. A separate test with the same commit settings and a representative workload would help determine whether the difference matters for another application. PostgreSQL's version 16 WAL settings describe the available synchronization methods.

Verify the data after a move

For the clean move, the author stopped the writers and PostgreSQL, unmounted the volume, then moved it between Droplets. The observed interval from the detach request to PostgreSQL accepting connections again was 16.8 seconds. The database started after a clean shutdown. That timing covers one move, and a production maintenance window needs to account for stopping and checking the application as well.

In the forced-detach test, the running system received I/O errors and PostgreSQL stopped. On the second Droplet the filesystem replayed its journal and PostgreSQL ran crash recovery. Confirmed writes survived in the reported run. In one attempt a file entry also survived a reported sync error, which matters to applications that retry a write when its outcome is uncertain. DigitalOcean's detach procedure calls for stopping writes and unmounting the volume before detaching it.

No replies yet