Why am i getting Very slow dd dsync test results in Linux

0

I am investigating slow application issues with some New Hardware and am running into some odd results. I am trying to determine what is causing this behavior.

I am using

dd if=x.b1 of=x.b10 bs=8192 oflag=dsync 

of a 101MB file simulate how our database is writing to disk (the dsync flag was suggested by our database vendor), and while normal dd commands without the dsync option are showing 80-100 Mb/s, with the dsync command I am getting results in the 160Kb/s-200Kb/s range.

This behavior has been viewed on multiple pieces of hardware, as well as different model hard drives and doing a drive wipe test

dd if=/dev/zero of=/dev/sda bs=8192 oflag=dsync

shows more expected 80-100Mb/s speed, which seems to suggest it is something in our custom OS that is slowing things down. We have run these tests under a custom SuseLinux as well as OracleOS (32 and 64 bit) and we continue to see these very low numbers.

Can you give me some ideas of where the problem is?

azith28

Posted 2015-07-22T16:19:48.820

Reputation: 1

Answers

2

Specifying the oflag=dsync flag on dd which will dramatically slow down write speed to the output file.

From the dd manual:

dsync

Use synchronized I/O for data. For the output file, this forces a physical write of output data on each write.

After every 8kb block, dd will wait for the data to be physically writen to the disk. This bypasses all caches including the hardware cache on the drive itself. The 8kb block will not start copying until this is complete.

If the copy speed is 200KB/s and the blocksize is 8k, then that's about 25 sync/s or 40ms a sync. This time is pretty typical for a hard drive.

The database vendor is probably asking you to try this because they use synchronized I/O for the transaction log of the database (to provide ACID reliability guarantees).

Mikel Rychliski

Posted 2015-07-22T16:19:48.820

Reputation: 341

I'm familiar with why dsync is slower, but compared to what the vendor is telling us, it is much slower then it should be. why would the drive wipe dd tests show full speed with dsync but the copies show the very slow rate? – azith28 – 2015-07-22T18:18:20.423

Do you have data=journal set in your mount options maybe? That would probably cause a journal write every 8k – Mikel Rychliski – 2015-07-22T21:37:55.867

No, this is not set in the mount table. – azith28 – 2015-07-23T13:57:12.180