Alibaba Cloud Dynamic Route for CDN (DCDN) allows you to refresh and prefetch resources. The refresh feature forces DCDN nodes to clear cached resources and retrieve the most recent resources from origin servers. The prefetch feature allows DCDN nodes to retrieve frequently accessed resources from origin servers during off-peak hours, which increases the cache hit ratio.

Overview

  • Refresh

    Forces DCDN nodes to delete all resources that are cached on them. When a DCDN node receives a request, the DCDN node redirects the request to the origin server to retrieve the requested resources. The retrieved resources are returned to the client and cached on the DCDN node. The refresh feature reduces the cache hit ratio.

  • Prefetch

    Prefetches resources from origin servers and caches the resources on DCDN nodes. When a DCDN node receives a request, the DCDN node directly returns the requested resources to the client because resources are already cached on DCDN nodes. The prefetch feature increases the cache hit ratio.

Scenarios

The following table describes the scenarios where the refresh or prefetch feature is commonly used.
Feature Scenario
Refresh
  • Update and release resources

    After resources on your origin server are updated, you can submit the URLs or directories of the updated resources to Alibaba Cloud DCDN. Then, Alibaba Cloud DCDN refreshes the resources that are cached on DCDN nodes. This ensures that visitors can retrieve the latest resources from DCDN nodes.

  • Delete resources that violate the limits of Alibaba Cloud DCDN

    After you delete resources that violate the limits described in Limits from your origin server, visitors can still access the resources because the resources are cached on DCDN nodes. In this case, you must submit the URLs of the resources to Alibaba Cloud DCDN to update the DCDN cache.

Prefetch
  • Provide support for major events

    If you want to hold a major event, you can push the static resources of the event page to DCDN nodes. After the event starts, visitors can access the static resources, which are already cached on DCDN nodes. This accelerates content delivery.

  • Release installation packages

    Before you release an installation or upgrade package of a product, you can push the package to DCDN nodes. After the product is launched, visitors can download the package from DCDN nodes. This accelerates content delivery and reduces the loads on origin servers when numerous visitors access your resources.

Precautions

  • To refresh or prefetch resources, you need to log on to the DCDN console and add the URL or directory of the resources to the acceleration rules. For more information, see Specify static file URIs and Specify static file paths.
  • After a refresh task is submitted and executed, some resources are removed from the DCDN nodes. When a DCDN node receives a request that requests the removed resources, the DCDN node redirects the request to the origin server to retrieve the resources. The retrieved resources are returned to the client and cached on the DCDN node. After multiple refresh tasks are executed, a large number of resources are removed from DCDN nodes. This increases the number of requests that are redirected to the origin server. The back-to-origin routing process consumes more bandwidth resources and the origin server may become overwhelmed.
  • After a prefetch task is submitted and executed, L2 DCDN nodes immediately start to retrieve resources from the origin server. Therefore, a large number of prefetch tasks may cause concurrent download tasks. This increases the number of requests that are redirected to the origin server. The back-to-origin routing process consumes more bandwidth resources and the origin server may become overwhelmed.

Refresh resources

  1. Log on to the DCDN console.
  2. In the left-side navigation pane, choose Tools > Refresh and Prefetch.
  3. On the Refresh Cache tab, configure the refresh rules.
    Parameter Description
    Operation Type Select Refresh.
    Refresh Type Select URL or Directory.
    URL
    • Refresh resources based on URLs
      • Each URL must start with http:// or https://.
      • Enter only one URL on each line.
      • Each Alibaba Cloud account can submit up to 100 URLs per day. The refresh task takes effect in about 5 minutes.
    • Refresh resources based on directories
      • Each URL must start with http:// or https:// and end with a forward slash (/).
      • Each Alibaba Cloud account can submit up to 100 directories per day. The refresh task takes effect in about 5 minutes.
  4. Click Submit.
  5. Optional: Check the refresh progress.
    After you submit a refresh task, you can check the progress and details on the Operation Records tab. The progress depends on the number of objects to be refreshed. It may take some time to complete the task.
    Note If Auto DCDN Cache Update is enabled in the Object Storage Service (OSS) console, you cannot check the automatic refresh tasks in the DCDN console.

Prefetch resources

  1. Log on to the Alibaba Cloud CDN console.
  2. In the left-side navigation pane, choose Tools > Refresh and Prefetch.
  3. On the Refresh Cache tab, configure the prefetch rules.
    Parameter Description
    Operation Type Select Push.
    Refresh Type Only URL can be selected.
    URL
    • Each URL must start with http:// or https://.
    • Enter only one URL on each line.
    • Each Alibaba Cloud account can submit up to 10 URLs per day.
  4. Click Submit.
  5. Optional: Check the prefetch progress.
    After you submit a prefetch task, you can view the progress and details on the Operation Records tab. The progress depends on the number of objects to be prefetched. It may take some time to complete the task.

Related API operations

You can call the API operations listed in the following table to refresh and prefetch resources.
Operation Description
DescribeDcdnRefreshTasks Queries details about refresh and prefetch tasks.
RefreshDcdnObjectCaches Refreshes specified objects on cache nodes. The objects can be included in the content of files or URLs. You can refresh multiple URLs in each request.
PreloadDcdnObjectCaches Prefetches content from an origin server to L2 cache nodes. This improves the cache hit ratio for first-time visitors, and reduces the workload on the origin server.
DescribeDcdnRefreshQuota Queries the daily quota and the remaining quota of URLs and directories that can be refreshed or prefetched.
DescribeDcdnUserQuota Queries resource quotas and resource usage.
DescribeDcdnRefreshTaskById Queries the status of refresh or prefetch tasks by task ID.