
The speed issue is related to the fact that the source file is stored on a network share. The bottleneck is the destination's gigabit network interface which I'm unable to reach with my current code.Īlso, removing the write will not make the read any faster, so I can't go past this 55MB/sec read limit. The file is read from a linux-based nas with a 10 Gigabit Ethernet interface with a 60 drives san behind (don't worry about its performances, it works very well) and written to a local raid0 which can write data at about 140MB/sec. ("MY Speed : " + (speed / 1024 / 1024).ToString() + " mo/sec") Īny idea how to enhance the performance ? Readbuffer = Interlocked.Exchange(ref writebuffer, readbuffer) Īsyncwrite = output.BeginWrite(writebuffer, 0, readsize, null, null) Īsyncread = input.BeginRead(readbuffer, 0, readbuffer.Length, null, null) ĭouble speed = input.Length / Duration.TotalSeconds // bytes/s Readsize = input.Read(readbuffer, 0, readbuffer.Length)

String src = dst = buffersize = 1024 * 1024 įileStream input = new FileStream(src, FileMode.Open, FileAccess.Read, FileShare.None, 8, FileOptions.Asynchronous | FileOptions.SequentialScan) įileStream output = new FileStream(dst, FileMode.CreateNew, FileAccess.Write, FileShare.None, 8, FileOptions.Asynchronous | FileOptions.SequentialScan) īyte readbuffer = new Byte īyte writebuffer = new Byte

My current implementation does the same copy at about 55mb/sec which is already better than the System.IO.File.Copy() which performs at 29mb/sec. I'm trying to implement a filecopy method that can match the performance a copy done with the windows explorer.įor exemple a copy (with the windows explorer) from our nas to my computer, performs above 100mb/sec.
