This topic describes how to configure the parameter filtering feature to resolve the issue that the cache hit ratio is low due to variable parameters in URLs.
Problem description
When you use Alibaba Cloud CDN, the cache hit ratio is low. Press the F12 key in the browser. In the Developer Tools window, click the Network tab, and then click a resource name in the Name column. In the Response Headers section of the Headers tab, you can view the value of the X-Cache
header. The value of MISS indicates that the cache is not hit. However, the value of the X-Cache
header of the file URL is HIT.
In this example, Google Chrome is used.
Cause
The parameter filtering feature of Alibaba Cloud CDN is disabled.
Solution
The following sections describe the cache hit ratio and provide a solution for a low cache hit ratio.
Cache hit ratio
If a request hits the cache, the requested data can be obtained from the cache.
If a request does not hit the cache, the requested data cannot be obtained from the cache. The client needs to query the data from databases or perform other operations. This is mostly because that the requested data does not exist in the cache or the cached data has expired.
Enable the parameter filtering feature
Enable the parameter filtering feature. Otherwise, requests whose URL contains variable parameters cannot hit the cache. The following URL is used as an example. The corresponding file is ArrowScene.ccbi. The number after the
?_t=
field in the URL is a variable and different for each request. Therefore, points of presence (POPs) do not cache the file.http://example.com/movie/XSHD/res/ccb/ArrowScene.ccbi?_t=xxxxxxxxxxxxxx
Log on to the Alibaba Cloud CDN console and enable the parameter filtering feature. For more information, see Ignore parameters.
NoteAfter you enable the feature, the parameters after the
?_t=
field are ignored.