I have a Mac running 10.14 as a file server. I have been copying files to it and today I noticed some very strange caching/buffering behavior. The drive is an external USB 2 HDD, so it tops out at around 40MB/s (and transfers to the share are the same). Today the network speed suddenly went up to around 100 MB/s (maxing out ethernet), then it just stops. Looking at iStat menus on the server, I notice that smbd doesn’t actually start writing data to the disk until what I assume is its write buffer getting filled up, then it begins writing the data. This causes the transfer on my end to freeze (obviously) but it also causes the entire share to freeze for my computer, so interacting with it in any way results in a beachball.
Not only that, but because this delays the actual write-back to the disk, it takes far longer, as it spends time doing nothing waiting for this buffer to fill up, then blocks the transfer and slowly writes the data it could (should) have been writing all along. Then it cycles again, it stops writing, waits for the buffer to fill, then starts writing again. The buffer is somewhere above 1.6 GB or so, as that was the smallest file I had and it copied all of it before it even started writing to the disk.
I have not changed anything, I have been copying data to it for a few days now and I’ve never seen this behavior before (nor have I ever seen this behavior at any point in the past, even with small transfers it would immediately write them to the disk, on this computer or any other, I find it odd that anything would allow that much data to remain unwritten). It doesn’t seem to matter if I use Finder or cp
on the client, nor does it seem to matter if I use SMB or AFP.
Speaking to the unwritten data part, while power outages are not the biggest concern, the fact that my data isn’t actually being written to the disk until much later is concerning as well.