You may have encountered the problem yourself, you select a bunch of files, you go to copy them to a remote network drive, things seem to be okay, and then all of the sudden the activity just stalls. Like forever.
A small number of files at a time works fine, but try to do a bulk copy or a backup, and it always aborts.
Even With Hulking Equipment
I ran into the above problem while trying to copy 98GB from a Ubuntu box to a Synology NAS.
Both the Synology and the Linux box are using dual 10GB bonded ethernet over short distances using CAT7 to a managed smart switch. Everything was using "jumbo frames" with an MTU of 9000 (the switch says 9198, as its accounting works a little differently).
So when the copy stalled and the network reported zero packet loss, it was time to look elsewhere.
Ubuntu's ps
command showed that the copy command was stalled with a process
state code of 'D+' (uninterruptible sleep, usually due to IO; the plus means
the process was in the foreground).
At that point I began to think maybe it was the file transfer protocol. I had mounted the Synology drive with afp://.
File Transfer Protocols
Okay, first we'll cover the mistake in my thinking, incase you're under the same impressions. Then, I'll explain what's really going on.
My Misunderstanding
I had used SMB before when I was primarily using Windows system. Then I switch to Apple, and in order to get resource forks and other metafile attributes, started using AFP.
Around that time, security warnings came out saying to stay away from SMB. So I did. Also, CIFS started appearing, and some sloppy online sources said it was basically just SMB. So, I treated it as an alias of SMB.
That leads to why I was connected to my Synology from Ubuntu using AFP.
Now, there is so much wrong with the above understanding, I had to start over at ground zero.
The Many Flavors of SMB
SMB stands for Server Message Blocks, and is also known as SMB1. This is the protocol that security folks were talking about and suggesting to avoid.
AFP stands for the Apple Filing Protool, which was designed to handle Apple's metadata, SpotLight, TimeMachine, Mac's Aliases, Bonjour Services. Apparently Apple burried the lead that AFP was deprecated in OS X Mavericks. The reason being is that AFP is 32-bits. The Apple File System (APFS) uses 64-bit ids.
NFS stands for Network File System. It was deisgned for Unix/Linux and has multiple versions (v2, v3, v4.x).
SMB2 stands for Server Message Blocks 2 and is also known as CIFS (Common Internet File System); it can handle the resource forks and meta data of Apple's file systems, even the 64-bit ones. It provides network printing, shared folder authentication, file locking. (There also appears to be a SMB2 and High MTUs option on Synology.)
SMB3 stands for Server Message Blocks 3.
In broad generalities, SMB3 is the best for performance, then AFP. On the slower side, there's NFS and finally SMB1 is the worst.
The Solution
The solution was as simple as going to Synology's control panel, looking up SMB, turning it on, and setting the minimum allowed protocol to SMB2.
Then on the Linux side connecting with smb://xxx.xxx.xxx.xxx/ and not afp://xxx.xxx.xxx.xxx/.
At that point, file operations were both quick and reliable.