Tencent Cloud EdgeOne, an edge security and acceleration platform, now officially supports JavaScript Edge Functions, allowing developers to run custom code across 2800+ global edge nodes.

Application Scenarios

  • Request/Response Processing: URL rewriting, header modification, cookie manipulation
  • A/B Testing: Distribute different versions based on user attributes
  • Personalized Delivery: Provide differentiated content based on geographic location

Pricing

Free quota of 1 million invocations per month, with overage at $0.15/million invocations.

Comparison with Cloudflare Workers

For developers familiar with edge computing, Cloudflare Workers is one of the most mature edge function platforms available. Comparing EdgeOne Edge Functions with Workers helps clarify their relative strengths:

Dimension Tencent Cloud EdgeOne Edge Functions Cloudflare Workers
Runtime JavaScript (V8 Isolate) JavaScript/WASM (V8 Isolate)
Global Nodes 2800+ 330+ cities, 12000+ nodes
Free Tier 1 million/month 100,000/day (~3 million/month)
Overage Cost $0.15/million $0.30/million (via Bundles)
Max Execution Time 30 seconds (adjustable for Enterprise) 30 seconds (up to 60s via Bundles)
KV Storage Built-in Workers KV (additional cost)
Cron Triggers Supported Supported
Sub-request Limit 20 sub-requests 50 sub-requests
China Acceleration Excellent (full domestic node coverage) Limited (requires China partner)

EdgeOne Edge Functions offers clear advantages in domestic China network coverage, with lower overage costs than Workers. However, Workers has a more mature ecosystem, community support, and third-party library availability.

Applicable Scenario Analysis

Scenario 1: Domestic Site Acceleration and Security

For websites serving mainland Chinese users, EdgeOne's domestic node coverage makes it the preferred choice. Common use cases include:

  • Hotlink protection: Validate Referer and User-Agent at the edge to block unauthorized resource requests
  • API aggregation: Merge multiple backend API calls at the edge, reducing client request count
  • Geo-blocking: Return 403 or redirect at the edge based on request IP location

Scenario 2: E-Commerce Promotional Campaigns

EdgeOne's A/B testing and personalization capabilities are ideal for e-commerce promotions. For example, during Singles' Day, edge functions can dynamically render different promotional banners based on user city and browsing history without backend code changes.

Scenario 3: Lightweight Dynamic Features for Blogs

For content-focused sites, EdgeOne Edge Functions can handle lightweight dynamic features that previously required backend involvement:

// Example: Set dark/light theme based on cookie
addEventListener('fetch', event => {
  event.respondWith(handleRequest(event.request))
})

async function handleRequest(request) {
  const response = await fetch(request)
  const theme = request.cookies.get('theme') || 'light'
  
  if (theme === 'dark') {
    // Inject dark theme CSS
    return new HTMLRewriter()
      .on('head', new ThemeInjector('dark'))
      .transform(response)
  }
  return response
}

Scenario 4: API Gateway Passthrough and Security Hardening

Use Edge Functions for API authentication, rate limiting, and logging:

// Example: Simple API rate limiting
const rateLimit = new Map()

addEventListener('fetch', event => {
  const ip = event.request.headers.get('X-Forwarded-For')
  const now = Date.now()
  const windowMs = 60000 // 1 minute window
  const maxRequests = 100
  
  const timestamps = rateLimit.get(ip) || []
  const recent = timestamps.filter(t => now - t < windowMs)
  
  if (recent.length >= maxRequests) {
    return event.respondWith(new Response('Too Many Requests', { status: 429 }))
  }
  
  recent.push(now)
  rateLimit.set(ip, recent)
  event.respondWith(fetch(event.request))
})

Adoption Advice for Site Teams

  1. Start with simple use cases: Begin with deterministic tasks like URL rewriting or header modification, then expand to A/B testing and personalization.
  2. Watch the debugging experience: EdgeOne's local debugging toolchain still lags behind Workers — allocate sufficient testing time in development.
  3. Cost estimation: The free tier of 1 million invocations/month is sufficient for sites with daily PV under 30,000. The $0.15/million overage rate is competitive in the edge computing space.
  4. Dual-platform strategy: For sites serving both mainland Chinese and overseas users, consider EdgeOne for domestic traffic and Cloudflare Workers for overseas traffic as a complementary solution.

Summary

Tencent Cloud EdgeOne's Edge Functions provide developers with the ability to run code at edge nodes, suitable for A/B testing, personalized delivery, and request processing scenarios. The free tier is adequate for small to medium-scale applications. Compared with Cloudflare Workers, EdgeOne has advantages in domestic node coverage and pricing, making it ideal for site teams targeting mainland Chinese users. Start with simple scenarios, gradually familiarize yourself with the platform features, then expand to more complex edge computing needs.