Content Delivery Network

Recommended Configurations (Optional)

2024-05-28 12:08:13

Background Information

To obtain an excellent performance from the start of using CDN after adding a domain name, you are recommended to check and deploy the recommended configurations as follows for optimizations.

Recommended Configurations

Improving the Cache Hit Ratio

Scenario

Feature

Description

Reference

Low cache hit ratio

Set a proper cache time-to-live (TTL)

In some cases, the cache TTL may be improperly set. For example, a short cache TTL is set for a rarely altered file, the cache frequently  become expired due to the short TTL, the cached file is treated as stale on CDN. As a result, when users send requests to CDN for the file, the requests are frequently passed to the origin server for cache validation. This causes an increase in the response time and brings latency. 

You are recommended to configure the TTL as follows:

1. Set a longer cache TTL for infrequently updated files (such as images, app  downloads, and videos on demand).

2. Set the cache TTL based on your actual business conditions for frequently  updated static files (such as JS, CSS, XML, and HTML files).

3. Set the cache TTL to 0 seconds for dynamic files (such as PHP, JSP, ASP,  ASPX, DO files). The value means that dynamic files are not cached on CDN.

Cache TTL

Ignore query strings when caching

For most of web page requests, query strings (the parameters following a question mark) are usually appended to the request URLs. If the parameters in the query string do not carry key information (such as version information), users can obtain correct content regardless of whether to carry the query strings. In this case, you are recommended to enable the settings to ignore query strings when caching. This helps improve the cache hit ratio and get better performance.

Cache TTL

Perform file prefetching

How file prefetching works: File prefetching commands are delivered to CDN before users request the corresponding files. CDN POPs prefetch the files from the origin server and cache them on CDN in advance. Afterwards, when users request to the CDN for the file, CDN responds cache files. The prefetching feature helps improve the cache hit ratio and reduce workloads on the origin server.

Prefetching

 

Improving Performance in Specific Scenarios

Scenario

Description

Reference

Text file acceleration

If the origin server does not compress text files, you are recommended to enable the file compression feature on eSurfing Cloud CDN. By doing so, the files are compressed using Gzip or Brotli compression before they are given to users. This effectively reduces the sizes of transferred files and reduces bandwidth usage, in the meanwhile, improving the performance.

File Compression

Large file delivery scenarios such as app downloads and audio/video on demand streaming

If the client sends range requests and the origin server supports range requests, the origin server returns the data within the specified range. Additionally, when the origin server response does not include the Transfer-Encoding: chunked header, you are recommended to enable the object chunking feature to improve file delivery efficiency and cache utilization.

Range Origin Fetching

Webpage file delivery scenarios such as HTML, JS, and CSS files

You are recommended to enable the page optimization feature. After this feature is enabled, CDN automatically deletes redundant content from web pages, such as comments and additional empty space characters in HTML pages, JavaScript code, and CSS code. This helps delete redundant content from web pages, reduce file sizes, accelerates content delivery, and improve readability of the web pages.

Webpage Optimization


ZunMhOH2IA4q