The prefetch feature of Edge Security Acceleration (ESA) proactively fetches resources from an origin server to points of presence (POPs). This way, ESA can directly serve the resources from the POPs even when the resources are requested for the first time, without the need to retrieve them from the origin server. The prefetch feature increases the cache hit ratio.
Scenarios
Support for major events
Before a big event, you can prefetch the static resources of the event page to POPs. When the event starts, visitors can access the static resources that are already cached on POPs. This accelerates content delivery.
Release of installation packages
Before you release an installation or upgrade package of a product, you can prefetch the package to POPs. After the product is launched, visitors can download the package from POPs. This accelerates content delivery and reduces loads on the origin server when a large number of visitors access your resources.
Prefetch methods
ESA supports instant prefetch and scheduled prefetch.
Instant prefetch: prefetches resources to POPs immediately after you configure URLs to fetch resources from.
Scheduled prefetch: prefetches resources as scheduled and at specified time intervals. Scheduled prefetch helps prevent fetching during peak hours, control origin traffic generated from prefetching, and reduce pressure on the origin server.
Usage notes
After a prefetch task is submitted and run, ESA fetches required resources from the origin server to POPs. Submitting a large number of instant prefetch tasks at a time generates a large number of download tasks, which burdens the origin server due to a surge in origin bandwidth and requests. We recommend that you use scheduled prefetch.
The period of time required to complete a prefetch task is proportional to the size of the files that you want to prefetch. In most cases, most prefetch tasks require 5 to 30 minutes to complete. A task that prefetches a smaller file requires less time to complete.
By default, prefetch requests include the
Accept-Encoding:gzip
header. If you want a prefetch request to include other headers or implement multi-replica prefetch, you can call the PreloadCaches operation and specify a custom prefetch header by configuring theHeader
parameter.If the origin server returns a redirection-related status code, such as 301, the prefetch task does not follow the redirected address and fails. If the origin server returns status code 301 or 302, submit a ticket to enable 301/302 redirection.
Feature availability
Prefetch method | Basic | Standard | Advanced | Enterprise |
URL prefetch | No | No | No | 500,000 |
Procedure
Log on to the ESA console.
In the left-side navigation pane, click Websites.
On the Websites page, find the website that you want to manage, and click the website name or View Details in the Actions column.
In the left-side navigation tree, choose
.Select instant prefetch or scheduled prefetch.
Instant prefetch
Instant prefetch retrieves resources from the origin server immediately after you submit the URLs of resources and caches retrieved resources to POPs.
You can select Manual Input to specify URLs one by one or Upload File to specify URLs collectively by uploading a file that contains a list of URLs.
Method
Description
Manual Input
Enter one or more URLs in the text box and click Submit. Each specified URL must be a complete path to the resource. You can specify up to 100 URLs at a time, with each line holding one single URL. Example:
https://www.example.com/cat.jpg https://www.example.com/image/cat.jpg
Upload File
If a large number of URLs need to be prefetched, you can specify the URLs in a TXT file and then upload the file. Each specified URL must be a complete path to the resource. One URL per line. The size of the TXT file cannot exceed 10 MB.
Scheduled prefetch
Scheduled prefetch retrieves resources as scheduled and at specified time intervals to prevent fetching during peak hours, control origin traffic generated from prefetching, and reduce pressure on the origin server.
Write complete URLs of resources to prefetch into a TXT file, with each URL in a separate line. The size of the TXT file cannot exceed 10 MB.
Click Create Prefetch Task.
In the Upload File Step, specify a prefetch task name, upload the TXT file, and then click Next.
NoteYou can create up to 100 prefetch tasks.
In the Create Prefetch Plan step, create a prefetch plan. You need to specify the time range, prefetch time intervals (at least 1 second), and number of URLs for each prefetch (at most 100 URLs).
NoteYou can create up to 10 prefetch plans.
Click OK.
View the prefetch progress.
After you submit a prefetch task, you can view the task progress and details on the Prefetch Records tab. The prefetch task is complete when the progress reaches 100%. The prefetch task may require a long period of time to complete if you have a lot of resources to prefetch.