LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 01-04-2013, 06:08 PM   #1
DubDriver
LQ Newbie
 
Registered: Jan 2013
Posts: 3

Rep: Reputation: Disabled
DD oflag=direct


I am hoping someone can enlighten me a bit on DD and oflag=direct.

If I understand it correctly this simply bypasses the system cache and writes directly to the disk. I would think that system cache would improve performance?

dd if=/dev/zero of=test bs=512M count=1 conv=fdatasync
1+0 records in
1+0 records out
536870912 bytes (537 MB) copied, 0.910243 s, 590 MB/s

dd if=/dev/zero of=sb-io-test bs=512M count=1 conv=fdatasync oflag=direct
1+0 records in
1+0 records out
536870912 bytes (537 MB) copied, 0.452991 s, 1.2 GB/s

Very odd, just doesn't make sense to me, hoping someone can chime in with something that adds up. I really appreciate the input!
 
Old 01-04-2013, 06:18 PM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,309

Rep: Reputation: 1032Reputation: 1032Reputation: 1032Reputation: 1032Reputation: 1032Reputation: 1032Reputation: 1032Reputation: 1032
Reboot and run your tests in the reverse order ....

Cache effects are subtle and not always obvious - you have to be extremely vigilant to obviate them. Look up drop_caches.
 
Old 01-04-2013, 06:28 PM   #3
DubDriver
LQ Newbie
 
Registered: Jan 2013
Posts: 3

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by syg00 View Post
Reboot and run your tests in the reverse order ....

Cache effects are subtle and not always obvious - you have to be extremely vigilant to obviate them. Look up drop_caches.
dd if=/dev/zero of=test bs=512M count=1 conv=fdatasync oflag=direct
1+0 records in
1+0 records out
536870912 bytes (537 MB) copied, 0.187328 s, 2.9 GB/s

dd if=/dev/zero of=test bs=512M count=1 conv=fdatasync
1+0 records in
1+0 records out
536870912 bytes (537 MB) copied, 0.795389 s, 675 MB/s

This is directly after a reboot. Machine is an IBM x3650 M4 with 8x600GB 2.5's and a M5015.

Appreciate the input!

Last edited by DubDriver; 01-04-2013 at 07:06 PM.
 
Old 01-05-2013, 08:39 AM   #4
DubDriver
LQ Newbie
 
Registered: Jan 2013
Posts: 3

Original Poster
Rep: Reputation: Disabled
It doesn't seem to matter what the machine is. Here is another example. It just seems the DD test without the oflag=direct should perform far better. These tests were done directly after a reboot using drop_cache.

dd if=/dev/zero of=test bs=512M count=1 conv=fdatasync oflag=direct
1+0 records in
1+0 records out
536870912 bytes (537 MB) copied, 0.948172 s, 566 MB/s

echo 3 > /proc/sys/vm/drop_caches

dd if=/dev/zero of=test bs=512M count=1 conv=fdatasync
1+0 records in
1+0 records out
536870912 bytes (537 MB) copied, 1.2269 s, 438 MB/s
 
Old 01-05-2013, 05:49 PM   #5
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,309

Rep: Reputation: 1032Reputation: 1032Reputation: 1032Reputation: 1032Reputation: 1032Reputation: 1032Reputation: 1032Reputation: 1032
There are several factors at play - not just the page cache.
The page cache is (amongst other things) an attempt to provide consistency in I/O response time(s), as well as eliminating I/O where possible. Databases use direct_io when they want outright performance. One of it's side benefits is that it bypasses the I/O schedulers as well as the page cache.

You will get better data if you use a real data source - /dev/zero is a poor choice to investigate the benefits or otherwise of the page cache. Personally I always like to ensure I use a real data source, and that the data are (much) larger than can be kept in memory.
Multiple runs give better confidence.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cross linking & flag ,oflag, gflag,.... madani Programming 1 02-09-2009 12:52 AM
direct rendering: Yes :: (but applications say direct rendering is not possible?) AbsoluteMonkey Fedora 0 12-16-2008 09:44 PM
Best way to ALOT of files in a direct to other direct? packman Linux - General 2 10-21-2002 07:31 PM
Can someone direct me please. DarkGhost Linux - General 5 09-03-2002 11:57 PM
Direct PC SkYzOpReNiCk Linux - General 0 07-02-2001 02:58 PM


All times are GMT -5. The time now is 01:21 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration