EdgeWorkers

Serverless computing and function creation at the edge
EdgeWorkers

EdgeWorkers Use Cases

EdgeWorkers provides a variety of use cases including creating new microservices, manipulating requests and responses, and managing Akamai-as-code.

 


Geolocation microservices at the edge

Many websites use geolocation logic to improve the user experience for online visitors. Geolocation allows sites and apps to increase user engagement, reduce bounce rate, and improve conversions by delivering location-specific content to visitors such as localized site versions, nearby stores, or special products and offers. 

Challenge

IP-based geolocation is often implemented as a separate HTTP request, allowing static page content to remain cacheable with client-side logic to handle the dynamic response to the user’s location. Additional HTTP requests to a geolocation service can decrease page load speed and increase visitor frustration.

Solution

Create a geolocation service at the edge leveraging EdgeWorkers to:

  • Access to EdgeScape geolocation data via EdgeWorkers
  • Augment EdgeScape geolocation data with custom location data stored in the EdgeWorkers javascript bundle or in the Edge Key Value (EdgeKV) store

Benefit

With a geolocation service that runs at the edge, the separate HTTP service to origin can be eliminated resulting in:

  • Faster, and more consistent, end user experiences
  • Reduction in cloud computing costs

Learn More

https://developer.akamai.com/blog/2020/06/11/edgeworkers-use-case-fast-geolocation

Search autocomplete

Suggesting relevant search terms while a user types in a search box is a common practice on many websites and search engines. It provides a relevant and fast response that is essential for excellent user experiences. 

Challenge

Tuning autocomplete results is difficult because:

  • Search requests are frequently changing and typically include long-tail keywords that are difficult to cache. This results in a high number of high latency requests back to the origin which negatively impact user experience
  • The high cardinality of search term results can create low offload numbers for the majority of requests 

Solution

Create an autocomplete service at the edge leveraging EdgeWorkers to:

  • Store search terms in the EdgeWorkers javascript bundle or in the EdgeKV store
  • Update search terms data storage in an automated fashion via the Edgeworkers CLI
  • Look up logic against search terms stored at the edge

Benefit

Since the autocomplete service now runs at the edge, the separate HTTP service to origin can be eliminated resulting in:

  • Faster and more consistent end user experiences
  • Reduction in cloud computing costs

Learn More

https://developer.akamai.com/blog/2020/05/15/boost-autocomplete-performance

Analytics tracking offload

Traffic from search engines is critical to the success of any business. Often, the URLs from the search engines or from social media platforms include query string parameters that are used by tools like Google Analytics in order to provide insight into user behavior. This insight enables companies to determine the return on their marketing investment. 

Challenge

Companies are forced to sacrifice offload and performance in order to gain valuable tracking insight. The query string parameters added by search engines and social media sites decrease offload as they are often unique values that result in the request going to origin as opposed to being served from the cache. However, companies do not want to remove these query string parameters as they allow them to use tools like Google Analytics to understand user behavior. 

Solution

Utilize EdgeWorkers to reduce latency and still maintain the ability to track analytics by:

  • Intercepting the request, removing query string params, and serving cached content to end users

  • Adding back the Google Analytics query strings on redirect response generated by origin to retain analytics visibility

Benefit

Query strings are managed and cached content is delivered at the edge for:

  • Increased offload as content can be served from cache, regardless of the query string parameter values

  • The ability to maintain analytics visibility

URL decoding

Marketing platforms provide their customers with solutions that enable them to communicate with their customers through a number of channels, including promotional emails. In order to send the end user to the right experience, marketing platforms embed contextual information in the URL path.

Challenge

Links that are embedded within promotional emails contain contextual information in the form of hashed parameters and other contextual attributes. High volumes of traffic coming from these links require processing and re-routing by the origin in order to send the end user to the right experience. This processing at origin reduces offload, increases latency, and requires sufficient origin infrastructure to handle the volume of traffic. 

Solution

Use EdgeWorkers to decode the hashed parameters that are a part of the URL and establishes where to route the user in order to:

  • Intercept the request and decode the hashed parameter which contains contextual information
  • Set cookies, if applicable, to increase offload
  • Redirect users to the right experiences

Benefit

Since the URL Decoding service now runs at the edge, the separate http service to origin can be eliminated resulting in:

  • A faster, and more consistent, end user experience
  • Reduction in cloud computing costs

Security block list

Companies want to deliver the right experience for real users and automated bots, including blocking, redirects, and constructed responses based on conditional logic. For example, a company may want to present an optimized view to an SEO bot and filter a bad bot from reaching their origin. 

Challenge

Allowlists and blocklists are created in order to determine the type of experience to provide to different incoming requests. These lists and the logic that determines the right action sit at origin. This results in:

  • Increased latency for requests on the allowlist

  • Unnecessary traffic to origin for requests on the blocklist

Solution

Create a filtering service at the edge leveraging EdgeWorkers to:

  • Store good/bad lists in the EdgeWorkers javascript bundle or in the EdgeKV store

  • Compare against the stored value based on the characteristics of the inbound request, so if the value matches, the request is forwarded to origin. If not, the request is dropped at the edge

Benefit

Since the filtering service now runs at the edge, the separate filtering service to origin can be eliminated resulting in:

  • A faster and more consistent end user experience

  • Reduction in cloud computing costs due to the decrease in unnecessary traffic

Routing based on request characteristics

Routing based on request characteristics allows individuals, teams, and companies to make careful changes to their user experiences while collecting data on the results. This allows them to test hypotheses to learn how certain elements of their experiences impact user behavior.

Challenge

Experimental decision logic is typically implemented as a service at the origin, which requires a trip to origin in order to make the A/B decisions for which piece of content to serve to the end user. This results in reduced offload and added latency to the end user request. 

Solution

Determine the content to serve based on the category that the inbound request resides by leveraging EdgeWorkers to:

  • Segment information stored in the EdgeWorkers javascript bundle or in the EdgeKV store

  • Serve content from the cache

Benefit

The decision on the content to serve to a user segment is written at the edge as opposed to the origin, resulting in:

  • A faster, and more consistent, end user experience

  • Increased offload

Learn More

https://github.com/akamai/edgeworkers-examples/tree/master/a-b-test

https://github.com/akamai/edgeworkers-examples/tree/master/multivariate-test

Dynamic content assembly

Companies are looking to deliver best-in-class, personalized digital experiences without sacrificing the core principles of performance and offload. By breaking a website into its cacheable micro-components, companies are able to deliver exceptional digital experiences while maintaining high offload and strong end user performance.

Challenge

Delivering a customized digital experience results in having to sacrifice performance and offload. Every end user cohort receives a different experience, which lowers cacheability of content and ultimately negatively impacts end user performance. 

Solution

Leverage EdgeWorkers to compose the response at the edge from page templates or fragments pushed from a CMS and stored in a database to:

  • Fragment and templatize information stored in the EdgeWorkers JavaScript bundle or in the EdgeKV store

  • Create logic to compose the response from cached fragments and retrieve non-cached fragments from the origin

Benefit

Response is composed of mostly cacheable fragments, as opposed to constructing a customized response at origin, resulting in:

  • Faster, and more consistent, end user experiences

  • Increased offload

Personalized responses

Companies are looking to deliver personalized experiences to end users without sacrificing the core principles of performance and offload. Personalized experiences increase user engagement and drive business metrics.

Challenge

Personalization decisions, specifically identifying the user and determining the personalized content that should be presented to this user, typically reside at the origin. This means that personalized content is typically uncacheable, resulting in low offload and negative impact to end user performance. 

Solution

Leverage EdgeWorkers to detect characteristics of inbound requests to uniquely identify users and retrieve personalized content to present to the user with:

  • Logic written in JavaScript at the edge

  • Personalized content stored in the EdgeWorkers JavaScript bundle or in the EdgeKV store

Benefit

Personalized content is retrieved from the edge, as opposed to the origin, resulting in: 

  • Faster, and more consistent, end user experiences

  • Increased offload

Manage HTTP header size

Sites and applications rely on headers and cookies to deliver elite user experiences. As more and more data is tracked, the size of response headers increases and can eventually exceed limits, resulting in page errors — and frustrated customers. 

Challenge

The size of the response with header data can eventually hit a limit, resulting in page errors for users. 

Solution

Leverage EdgeWorkers to implement JavaScript logic to determine cookie lengths and remove unnecessary data to:

  • Get programmatic control for developers resulting in fast time to market

Benefit

EdgeWorkers allows developers to easily manage response sizes and eliminate unnecessary data to:

  • Ensure customers don’t experience page errors 

  • Avoid impacting the page performance

  • Increase business results by ensuring users don’t see page errors

  • Improve performance overall with reduced bytes to the client

Authentication

Many web experiences require a request to be authenticated in order to return data. Reasons for this include presenting information behind a login for registered users or presenting information only if a user has an active subscription.

Challenge

The logic to authenticate requests typically resides at the origin (via logic that was custom built or via a 3rd party tool like an API gateway). The logic residing at the origin results in the following challenges:

  • Reduced offload and decreased performance as every request that requires authentication needs make a trip to origin

  • Unnecessary or unauthenticated traffic to origin 

Solution

Use EdgeWorkers to implement JavaScript logic to determine if a request is authenticated:

 

  • Leverage a crypto library included as part of the JS bundle

  • Send acached response to unauthenticated requests 

  • Send authenticated requests back to origin or present them with a cached response if it exists

Benefit

By performing request authentication using EdgeWorkers at the Akamai Edge, customers are able to:

  • Filter out unnecessary traffic back to origin resulting in a reduction in origin infrastructure and costs

  • Increase offload

  • Increased end user performance

Promotional campaigns

Developers are often asked to implement logic to support marketing campaigns to their web properties, including traffic management routed to origin for content delivery or appropriate tagging by back-end systems. Placing the logic that governs marketing campaigns at the edge results in faster page performance and decreased traffic to origin.

Challenge

The logic to track marketing campaigns or promotions is often done at origin. This results in the following challenges:

  • Decreased page performance as every request that requires logging must needs make a round-trip to origin

  • Unnecessary traffic to origin that requires extra origin infrastructure to handle

Solution

EdgeWorkers can implement much of this logic at the edge instead of making a long, latent trip to origin.

Benefit

Decreased page load time and reduced load on origin infrastructure yields a better user experience.

Video streaming: manifest manipulation

Online video providers often deposit the logic that governs content delivery on the client side. Not only is this not optimal for customer experiences, it creates challenges for scaling and personalization. Managing dynamic delivery with EdgeWorkers opens up a new arena of customizable and fast-to-market experiences.

Challenge

The logic to track marketing campaigns or promotions is often done at origin. This results in the following challenges:

  • Decreased page performance as every request that requires logging needs to make a round-trip to origin

  • Unnecessary traffic to origin

Solution

Leverage EdgeWorkers to implement dynamic logic at the edge to: 

  • Optimize the video experience for each viewer using server-side ad stitching that allows CDNs to work in tandem with ad-decision-systems to enable dynamic ad insertion on a per-user basis

  • Create personalized video experiences while optimizing video playback quality (bitrate selection) based on user, device type, network conditions or geography, localized content, DVR and clip creation, and content rights 

  • Secure content by protecting it against unauthorized viewing using scalable session-level encryption, access control and watermarking

Benefit

Utilizing manifest manipulation at the edge enables personalization, content security, and ad-insertion at greater scale than can be achieved using a client-side approach. Using a widely distributed network can reach large audiences with customized manifests across the landscape of devices and browsers without concerns around player updates and heavy reliance on third-party software.


Additional Resources

Get Started with EdgeWorkers

Learn how serverless computing with Akamai can improve your web and app performance and support agile development processes. 

SIGN UP TO ENABLE EDGEWORKERS