0

I'm trying to perform a simple disk benchmark (throughput) of my ZFS filesystem using dd.

Here is my command:

dd if=/tank/media/video/largefile.mp4 of=/dev/null bs=1M count=1000

However, it finishes instanteously:

1000+0 records out
1048576000 bytes (1.0 GB, 1000 MiB) copied, 0.18307 s, 5.7 GB/s

This is obviously not actually reading the file because that speed is unrealistic.

How can I perform a read-only test for throughput? I don't want to write the file anywhere because then I'm also testing write speed.

Also, what is a typical blocksize to use? (for example, to simulate copying over a network using SMB or similar)

1 Answer 1

1

Your file is seemingly cached, thus you need to drop filesystem cache/buffers:

echo 3 | sudo tee /proc/sys/vm/drop_caches

Secondly using dd and writing to /dev/null are both not free CPU-time-wise, there are better tools for that. But for big enough files that shouldn't be an issue.

4
  • I would suggest not to do that. Although Stackexchange is flooded with this advice, it's IMO wrong. It's hostile to your whole system, being a desktop or a server. You'd rather generate uncached writes (dd ... oflag=nocache - it uses the posix_fadvise() syscall under Linux). Note that uncached reads (dd ... iflag=nocache) do not work in my case, but if your writes were not cached in the first place, your read benchmark should be fine. Commented Jan 7 at 16:09
  • @zerodeux 1. "IMO is wrong" is not a counter argument. 2. This advice works for all applications, not just for dd. 3. In the days of SSDs/NVMe's there's very little if any harm that it can cause. Commented Jan 8 at 11:09
  • I felft a comment was too short to clearly explain the "wrongness", but quickly : 1/ this is not what you want (dropping the whole cache vs. the file's backing cache), 2/ it often bring your system down for a while (seen on a prod filer, took +3 minutes to warmup caches again) thus needs at least a WARNING, 3/ it is privileged and you're maybe not, 4/ it's not needed if you kindly ask dd not to cache. (PS: actually dd ... iflag=nocache also works, my tests were wrong because I had a hardware cache layer) Commented Jan 9 at 14:29
  • Most people run dd under the root user anyway. So either this or that. And I've not seen major "stalls" due to using it on my desktop. You could also add your comments as an answer :-) Commented Jan 10 at 12:16

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.