c# - Bad download speed when writing to NAS (network drive) - solved?
hi,
I'm using the C# package to build an automatic downloader (from an FTP server on my LAN)
Everything works right out of the box, but...
I noticed that download speed is about 10x slower when I download to a network (NAS) folder, than when I download to a local (SSD) folder
NAS folder: 0.5MB/s
SSD folder: 5MB/s
(FileZilla does 5MB/s in both cases)
While looking at the file that was being downloaded by WinSCP, in Windows Explorer, I noticed that the size of the file changes very frequently.
I assumed that the difference in download speed might be caused by WinSCP doing many, many small writes to the file - and that this might freak out the NAS and degrade overall throughput performance (whereas the local SSD is able to keep up)
To confirm, I added some debug logic to my executable. This debug logic monitors the frequency with which the size of the file (that is being downloaded by WinSCP) changes.
If my calculations are correct I saw between 30 and 50 updates to the file PER SECOND.
At 5MB/s this means that WinSCP's (write) buffer size is roughly 125KB.
If the above is correct, can I suggest changing the size of the internal write buffer to 8MB or so?
Btw, it would be nice if we had more control over file IO in general in the WinSCP libraries.
Thanks,
Lambert
I'm using the C# package to build an automatic downloader (from an FTP server on my LAN)
Everything works right out of the box, but...
I noticed that download speed is about 10x slower when I download to a network (NAS) folder, than when I download to a local (SSD) folder
NAS folder: 0.5MB/s
SSD folder: 5MB/s
(FileZilla does 5MB/s in both cases)
While looking at the file that was being downloaded by WinSCP, in Windows Explorer, I noticed that the size of the file changes very frequently.
I assumed that the difference in download speed might be caused by WinSCP doing many, many small writes to the file - and that this might freak out the NAS and degrade overall throughput performance (whereas the local SSD is able to keep up)
To confirm, I added some debug logic to my executable. This debug logic monitors the frequency with which the size of the file (that is being downloaded by WinSCP) changes.
If my calculations are correct I saw between 30 and 50 updates to the file PER SECOND.
At 5MB/s this means that WinSCP's (write) buffer size is roughly 125KB.
If the above is correct, can I suggest changing the size of the internal write buffer to 8MB or so?
Btw, it would be nice if we had more control over file IO in general in the WinSCP libraries.
Thanks,
Lambert