AFP versus SMB/Samba


Mac OS X clients can connect to network file servers using both the Apple Filing Protocol (AFP) and the Microsoft Server Message Block (SMB) protocol. (SMB is also known as Common Internet File System or CIFS). Mac OS X clients can also use other protocols such as NFS and FTP.

OS X supports SMB largely because there are many environments in which only Microsoft and other SMB servers are available on a network. However, SMB is proprietary to Microsoft and was designed specifically for Windows clients whereas AFP was designed by Apple for Mac clients. In production/professional workflow environments, SMB is unlikely to be a sufficiently fast or robust solution. Apple recommends only AFP which performs better over faster networks where large files need to be transferred - the norm in graphics/print/video environments where Macs are commonly used.

It is also possible to run SMB file services on Unix-type operating systems. A product which provides this is Samba - an open source project. Samba provides both the client and server elements of the SMB protocol. While Samba is a great product, it should be born in mind that the SMB protocol is proprietary to Microsoft and Samba and products like it are built by reverse-engineering Microsofts proprietary protocol. Reverse engineering means that Samba was developed not from a formal Microsoft specification but by analysing many data packets on a network and inferring the mechanisms behind them. Hence, its successful implementation depends upon the unlikely scenario of the developers having catered for every packet contingency. At the same time, for format specification for SMB changes with new releases of Microsofts server products, so other implementations are in a continual state of catch-up.

Samba is used both on Linux/Solaris servers, embedded in NAS devices and in some commercial SAN products. There are some other proprietary SMB implementations - since OS X Server 10.7, Apple replaced Samba with a proprietary equivalent

While Samba is useful for Windows clients that wish to access a non-Windows server, it cannot be recommended as Mac OS file-sharing solution over AFP. The table below details the main differences, the primary one being performance. 

In summary, these are the general issues affecting SMB file servers for Mac OS X clients...

SMB has significantly poorer read/write performance The SMB block size is limited to less than 64kb per transaction, AFP uses 128 KB by default. Starting with 10.6 clients it can be up to 1024kb.
SMB has no Spotlight search A single client search can make heavy use of the disk, CPU and network. A search of a server-based volume can several minutes (depending on the amount of files). Spotlight utilises an index which is instant and generates almost no server load. AFP servers from HELIOS and Apple support Spotlight searching. HELIOS even implements it for Windows clients.
SMB has no Time Machine support Native AFP servers from HELIOS and Apple provide this.
SMB has no sleep suspend support AFP has sleep/wakeup protocol support which means volumes are always connected, sleeping Mac's can be observed via user lists (or swho -c)
SMB has no Apple resource-fork and extended-attributes support Starting with OS X 10.4, Apple uses "xattrs" to save additional information, e.g. Finder comments. Resource-forks contain legacy type/creator file information used by Mac applications.
BonjourTM server and printer browsing AFP servers can be quickly browsed via Bonjour. SMB uses still WINS which is slower.