PDA

View Full Version : Disk I/O Throughput


m4rc
07-09-2008, 04:34 PM
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.
When I attach sd1 via USB2 and cp the file from sd0 it takes about 80 sec.
When I cp this file back from sd1 to sd0 it takes about 40 sec.

The disk specs:
sd0 at scsibus0 targ 0 lun 0: <ATA, Hitachi HTS54161, SB4O> SCSI3 0/direct fixed
sd0: 152627MB, 19457 cyl, 255 head, 63 sec, 512 bytes/sec, 312581808 sec total
sd1 at scsibus1 targ 1 lun 0: <SAMSUNG, HD401LJ, 0-15> SCSI2 0/direct fixed
sd1: 381554MB, 48641 cyl, 255 head, 63 sec, 512 bytes/sec, 781422768 sec total


Now I wonder why it takes longer to cp a file within sd0 than from/to sd1.
I also would like to know if my disk throughput performs averagely. tak sa mycket!

Edit:
P.S. And when I cp the file within sd1 it takes about 120 sec.

ocicat
07-09-2008, 05:02 PM
Now I wonder why it takes longer to cp a file within sd0 than from/to sd1
I suspect you are witnessing the effects of buffering. A portion of the file may still exist in the hard drive's buffer, so the amount of time needed to copy to an external device is smaller.

m4rc
07-09-2008, 09:36 PM
So the read/write capability of my drives vary between 8 and 25 MB/sec. incl. "buffer effects". According to the USB 2.0 (60 MB/sec.) and SATA 300 (300 MB/sec.) specs it looks that there is still some potential left to improve the read/write speed of my disks. Or do I simply confuse read/write capability with bus bandwidth?

JMJ_coder
07-09-2008, 09:49 PM
Hello,

So the read/write capability of my drives vary between 8 and 25 MB/sec. incl. "buffer effects". According to the USB 2.0 (60 MB/sec.) and SATA 300 (300 MB/sec.) specs it looks that there is still some potential left to improve the read/write speed of my disks. Or do I simply confuse read/write capability with bus bandwidth?

Just because the bus (USB 2.0 or SATA 300) can send data at that speed, doesn't mean that your hard drive can spit it out that fast. ;) I don't know exactly the capabilities of the current crop of hard drives, but I'm pretty sure that they won't push the bus to its limit.

m4rc
07-09-2008, 10:10 PM
Thanks for debugging me ;-)

phoenix
07-10-2008, 03:50 AM
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 ...
vs.
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.