TNS
VOXPOP
Tech Conferences: Does Your Employer Pay?
Does your employer pay for you to attend tech conferences?
Yes, registration and travel are comped.
0%
Yes, just registration but not travel expenses.
0%
Yes, travel expenses but not registration.
0%
Only virtual conferences.
0%
No reimbursement.
0%
Software Development

Netlify’s Edge Handlers Bring Custom Code to JAMStack at the Edge

Netlify offers serverless functions as a way to add some amount of backend processing and functionality, and now the company is adding Edge Handlers to the mix as a way to enable fast, personalized content in websites and web apps by executing custom code at the network edge.
Oct 6th, 2020 6:00am by
Featued image for: Netlify’s Edge Handlers Bring Custom Code to JAMStack at the Edge

Building web applications with JAMstack is meant to simplify the process for developers by eliminating the need for them to worry about a backend web server. Instead, the application is built using Javascript, APIs to external managed services, and Markup for the content. These pieces are built using a static site generator and the content is then put out across a content distribution network (CDN), to provide a speedy experience for users across the globe.

While the websites and web applications produced using JAMstack are not entirely static, there are some limitations in their functionality, and Netlify, the primary company behind the creation of JAMstack some years ago, is working to address those limitations with the introduction of Edge Handlers. Already, Netlify offered serverless functions as a way to add some amount of backend processing and functionality, and now the company is adding Edge Handlers to the mix as a way to enable fast, personalized content in websites and web apps by executing custom code at the network edge.

“Some of the things that you would traditionally do in your application server in that request response cycle — things like personalized sessions or complex authentication patterns — how do you do those things if you don’t have the request response cycle?” said Netlify CEO and co-founder Matt Biilmann in an interview. “We always had a pretty powerful set of declarative rules you could use at the edge for rewrites, redirects, and so on, but there are still things that would be a blocker unless you have a way to custom program that in that request-response cycle. That’s what we’re really solving with edge handlers. Edge handlers allow developers to write fully custom code in JavaScript that gets executed as part of this request cycle directly on our edge node.”

Introduced this week at Netlify’s Jamstack Conf Virtual, Edge Handlers are available to select customers in preview and are intended to more easily deliver localized content, simplify A/B testing, and offer custom authentication, among other features that might otherwise be difficult using JAMstack. Netlify will provide detailed logs for Edge Handlers within the Netlify UI, allowing users to use their existing tooling, and soon plans to provide location testing and validation before shipping to production. Edge Handlers, said Biilmann, differ from serverless functions in their speed.

“In an Edge Handler, you want routing decisions, authentication decisions, personalization, response transformations, and in general, you want to write the kind of code that can take very quick decisions and run within milliseconds,” said Biilmann.

According to Biilimann, the release will be accompanied by the release of background functions at this week’s conference, joining the company’s existing serverless offering, to provide three ways to extend JAMstack functionality with three different use cases.

“We will be introducing a third kind of functions, background functions, which are for really long-running tasks. Let’s say you have a function that allows someone to subscribe to your service, that makes a call to Stripe and creates you as a subscriber. After you do that, you might want to take that email address and run some background processes. Those are all the things you might want to do in a background function that can run for even minutes,” said Biilmann. “I tend to see it in these three layers: edge handlers for things where you can do it in milliseconds and it typically involves quick routing decisions, authentication decisions, or response transformations, serverless functions for things that are more like microservices, API endpoints, and things like that, and then background functions for long-running tasks where you just want to start the task and then the user can go their own way.”

A company statement described Edge Handlers as “the result of a foundational rewrite of the Netlify Edge network” and Biilmann explained that the company had rewritten its edge layer in Rust, instead of C++, because of the language’s strong memory guarantees. Rust was also chosen because of its performance, which he said was critical for speed on the edge. The Edge Handlers themselves were written using Deno, a runtime for Javascript and Typescript based on the V8 Javascript engine, which he said “gives us an opportunity to use isolates to make sure that we can control in any given Edge Handler how many resources is it allowed to use.”

Interested users can request early access to Edge Handlers, though Biilmann declined to say when the feature would be generally available.

Feature image by skeeze from Pixabay.

Group Created with Sketch.
TNS owner Insight Partners is an investor in: Deno.
TNS DAILY NEWSLETTER Receive a free roundup of the most recent TNS articles in your inbox each day.