Checking for samba transfer bottlenecks

So basically you have:

Mac <-- wireless N --> Router <-- 100MbE --> Switch <-- GbE --> NAS

The main things you can check here are the traffic capabilities of your network and the file copy capabilities of your devices. There are a number of utilities that are fast and efficient in addressing the characteristics of each.

Network

There's a cross-platform program called iperf which utilizes a client-server model to assess, among other things, network bandwidth. You'll want to download and/or compile a copy of iperf to both the NAS box and your Mac. Your NAS box in this instance is acting as your server, so you'll want to start iperf as a server: iperf -s. On your Mac, you'll want to run iperf -c <ip> where ip is the IP-address of your NAS box. This should give you an estimate of the raw capabilities of your network configuration between the Mac and the NAS system.

NAS File Copy

I noticed that the Synology 407e has two USB ports in the back. One thing you could to do assess strictly the file-copy capabilities of your NAS system is to attach an fast external hard drive, or preferably a solid state drive, and copy files to and from the external drive to your Samba share. To do this you could simply copy large files and estimate the time taken for transfer and divide it into the bulk transfer size. Or you could use a utility such as fio which operates as a file I/O benchmark. fio is a feature-rich utility that provides comprehensive statistics about the I/O operations it conducts. In conjunction with Chris' suggestion, you could run top as the file transfer is in progress to view real-time CPU and memory usage. Some other good system stat utilities are vmstat and dstat

Summary

If your network, NAS box, Mac, switches and routers are all functioning within their specifications, there is a possibility that one or more of your hard drives within the NAS are bad, or that the RAID array is corrupted. There could also be latency issues within your network that may need further investigation.

Tools

  • fio
  • iperf
  • Wireshark
  • dstat
  • traceroute

Report Preparation

Usually such a report would focus on bandwidth (MB/s), throughput (IO/s) and latency (ms). Smaller file sizes for transfer (512 bytes) generally offer higher throughput but worse bandwidth with minimal latency. Larger file sizes >64KB would show higher bandwidth, lesser throughput, and increased latency dependent on the transfer size and speed of the medium.

Source: 14 months of storage application benchmarking within a tech company.


The bottleneck will generally always be the network. Wireless will always be slower than wired. To test, connect your computer to directly to the NAS, then the switch, then the router, then via wireless, and use these commands on your computer:

time cp -r /nas/representative/directory /tmp # will print the durantion
rm -r /tmp/directory

That will time the copy for each connection, and you can judge from there.