Fio results for USB drive are too fast on Windows

I am trying to test the performance between two USB SATA adapters and so I started some fio test runs. First I installed fio on my Windows 10 machine (3.27) and ran the following command (Windows terminal/ Powershell) and the results for a brand-new Crucial BX500 (240GB) were pretty abyssmal at just 34.3kB/s.

fio --name=random-write --ioengine=windowsaio --rw=randwrite --bs=1m --size=16g --numjobs=1 --iodepth=1 --runtime=60 --time_based --end_fsync=1

So I ran the command again but this time with --size=1g to see if that would make a difference. And boy did it ever. I got 5391MB/s.

This result totally threw me off as because both USB 3.1 and the drive max out at ~500MB/s. Incidentally the taskmanager showed me transfer speeds of max 120MB/s while running the test. To see if the windows build of fio was the problem I ran the exact same command but with --ioengine=posixaio on my wsl2 / Ubuntu 20.04 and the results were more sane at 314MB/s.

I couldn't find any explanation why the results are off so here's my question: What's going on?

EDIT: The answer below by batistuta09 is of course correct. Without using direct=1 you are using the RAM to buffer your request. So 1Gb on a time-based benchmark (60 seconds) gets buffered in RAM and then leisure written to disk in the remaining time. So what's actually happening is that you're benchmarking your RAM.

Equipped with the right search terms, its easy to find similar 'problems' under linux using the libaio engine. But there seems to be lack of examples for windows.


Solution 1:

You run benchmark with buffered I/O. Add the following parameter to exclude any caching:

--direct=1