On the resource monitoring page of the Alibaba Cloud Content Delivery Network console, the back-to-source traffic is found to be large.
The back-to-source traffic is large in the following two cases.
- If the cache hit rate is poor, the back-to-source traffic will increase. Generally, the cache hit rate is recommended to be 90% or above.
- The cache hit rate is high. When the total Alibaba Cloud Content Delivery Network traffic base is large, the back-to-source traffic will relatively increase, which is normal.
The solution to the poor cache hit rate is as follows.
- Log on to the Alibaba Cloud Content Delivery Network console, click Manage at the right of the target domain name, and then click Cache Configuration to add cache expiration time rules for website root directory.
- It is recommended that this cache rule be set at the bottom, mainly to ensure that other files that are not matched can be cached and hit.
- For cases where caching is not required, it is recommended to set nocache at the origin, but it is not recommended to set nocache for too many files. If too many files are returned to the origin, the acceleration effect will be unsatisfactory.
- View Alibaba Cloud Content Delivery Network log files and locate files that always miss the cache. For Alibaba Cloud Content Delivery Network log format, please refer to log download.
- Log in to the browser, press the F12 key, endpoint, select the requested resource, and view the Response Header information. As shown in the following figure, it indicates that the resource does not hit the cache, because the Cache-Control value is no-cache, you can locate whether the resource can be cached, if it can be cached, cancel the setting of nocache, or set private cannot hit the cache.
- X-cache indicates whether to hit the cache, miss indicates a miss, and hit indicates a hit.
- X-Swift-CacheTime indicates how long it will be cached in the Alibaba Cloud Content Delivery Network-level node.
- The X-Swift-SaveTime indicates what point in time the resource was cached.
- Alibaba Cloud Content Delivery Network, only requests from GET methods are cached, domain name separation is recommended for requests from non-GET methods, and only static resources are Alibaba Cloud Content Delivery Network accelerated.