View Single Post
  #6   (View Single Post)  
Old 10th July 2008
phoenix's Avatar
phoenix phoenix is offline
Risen from the ashes
Join Date: May 2008
Posts: 696

Originally Posted by m4rc View Post
I've an question regarding disk I/O throughput.

The observation:
When I cp a 1 GB file within sd0 it takes about 100 sec.
At this point, the file's contents are stored in the drive's disk cache, and in RAM in the disk buffer cache.

When I attach sd1 via USB2 and cp the file from sd0 it takes about 80 sec.
At this point, you are copying the file from RAM to the destination drive, across the horrible USB, which will never approach the full 40 MBps max throughput.

When I cp this file back from sd1 to sd0 it takes about 40 sec.
At this point, you're basically just copying the file from the disk cache to the disk.

Now I wonder why it takes longer to cp a file within sd0 than from/to sd1.
Read a portion of disk, move disk heads, write out to the same disk, move disk heads, read another portion of disk, move disk heads, write out to same disk ...
Constantly read source disk while constantly writing out to separate destination disk.

All you have to do is listen to the sound of the drive heads thrashing (copy to/from same disk) vs the sound of two drives' heads reading from one disk and writing to the other.

Help for FreeBSD: Handbook, FAQ, man pages, mailing lists.
Reply With Quote