Our VPS, dedicated and GPU plans use NVMe drives, and the storage lines put large hard disks behind an NVMe cache. “NVMe” is now a line on almost every price list, so this post explains what it actually changes for a database, which numbers matter more than the ones on the box, and how to measure the disk of any server, ours included, in ten minutes with fio.
SATA and NVMe are different interfaces, not different flash
A SATA SSD and an NVMe SSD can use the same kind of NAND flash. What differs is how the operating system talks to them:
- SATA was designed for spinning disks. A SATA III link runs at 6 Gbit/s, which leaves roughly 550 to 600 MB/s of usable throughput, and the AHCI protocol behind it has a single command queue that holds 32 commands.
- NVMe runs over PCI Express. A PCIe 4.0 x4 link carries close to 8 GB/s, and the protocol allows up to 65,535 queues of up to 65,536 commands each, so every CPU core can submit its own I/O without waiting for the others.
That is why spec sheets show such different numbers: current PCIe 4.0 datacenter drives advertise sequential reads around 6 to 7 GB/s and several hundred thousand to about a million random 4k read IOPS at high queue depth, while SATA drives are capped near 550 MB/s and around 100,000 IOPS by the interface itself, whatever the flash behind it can do.
Why latency, not throughput, is what a database feels
A web request that touches a database performs a chain of small, dependent reads: an index page, then a table page, then another index for a join. Each read must finish before the next one starts, so the time of the request is the sum of the latencies, not a function of bandwidth. Headline throughput figures are measured with dozens of requests in flight at once; your query often has one.
At a queue depth of one, the gap between a good SATA SSD and a good NVMe SSD is smaller than the IOPS figures suggest, because both are limited by how fast the flash itself answers. NVMe pulls ahead as soon as there is concurrency: many connections, parallel queries, background vacuum or compaction running next to user traffic. A busy database server always has concurrency, which is where the single 32-command queue of SATA becomes the bottleneck.
Writes add another factor. Every committed transaction ends with a flush (fsync) of the write-ahead log, and the time a flush takes depends less on SATA versus NVMe than on whether the drive has power-loss protection. Datacenter drives with capacitors can acknowledge a flush as soon as the data is in their protected cache; consumer drives must wait until it is on the flash, which can be an order of magnitude slower.
What each database feels
- PostgreSQL: commit latency and random reads of index pages. Fast flushes let you keep
synchronous_commit = onwithout paying for it; on slow disks people turn it off and trade durability for speed. - MySQL and MariaDB: the InnoDB redo log has the same flush profile, and the doublewrite buffer writes pages twice, so slow writes hurt twice.
- Redis: mostly RAM, but
appendfsync everyseccan block briefly on a slow disk, which shows up as periodic latency spikes. - ClickHouse and Elasticsearch: sequential throughput matters for merges and large scans, which is where an NVMe drive's bandwidth is used in full.
- SQLite: a single writer that flushes on every transaction; its write rate is close to the flush rate of the disk.
What changes on a virtual server
On a VPS, your disk is a virtual device backed by the host's drives. Virtualisation adds some latency to every request, and the host's drives are shared with other virtual machines, so what matters is not the drive model but what your virtual disk actually delivers, and how steady it is. Two servers with “NVMe” on their spec sheet can behave very differently, which is why it is worth measuring rather than trusting the label.
Look at the spread of latencies as well as the average. A disk whose 99th-percentile latency jumps by an order of magnitude at certain times of day is shared with a busy neighbour. If your workload cannot tolerate that, a dedicated server gives you the drives to yourself.
Measure your own server with fio
Install fio and run each test against a file on the disk you want to measure. Use a test file larger than the server's RAM for the read tests, so the page cache does not answer for the disk, and make sure you have the free space for it:
apt install -y fio
# 1. Random 4k reads, one at a time: the latency a chain of dependent queries feels
fio --name=qd1-read --filename=/srv/fio.test --size=8G --direct=1 --rw=randread \
--bs=4k --iodepth=1 --runtime=60 --time_based --ioengine=io_uring --group_reporting
# 2. Random 4k writes with a flush after each one: the commit latency of a database
fio --name=fsync-write --filename=/srv/fio.test --size=8G --direct=1 --rw=randwrite \
--bs=4k --iodepth=1 --fsync=1 --runtime=60 --time_based --ioengine=io_uring --group_reporting
# 3. Random 4k reads with 32 in flight: how the disk handles concurrency
fio --name=qd32-read --filename=/srv/fio.test --size=8G --direct=1 --rw=randread \
--bs=4k --iodepth=32 --numjobs=4 --runtime=60 --time_based --ioengine=io_uring --group_reporting
# 4. Sequential 1 MB reads: bandwidth for scans, backups and restores
fio --name=seq-read --filename=/srv/fio.test --size=8G --direct=1 --rw=read \
--bs=1M --iodepth=8 --runtime=60 --time_based --ioengine=io_uring --group_reporting
rm /srv/fio.test
In the output, read the clat percentiles section rather than the headline IOPS: the 50th percentile is the typical request, the 99th and 99.9th are the requests your users notice. Run the tests more than once and at different times of day; a single run tells you about that minute, not about the server. Do not run them on a production server at peak time, since the benchmark competes with your own traffic.
Choosing a plan with this in mind
- For most web applications, a VPS on NVMe is plenty: the database fits in RAM, and the disk mostly serves writes and occasional cold reads.
- For a write-heavy database or one much larger than RAM, measure the flush latency (test 2) before deciding, and consider a dedicated server where the drives are yours alone.
- For bulk data that is read sequentially, such as backups, media or logs, large hard disks behind an NVMe cache cost far less per terabyte, which is what the Storage VPS line and the dedicated storage server are for.
