هذه الصفحة غير متوفرة حاليًا بلغتك المحلية. نحن نعمل جاهدين على إضافة المزيد من اللغات. شاكرين تفهمك ودعمك المستمر لنا.
- What's New
- Function Overview
-
Product Bulletin
- Service Termination Policy Function Will Be Taken Offline
- Huawei Cloud CDN Will Verify the Ownership of All Domain Names
- Huawei Cloud CDN Will Add a Log Field
- Huawei Cloud CDN Will Adjust the Cache Logic of Status Code 400
- Huawei Cloud CDN Will No Longer Maintain the Log Combination Tool
- Huawei Cloud CDN Will Take the Old Analytics Offline
- Service Overview
-
Billing
- Billing Items
- Basic Service Billing
- Value-added Service Billing
- Prepaid Resource Packages
- Billing Examples
- Changing the Billing Option
- Traffic Package Renewal
- Expiration and Overdue Payment
- Bills
- Cost Management
- Stopping Billing
- High Bill Risk Warning
- Billing for Whole Site Acceleration
- OBS Billing for CDN Acceleration
- Billing FAQ
- Change History
- Getting Started
-
User Guide
- Domain Name Management
- Custom Domain Name Configuration
- Resource Package Management
- Cache Prefetch and Purge
- Analytics
- Analytics (New)
- Log Management
- Domain Certificate Management
- IP Address Check
- Security
- Permissions Management
- Enterprise Projects
- Auditing
- Monitoring
- Best Practices
-
API Reference
- Before You Start
- API Overview
- Calling APIs
-
API
- Domain Name Operations
-
Domain Name Configuration
- Querying IP Address Information
- Modifying the Status of Private Bucket Access
- Associating a Certificate with Multiple Domain Names
- Querying All Domain Names Associated with HTTPS Certificates
- Listing Resource Tags
- Creating a Resource Tag
- Deleting a Resource Tag
- Copying Domain Configuration
- Modifying the Full Domain Configuration
- Querying Domain Name Configuration
- Analytics
- Billing Management
- Quotas
- Log Management
- Cache Purge and Prefetch
-
Out-of-Date APIs
-
Domain Name Configuration
- Enabling or Disabling Range-based Retrieval
- Enabling or Disabling Redirect Retrieval
- Configuring a Referer List
- Querying a Referer List
- Querying Details About an ACL
- Setting an ACL
- Configuring a Cache Rule
- Querying a Cache Rule
- Configuring HTTPS Settings
- Querying HTTP Settings
- Adding or Modifying Response Headers
- Querying Response Headers
- Modifying Origin Server Details
- Modifying the Host Header
- Querying a Retrieval Host
-
Statistics Analysis
- Querying the Total Network Traffic
- Querying Details of Network Traffic
- Querying the Peak Bandwidth Value
- Querying Details of Network Bandwidth
- Querying Consumption Summary
- Querying Consumption Details
- Querying Consumption of Each Domain Name
- Querying Domain Consumption by Region
- Querying Domain Consumption by Carrier
- Querying Statistics About Each Domain Name Under a Region or Carrier
- Querying Statistics About Domain Names Under a Region or Carrier
- Querying Statistics About Domain Names by Region and Carrier
- Querying Statistics About Domain Names
- Downloading a Statistical Metric Table
- Querying Top Domain Names
- Querying Peak Bandwidth Data of a Domain Name
- Downloading a Table of Statistics by Region and Carrier
- Refreshing and Preheating (Old Version)
- Domain Name Operations
-
Domain Name Configuration
- Examples
- Permissions Policies and Supported Actions
- Appendix
- SDK Reference
-
FAQs
-
Functions
- What Is Whole Site Acceleration?
- What Service Types Does CDN Support?
- Does CDN Support DNS, HTTPDNS, and IP302 Scheduling?
- Which Protocols Does CDN Support?
- Does On-Demand Service Acceleration Support HLS and RTMP?
- Can CDN Identify Whether a User Is on a Desktop or Mobile Device?
- Does CDN Support Acceleration for a Single Web Page?
- Does CDN Support Binary File Acceleration?
- Does CDN Support Level-2 Domain Name Acceleration?
- Does CDN Accelerate POST Requests?
- Does CDN Have a Speed Limit?
- Does CDN Accelerate Local Access to Shopping Websites?
- What Origin Types Does CDN Support?
- Does CDN Support Domain Names That Contain Chinese Characters?
- Does Huawei Cloud CDN Support HTTP/3?
- Does Huawei Cloud CDN Support Content Encryption Before Distribution?
- Does Huawei Cloud CDN Support Intranet Acceleration?
- Can CDN Provide All PoP IP Addresses and Origin IP Addresses?
- Can I Migrate Domain Configurations in One Account to Another Account?
- Is the Principle of Accelerating Delivery of Static and Dynamic Content the Same?
- How Do I Stop the CDN Service?
- What Is the Maximum Size of a File to Be Uploaded to CDN?
- Does CDN Support Frequency Control?
- Does CDN Support Real-Time Monitoring?
- Does CDN Support Access Through Fixed IP Addresses?
-
Usage
- How Do I Enable CDN?
- How Do I Control and Assign CDN Permissions by Project?
- How Do I Grant Some CDN Permissions to IAM Users?
- Is the CDN Service Area Related to the Origin Server Location and ICP Filing?
- Will User Access from Other Regions Be Accelerated If I Select Chinese Mainland or Outside the Chinese Mainland as My Service Area?
- Does CDN Support Acceleration by Region?
- What Is the Conversion Rule for Traffic and Bandwidth?
- Does CDN Accelerate Access to the Origin Server of a Website, or Accelerate Access to the Domain Name?
- Can Wildcards Be Used as Part of an Acceleration Domain Name?
- What Are the Differences in CDN Acceleration Among the Three Service Areas?
- Can I Use the CDN SDKs?
- How Do I Select the Service Area If the Server Is Outside the Chinese Mainland but My Web Visitors Are in the Chinese Mainland?
- Is CDN Necessary If My Services Are Deployed Within a City?
- How Does CDN Determine the Region to Which a User Belongs?
- How Do I Direct Traffic from a Third-Party Platform to CDN?
- Can an Acceleration Domain Name Be Configured with Multiple Origin Servers?
- Can File Upload Be Accelerated?
- Can Users in the Chinese Mainland Access Origin Servers and Users Outside the Chinese Mainland Access CDN?
- Can I Use CDN If the Origin Port Is Not 80?
- Can I Use Global Acceleration If My Origin Server Is in the Chinese Mainland?
- How Do I Configure an Origin Server When It Is a Non-Huawei Cloud Object Storage Bucket?
- Does CDN Accelerate User Access from a Specified Line?
- What If the ICP License of My Acceleration Domain Name Expires?
- What Are the Differences Between an Acceleration Domain Name and an Origin Domain?
- Do Acceleration Domain Name and Origin Domain Both Need to Be Licensed by China's MIIT?
- Can CDN Provide Acceleration for a Domain Name That Houses Different Types of Services (Website, VOD, and File Download)?
- Why Is the Error Message Indicating Failed to Obtain the Domain ID Displayed When an IAM User Calls an API After the Enterprise Project Function Is Enabled?
- Can CDN Share an Acceleration Domain Name with Live?
-
Purchase and Billing
- What Will I Billed For?
- Will I Be Billed If My Domain Name Is Under Attack?
- Issues Related to CDN Traffic Packages
- Can I View the Billing Information of a Single Domain Name?
- Does CDN Charge for HTTP/HTTPS Requests?
- What Traffic Is Consumed When CDN Requests Resources from OBS?
- How Do I Set an Alert for the Remaining Traffic in a Traffic Package?
- How Do I Check the Bills of 95th Percentile Bandwidth?
- Why Is the Traffic Usage in a Traffic Package Different from That Shown in Analytics?
- Why Is My Account Balance Deducted Even If I Have Purchased a Traffic Package?
- Is Billing for On-Demand Service Acceleration the Same as That for File Download Acceleration?
- What Is a Retention Period?
- If Global Acceleration Is Configured, Are the Traffic and Bandwidth Consumptions in and Outside the Chinese Mainland Billed Separately?
- Why Is My CDN Not Working When My Account Is in Arrears?
- An OBS Bucket Is Being Used as the Origin Server and an OBS Pull Traffic Package Has Been Purchased. Why Isn't the Origin Pull Traffic Generated by CDN Being Deducted From the OBS Pull Traffic Package?
-
Domain Name Settings
- Does CDN Support the Configuration of Domain Names with Ports?
- Can a Subdomain Name Be Used as an Acceleration Domain Name?
- Can the CNAME of an Acceleration Domain Name Be Directly Accessed?
- Do I Need to Configure a Certificate for the Origin Server After Adding a Security Certificate to CDN?
- Can a Rejected Domain Name Be Modified and Added Again to CDN?
- Can Multiple Acceleration Domain Names Use the Same Origin Server IP Address?
- Can the OBS Bucket's Domain Name Be Used as an Acceleration Domain Name If an OBS Bucket Is Configured as an Origin Server?
- What Requirements Should I Meet Before Adding a Domain Name Whose Service Area Is Chinese Mainland?
- Can I Limit Access to Domain Names Based on QPS?
- Does Huawei Cloud CDN Accelerate Delivery of Content Redirected from VPN?
- Does My Domain Name Have to Be Resolved on Huawei Cloud?
- Can an Acceleration Domain Name Be Used in and Outside the Chinese Mainland?
- Why Do My Domain Requests Still Go to CDN PoPs After My Domain Name Has Been Disabled and Domain Resolution Has Been Changed?
- How Do I Configure a Certificate for a Wildcard Domain?
- Why Am I Seeing the "Incomplete certificate chain" Message?
- Why Am I Seeing a Message Indicating that the Certificate Format Is Incorrect?
- Are Self-Signed HTTPS Certificates Supported?
- After Force HTTPS Is Enabled, Why Are Parameters Missing in a POST Request When I Call an API Using HTTP?
- Can Users Use HTTP to Visit My Domain Name After HTTPS Is Configured?
- What Should I Do If the ICP License of an Acceleration Domain Name Expires?
-
Cache Settings
- Will the Cache on CDN PoPs Be Updated in Real Time?
- Does Huawei Cloud CDN Support Regular Expressions for Cache Policy Setting?
- Does CDN Support Batch Configuration of Cache Policies for Acceleration Domain Names?
- Does CDN Cache Status Codes 404 and 403?
- What Are the Default Cache Rules? Can I Modify the Cache TTL?
- Why Is the Cache Hit Ratio of a Domain Name with Whole Site Acceleration Greater Than 0?
- Does the Path in Cache Settings Refer to a Web Address or File Path on the Server?
- Why Is the CDN Cache Hit Ratio Low?
- Why Am I Able to Access and Download a File After It Is Deleted from an OBS Bucket?
- How Do I Cache the Homepage (Root Directory)?
- How Do I Check Whether a Cache Is Hit?
- Why Is the Latest Content Inaccessible Even When the Cache TTL Is Set to 0?
- Does Huawei Cloud CDN Support Caching octet-stream Stream Files?
- Why Are Certain Files Not Downloadable Even Though They Have Not Expired (365 Days)?
- How Do I Configure Cache for Resources That Do Not Need to Be Cached?
- Can I Specify a Directory and Filename Extension for Caching?
- When Hotlinking Happens, Will the Previous Cache Still Exist After I Change the Domain Name?
- All Resources Are Preheated, and the Cache TTL Is One Year. Why Is the Requested Content Still Being Pulled from the Origin Server?
- How Do I Synchronize Content Cached on CDN PoPs with That on the Origin Server?
- Why Does a Cache Rule Not Take Effect?
-
Troubleshooting
- Why Am I Seeing a Message Indicating that the Domain Name Already Exists When I Add a Domain Name for CDN Acceleration?
- Why Is My Domain Name Inaccessible After HTTPS Secure Acceleration Is Configured?
- Why Is Data Obtained from a CDN PoP Not the Updated Data?
- Why Is 304 Returned When a User Accesses a Resource Under My Acceleration Domain Name?
- Why Does Agency Creation for OBS Fail When an OBS Private Bucket Is Used as the Origin Server?
- Why Can't a Web Page Be Properly Displayed After the Origin Server's IP Address Is Changed?
- Why Do I Get an Access Failure and Access-Control-Allow-Origin Error?
- Why Does Baidu Spider Fail to Capture Data?
- Why Are All Files in the Bucket Displayed When Users Request a File from an OBS Bucket Connected to CDN?
- Why Does a Video Freeze After CDN Is Configured?
- Why Is My CDN Disabled?
- Why Does the System Always Display "301" After HTTPS Is Configured for a Domain Name?
- Why Do I Get Request Timed Out When Trying to Ping an Acceleration Domain Name?
- Why Are Incorrect Resources Being Pulled from My Origin Server?
- Why Is My Site Slow the First Time I Access It After CDN Is Configured?
- Why Is My Acceleration Domain Name Inaccessible Outside the Chinese Mainland?
- Why Is a File in an OBS Bucket with CDN Acceleration Enabled Automatically Downloaded When I Access the File?
- What Should I Do If a Domain Name Fails to Be Added?
- Why Are CDN PoPs Offline During O&M?
-
Cache Purge and Prefetch
- What Are the Differences Between Cache Purge and Cache Prefetch?
- Why Am I Seeing Insufficient Permission for Cache Purge and Prefetch?
- Why Does a Cache Prefetch Operation Fail?
- Does Cache Purge Refresh Content Cached on All PoPs?
- Should I Enter an Origin URL or Domain Name URL for Cache Purge and Prefetch?
- Why Does a Prefetch Task Remain in the Being Processed Status for a Long Time?
- How Do I Purge the CDN Cache Where the Domain Name Includes a Wildcard?
- Why Do Users Still Access the Stale Resource After It Has Been Updated on the Origin Server and Its Cache on CDN Has Been Purged?
- Does CDN Support Directory Prefetch?
- Are Cache Purge and Prefetch Mandatory?
- Do I Need to Purge or Prefetch the Cache of Both HTTP and HTTPS URLs?
- If CDN Is Enabled in and Outside the Chinese Mainland, Does It Need to Be Differentiated When Cache Purge and Prefetch?
- Can I Prefetch M3U8 Files?
- Can the Cache Be Automatically Updated After a Static File on the Origin Server Is Updated?
- Which Should I Do First, Purge or Prefetch, When I Want to Update Cache?
-
Security
- What Security Capabilities (Anti-DDoS/CC Attack Defense/Anti-hotlinking) Does CDN Provide?
- Does CDN Support IP Address Filtering?
- How Does CDN Respond to CC Attacks?
- Does CDN Prevent Content Hijacking?
- Does CDN Have Anti-DDoS Capabilities?
- Can CDN, WAF, and AAD Be Used Simultaneously?
- Can Certificates Be Updated Without Service Interruption?
- If a Referer ACL Have Been Configured for an OBS Bucket, Will the Settings Take Effect on the CDN Side?
- Does CDN Detect Viruses in an Acceleration File?
- Can Multiple Certificates Be Configured for a Domain Name?
- Will the Traffic Pass Through WAF If Both CDN and WAF Are Configured?
- How Do I Check If CDN Is Being Maliciously Used?
-
Statistics and Logs
- What Could Fall Into the "Other" Category in the Visitor Region Statistics?
- How Long Is the API Delay of the Top 100 URLs?
- What Are the Meanings of HEAD, HIT, and MISS in CDN Logs?
- What Does User-Agent OkHttp in CDN Logs Mean?
- How Many Days of Data Can Be Queried?
- Why Am I Seeing the Message "Fine-grained Authentication Failed" When I Call an API to Download CDN Logs?
- Why Is There No Data in Analytics?
-
Origin Pull
- In What Scenarios Does CDN Pull Content from an Origin Server?
- What Do I Fix Origin Pull Failures?
- Can CDN Pull Content from Third-Party Private Buckets?
- How Do I Check Whether Range Requests Are Supported for Origin Pull?
- If a Domain Name Is Attacked, Will Access Requests Be Directed to the Origin Server?
- What Are the Benefits of a Standby Origin Server?
- Does CDN Support Direct Origin Pull Through Crawler Access?
- What Is the Difference Between a Host and an Origin Server?
- How Does Origin Pull Work If Origin Servers Have Multiple IP Addresses?
- Why Are Incorrect Resources Being Pulled?
- How Do I View Origin Pull Records?
- Will CDN Download All Files If I Send a Status Code 206 to Request 100-Byte Content?
- Quota
-
Functions
-
Troubleshooting
- Overview
- Why Can't I Access a Web Page or Play a Video After I Enable CDN?
- Why Is It Still Slow to Access a Domain Name That Has Been Added for CDN Acceleration?
- Why Is the Displayed or Downloaded Content Incorrect After CDN Acceleration Is Used?
- Why Is a 4XX Status Code Returned When I Request Resources from My Acceleration Domain Name?
- Why Is a 5XX Status Code Returned When I Request Resources from My Acceleration Domain Name?
- Why Does a 301/302 Redirect Loop Occur When I Request Resources from My Acceleration Domain Name?
- Status Code and Handling Suggestions
- Why Am I Getting a Permission Error Message?
- Why Can't I Log In to My Domain Name or Why Is the Information of Other Users Displayed?
- How Do I Check Whether an Access Fault Is Caused by a CDN PoP or Origin Server?
- Why Is the Cache of a Resource Inconsistent on Different PoPs?
- Why Does the Configured Cache Rule Not Take Effect?
- What Do I Do If the Browser Displays a Message Indicating that a Cross-domain Exception Occurs After CDN Is Enabled?
- Change History
- WSA User Guide
- Videos
- Glossary
- General Reference
Copied.
Improving the Cache Hit Ratio
Background
If the CDN cache hit ratio is low, the pressure on the origin server is high and the static resource access efficiency is low. You can select an optimization policy based on the cause of the low cache hit ratio to improve the cache hit ratio. In CDN, the cache hit ratio includes the traffic hit ratio and request hit ratio.
- Traffic hit ratio = Traffic generated by requests that hit the cache/Total traffic of requests
- Request hit ratio = Number of requests that hit the cache/Total number of requests
NOTE:
The traffic hit ratio indicates the load on the origin server. A lower traffic hit ratio means a larger origin pull traffic, which leads to a larger output traffic and higher bandwidth consumption on the origin server.
Viewing the Cache Hit Ratio
You can log in to the CDN console to view the traffic hit ratio and request hit ratio.
- Log in to Huawei Cloud console. Choose Service List > Content Delivery & Edge Computing > Content Delivery Network.
The CDN console is displayed.
- In the navigation pane, choose Analytics.
- Choose Traffic and Requests under Analytics to view the traffic hit ratio and request hit ratio.
Figure 1 Traffic hit ratioFigure 2 Request hit ratio
Optimizing the Cache Hit Ratio
- Set an appropriate cache TTL.
CDN caches origin content on globally distributed PoPs so that users can obtain the content from nearby PoPs. You can set a proper TTL for different content on the CDN console to improve the cache hit ratio.
- For static files (such as images and app packages) that are not frequently updated, set the TTL to more than one month.
- For static files (such as JS and CSS files) that are frequently updated, set the TTL based on service requirements.
- For dynamic files (such as PHP, JSP, and ASP files), set the TTL to 0, so these files will not be cached on CDN PoPs.
For details, see Setting the Cache TTL.
NOTE:
- By default, Origin Cache Control is disabled. If you have set Cache-Control to s-maxage=0, max-age=0, no-cache, no-store, or private on the origin server and enabled Origin Cache Control on the CDN console, CDN PoPs cannot cache origin content and frequently pulls content from the origin server.
- If your origin server has multiple hosts and the Last-modified, Etag, and Content-Length parameters of a resource on these hosts are set to different values, CDN PoPs cannot cache the resource and frequently pulls the resource.
- If origin content has been updated, purge the URLs of the content to ensure that users can obtain the latest content.
- If you have modified a cache rule,
- Your modifications are effective for new content cached.
- You can purge to apply modifications to the existing cache.
- Set URL parameter rules.
Currently, most web page requests carry URL parameters following a question mark (?). Parameters that do not contain important information (such as version) do not affect users' access to the correct content. When setting a cache rule, you can set Query Parameters to Ignore all or Ignore specific to improve the cache hit ratio and distribution efficiency. For details, see Cache Rules.
Typical applications
- When a user requests http://www.example.com/1.txt?test1 for the first time, the content is not cached on CDN, and CDN pulls that content from the origin server. If Query Parameters is set to Ignore all on CDN, when another user requests http://www.example.com/1.txt?test2, the parameter behind the question mark (?) will be ignored. As a result, the cache of http://www.example.com/1.txt is hit.
- When a user requests http://www.example.com/1.txt?test1 for the first time, the content is not cached on CDN, and CDN pulls that content from the origin server. If Query Parameters is set to Retain all on CDN, when another user requests http://www.example.com/1.txt?test2, the full URL, including the parameter behind the question mark (?) will be matched. As a result, no cache is hit and CDN has to pull http://www.example.com/1.txt?test2 from the origin server.
- Preheat URLs.
CDN can proactively cache origin content to CDN PoPs through cache prefetch. When users access the content, they can directly obtain the latest content from CDN PoPs. For details, see Cache Prefetch.
Content prefetch can help you improve the cache hit ratio.
Typical scenarios
- Initial access to CDN: When a domain name is connected to CDN for the first time, the origin content is not cached on CDN PoPs. In this case, you can prefetch the origin content to CDN PoPs. Then users can directly obtain the content from the nearest CDN PoP, improving the access speed.
- Installation package release: Before releasing a software installation package or upgrade package, you can prefetch the content to CDN PoPs. After the software or upgrade is launched, the CDN PoPs directly respond to the download requests of a large number of users, which improves the download speed and greatly reduces the pressure on your origin server.
- Promotional activity: Before releasing a promotional campaign, you can prefetch the static content involved on the activity page to CDN PoPs. After the activity starts, the CDN PoPs respond to user requests for accessing all static content, which ensures service availability and improves user experience.
- Enable range requests.
A range request allows the origin server to send a specific range of data to a CDN PoP using the range information in the HTTP request header. Range requests accelerate large file distribution and improve origin pull efficiency and cache hit ratio. For details, see Range Requests.
Typical scenarios
- If a user requests a clip of a video, CDN needs to pull the entire video from the origin server when range requests are disabled. As a result, the pull traffic is greater than the traffic used for returning the content to the user, decreasing the cache hit ratio. When range requests are enabled, CDN only needs to pull the requested video clip and returns it to the user, improving the cache hit ratio.
- Perform further operations.
- Do not update an entire directory when a specific cached content needs to be updated.
You can purge the URL of the cached content to force the cache on CDN PoPs to expire. Purging the entire directory will force the cache of all content in the directory to expire. When a user accesses a resource in the directory, no cache is hit and CDN needs to pull the resource from the origin server. Therefore, do not purge the entire directory, especially the root directory.
- Do not carry dynamic parameters in URLs.
If your URLs contain dynamic parameters, such as timestamps, CDN cannot cache the content and frequently pulls the content.
- Do not update an entire directory when a specific cached content needs to be updated.
Checking Whether Requests for a URL Hit the Cache
- Open Google Chrome and press F12.
- Choose Network.
- Enter the website to be accessed in the address box and press Enter. View the response headers of the URL of a specific resource and perform the following operations:
- If the x-hcs-proxy-type header exists, check its value. The value 1 indicates that the cache is hit, and the value 0 indicates that the cache is not hit.
- If the x-hcs-proxy-type header does not exist, check the value of the X-Cache-Lookup header. Value Hit From MemCache, Hit From Disktank, or Hit From Upstream indicates that the cache is hit, whereas other values indicate that the cache is not hit.
- If neither the x-hcs-proxy-type nor X-Cache-Lookup header exists, check the value of the age header. Values greater than 0 indicate that the cache is hit, and the value 0 indicates that the cache is not hit.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot