Hierarchical Caching¶
Understanding Cache Hierarchies¶
A cache hierarchy consists of cache levels that communicate with each other. Traffic Server supports several types of cache hierarchies. All cache hierarchies recognize the concept of parent and child. A parent cache is a cache higher up in the hierarchy, to which Traffic Server can forward requests. A child cache is a cache for which Traffic Server is a parent.
Traffic Server supports the following hierarchical caching options:
Parent Caching¶
If a Traffic Server node cannot find a requested object in its cache, then it searches a parent cache (which itself can search other caches) before finally retrieving the object from the origin server. You can configure a Traffic Server node to use one or more parent caches so that if one parent is unavailable, then another parent is availale to service requests. This is called Parent Failover. Traffic Server will support parent caching for HTTP and HTTPS requests.
Note: If you do not want all requests to go to the parent cache, then simply configure Traffic Server to route certain requests (such as requests containing specific URLs) directly to the origin server. Simply set parent proxy rules in parent.config
The figure below illustrates a simple cache hierarchy with a Traffic Server node configured to use a parent cache. In the following scenario, a client sends a request to a Traffic Server node that is a child in the cache hierarchy (because it’s configured to forward missed requests to a parent cache). The request is a cache miss, so Traffic Server then forwards the request to the parent cache, where it is a cache hit. The parent sends a copy of the content to the Traffic Server, where it is cached and then served to the client. Future requests for this content can now be served directly from the Traffic Server cache (until the data is stale or expired).

Parent caching
Note: If the request is a cache miss on the parent, then the parent retrieves the content from the origin server (or from another cache, depending on the parent’s configuration). The parent caches the content and then sends a copy to Traffic Server (its child), where it is cached and served to the client.
Parent Failover¶
Traffic Server supports use of several parent caches. This ensures that if one parent cache is not available, another parent cache can service client requests.
When you configure your Traffic Server to use more than one parent cache, Traffic Server detects when a parent is not available and sends missed requests to another parent cache. If you specify more than two parent caches, then the order in which the parent caches are queried depends upon the parent proxy rules configured in the file:parent.config configuration file. By default, the parent caches are queried in the order they are listed in the configuration file.
Configuring Traffic Server to Use a Parent Cache¶
To configure Traffic Server to use one or more parent caches, you must complete the following steps:
- Enable the parent caching option.
- Identify the parent cache you want to use to service missed requests. To use parent failover, you must identify more than one parent cache so that when a parent cache is unavailable, requests are sent to another parent cache.
Note
You need to configure the child cache only. No additional configuration is needed for the Traffic Server parent cache.
Configure Traffic Server to use a parent cache by editing the following variable proxy.config.http.parent_proxy_routing_enable in records.config file.
Edit the parent.config file located in the Traffic Server config directory to set parent proxy rules to specify the parent cache to which you want missed requests to be forwarded;
The following example configures Traffic Server to route all requests containing the regular expression politics and the path /viewpoint directly to the origin server (bypassing any parent hierarchies):
url_regex=politics prefix=/viewpoint go_direct=true
The following example configures Traffic Server to direct all missed requests with URLs beginning with http://host1 to the parent cache parent1. If parent1 cannot serve the requests, then requests are forwarded to parent2. Because round-robin=true, Traffic Server goes through the parent cache list in a round-robin based on client IP address.:
dest_host=host1 scheme=http parent="parent1;parent2" round-robin=strict
Run the command traffic_line -x to apply the configuration changes.