What is content caching on Mac?
What is content caching?
Content caching is a macOS service that helps reduce internet data usage and speed up software installation on Mac computers, iOS and iPadOS devices, and Apple TV.
Content caching speeds up downloading of software distributed by Apple and data that users store in iCloud by saving content that local Mac computers, iOS and iPadOS devices, and Apple TV devices have already downloaded. The saved content is stored in a content cache on a Mac, and is available for other devices to retrieve without going out over the internet.
See the Apple Support article Content types supported by content caching in macOS.
You can use content caching on networks consisting of a NAT environment for the content cache and all devices, or on networks consisting of publicly routable IP addresses. Apple devices with iOS 7 or later and OS X 10.8.2 or later automatically contact a nearby content cache without any configuration.
Important: It’s strongly recommended that you set up content caching on a Mac that has a single wired Ethernet connection as its only connection to the network. Content caching can use a Wi-Fi connection instead of Ethernet, but performance might be affected.
How does it work?
After you enable content caching on a Mac, it keeps a copy of all content that local networked devices (called clients) download.
For example, when the first client on your network downloads a macOS update, the content cache keeps a copy of the update. When the next client on the network connects to the App Store to download the update, the update is copied from the content cache rather than from the App Store.
Because the local network is normally much faster than the internet, the second client (and all subsequent clients) download updates much faster.
The following figure illustrates a single private subnet with a single content cache:
What if my network has multiple subnets?
By default, content caching is limited to a specific subnet, but you can set it to provide content caching for:
All combinations of subnets of the local network that share a common public IP address
Any combination of subnets of publicly accessible IP addresses (with additional DNS setting support)
If your network has multiple subnets that share the same public IP address, all the subnets can take advantage of a single content cache. The following figure illustrates a network with two subnets sharing a single content cache:
Can I have more than one content cache?
When your network has more than one content cache, they automatically become peers and can consult and share cached software. When a requested item isn’t available on a content cache, its peers are checked and, if the item is available, it’s downloaded. If it’s not available from a peer, the item is downloaded from a parent, if configured, or from Apple over the internet. The right content cache is automatically selected by the client when more than one is available. See Set up content cache clients, peers, or parents.
Where are the cached files stored?
The default location for cached content is the boot volume. You can choose an alternate location and specify how much of the volume is used by content caching. When the disk space for the cached content reaches the maximum you specified, or when the available space on the volume runs low, the content cache deletes content that hasn’t been used recently to make space for the next request.
How can I evaluate the performance of a content cache?
See Content caching metrics on Mac in the Apple Platform Deployment guide and View cache activity in Activity Monitor.
Performance best practices
Content caching is primarily affected by two main factors: connectivity and hardware configurations.
You get the best performance from your content cache by connecting it to your network using Gigabit Ethernet. The content cache can serve hundreds of clients concurrently, which can saturate a Gigabit Ethernet port. Therefore, in most small to medium scale deployments, the performance bottleneck is usually the bandwidth of your local network.
To determine if your Mac is the performance bottleneck when a large number of clients are accessing the content cache simultaneously, check the processor usage for the AssetCache process in Activity Monitor (open Activity Monitor, choose View > All Processes, then click CPU). If the processor usage is constantly at or near the maximum, you may want to add additional content caches to distribute the requests across multiple computers.
Also, if your Mac is in an environment where clients download large amounts of a wide variety of content, be sure to set the cache size limit high enough. This prevents the content cache from deleting cached data frequently, which may necessitate downloading the same content multiple times, thereby using more internet bandwidth.
Content caching best practices
The following are best practices for content caching. Whenever possible, you should follow these recommendations:
Allow all Apple push notifications.
Don’t use manual proxy settings.
Don’t proxy client requests to content caches.
Bypass proxy authentication for content caches.
Specify a TCP port for caching. (See the Port key in Advanced content caching settings on Mac in the Apple Platform Deployment guide.)
Manage inter-site caching traffic.
Block rogue cache registration.
Use a static public IP address for content caches.