All Products
Search
Document Center

Function Compute:Overview

Last Updated:Apr 02, 2024

Alibaba Cloud Content Delivery Network (CDN) is seamlessly integrated with Function Compute. You can write function code to perform custom operations to process CDN events. You can configure a CDN event trigger to trigger function invocation when the CDN system receives a specific type of event that meets the filtering conditions.

Background information

Alibaba Cloud CDN is a distributed network that is built on top of the bearer network and consists of edge server clusters that are distributed in different regions. You can replace the conventional web server-based data transmission mode by using Alibaba Cloud CDN to cache resources of the origin server to edge servers distributed across China. Caching of resources allows you to obtain data from the nearest servers. This improves user experience and reduces the loads on the origin server. In Function Compute, you can configure CDN event triggers to integrate Function Compute with CDN and perform custom operations to process CDN events. For example, you can configure a function and a CDN event trigger to process resource refresh events in the www.taobao.com domain. When a resource refresh event occurs in the domain, the CDN event trigger automatically invokes the function.

Scenarios

A CDN event trigger can integrate Function Compute and CDN in the following scenarios:

  • If user data is preloaded and refreshed in the CDN system, CachedObjectsPushed and CachedObjectsRefreshed events occur. The CDN event trigger automatically invokes a specific function. In this case, you can obtain the preload and refresh status of resources before you proceed to the next step, which prevents constant polling of the list for the most recent status.

  • If a log file is generated, a LogFileCreated event occurs. The CDN event trigger automatically invokes the function to process logs with high efficiency, without waiting for a long period of time.

  • If a domain name of CDN is enabled or disabled, a CdnDomainStarted or CdnDomainStopped event occurs. The CDN event trigger automatically triggers the execution of the function to process data at the earliest opportunity.

CDN events

After the CDN system captures CDN events, the system encodes events in a JSON string and forwards the events to a function for processing. The following table lists the events and versions that are currently supported by CDN event triggers.

Event

Version

Filtered parameter

References

CachedObjectsRefreshed

1.0.0

domain

RefreshObjectCaches

CachedObjectsBlocked

1.0.0

domain

Encapsulates a specified URL on a Point of Presence (POP).

Note

If you want to use this operation, submit a ticket to have your account added to the whitelist of CDN.

CachedObjectsPushed

1.0.0

domain

PushObjectCache

LogFileCreated

1.0.0

domain

DescribeCdnDomainLogs

CdnDomainStarted

1.0.0

domain

StartCdnDomain

CdnDomainStopped

1.0.0

domain

StopCdnDomain

CdnDomainAdded

1.0.0

domain

AddCdnDomain

CdnDomainDeleted

1.0.0

domain

DeleteCdnDomain