07-Layer 3—IP Services Configuration Guide

HomeSupportConfigure & DeployConfiguration GuidesH3C MSR810 2600 3600 Routers Configuration Guides(V7)-R0707-6W30107-Layer 3—IP Services Configuration Guide
22-Web caching configuration
Title Size Download
22-Web caching configuration 78.64 KB

Configuring Web caching

About Web caching

The Web caching feature saves specific webpage contents requested by HTTP users from specific Web servers to files in the Web cache directory. If users access the same contents before the contents are aged out, the device retrieves the contents from the files and sends the contents 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.

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 contents 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 contents.

?     If the requested contents are found in the cache, the device retrieves the contents and sends the contents to the host. The HTTP GET operation is completed.

?     If the requested contents are not found, the device re-constructs the request and sends the request to the Web server.

4.     The Web server sends the requested contents to the device.

5.     The device identifies whether the Web caching feature is configured to cache the contents.

?     If yes, the device uses the Web caching feature to cache the contents, 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—The Web caching feature saves Web contents to be cached to files in the Web cache directory. After the actual 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 contents in a file, it resets the aging timer. If no users request the cached contents 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 contents.

License requirement for Web caching

The Web caching feature requires a license to run on the device. If you do not install a license for the feature, Web caching settings will be deleted automatically at 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

2.     Enabling Web caching

Configuring Web caching parameters

Restrictions and guidelines

Before modifying Web caching parameters, you must disable Web caching first. After modifying Web caching parameters, enable Web caching again.

Procedure

1.     Enter system view.

system-view

2.     Create and enter Web cache view.

In standalone mode:

web-cache

In IRF mode:

web-cache slot slot-number

3.     Specify the types of the files on webpages to be cached.

cached-data { apk | bmp | doc | docx | gif | gzip | ipa | jar | jpg | jpeg | pdf | png | ppt | pptx | rar | swf | tar | txt | xls | xlsx | zip } *

By default, no webpage file types are specified.

If you do not specify the types of the files on webpages to be cached, the Web caching feature does not cache any types of files on webpages.

4.     Setting the Web caching listening port number.

listen-port port-number

By default, the Web caching listening port number is not configured.

If you do not specify the Web caching listening port number, 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.     Reference an IPv4 address object to specify the Web servers whose Web contents are to be cached.

object-group ip object-group-name

By default, no address object is specified. The Web caching feature is allowed to cache webpage contents from all Web servers.

This command requires the cooperation of the IPv4 object group feature. For more information about the IPv4 object group feature, see object group configuration in Security Configuration Guide.

6.     (Optional.) Set the Web cache directory.

file-directory directory

By default, the Web cache directory is flash:/var/web-cache.

If you specify a non-existent directory for this command or enable Web caching without specifying the Web cache directory, the device creates and uses the default Web caching directory.

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.

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 actual maximum total size for Web cache files is the smaller one between the specified maximum total size and the maximum storage space size in the working directory.

Enabling Web caching

1.     Enter system view.

system-view

2.     Create and enter Web cache view.

In standalone mode:

web-cache slot slot-number

In IRF mode:

web-cache slot slot-number

3.     Enable Web caching.

http enable

By default, Web caching is disabled.

Display and maintenance commands for Web caching

Execute the display command in any view.

 

Task

Command

Display Web caching information.

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 contents from the server.

Figure 2 Network diagram

 

Procedure

1.     Configure IP addresses for interfaces. (Details not shown.)

2.     Create and enter Web cache view.

In standalone mode:

<Device> system-view

[Device] web-cache slot 0

In IRF mode:

<Device> system-view

[Device] web-cache slot 1

3.     Configure Web caching parameters.

In standalone mode:

# Set the Web cache directory to slot0#flash:/webcache.

[Device-web-cache-slot0] file-directory slot0#flash:/webcache

# Set the Web caching listening port number to 9955.

[Device-web-cache-slot0] listen-port 9955

# Set the maximum total size for Web cache files to 10 GB.

[Device-web-cache-slot0] cache-limit 10

# Specify the Web server at 172.16.1.2 for Web caching.

[Device-web-cache-slot0] server 172.16.1.2

In IRF mode:

# 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 Web server at 172.16.1.2 for Web caching.

[Device-web-cache-slot1] server 172.16.1.2

4.     Enable Web caching.

In standalone mode:

[Device-web-cache-slot0] http enable

In IRF mode:

[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.

In standalone mode:

[Device-web-cache-slot0] display web-cache

Capability information

  Cache path: /mnt/flash:/webcache/proxy/cache

  Max connections: 1022

  Max cache size: 10GB

 

Current state information

  Cache memory: 25.0MB

  Cache count: 2

 

Last 1 minute state information

  ConnectTop: 4

  CacheTop: 25.0MB

  Bandwidth saved:           0

    Service speed:     3.3Mbps        Service size:    25.0MB

    Download speed:    3.3Mbps        Download size:   25.0MB

  CacheHitRate: 0%

    Hit count: 0                     Miss count: 1

 

Last 1 hour state information

  ConnectTop: 4

  CacheTop: 25.0MB

  Bandwidth saved:           0

    Service speed:    56.0Kbps        Service size:    25.0MB

    Download speed:   56.0Kbps        Download size:   25.0MB

  CacheHitRate: 0%

    Hit count: 0                     Miss count: 1

 

Last 1 day state information

  ConnectTop: 4

  CacheTop: 25.0MB

  Bandwidth saved:           0

    Service speed:     2.0Kbps        Service size:    25.0MB

    Download speed:    2.0Kbps        Download size:   25.0MB

  CacheHitRate: 0%

    Hit count: 0                     Miss count: 1

 

Last 30 days state information

  ConnectTop: 4

  CacheTop: 25.0MB

  Bandwidth saved:           0

    Service speed:           0        Service size:    25.0MB

    Download speed:          0        Download size:   25.0MB

  CacheHitRate: 0%

    Hit count: 0                     Miss count: 1

 

Last 365 days state information

  ConnectTop: 4

  CacheTop: 25.0MB

  Bandwidth saved:           0

    Service speed:           0        Service size:    25.0MB

    Download speed:          0        Download size:   25.0MB

  CacheHitRate: 0%

Hit count: 0                     Miss count: 1

In IRF mode:

[Device-web-cache-slot1] display web-cache

Capability information

  Cache path: /mnt/flash:/webcache/proxy/cache

  Max connections: 1022

  Max cache size: 10GB

 

Current state information

  Cache memory: 25.0MB

  Cache count: 2

 

Last 1 minute state information

  ConnectTop: 4

  CacheTop: 25.0MB

  Bandwidth saved:           0

    Service speed:     3.3Mbps        Service size:    25.0MB

    Download speed:    3.3Mbps        Download size:   25.0MB

  CacheHitRate: 0%

    Hit count: 0                     Miss count: 1

 

Last 1 hour state information

  ConnectTop: 4

  CacheTop: 25.0MB

  Bandwidth saved:           0

    Service speed:    56.0Kbps        Service size:    25.0MB

    Download speed:   56.0Kbps        Download size:   25.0MB

  CacheHitRate: 0%

    Hit count: 0                     Miss count: 1

 

Last 1 day state information

  ConnectTop: 4

  CacheTop: 25.0MB

  Bandwidth saved:           0

    Service speed:     2.0Kbps        Service size:    25.0MB

    Download speed:    2.0Kbps        Download size:   25.0MB

  CacheHitRate: 0%

    Hit count: 0                     Miss count: 1

 

Last 30 days state information

  ConnectTop: 4

  CacheTop: 25.0MB

  Bandwidth saved:           0

    Service speed:           0        Service size:    25.0MB

    Download speed:          0        Download size:   25.0MB

  CacheHitRate: 0%

    Hit count: 0                     Miss count: 1

 

Last 365 days state information

  ConnectTop: 4

  CacheTop: 25.0MB

  Bandwidth saved:           0

    Service speed:           0        Service size:    25.0MB

    Download speed:          0        Download size:   25.0MB

  CacheHitRate: 0%

Hit count: 0                     Miss count: 1

In standalone mode:

[Device-web-cache-slot0] display web-cache

Capability information

  Cache path: /mnt/flash:/webcache/proxy/cache

  Max connections: 1022

  Max cache size: 10GB

 

Current state information

  Cache memory: 25.0MB

  Cache count: 2

 

Last 1 minute state information

  ConnectTop: 3

  CacheTop: 25.0MB

  Bandwidth saved:     3.3Mbps

    Service speed:     3.3Mbps        Service size:    25.0MB

    Download speed:          0        Download size:        0

  CacheHitRate: 100%

    Hit count: 1                     Miss count: 0

 

Last 1 hour state information

  ConnectTop: 4

  CacheTop: 25.0MB

  Bandwidth saved:    56.0Kbps

    Service speed:   113.0Kbps        Service size:    50.0MB

    Download speed:   56.0Kbps        Download size:   25.0MB

  CacheHitRate: 33.3%

    Hit count: 1                     Miss count: 1

 

Last 1 day state information

  ConnectTop: 4

  CacheTop: 25.0MB

  Bandwidth saved:     2.0Kbps

    Service speed:     4.0Kbps        Service size:    50.0MB

    Download speed:    2.0Kbps        Download size:   25.0MB

  CacheHitRate: 33.3%

    Hit count: 1                     Miss count: 1

 

Last 30 days state information

  ConnectTop: 4

  CacheTop: 25.0MB

  Bandwidth saved:           0

    Service speed:           0        Service size:    50.0MB

    Download speed:          0        Download size:   25.0MB

  CacheHitRate: 33.3%

    Hit count: 1                     Miss count: 1

 

Last 365 days state information

  ConnectTop: 4

  CacheTop: 25.0MB

  Bandwidth saved:           0

    Service speed:           0        Service size:    50.0MB

    Download speed:          0        Download size:   25.0MB

  CacheHitRate: 33.3%

    Hit count: 1                     Miss count: 1

In IRF mode:

[Device-web-cache-slot1] display web-cache

Capability information

  Cache path: /mnt/flash:/webcache/proxy/cache

  Max connections: 1022

  Max cache size: 10GB

 

Current state information

  Cache memory: 25.0MB

  Cache count: 2

 

Last 1 minute state information

  ConnectTop: 3

  CacheTop: 25.0MB

  Bandwidth saved:     3.3Mbps

    Service speed:     3.3Mbps        Service size:    25.0MB

    Download speed:          0        Download size:        0

  CacheHitRate: 100%

    Hit count: 1                     Miss count: 0

 

Last 1 hour state information

  ConnectTop: 4

  CacheTop: 25.0MB

  Bandwidth saved:    56.0Kbps

    Service speed:   113.0Kbps        Service size:    50.0MB

    Download speed:   56.0Kbps        Download size:   25.0MB

  CacheHitRate: 33.3%

    Hit count: 1                     Miss count: 1

 

Last 1 day state information

  ConnectTop: 4

  CacheTop: 25.0MB

  Bandwidth saved:     2.0Kbps

    Service speed:     4.0Kbps        Service size:    50.0MB

    Download speed:    2.0Kbps        Download size:   25.0MB

  CacheHitRate: 33.3%

    Hit count: 1                     Miss count: 1

 

Last 30 days state information

  ConnectTop: 4

  CacheTop: 25.0MB

  Bandwidth saved:           0

    Service speed:           0        Service size:    50.0MB

    Download speed:          0        Download size:   25.0MB

  CacheHitRate: 33.3%

    Hit count: 1                     Miss count: 1

 

Last 365 days state information

  ConnectTop: 4

  CacheTop: 25.0MB

  Bandwidth saved:           0

    Service speed:           0        Service size:    50.0MB

    Download speed:          0        Download size:   25.0MB

  CacheHitRate: 33.3%

    Hit count: 1                     Miss count: 1

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 a TCP port number that is not being used for Web caching.

 

 

  • Cloud & AI
  • InterConnect
  • Intelligent Computing
  • Security
  • SMB Products
  • Intelligent Terminal Products
  • Product Support Services
  • Technical Service Solutions
All Services
  • Resource Center
  • Policy
  • Online Help
All Support
  • Become a Partner
  • Partner Resources
  • Partner Business Management
All Partners
  • Profile
  • News & Events
  • Online Exhibition Center
  • Contact Us
All About Us
新华三官网