Applies To:
Show VersionsBIG-IP versions 1.x - 4.x
- 4.2 PTF-10, 4.2 PTF-09, 4.2 PTF-08, 4.2 PTF-07, 4.2 PTF-06, 4.2 PTF-05, 4.2 PTF-04, 4.2 PTF-03, 4.2 PTF-02, 4.2 PTF-01, 4.2.0
13
Load Balancing a Forward Proxy Caching Array
- Introducing forward proxy caching
- Configuring forward proxy caching
- Creating pools
- Creating a cache rule
- Creating a virtual server
- Additional configuration options
Introducing forward proxy caching
This chapter explains how to set up a forward proxy caching configuration, in which a BIG-IP uses content-aware traffic direction to enhance the efficiency of an array of cache servers storing Internet content for internal users. This type of configuration is useful for any enterprise that wants to increase the speed with which its users receive content requests from the Internet.
Note: All BIG-IP products except the BIG-IP LoadBalancer Controller and the BIG-IP e-Commerce Controller support this solution.
The configuration detailed in this chapter uses the following BIG-IP features:
- Cacheable content determination
Cacheable content determination enables you to determine the type of content you cache on the basis of any combination of elements in the header of an HTTP request. - Content affinity
Content affinity ensures that a given subset of content remains associated with a given cache to the maximum extent possible, even when cache servers become unavailable, or are added or removed. This feature also maximizes efficient use of cache memory. - Hot content load balancing
Hot content load balancing identifies hot, or frequently requested, content on the basis of number of requests in a given time period for a given hot content subset. A hot content subset is different from, and typically smaller than, the content subsets used for content striping. Requests for hot content are redirected to a cache server in the hot pool, a designated group of cache servers. This feature maximizes the use of cache server processing power without significantly affecting the memory efficiency gained by content affinity.
Maximizing memory or processing power
From the time you implement a cache rule until such time as a hot content subset becomes hot, the content is divided across your cache servers, so that no two cache servers contain the same content. In this way, efficient use of the cache servers' memory is maximized.
After a hot content subset becomes hot, requests for any content contained in that subset are load balanced, so that, ultimately, each cache server contains a copy of the hot content. The BIG-IP distributes requests for the hot content among the cache servers. In this way, efficient use of the cache servers' processing power is maximized.
Thus, for a particular content item, the BIG-IP maximizes either cache server memory (when the content is cool) or cache server processing power (when the content is hot), but not both at the same time. The fact that content is requested with greatly varying frequency enables the cache statement rule to evaluate and select the appropriate attribute to maximize for a given content subset.
Using the configuration diagram
Figure 13.1 illustrates a forward proxy caching configuration, and provides an example configuration for this entire chapter. Remember that this is just a sample; when creating your own configuration, you must use IP addresses, host names, and so on, that are applicable to your own network.
Figure 13.1 Caching Internet content
Configuring forward proxy caching
To configure forward proxy caching, complete the following tasks in order:
- Create pools
- Create a cache rule
- Create a virtual server
Each of the following sections explains one of these tasks, and shows how you perform the tasks in order to implement the configuration shown in Figure 13.1. Note that in this example, as in all examples in this guide, we use only non-routable IP addresses. In a real topology, the appropriate IP addresses have to be routable on the Internet.
Creating pools
For this configuration, you create load balancing pools for your origin server (in this configuration, the origin server is the router that provides access to the Internet), for your cache servers, and for your hot, or frequently requested, content servers, which may or may not be cache servers. A pool is a group of devices to which you want the BIG-IP to direct traffic. For more information about pools, refer to Pools in the BIG-IP Reference Guide, Chapter 4, Configuring the High-Level Network.
You create three pools:
- Cache server pool
The BIG-IP directs all cacheable requests bound for your web server to this pool, unless a request is for hot content. - Origin server pool
This pool includes your origin web server. Requests are directed to this pool when:
- The request is for non-cacheable content; that is, content that is not identified in the cacheable content expression part of a cache statement. For more information, see Working with a cacheable content expression, on page 13-5.
- The request is from a cache server that does not yet contain the requested content, and no other cache server yet contains the requested content.
- No cache server in the cache pool is available.
- Hot cache servers pool
If a request is for frequently requested content, the BIG-IP directs the request to this pool.
Note: While the configuration shown in Figure 13.1 implements a hot cache servers pool, this pool is not required if you want to use the content determination and content affinity features. However, you must implement this pool if you want to use the hot content load balancing feature.
To create a pool using the Configuration utility
- In the navigation pane, click Pools.
The Pools screen opens. - Click the Add button.
The Add Pool screen opens. - For each pool, enter the pool name and member addresses in the Add Pool screen. (For additional information about configuring a pool, click the Help button.)
Configuration Notes
Create a pool named cache_servers.
Add each cache server from the example, 10.10.20.4, 10.10.20.5, and 10.10.20.6, to the pool. For each cache server you add to the pool, specify port 80, which means this cache server accepts traffic for the HTTP service only.
Create a pool named origin_server.
Add the origin server from the example, the router 10.10.20.254, to the pool. Specify port 80, which means the origin server accepts traffic for the HTTP service only. In this configuration, the origin server is the router between the cache servers and the Internet.
Create a pool named hot_cache_servers.
Add each cache server from the example, 10.10.20.4, 10.10.20.5, and 10.10.20.6, to the pool. For each cache server you add to the pool, specify port 80, which means this cache server accepts traffic for the HTTP service only.
To create a pool from the command line
To define a pool from the command line, use the following syntax:
b pool <pool_name> { lb_method <lb_method> member <member_definition> ... member <member_definition> }
To create the cache server pools, type:
b pool cache_servers { \
member 10.10.20.4:80 \
member 10.10.20.5:80 \
member 10.10.20.6:80 }
To create the origin server pool, type:
b pool origin_server { member 10.10.20.254:80 }
To create the hot pool, type:
b pool hot_cache_servers { \
member 10.10.20.4:80 \
member 10.10.20.5:80 \
member 10.10.20.6:80 }
Creating a cache rule
A cache rule is a specific type of rule. A rule establishes criteria by which a BIG-IP directs traffic. A cache rule determines where and how the BIG-IP directs content requests in order to maximize the efficiency of your cache server array and of your origin web server.
A cache rule includes a cache statement, which is composed of a cacheable content expression and two attributes. An attribute is a variable that the cache statement uses to direct requests. It can also include several optional attributes.
A cache statement may be either the only statement in a rule, or it may be nested in a rule within an if statement.
Working with a cacheable content expression
The cacheable content expression determines whether the BIG-IP directs a given request to the cache server or to the origin server, based on evaluating variables in the HTTP header of the request.
Any content that does not meet the criteria in the cacheable content expression is deemed non-cacheable.
For example, in the configuration illustrated in this chapter, the cacheable content expression includes content having the file extension .html or .gif. The BIG-IP considers any request for content having a file extension other than .html or .gif to be non-cacheable, and sends such requests directly to the origin server.
For your configuration, you may want to cache any content that is not dynamically generated.
Using required attributes
The cache rule must include the following attributes:
- origin_pool
Specifies a pool of servers that contain original copies of all content. Requests are load balanced to this pool when any of the following are true:
- The requested content does not meet the criteria in the cacheable content condition.
- No cache server is available.
- The BIG-IP is redirecting a request from a cache server that did not have the requested content.
- cache_pool
Specifies a pool of cache servers to which requests are directed in a manner that optimizes cache performance.
Reviewing optional attributes
The attributes in this section apply only if you are using the hot content load balancing feature.
- hot_pool
Specifies a pool of cache servers to which requests are load balanced when the requested content is hot.
The hot_pool attribute is required if any of the following attributes is specified:
- hot_threshold
Specifies the minimum number of requests for content in a given hot content set that causes the content set to change from cool to hot at the end of the period.
If you specify a value for hot_pool, but do not specify a value for this variable, the cache statement uses a default hot threshold of 100 requests. - cool_threshold
Specifies the maximum number of requests for content in a given hot content set that causes the content set to change from hot to cool at the end of the hit period.
If you specify a variable for hot_pool, but do not specify a value for this variable, the cache statement uses a default cool threshold of 10 requests. - hit_period
Specifies the period in seconds over which to count requests for particular content before determining whether to change the content demand status (hot or cool) of the content.
If you specify a value for hot_pool, but do not specify a value for this variable, the cache statement uses a default hit period of 60 seconds. - content_hash_size
Specifies the number of units, or hot content subsets, into which the content is divided when determining whether content demand status is hot or cool. The requests for all content in a given subset are summed, and a content demand status (hot or cool) is assigned to each subset. The content_hash_size should be within the same order of magnitude as the actual number of requests possible. For example, if the entire site is composed of 500,000 pieces of content, a content_hash_size of 100,000 would be typical.
If you specify a value for hot_pool, but do not specify a value for this variable, the cache statement uses a default hash size of 1028 subsets.
Understanding content demand status
Content demand status is a measure of the frequency with which a given hot content subset is requested. Content demand status, which is either hot or cool, is applicable only when using the hot content load balancing feature. For a given hot content subset, content demand status is cool from the time the cache rule is implemented until the number of requests for the subset exceeds the hot_threshold during a hit_period. At this point content demand status for the subset becomes hot and requests for any item in the subset are load balanced to the hot_pool. Content demand status remains hot until the number of requests for the subset falls below the cool_threshold during a hit_period, at which point the content demand status becomes cool. The BIG-IP the directs requests for any item in the subset to the appropriate server in the cache_pool until such time as the subset becomes hot again. The following steps show how, given the configuration shown in Figure 13.1, you would cache all content having either the file extension .html or .gif.
To create a cache statement rule using the Configuration utility
- In the navigation pane, click Rules.
The Rules screen opens. - Click the Add button.
The Add Rule screen opens. - In the Add Rule screen, type the cache statement.
For example, given the configuration shown in Figure 13.1, to cache all content having either the file extension .html or .gif, you would type:
rule cache_rule { cache ( http_uri ends_with "html" or http_uri ends_with "gif" ) { origin_pool origin_server cache_pool cache_servers hot_pool hot_cache_servers } }
- Click the Add button.
To create a cache rule from the command line
To create a cache statement rule from the command line, use the following command:
b 'rule cache_rule { cache \
( http_uri ends_with "html" or http_uri ends_with "gif" ) \
{ origin_pool origin_server \
cache_pool cache_servers \
hot_pool hot_cache_servers } }'
Creating a virtual server
Now that you have created pools and a cache rule to determine how the BIG-IP will distribute outbound traffic, you need to create a wildcard virtual server to process traffic using this rule and these pools. For example:
- Add a virtual server with address 0.0.0.0 and port 0 (this designates a wildcard virtual server).
- Add the rule cache_rule.
To create a wildcard virtual server using the Configuration utility
- In the navigation pane, click Virtual Servers.
- Click the Add button.
The Add Virtual Server screen opens. - For each virtual server, enter the virtual server address and pool name. (For additional information about configuring a virtual server, click the Help button.)
To create a wildcard virtual server from the command line
Use the bigpipe virtual command to configure the virtual server to use the pool that contains the outside addresses of the firewalls:
b virtual 0.0.0.0:0 use rule cache_rule
Additional configuration options
Whenever a BIG-IP is configured, you have a number of options:
- You have the option in all configurations to configure a BIG-IP redundant system for fail-over. Refer to Chapter 6, Configuring a Redundant System, in the BIG-IP Reference Guide.
- All configurations have health monitoring options. Refer to Health Monitors in Chapter 4, Configuring the High-Level Network, in the BIG-IP Reference Guide.
- When you create a pool, there is an option to set up persistence and a choice of load balancing methods. Refer to Pools in the Chapter 4, Configuring the High-Level Network, in the BIG-IP Reference Guide.