Mac OS X Server: AppleShare performance tuning for client and server

Learn how you can "tune" AppleShare performance for both Mac OS X client and server in this advanced article.

Client tuning

The AFP client in Mac OS X has the ability to check network latency to the server and select a network packet size based on the result. The client does this by measuring the response time of the first packet it sends to the server to open the AFP connection. This response time is measured in milliseconds and compared to configurable settings in the AFP client.

Note: The client tuning steps below do not affect a Network Home user. The client settings are only loaded after a user logs in. The Network Home user takes its defaults from the system prior to user login.

The values of all AFP client settings can be accessed in Terminal with the following command:

defaults read -g com.apple.AppleShareClientCore

The two settings that this article will cover are:

On a standard Mac OS X 10.4.x system, the values reported in Terminal will be zero for both values. This tells the client to use the Apple-supplied standard values of:

If the response time is greater than the afp_wan_threshold, then the AFP client assumes that the server is either far away (possibly located across a WAN), or being accessed over a slow link. In this case, the AFP client chooses the afp_wan_quantum size for communicating with the AFP server.

If the round trip timing is less than the afp_wan_threshold, then its assumed that the server is close by (on a LAN) or being accessed through a fast link. The LAN quantum value is 128K or 131072 bytes.

Because the AFP client sets the value of afp_wan_quantum based on its first connection with the server, cases where the AFP server is experiencing loads that artificially slow it's network response time will affect all clients that connect during that time. For all clients connecting to the server on your LAN, you can set the WAN quantum equal to the LAN quantum with this single-line Terminal command:

 defaults write -g com.apple.AppleShareClientCore -dict-add afp_wan_quantum -int 131072;

This command allows the AFP client to use the LAN quantum size regardless of the server's response time when the client first connected.

Please note that if your clients do connect to other servers that are not on your LAN, they will choose the 128K quantum size which can impact your user's experience with those servers. In addition, these client tuning steps will not affect a user with an AFP Network Home Directory.

Server Tuning

For servers not acting as either Network Home or Portable Home Directory servers, more than 150 users can be supported.

For best performance of the server with all connected clients, each server should have at least 2 GB of memory. AFP server maintains caches for each client of both the files that client is using and memory for network communication.

Default Server settings

In /Library/Preferences/, the file "com.apple.AppleFileServer.plist" contains the default threads setting. It is found below "maxThreads". These are the settings for different versions of the operating system:

Mac OS X Server version originally installed AFP threads
Mac OS X Server 10.4 for PowerPC (any version) 40
Mac OS X Server 10.4 Universal (any version) 200

maxThreads can be increased to as much as 400 without incurring significant performance penalties (edit the .plist file in the text editor or your choice). After 400 server threads, there can be performance issues with the AFP server due to memory allocation requirements. Threads are not bound to any particular user. The server maintains a pool of threads that perform work as it arrives. Under many workloads a small number of threads can effectively serve a large number of clients. Servers that support large data I/O workloads may benefit from an increased number of threads.

To find the optimum number of threads for your server, start with 200 and test performance and monitor bandwidth usage. Then increase threads by 50 until you reach 400 or a plateau where bandwidth does not increase with the increase in threads. It is important to note that the AFP server will not use the new threads unless it is stopped and started either using the GUI or the command line.

Tip: The the Terminal command top, then look for the column labeled "#TH". This number will increase as more users connect, and can be used to confirm how many threads the AFP server is actually using as you test.

 

Published Date: Oct 7, 2016