Why does my network file copy speed form a wave?
With the upgrade to Windows 10 I've now got this nice graph when copying files.
When I copy a single large file the speed always takes this reasonably consistent wave shape. What causes that?
The connection is
My PC <- cable -> gigabit switch <- cable -> Netgear ReadyNAS
Files are copying via SMB, this graph shows one such copy over about a minute:
There's no problem here, I just want to understand how things work.
Solution 1:
Short answer: Write cache
TL;DR: First off, there is much less overhead when copying a single large file, compared to many smaller. That means PC and NAS are not "wasting" much time seeking files, updating file table and file system meta data. This also means a lot higher throughput, that is likely to reveal some of the bandwidth bottlenecks in the setup.
The peaks and valleys in the bandwidth graph seems to occur at fairly regular intervals, and given the fact that you are copying a single large file (maximum bandwidth, minimum overhead), I'd say you're seeing the effect of buffering/caching.
It seems to me you are probably sending data to the NAS at a faster rate than it is able to write it to disk. Thanks to write cache/buffers it is still able to receive it at the faster rate (the peaks of the graph), but you can't keep receiving data without committing it to disk.
Eventually the buffer will run full and has to be written to disk. Meanwhile, the NAS cannot receive data as fast as before, as it has no where to store it (buffer is full, and disks are slower). This is where you get the valleys of the graph.
It seems Windows is smoothing the throughput graph. With more precise graphs (say from Performance Monitor), you can actually estimate the write buffer size, by analysing the intervals and transferred bytes.
The reason why the peaks and valleys does not occur in perfectly uniform intervals, is probably because PC, NAS or both, are doing "something else" while you are copying the file.
Solution 2:
It's hard to answer authoritatively without a lot of further investigation. Thanks for updating your Question with the time scale and the protocol.
It could normal TCP "scallops". TCP goes as fast as it can until it experiences packet loss. Then it backs off a little and ramps up again. So it keeps "bumping its head against the ceiling". This is how it maximizes the bandwidth available without making congestion worse. I usually look at TCP scallops in a TCPTrace graph, which is a little different from this graph. I would expect it to look a little more sawtooth-like in this kind of graph, but there may be some smoothing going on in this graph. And now that I think about it, TCP scallops would be in a much smaller timescale than this graph seems to show.
It could also be that your remote filesystem protocol (SMB) reads the file a chunk at a time, and the dips are where one chunk read has finished and the next one is being requested.
Solution 3:
I think Microsoft introduced this feature in the progress bar in Windows 8.
Left to Right shows the progress in percentage & Up-Down motion shows the transfer rate in MB/s.
Transfer rates are driven by speed of media (BUS or Network), number & size of files, file system & availability of resources, etc...
Also during a file transfer lot of metadata read/write takes place.
You are seeing a reasonably consistent wave as this metadata read/write overhead is reduced & other resources are being used at the same rate. Occasional dips could be the events of packet loss, next chunk read, resource polling, etc..
For further clarification here are further reads
- Windows file copy dialog: Why is the estimation so... BAD?
- How to make a progress-speed bar more understandable?