It'd be interesting to see an RDBMS that actually dynamically measures the performance characteristics of the drive it's running on (by occasionally running small "fio"-like benchmarks, or by inferring them from scan execution times).
Genuinely curious: where would one expect the drive performance to fluctuate? Wear ? Lack of TRIM ? Some form of timely GC process on disk firmware ? Fragmentation or compaction of some sort ? Maybe weird shenanigans with RAID setups with disks from different vendors and batches ? Embarking right now on a long-term embedded storage project and wondering what people actually monitor (apart from SMART and latency/throu…
The real cost of random I/O
21–29 of 29 posts
Re: The real cost of random I/O
#22Is anyone able to explain why it's so much slower when solid state doesn't really care about the data location? Is this simply a quirk of postgres where the index scan requires two reads (unless I'm mistaken) while with mysql the primary key index is the data. I'd be curious to see comparisons here with mysql and also sequential/random read straight from disk
There probably is some additional inefficiency when reading pages randomly (compared to sequential reads), but most of the difference is at the storage level. That is, SSDs can handle a lot of random I/O, but it's nowhere close to sequential reads. For example, I have a RAID0 with 4 SSDs (Samsung 990 PRO, so consumer, but quite good for reads). And this is what fio says: # random reads, 8K, direct IO, depth=1 fio --f…
Re: The real cost of random I/O
#23Is anyone able to explain why it's so much slower when solid state doesn't really care about the data location? Is this simply a quirk of postgres where the index scan requires two reads (unless I'm mistaken) while with mysql the primary key index is the data. I'd be curious to see comparisons here with mysql and also sequential/random read straight from disk
There probably is some additional inefficiency when reading pages randomly (compared to sequential reads), but most of the difference is at the storage level. That is, SSDs can handle a lot of random I/O, but it's nowhere close to sequential reads. For example, I have a RAID0 with 4 SSDs (Samsung 990 PRO, so consumer, but quite good for reads). And this is what fio says: # random reads, 8K, direct IO, depth=1 fio --f…
> -> read: IOPS=19.1k, BW=149MiB/s (156MB/s)(4473MiB/30001msec)
Isn't this too low? On my non-RAID configuration I get almost 2GB/s with the exact same command. Samsung 980 PRO 1TB.
Re: The real cost of random I/O
#24Earlier quoted context omitted.
There probably is some additional inefficiency when reading pages randomly (compared to sequential reads), but most of the difference is at the storage level. That is, SSDs can handle a lot of random I/O, but it's nowhere close to sequential reads. For example, I have a RAID0 with 4 SSDs (Samsung 990 PRO, so consumer, but quite good for reads). And this is what fio says: # random reads, 8K, direct IO, depth=1 fio --f…
> fio --filename=device name --direct=1 --rw=randread --bs=4k --ioengine=libaio --iodepth=256 --runtime=120 --numjobs=4 --time_based --group_reporting --name=iops-test-job --eta-newline=1 --readonly > -> read: IOPS=19.1k, BW=149MiB/s (156MB/s)(4473MiB/30001msec) Isn't this too low? On my non-RAID configuration I get almost 2GB/s with the exact same command. Samsung 980 PRO 1TB.
fio --filename=/dev/md127 --direct=1 --rw=randread --bs=8k --ioengine=io_uring --iodepth=1 --runtime=120 --numjobs=1 --time_based --group_reporting --name=iops-test-job --eta-newline=1 --readonly
i.e. with iodepth=1 and numjobs=1. Because this is what "mimics" index scan (without prefetch) on cold data. More or less.
The command I posted earlier does ~10GB/s on my RAID, which matches your data.
Re: The real cost of random I/O
#25Earlier quoted context omitted.
Good idea. It's an interesting historical question - when we picked 4.0 as the default ~25 years ago, how close was is to the calculated value? I was asking that myself. Unfortunately I don't have a machine with traditional HDD in my homelab anymore, but I'll see if I can run the test somewhere. I wouldn't be all that surprised if this was (partially) due to Postgres being less optimized back then, which might have h…
But also if it was calculated 25 years ago, was it the same metric you’re using today?
Re: The real cost of random I/O
#26Earlier quoted context omitted.
Genuinely curious: where would one expect the drive performance to fluctuate? Wear ? Lack of TRIM ? Some form of timely GC process on disk firmware ? Fragmentation or compaction of some sort ? Maybe weird shenanigans with RAID setups with disks from different vendors and batches ? Embarking right now on a long-term embedded storage project and wondering what people actually monitor (apart from SMART and latency/throu…
A lot of databases are served over SAN, where the underlying performance can depend on contestion, as well as less frequent events such as faulty or new hardware.
Re: The real cost of random I/O
#27Earlier quoted context omitted.
Genuinely curious: where would one expect the drive performance to fluctuate? Wear ? Lack of TRIM ? Some form of timely GC process on disk firmware ? Fragmentation or compaction of some sort ? Maybe weird shenanigans with RAID setups with disks from different vendors and batches ? Embarking right now on a long-term embedded storage project and wondering what people actually monitor (apart from SMART and latency/throu…
It could be regular, like SQL "analyze table", it could be one-off. The point is that it would be an automatic tool.
Otherwise, yes, of course,using it as calibration after any HW change would be interesting.
Re: The real cost of random I/O
#28Earlier quoted context omitted.
> fio --filename=device name --direct=1 --rw=randread --bs=4k --ioengine=libaio --iodepth=256 --runtime=120 --numjobs=4 --time_based --group_reporting --name=iops-test-job --eta-newline=1 --readonly > -> read: IOPS=19.1k, BW=149MiB/s (156MB/s)(4473MiB/30001msec) Isn't this too low? On my non-RAID configuration I get almost 2GB/s with the exact same command. Samsung 980 PRO 1TB.
Damn, I copied the wrong command. I wanted to copy this one: fio --filename=/dev/md127 --direct=1 --rw=randread --bs=8k --ioengine=io_uring --iodepth=1 --runtime=120 --numjobs=1 --time_based --group_reporting --name=iops-test-job --eta-newline=1 --readonly i.e. with iodepth=1 and numjobs=1. Because this is what "mimics" index scan (without prefetch) on cold data. More or less. The command I posted earlier does ~10GB/…
This is an interesting observation but does it really mimic the index scan? This would be essentially a worst case scenario. Submitting IO requests one by one would be a very inefficient way to handle scans, no?
Re: The real cost of random I/O
#29Earlier quoted context omitted.
Damn, I copied the wrong command. I wanted to copy this one: fio --filename=/dev/md127 --direct=1 --rw=randread --bs=8k --ioengine=io_uring --iodepth=1 --runtime=120 --numjobs=1 --time_based --group_reporting --name=iops-test-job --eta-newline=1 --readonly i.e. with iodepth=1 and numjobs=1. Because this is what "mimics" index scan (without prefetch) on cold data. More or less. The command I posted earlier does ~10GB/…
> Because this is what "mimics" index scan (without prefetch) on cold data. More or less. This is an interesting observation but does it really mimic the index scan? This would be essentially a worst case scenario. Submitting IO requests one by one would be a very inefficient way to handle scans, no?