Unlocking the Programmatic Edge for the Agile DeveloperUsing EdgeWorkers with Akamai Sandbox
SpeakerDavid TheobaldPrincipal Product Architect, Web Performance Engineering
@Akamai 11 years and counting
Aka-SME for all things Edge Computing: EdgeWorkers, Cloudlets, ESI, Advanced Configuration
Based in tropical Des Moines, Iowa USA
Full Transparency Clause
This is a preview of capabilities coming later in 2019. The products in this talk are available now…their integration is on the near term horizon.
EdgeWorkers: Unlocking the content delivery layer
Let’s Dig in…
EdgeWorkers? Not EW!
EdgeWorkers is a new way to drive powerful web experiences, by enabling developers to run JavaScript at the Akamai Edge.
This intersection of serverless compute and content delivery provides the best of both worlds - performanceand productivity.
EdgeWorkers FeaturesThe tech preview release, available now on Akamai Staging & Production* networks, offers…
Low-latency JavaScript engine built on V8 isolates to safely deploy event functions on every Akamai Edge
Read/Modify Cookies, headers, URI to build custom logic and optimize traffic
Create response bodies for quick Edge responses
Access to content targeting, and device characteristics to personalize logic
Build conditional logic using Property Manager Variables
* Fine print: customer must be leveraging Ion or DSA delivery products on Akamai’s Secure Networks; Production traffic will be contained by custom delivery maps during Tech Preview Phase (ie: not full network reach, yet)
This is just the beginning ... regular releases will build on this initial capability!
Intersection of serverless and CDN improves performance and productivity
Why Serverless + CDN ?
Faster application experiencesWith compute closer to your data, you can avoid unnecessary network hops.
Faster to productionIntegrate into your existing workflows enabling multiple teams to work in parallel.
Minimize ramp-up timeLeverage tools and skills your team already has, and avoid learning proprietary products.
Just codeAvoid the hassle of managing cloud resources, and building for scale.
What can I do?
Use EdgeWorkers functions to solve challenging delivery problems such as…
Offload Improvement
Ability to manage and improve cache TTLs
A/B Testing
Enable controlled roll-outs of new services
URL Redirects
Redirect based on geo, device, and user-agent
Traffic Filtering
Block, redirect and provide responses based on conditional logic
Customized Responses
Customize error responses to improve web experiences, even when the origin is down
Load and Failover
Forward to different origins to balance request or react to failures
Debug logging
Add or remove debug information from the http message
Event Model
Like all serverless computing solutions, EdgeWorkers functions are event driven, allowing developers to run their code at specific events along the content delivery path.
Leverage any of the key delivery events:
1. On Client Request: for every request before checking cache 2. On Origin Request: if response not served from cache, before forwarding to origin 3. On Origin Response: when origin responds with content
4. On Client Response: for every request before response sent
Just Code!
EdgeWorkers offers a JavaScript specification that can be used to influence the delivery of responses to your end users Modern JavaScript syntax allows you to express CDN transformations more succinctly than ever before! Request and Response Objects provide access to HTTP and Akamai network data
function onClientRequest(request) {var requestUrl = request.url.toLowerCase();var cartCookie = (request.cookies.hasOwnProperty('cart')) ? request.cookies['cart'] : null;
if (requestUrl === '/api/cart-count' && !cartCookie) {request.respondWith(new Response(
200, {'Content-Type': ['application/json; charset=utf-8']}, '[]'));}}
function onClientResponse(request, response) {//Add custom trace header
response.headers['X-EdgeWorker'] = ['onClientResponse-'+request.variables['PMUSER_GHOST_IP']];}
EdgeWorkers Demo
Welcome to Akamai’s tasty treats e-commerce site, MoFroYo.Co!
As Software Engineers @ MoFroYo, we are tasked today with solving some delivery problems to make our user’s experience extra sweet:
Improve the shopping cart response time when there are clearly no snacks yet in the cart
Reduce inbound traffic to the Content Origin for shopping cart count checks
Leverage a programming language familiar to our development team for easy debugging and maintenance Configure, code and test these changes in a way that does
not disturb production end users of MoFroYo or other team members
Code
Test
Configure
EdgeWorkers Akamai Sandbox
Isolated, Concurrent and Rapid iteration
(Serverless Computing @ the Edge) (Isolated Akamai Dev Stack)
EdgeWorkers +
SandboxRequest Flow
Demo Task ListHere’s what we need to accomplish as Software Engineers @ MoFroYo.Co:
Spin up an Akamai Sandbox that clones the Ion delivery property for www.mofroyo.co, as well as any associated EdgeWorkers
Use JavaScript constructs and Akamai’s EdgeWorker specification to code the Traffic Filtering business logic for the Shopping Cart
Update Akamai Sandbox with new EdgeWorkers function(s) and test to validate the transformations achieve the intended result
Let’s Go!
What’s Coming Next…2019 H2 2020 H1 H2 2021
Features for Production traffic
Support for Conditional Decisions and Additional Delivery Types
Support for Dynamic Decisions, API Orchestration, and Dynamic Content Assembly
Integration with Data Storage
Features Adds:
● Low-latency JavaScript engine
● Read/Modify Cookies, headers, URI
● Create response bodies
● Access to content targeting, and device characteristics
Adds:
● Debugging and trace tools
● Cache key features: set cache keys, change TTLs, change origin path, modify forward URL
● Support for Standard TLS-only network
Adds:
● Remote call interface
● Ability to read and modify response bodies
Adds:
● Edge data storage interfaces to optimize edge decisions
● Fast deployment and globally consistent within seconds
Use Cases Enables:
● URL Redirects
● Traffic Filtering
● Customized Responses
● Debug logging
Enables:
● A/B Testing
● Load and Failover
● Offload Improvement
Enables:
● Personalization Decisions
● Dynamic Content Assembly
● API Orchestration
● 3rd Party Integration
● Authorization Offload
Enables:
● Access Tokens and Authentication
● Redirect / Block lists
● Phase Release and A/B Testing
● Configuration Data
● Log data
● Shopping Cart
MORE EdgeWorkers?Sign-up for the Tech Preview Learn more at: developer.akamai.com/edgeworkers
Get Hands-OnVisit the innovation zone for demos and deep dives!