请选择
Edge Developer Platform
  • Edge Functions
    • Overview
    • Getting Started
    • Operation Guide
      • Function Management
      • Function Trigger
    • Runtime APIs
      • addEventListener
      • Cache
      • Cookies
      • Encoding
      • Fetch
      • FetchEvent
      • Headers
      • Request
      • Response
      • Streams
        • ReadableStream
        • ReadableStreamBYOBReader
        • ReadableStreamDefaultReader
        • TransformStream
        • WritableStream
        • WritableStreamDefaultWriter
      • Web Crypto
      • Web standards
      • Images
        • ImageProperties
    • Sample Functions
      • Returning an HTML Page
      • Returning a JSON Object
      • Fetch Remote Resources
      • Authenticating a Request Header
      • Modifying a Response Header
      • Performing an A/B Test
      • Setting Cookies
      • Performing Redirect Based on the Request Location
      • Using the Cache API
      • Caching POST Requests
      • Responding in Streaming Mode
      • Merging Resources and Responding in Streaming Mode
      • Protecting Data from Tampering
      • Rewriting a m3u8 File and Configuring Authentication
      • Adaptive Image Resize
      • Image Adaptive WebP
      • Customize Referer restriction rules
      • Remote Authentication
      • HMAC Digital Signature
      • Naming a Downloaded File
      • Obtaining Client IP Address
    • Best Practices
      • Adaptive Image Format Conversion via Edge Functions

Overview

Tencent Cloud Edge Functions provides a serverless code execution environment for the edge nodes of Tencent Cloud EdgeOne. This way, you can focus on writing business function code and configuring triggering rules, without the need to configure or manage infrastructure such as servers. The written code can be elastically and securely executed on the edge nodes that are closest to users.


How It Works


You can develop JavaScript functions and deploy them to the edge nodes of Tencent Cloud EdgeOne.
1. If a client request does not hit the configured function triggering rule, the request is handled in the following process:
(1) The client request is sent to the gateway of an edge node of Tencent Cloud EdgeOne. > (2) The cache of the node responds if the requested content already exists in the cache. > (3) The origin server responds if the requested content does not exist in the cache.
2. If a client request hits the configured function triggering rule, the request is handled in one of the following processes:
(1) The client request is sent to the gateway of an edge node of Tencent Cloud EdgeOne. > (4) Edge Functions receives and executes the JavaScript code. > (5) Subrequests access the cache. > (3) The origin server responds if the requested content does not exist in the cache.
(1) The client request is sent to the gateway of an edge node of Tencent Cloud EdgeOne. > (4) Edge Functions receives and executes the JavaScript code. > (6) Subrequests access the public network service.

Benefits

Distributed Deployment

Tencent Cloud EdgeOne supports more than 3,200 edge nodes. Edge Functions is deployed on edge nodes in distributed mode.

Ultra-low Latency

Client requests are automatically scheduled to the edge nodes that are closest to users. If triggering rules are hit, edge functions are triggered to process the requests and return results to the client. This helps significantly reduce the client access latency.

Elastic Scaling

Edge Functions schedules requests to edge nodes that are allocated sufficient computing resources based on the proximity of the user when spikes occur in client requests.

Serverless Architecture

The serverless architecture of Edge Functions eliminates the need to focus on the maintenance of the memory, CPU, and network of servers and other infrastructure resources. You can focus on the development of business code.

Use Cases



Use Limits

Content
Limit
Note
Number of Functions per Site
100 functions
A single site supports up to 100 edge functions.
Number of Trigger Rules per Site
200 rules
A single site supports up to 200 trigger rules for functions.
Function Name Length
30 characters
2 to 30 characters, up to 30 characters.
Code Package Size
5 MB
The maximum size for a single function code package is 5 MB.
Request Body Size
1 MB
Client requests can carry a body up to 1 MB.
CPU Time
200 ms
CPU time slice allocated for single function execution, excluding I/O waiting time.
Programming Language
JavaScript
Currently only JavaScript is supported.
Number of Console Invocations
20 times
Each function is allowed to call the console method up to 20 times. Beyond 20 times, print operations will no longer be executed.
Number of Loop Executions
100,000 times
In the function, the for, for in, for of, while, do while loops are limited to execute no more than 100,000 times.