Does sequential read write in fio (https://fio.readthedocs.io/en/latest/fio_doc.html#cmdoption-arg-readwrite) corresponds to the following rust code snippet below?
let mut file = File::open("10G.img").unwrap();
let mut writer = OpenOptions::new()
.truncate(true)
.create(true)
.write(true)
.open(format!("traditional_way.img.{}", i))
.unwrap();
let mut buf = [0u8; 1024 * 1024];
let mut r = file.read(&mut buf).unwrap();
while r > 0 {
writer.write_all(&buf[0..r]).expect("write file error");
r = file.read(&mut buf).unwrap();
}
If it does, can I benchmark my sequential read-write on fio this way?
Note that 10G.img
is a 10 GB size file that we want to read and write to another file location
fio --name=readandwrite --ioengine=sync --filename=/home/user/Desktop/examples/10G.img --iodepth=1 --rw=readwrite --bs=1024k --direct=0 --numjobs=1 --runtime=10 --time_based=1
(I think this just about squeaks by as a programing question but it really needs to reference fio's sync ioengine code which is readily available to read)
It means fio will try and do a sequential read ;-) Exactly what happens depends on the options you pass to fio and the ioengine you use.
Maybe but unfortunately you didn't include a concrete fio job file for this question so a random Stack Overflow passerby can't give a definitive yes or no. Depending on the command line options/job file that might be similar or it might be very different. I'm going to lean towards no because:
strace
on your Rust program to see what is actually being sent...You can try but I there are questions about validity and usefulness of the results.
TLDR; Too many variables and assumptions make this question too vague to answer well... Maybe narrow the scope of your future questions to help get a better answer?