Need cloud computing? Get started now

Say Goodbye to Monolithic EdgeWorkers: Introducing Flexible Composition (Part 2)

Akamai Wave Blue

Written by

Evan Hughes and AJ Johnson

February 13, 2024

Evan Hughes

Written by

Evan Hughes

Evan Hughes is a Principal Lead on the EdgeWorkers project at Akamai. He's focused on building a platform that every customer wants to use.

AJ Johnson headshot

Written by

AJ Johnson

AJ Johnson is an Akamai Senior Product Manager focused on EdgeWorkers. His background is in cloud computing, application modernization, observability, and product management. For more than 20 years, AJ has worked as a product manager and consultant in multiple sectors, including technology, financial services, education, and information services.

Now that one EdgeWorker can import another as a module, multiple teams can collaboratively contribute to a single edge application.

In the first blog post of this two-part series, we explored how Akamai’s new Flexible Composition feature improves the EdgeWorkers programming process for organizations with multiple development teams. Teams used to be forced into a cumbersome process, developing for edge applications from a single code base. But with Flexible Composition, each team can contribute functionality to a parent EdgeWorker for more streamlined, dynamic workflows.

Now that Flexible Composition is in beta, let’s explore the EdgeWorkers’ bill of materials, debugging techniques, and working with revisions. 

Table of contents

Revisions

Revisions identify the exact code running in a deployed EdgeWorker. The first revision is generated when a parent EdgeWorker activates, while subsequent revisions are generated when a new child version dynamically activates. Dynamic reactivations are when a parent EdgeWorker is automatically updated to include the changes in a modified child EdgeWorker. These reactivations occur automatically, so EdgeWorkers developers don't need to manage release cycles or coordinate changes.

To learn more about revisions, read Akamai’s documentation for reviewing dynamic reactivations.

Bill of materials

A bill of materials (BOM) lists each EdgeWorker version in a revision pushed to Akamai's networks during dynamic reactivation. BOMs contain every EdgeWorker in the dependency tree along with the deployed version. Figure 1 displays a BOM for our Acme EdgeWorker example from part 1 of this series, while Figure 2 visualizes the request-response flow outlined in Figure 1’s code.

  parent EdgeWorker (EW 12, version "release-25")
 + seo (EW 99, version "2023/05/18")
 + marketing (EW 222, version "28")
    + xss (EW 1356, version "19.6.2")
 + security (EW 478, version "v72")

Fig. 1: Acme EdgeWorker BOM code sample

Figure 2 visualizes the request-response flow outlined in Figure 1’s code. Fig. 2: Acme EdgeWorker BOM request-response flow chart

When the support team activates version 19.6.3 of EdgeWorker 1356, the parent EdgeWorkers dynamically reactivate. Figure 3 shows the new revision’s BOM.

  parent EdgeWorker (EW 12, version "release-25")
 + seo (EW 99, version "2023/05/18")
 + marketing (EW 222, version "28")
    + xss (EW 1356, version "19.6.3")  <-- Note the `xss` version changed
 + security (EW 478, version "v72")

Fig. 3: Dynamically reactivated Acme EdgeWorker BOM, including new xss version

Note the BOM for the top-level EdgeWorker shows the new EW 1356 version, but the other EdgeWorker versions are unchanged. This BOM is available in the current Flexible Composition beta release and can be found in Akamai Control Center, the command-line interface (CLI), and the application programming interface (API). A future version will enable developers to view the BOM in a visual layout to better understand EdgeWorker relationships at a glance. Learn more about BOMs from Akamai’s documentation.

Revision ID

Revision IDs name the revisions of parent EdgeWorkers. Each reactivation generates a unique revision ID and identifies what was pushed to the network. Revision IDs appear in the Control Center with a link to the BOM, which lists the exact version set that’s activated or dynamically reactivated on the network. BOMs are uniquely identified by discrete revision IDs.

Each dynamic reactivation is listed as a new user interface (UI) entry, making it easy to see when and how the EdgeWorker changes. If there’s a problem with the new revision, users can use the Roll Back button to restore the previous revision. Figure 4 displays revisions listed from a user’s EdgeWorker ID dashboard.

Figure 4 displays revisions listed from a user’s EdgeWorker ID dashboard. Fig. 4: EdgeWorker ID dashboard displaying revisions, including revision IDs

Note: Customers who monitor log usage with DataStream 2 can examine the EdgeWorker usage info to track EdgeWorker revision IDs for individual requests.

Evaluating revision differences

Users may wish to see what has changed between two revisions. Figure 5 displays the Control Center’s view for comparing selected revisions side by side, showing the exact version of a child EdgeWorker that was updated during a dynamic reactivation.

Compare revisions of EdgeWorkers ID 80554 Fig. 5: EdgeWorker ID revisions comparison view in the Control Center

Revision pinning

For organizations that are keen to stabilize security and production, EdgeWorkers offers a revision pinning functionality that sticks to a specified revision.

Let’s say the Acme Ops team was preparing a Black Friday sales event. What if a developer accidentally introduced a bug to the site during the most profitable weekend of the year? 

With revision pinning, the team can stop dynamic reactivations of their EdgeWorker for the duration of the event. From the Control Center UI or CLI, the team can pin the current parent EdgeWorker revision so the pinned revision remains on Akamai's network, regardless of dependency changes. When Black Friday becomes Cyber Monday at the event’s conclusion, the Acme Ops team can unpin the parent EdgeWorker to resume dynamic reactivations. 

Version pinning provides customers the flexibility to accept changes when it’s safe to do so and avoid unnecessary changes during critical periods. Figure 6 shows how to pin a revision from the Revision Activations tab of your Control Center dashboard.

Figure 6 shows how to pin a revision from the Revision Activations tab of your Control Center dashboard. Fig. 6: Revision pinning instructions from Control Center dashboard’s Revision Activations tab

Flexible composition debugging

Developers need to know exactly what they’re dealing with when building and troubleshooting software. To help developers understand which EdgeWorker versions handled a request, we've updated our enhanced debug headers documentation to include the EdgeWorker revision ID and the EdgeWorker ID in file paths.

  • EdgeWorker revision ID Developers can use the revision ID to find the associated BOM 

  • EdgeWorker ID in file paths — The EdgeWorker ID appears in log output and stack traces to show customers exactly where events occurred 

For example, when a developer is verifying their new EdgeWorker version on the Akamai staging network, they can pass the standard trace header to view debug headers — triggering an exception for the user. Check out the enhanced debug headers section of the Akamai TechDocs for examples of both success and failure messages. 

With dynamic reactivation, teams developing EdgeWorkers must ensure parent EdgeWorkers continue to function when they activate new versions, which can be achieved by:

  1. Testing the parent EdgeWorkers with the new version as part of a continuous integration pipeline

  2. Adhering to a mutually agreed upon API definition verified through unit tests

  3. Monitoring the behavior of parent EdgeWorkers and quickly rolling back in the case of an error

Rollback

Even with extensive verification, releasing bad software is always a possibility. For example, if the Acme support team produces and activates a buggy version of the xss EdgeWorker, the parent EdgeWorker will begin producing errors. 

In that case, the Acme Ops team will notice and investigate the failures that begin after the most recently activated revision ID by reviewing the parent EdgeWorker’s revision history. The team can roll back to the previous parent EdgeWorker revision that uses the old xss EdgeWorker version. After the rollback is completed, Acme staff can review the changes introduced in the new xss EdgeWorker version, fix errors, and activate a safe version.

Summary

Now that one EdgeWorker can import another as a module, multiple teams can collaboratively contribute to a single edge application. Dynamic reactivations — when a parent EdgeWorker updates to leverage changes introduced to an edited child EdgeWorker — streamline the process of getting developer changes to production so teams that own parent EdgeWorkers don’t have to monitor and reactivate whenever a child changes. And when a new EdgeWorker dependency version is published to the network, the EdgeWorker dynamically reactivates to use the dependency’s latest version and is assigned a revision ID.

Revision IDs are listed in Akamai Control Center and linked to the BOM specifying each dependency’s version in that revision. If there are problems with a revision, users can roll back to a previous revision. The EdgeWorkers revision pinning functionality helps organizations stick to a specified EdgeWorker revision.

We’ll continue Flexible Composition development with a focus on security and usability features, such as permissions and a hierarchy view for parent-child relationships. We also plan to add the ability to import specific EdgeWorkers revisions.

Learn more about Akamai EdgeWorkers

Check out these Akamai resources to learn how Akamai EdgeWorkers can benefit your organization:

Learn more about Flexible Composition

Learn more about our new Flexible Composition feature (currently in beta) on these TechDocs pages from Akamai’s security experts:

Ready to implement EdgeWorkers across your enterprise organization?

Coming soon from Akamai

In spring 2024, Akamai will release a Flexible Composition enhancement called SubWorkers. SubWorkers will enable teams to call an EdgeWorker from a SubRequest function within another EdgeWorker. Contact your Akamai representative to experience this new feature when it launches as part of Akamai’s Flexible Composition beta program.



Akamai Wave Blue

Written by

Evan Hughes and AJ Johnson

February 13, 2024

Evan Hughes

Written by

Evan Hughes

Evan Hughes is a Principal Lead on the EdgeWorkers project at Akamai. He's focused on building a platform that every customer wants to use.

AJ Johnson headshot

Written by

AJ Johnson

AJ Johnson is an Akamai Senior Product Manager focused on EdgeWorkers. His background is in cloud computing, application modernization, observability, and product management. For more than 20 years, AJ has worked as a product manager and consultant in multiple sectors, including technology, financial services, education, and information services.