Edge functions: good for performance and cost, hard to debug and integrate, states new survey

Edge functions: good for performance and cost, hard to debug and integrate, states new survey

Around 1,000 developers have expressed their views on edge functions, a modern approach to web applications, showing enthusiasm for performance and cost, but frustrations in areas including debugging and integration with third-party APIs.

The traditional way to deploy a web application is with hosted servers, load balancers, content delivery network for global low-latency to static content, and so on. Serverless functions, pioneered by AWS Lambda and also available via the likes of Azure Functions and Google Cloud Functions, can reduce or even replace reliance on hosted servers, but have issues like cold start, when a request has to trigger a new instance before it receives data. Provisioning and architecting applications that perform well everywhere is complex and expensive.

Edge functions are a more recent approach, where code is deployed to a provider which transparently distributes it on a global network. It is a natural fit with a content delivery network (CDN), which is why AWS Lambda@Edge is a feature of its CloudFront CDN. The barrier to entry for edge functions is low, and even a small low-traffic site can achieve global low-latency. Examples of edge function providers, aside from AWS, are Cloudflare, Fastly, Vercel, Netlify and Deno. Cloudflare and Fastly aside, these providers may use AWS, Cloudflare or other hyperscale clouds under the covers, which means customers in effect pay a markup; but that may be worth it if it abstracts the complexity, especially for small deployments.

The Deno-sponsored State of Edge survey attracted responses from a balanced spread of organizations ranging from solo developers (the biggest single group) to those with over 1,000 employees (65 of them). Although the absolute number of respondents is relatively small they claim to be an influential bunch, with 72 saying they are company founders, 60 architects or CTOs, 156 full stack engineers, and so on.

Cloudflare is top choice for edge function deployment

The first question is illuminating. Where are edge functions deployed? Cloudflare is the winner here, being top choice despite Deno’s sponsorship of the survey, followed by Fastly’s Compute@Edge. These providers may in principle offer the best value, as they deploy to their own networks, whereas the likes of Deno, Vercel and Netlify compete on developer experience. 

What is the use case for edge functions? The top reason developers give is performance, followed closely by cost savings and ease of deployment. “True serverless, deploy everywhere at once around the globe, no OS updates, fast continuous deployment, easy to server render,” said one respondent.

There are challenges though. The biggest single problem, according to the survey, is “debugging behavior in live functions.” However well it is abstracted, this is distributed computing, and potentially complex to troubleshoot. “Distributed database synchronization” was mentioned by another respondent. “Actually developing the edge function” comes rather low in the list of top frustrations.

TypeScript or JavaScript dominate in edge functions, perhaps because they run in the v8 engine

What programming language is used? TypeScript is the big winner here, cited by 229 respondents, with JavaScript next at 143 respondents. Other languages such as Java, Go, Python and Rust all make a showing but with much lower usage. Microsoft’s C# is a notable absentee.

The popularity of TypeScript is not a surprise. Developers of large applications often prefer it to JavaScript, and the Google-sponsored V8 runtime is universally popular for edge functions, especially with its v8 isolates which form the foundation of Cloudflare workers, for example. Start-up time is much quicker than for containers, though the level of isolation is not as strong. Languages like Java and C# are at a disadvantage as they require their own runtimes – one reason for interest in native code compilation or transpiling to web assembly (which runs in v8).