We're using a simple File.Copy in C# for moving our database backups to extra locations.
However on some servers, this causes the SQL server to pretty much stop working. These servers have very limited memory, so they're paging data out to the harddrive every so often.
Whilst we should buy more memory, this is not going to happen for a long time :-/
So I'm wondering if I can somehow limit the speed of the File.Copy operation ? (Thereby giving the SQL server some room to access the harddrive)
I could use an "old school" approach with two streams, reading and writing through a buffer, and just sleep 5 ms or so between reads. But I'd really prefer a neater solution, if such a one is available.
If you have more ram more data can be transferred making it faster. Second there are different speeds for usb's too both for the pendrives and for the part in the computer that you plug your pendrive into. They too affect the speed of the transfer.
Slow file copying can be caused by storage issues, client issues, and server issues. On the file server that hosts the shared folder, copy the file to its local hard disk. If the file-copying speed is unusually low (much slower than average speed), try to update the driver for your storage.
The physical head movement (latency) is what will slow a transfer from a spinning platter disk. If you were copying from a single HDD, then you would start a single big transfer rather than lots of small ones. The head going back and forth between two or more files that are being copied is what slows the transfer.
CopyFileEx might do what you need - it has a callback function that you could use as an artificial slowing method
(haven't tried that for this scenario though so I am unsure about real effects - worth a try IMHO).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With