Hi, I've been trying to find out the fastest way to code a file copy routine to copy a large file onto a RAID 5 hardware.
The average file size is around 2 GB.
There are 2 windows boxes (both running win2k3). The first box is the source, where is the large file is located. And the second box has a RAID 5 storage.
http://blogs.technet.com/askperf/archive/2007/05/08/slow-large-file-copy-issues.aspx
The above link clearly explains why windows copy, robocopy and other common copy utilities suffer in write performance.
Hence, i've written a C/C++ program that uses CreateFile, ReadFile & WriteFile API's with NO_BUFFERING
& WRITE_THROUGH
flags. The program simulates ESEUTIL.exe, in the sense, it uses 2 threads, one for reading and one for writing. The reader thread reads 256 KB from source and fills a buffer. Once 16 such 256 KB blocks are filled, the writer thread writes the contents in the buffer to the destination file. As you can see, the writer thread writes 8MB of data in 1 shot. The program allocates 32 such 8MB blocks... hence, the writing and reading can happen in parallel.
Details of ESEUtil.exe can be found in the above link.
Note: I am taking care of the data alignment issues when using NO_BUFFERING
.
I used bench marking utilities like ATTO and found out that our RAID 5 hardware has a write speed of 44MB per second when writing 8MB data chunk. Which is around 2.57 GB per minute.
But my program is able to achieve only 1.4 GB per minute.
Can anyone please help me identify what the problem is? Are there faster API's other that CreateFile
, ReadFile
, WriteFile
available?