This topic describes how to refresh and preload resources in Dynamic Route for CDN (DCDN).

Description

  • Refresh: marks all resources that are cached on the points of presence (POP) as expired. When a POP receives a request, the POP redirects the request to the origin server to retrieve the requested resources. The retrieved resources are returned to the client and cached on the POP. The refresh feature decreases the cache hit ratio.
  • Prefetch: prefetches resources from origin servers and caches the resources on DCDN POPs. When a DCDN POP receives a request, the POP directly serves the resources that are already cached. The prefetch feature increases the cache hit ratio.

Scenarios

The following table describes the common scenarios in which the refresh or prefetch feature is used.
Feature Scenario
Refresh
  • Update and publish resources

    After you update the resources on your origin server, you can submit the URLs or directories of the updated resources to DCDN. Then, DCDN removes the cached resources and retrieves the resources from the origin server when requested. This ensures that visitors can retrieve the most recent resources from DCDN POPs.

  • Remove illicit content

    Even after your remove illicit content from your origin server, visitors can still access those resources if they are still cached on DCDN. In this case, you must submit the URLs of the resources to Alibaba Cloud DCDN to update the DCDN cache. For more information about illicit content, see Limits.

Prefetch
  • Provide support for major events

    Before a large-scale event, you can prefetch the static resources of the event to DCDN. When the event starts, the resources are directly served to the users from the closest POPs, which greatly improves user experience.

  • Release installation packages

    Before you release an installation package or an upgrade package of a product, you can push the package to DCDN. This allows you to directly serve the package from POPs closest to your customers. This not only accelerates content delivery, but also reduces bandwidth costs and pressure on your origin server.

Description

  • After you submit and execute a refresh task, specific resources are removed from DCDN POPs. When a DCDN POP receives a request for the removed resources, the DCDN POP redirects the request to the origin server to retrieve the resources. The retrieved resources are returned to the client and cached on the DCDN POP. After you execute multiple refresh tasks, a large number of resources are removed from DCDN POPs. This increases the number of requests that are redirected to the origin server. The back-to-origin routing process consumes a large amount of bandwidth resources, which may overwhelm the origin server.
  • A refresh task takes effect 5 to 6 minutes after being submitted. If the TTL for the resources you want to refresh is less than five minutes, you can wait until the TTL expires instead of performing the refresh operation.
  • After you submit and execute a prefetch task, DCDN POPs immediately start to retrieve resources from the origin server, which generates a large number of back-to-origin requests. This may cause a temporary increase in outbound bandwidth on your origin server.
  • The time required for prefetch task to complete is proportional to the size of the prefetched file. In actual practice, most prefetch tasks take 5 to 30 minutes to complete. A task with a smaller average file size takes less time.
  • If you want to use Resource Access Management (RAM) users to refresh or prefetch resources, you must acquire the required permissions. For more information, see Authorize a RAM user to prefetch and refresh resources.
  • URL refresh, directory refresh, and refresh that contains regular expressions support shared cache. If shared cache is configured for a domain name, you can submit a refresh task with the primary domain name or any associated domain name to refresh the cache.

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.
    Refresh
    Parameter Description
    Operation Select Refresh.
    Operation Method 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 at most 2,000 URLs per day, and at most 1,000 URLs at a time. You can submit at most 1,000 URLs for each domain name per minute.

        If the daily peak bandwidth value of your workloads exceeds 200 Mbit/s, you can submit a ticket to request a quota increase. Alibaba Cloud reviews your application and then increases the quota accordingly.

    • Refresh resources based on directories
      • Each URL must start with http:// or https:// and end with a forward slash (/).
      • Enter only one URL on each line.
      • Each Alibaba Cloud account can submit up to 100 directories per day and up to 100 directories at a time. Subdirectories are supported. You can submit a ticket to request a quota increase. If your application is approved, you can submit up to 1,000 directories at a time.

        If the daily peak bandwidth value of your workloads exceeds 200 Mbit/s, you can submit a ticket to request a quota increase. Alibaba Cloud reviews your application and then increases the quota accordingly.

  4. Click Commit.
  5. Check the refresh progress.
    After you submit a refresh task, you can check the task progress and details on the Records tab. The progress depends on the number of objects that you want to refresh. The refresh task may require some time.
    Note If you enable the Auto DCDN Cache Update feature 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 DCDN console.
  2. In the left-side navigation pane, choose Tools > Refresh and Prefetch.
  3. On the Refresh Cache tab, configure the refresh rules.
    Refresh and prefetch
    Parameter Description
    Operation Select Prefetch.
    Operation Method Only URL is supported.
    URL
    • Each URL must start with http:// or https://.
    • Enter only one URL on each line.
    • Each Alibaba Cloud account can submit at most 500 URLs per day, and at most 100 URLs at a time.

      If the daily peak bandwidth value of your workloads exceeds 500 Mbit/s, you can submit a ticket to request a quota increase. Alibaba Cloud reviews your application and then increases the quota accordingly.

    • The prefetch queue of each Alibaba Cloud account can contain at most 100 URLs. DCDN performs prefetch tasks in the order in which the URLs are submitted.
  4. Click Commit.
  5. Check the prefetch progress.
    After you submit a prefetch task, you can view the task progress and details on the Records tab. The progress depends on the number of objects that you want to prefetch. The prefetch task may require some time.

API references

You can call the API operations that are listed in the following table to refresh and prefetch resources.
Operation Description
RefreshDcdnObjectCaches Refreshes specified objects on DCDN 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 origin servers to L2 DCDN nodes. This reduces workloads on origin servers because users can hit cache upon their first visits.
DescribeDcdnRefreshQuota Queries the maximum number and the remaining number of URLs and directories that can be refreshed or the maximum number and the remaining number of URLs that can be prefetched per day.
DescribeDcdnRefreshTasks Queries details about refresh or prefetch tasks.
DescribeDcdnUserQuota Queries resource quotas and resource usage.
DescribeDcdnRefreshTaskById Queries the status of refresh or prefetch tasks by task ID.