- Table of Contents
-
- 08-Layer 3—IP Services Configuration Guide
- 00-Preface
- 01-ARP configuration
- 02-IP addressing configuration
- 03-DHCP configuration
- 04-DNS configuration
- 05-IP forwarding basics configuration
- 06-Fast forwarding configuration
- 07-Adjacency table configuration
- 08-IRDP configuration
- 09-IP performance optimization configuration
- 10-UDP helper configuration
- 11-IPv6 basics configuration
- 12-IPv6 neighbor discovery configuration
- 13-DHCPv6 configuration
- 14-IPv6 fast forwarding configuration
- 15-IPv6 transition technologies configuration
- 16-WAAS configuration
- 17-HTTP redirect configuration
- 18-Web caching configuration
- Related Documents
-
Title | Size | Download |
---|---|---|
18-Web caching configuration | 92.92 KB |
Contents
Restrictions and guidelines: Web caching configuration
License requirement for Web caching
Configuring Web caching parameters
Verifying and maintaining Web caching
Web caching configuration examples
Example: Configuring Web caching
Configuring Web caching
About Web caching
The Web caching feature saves specific webpage content requested by HTTP users from specific Web servers to files in the Web cache directory. If users access the same content before the content is aged out, the device retrieves the content from the files and sends the content to the users. Web caching can reduce the traffic between the device and the Web servers, lower Web content transmission costs, relieve pressure on Web servers, and improve user Web access speed.
Web caching mechanism
Figure 1 shows the Web caching mechanism.
Figure 1 Web caching mechanism
1. The host sends an HTTP GET request to the device.
2. The device identifies whether the Web caching feature is configured to cache Web content from the Web server.
¡ If not, the device forwards the request directly to the Web server. The Web caching feature does not take part in the communication between the host and the Web server.
¡ If yes, the device forwards the request to the Web caching process.
3. The Web caching process obtains the URL of the request and looks up its cache for the requested content.
¡ If the requested content is found in the cache, the device retrieves the content and sends the content to the host. The HTTP GET operation is completed.
¡ If the requested content is not found, the device re-constructs the request and sends the request to the Web server.
4. The Web server sends the requested content to the device.
5. The device identifies whether the Web caching feature is configured to cache the content.
¡ If yes, the device uses the Web caching feature to cache the content, re-constructs a response, and sends the response to the host.
¡ If not, the device re-constructs a response and sends the response to the host.
Basic concepts
· Web cache files and Web cache directory—The Web caching feature saves its operation data and the Web content to be cached to files in the Web cache directory. After the effective maximum total size for Web cache files is reached, the device deletes the oldest Web cache file to save the new Web cache file.
· Web cache file aging time—The Web cache file aging time is fixed at 30 days. When the device reboots or receives a request for the cached content in a file, it restarts the aging timer. If no users request the cached content before the aging timer expires, the device deletes the file.
Restrictions and guidelines: Web caching configuration
In the current software version, the Web caching feature supports only HTTP-based Web content.
License requirement for Web caching
The Web caching feature requires a license. If you configure the feature without a license, the settings will be lost after a device reboot. For information about feature licensing, see Fundamentals Configuration Guide.
Web caching tasks at a glance
To configure Web caching, perform the following tasks:
1. Configuring Web caching parameters
Configuring Web caching parameters
Restrictions and guidelines
Before configuring or modifying Web caching parameters, you must disable Web caching. After configuring or modifying Web caching parameters, enable Web caching again.
The Web cache directory for a Web cache view must reside on the same slot as the Web view.
Before specifying a Web cache directory, make sure all files in the upper-level directory are using a different name than the Web cache directory or have a file extension.
Make sure the storage medium where the Web cache directory resides has sufficient storage space. The directory typically needs a storage space of over 1 GB.
Procedure
1. Enter system view.
system-view
2. Create and enter Web cache view.
web-cache slot slot-number
3. Specify the types of the webpage files to be cached.
cached-data { apk | bmp | doc | docx | gif | gzip | ipa | jar | jpg | jpeg | mp4 | pdf | png | ppt | pptx | rar | swf | tar | txt | xls | xlsx | zip } *
By default, no webpage file types are specified. The Web caching feature does not cache any types of files on webpages.
4. Set the Web caching listening port number.
listen-port port-number
By default, the Web caching listening port number is not configured. The Web caching feature does not operate.
Make sure the specified TCP port number is not being used by any other services on the device. To display TCP port numbers being used, execute the display tcp verbose command.
5. (Optional.) Specify an IPv4 object group used to filter Web content to be cached.
object-group [ source ] ip object-group-name
By default, no IPv4 object group is specified for the Web caching feature to filter Web content. The Web caching feature caches Web content from all Web servers.
To cache Web content requested by specific Web clients, specify the source keyword. To cache Web content sent from specific Web servers, do not specify the source keyword.
6. Set the Web cache directory.
file-directory directory
By default, the Web cache directory is not set.
7. (Optional.) Set the maximum total size of Web cache files.
cache-limit size
By default, the maximum total size of Web cache files is 4 GB.
The maximum total size for Web cache files must be smaller than the maximum storage space size in the working directory.
Enabling Web caching
Restrictions and guidelines
Before enabling Web caching, you must configure the following Web caching parameters:
· Types of the webpage files to be cached.
· Web cache directory.
· Web caching listening port number.
Procedure
1. Enter system view.
system-view
2. Create and enter Web cache view.
web-cache slot slot-number
3. Enable Web caching.
http enable
By default, Web caching is disabled.
Verifying and maintaining Web caching
To display Web caching information, execute the following command in any view:
display web-cache [ history ] [ last { day | 30-days | 365-days | hour | minute | week } | verbose ]
Web caching configuration examples
Example: Configuring Web caching
Network configuration
As shown in Figure 2, configure and enable Web caching on the device to cache Web content from the server.
Procedure
1. Configure IP addresses for interfaces. (Details not shown.)
2. Create and enter Web cache view.
<Device> system-view
[Device] web-cache slot 1
3. Configure Web caching parameters.
# Set the Web cache directory to slot0#flash:/webcache.
[Device-web-cache-slot1] file-directory slot1#flash:/webcache
# Set the Web caching listening port number to 9955.
[Device-web-cache-slot1] listen-port 9955
# Set the maximum total size for Web cache files to 10 GB.
[Device-web-cache-slot1] cache-limit 10
# Specify the types of the files on webpages to be cached.
[Device-web-cache-slot1] cached-data doc docx
4. Enable Web caching.
[Device-web-cache-slot1] http enable
Verifying the configuration
# Display Web caching information after the host sends the first HTTP request to the Web server.
[Device-web-cache-slot1] display web-cache
Capability information
Cache path: slot1#flash:/webcache/proxy/cache
Max connections: 1022
Max cache size: 10GB
Current state information
Cache memory: 25.0MB
Cache count: 1
Statistics for past 1 minute
ConnectTop: 4
CacheTop: 25.0MB
Bandwidth saved: 0
Cached data transmission speed: 3.3Mbps
Cached data transmitted: 25.0MB
Download speed: 3.3Mbps
Download size: 25.0MB
CacheHitRate: 0%
Hit count: 0 Miss count: 1
Statistics for past 1 hour
ConnectTop: 4
CacheTop: 25.0MB
Bandwidth saved: 0
Cached data transmission speed: 56.0Kbps
Cached data transmitted: 25.0MB
Download speed: 56.0Kbps
Download size: 25.0MB
CacheHitRate: 0%
Hit count: 0 Miss count: 1
Statistics for past 1 day
ConnectTop: 4
CacheTop: 25.0MB
Bandwidth saved: 0
Cached data transmission speed: 2.0Kbps
Cached data transmitted: 25.0MB
Download speed: 2.0Kbps
Download size: 25.0MB
CacheHitRate: 0%
Hit count: 0 Miss count: 1
Statistics for past 30 days
ConnectTop: 4
CacheTop: 25.0MB
Bandwidth saved: 0
Cached data transmission speed: 0
Cached data transmitted: 25.0MB
Download speed: 0
Download size: 25.0MB
CacheHitRate: 0%
Hit count: 0 Miss count: 1
Statistics for past 365 days
ConnectTop: 4
CacheTop: 25.0MB
Bandwidth saved: 0
Cached data transmission speed: 0
Cached data transmitted: 25.0MB
Download speed: 0
Download size: 25.0MB
CacheHitRate: 0%
Hit count: 0 Miss count: 1
[Device-web-cache-slot1] display web-cache
Capability information
Cache path: slot1#flash:/webcache/proxy/cache
Max connections: 1022
Max cache size: 10GB
Current state information
Cache memory: 25.0MB
Cache count: 1
Statistics for past 1 minute
ConnectTop: 4
CacheTop: 25.0MB
Bandwidth saved: 0
Cached data transmission speed: 3.3Mbps
Cached data transmitted: 25.0MB
Download speed: 3.3Mbps
Download size: 25.0MB
CacheHitRate: 0%
Hit count: 0 Miss count: 1
Statistics for past 1 hour
ConnectTop: 4
CacheTop: 25.0MB
Bandwidth saved: 0
Cached data transmission speed: 56.0Kbps
Cached data transmitted: 25.0MB
Download speed: 56.0Kbps
Download size: 25.0MB
CacheHitRate: 0%
Hit count: 0 Miss count: 1
Statistics for past 1 day
ConnectTop: 4
CacheTop: 25.0MB
Bandwidth saved: 0
Cached data transmission speed: 2.0Kbps
Cached data transmitted: 25.0MB
Download speed: 2.0Kbps
Download size: 25.0MB
CacheHitRate: 0%
Hit count: 0 Miss count: 1
Statistics for past 30 days
ConnectTop: 4
CacheTop: 25.0MB
Bandwidth saved: 0
Cached data transmission speed: 0
Cached data transmitted: 25.0MB
Download speed: 0
Download size: 25.0MB
CacheHitRate: 0%
Hit count: 0 Miss count: 1
Statistics for past 365 days
ConnectTop: 4
CacheTop: 25.0MB
Bandwidth saved: 0
Cached data transmission speed: 0
Cached data transmitted: 25.0MB
Download speed: 0
Download size: 25.0MB
The command output shows the Web caching feature is operating correctly.
· The value of the Miss count field in the command output from the first display command is 1. The value of the Hit count field in the command output from the second display command is 1. The second HTTP request hits the Web cache.
· The value of the Download size field in the command output from the second display command is the same as that from the first display command. No Web data was downloaded from the Web server to the device after the device sent the second HTTP request.
Troubleshooting Web caching
Web caching enabling failure
Symptom
Web caching failed to be enabled.
Analysis
The TCP port number specified for Web caching must belong to Web caching exclusively. If any other services on the device are using the same TCP port number, Web caching cannot be enabled.
Solution
To resolve the problem:
1. Execute the display tcp verbose command to display TCP port numbers being used.
2. Specify an unused TCP port number as the Web caching listening port number.