Serverless edge compute starter kits
Kameleoon provides starter kits to help implement feature flags and experiments across the main serverless edge compute platforms offered by modern Content Delivery Network (CDN) providers such as Akamai EdgeWorkers, AWS Lambda@Edge, Cloudflare Workers, Fastly Compute@Edge and Vercel Edge Functions.
A key benefit of edge computing is that it overcomes the static nature of CDNs by running code at the edge. For experimentation purposes, this means bucketing decisions for experiments occur at the edge with reduced latency and avoid caching issues. Use a starter kit to minimize latency or to run feature flags and experiments on parts of the application that are heavily cached.
Kameleoon has extended and embedded the NodeJS SDK into the following starter kits:
- Fastly Compute@Edge
- Cloudflare Workers
- Vercel Edge Functions
- AWS Lambda with CloudFront Lambda@Edge function
- Akamai Edge
Tracking in serverless environments
Most serverless edge compute providers, including AWS, Akamai, Vercel, and Fastly, charge based on the CPU time your functions consume. Waiting for tracking requests to complete at the edge increases execution time and costs. To optimize performance and reduce expenses, Kameleoon recommends performing tracking on the client side.
To implement client-side tracking, use one of the following methods:
- Engine tracking code: Use the
getEngineTrackingCode()method to generate a tracking script that runs in the client browser. - JavaScript SDK: Load the Kameleoon JavaScript SDK on the client side for tracking. Because the edge worker handles bucketing and experiment variation decisions, the client-side SDK only manages tracking and does not require variation configuration.
Cloudflare Workers
Cloudflare Workers is an exception because it allows you to wait for asynchronous requests without additional costs. In a Cloudflare environment, you can perform tracking requests directly within the edge worker without increasing your billable CPU time.