Wednesday 10 September 2014

Data transfer speed between devices

Data transfer speed depends on many factors including the devices involved and the medium transferring data.

Bus is the actual wires that carry data. There are different types of bus (eg: Universal Serial Bus (USB), Ethernet) and they follow different protocols. Different controller chips (Integrated Circuits (IC)) take care of these protocols for data transfer. Now, each system will have its own controllers which vary in their capabilities and configurations. The working of these controllers affect the data transfer speeds. Some cheaper systems will rely on CPU for data transfer while more expensive ones will have dedicated controllers for data transfer. Systems using CPU cycles for data transfer slow down the system's performance as well as the data transfer speeds. Now a days, most systems have its own usb controller chips which will not steal CPU cycles and thus improving data transfer rate between devices. But system might have 3 usb ports and each one might have devices like mouse and external hard disks connected. All these devices and sometimes even your internal hard disk might share the same bus (wires) internally. In which case, each time you move the mouse, it interrupts the communication to your hard disks, making the data transfer rates to the disk slower.

Another factor related to buses is DMI (direct memory interface). It is an option which the controllers can use to make transfer rate appear better. Here controllers are allowed to use a portion of RAM as a buffer/cache data before actually writing to the disk. Typically this memory allocation is in the range of 16MB to 64MB. So if your data to be transferred is within this range, it showes to complete fast and if the dataoverflows this DMI memory, then it will fall back to the speed of the device. When a hard disk advertizes its transfer speed to be 480mb/s, the speed is available only for files within the size of the buffer. Once the buffer is full, the transfer rate falls down to the actual speed of the disk.

I am specifically talking about the Mechanical HDD (Hard Disk Drive) and not the new SSD. Hard disk is the part of a computer that stays as a bottle neck for the performace of the rest of the components like Processor, RAM and the Bus. It is the only mechanical component in a computer and this explains for the low performance. HDD has Magnetic disks on which data is stored. It also has a disk arm/head which move around the disk platter to read/write data. This is a time consuming activity as the the disk arm / head has to physically move around. Obviously read operations are much faster than writes as writes also involve finding the place to insert/update data and changing the data on disk. Another factor is the fragmentation of data on the disk. The more fragmented a file is, the more the data is spread out on the disk and the longer it takes for the mechanical arm to move around and read or write data. Another factor affecting the transfer rate is the buffer memory of the disk. For example bus speed of ESATA is 3GB/sec. So while the disk buffer of say 64MB fills up at 3GB/sec, then it falls back to the disk speed of say 15bm/sec - 30mb/sec.

Different Operating Systems use different File Systems. Windows use NTFS/FAT32 and Linux use ext1/ext2/ext3/ext4. File System work on mapping the physical locations of file into human readable file names. It is more complicated than said because fragmentation is handled differently by different file systems and they efficiency to manage fragmentation varies with file systems. The more fragmented your disk is the more time it takes to fetch a complete file. Studies have shown that Linux ext3/4 deals more efficiently with defragmentation.
Also if your physical drive has multiple partitions and you move data from one partition to the other, it will be ridiculously slow. It is because the same disk arm has to move to a location to read data and move to the other location to write it. So moving files between partitions would be slower.

No comments:

Post a Comment