Faster Than a Blink: Globally Distributed Wasm Functions on Akamai by Kate Goldenring

ScyllaDB 0 views 22 slides Oct 13, 2025
Slide 1
Slide 1 of 22
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22

About This Presentation

Users start noticing lag after just 100 milliseconds (a blink of an eye) making latency a critical challenge for modern, globally distributed applications. In this talk, Kate shares how Akamai and Fermyon partnered to beat that blink, minimizing both network and compute latency by deploying Spin-bas...


Slide Content

A ScyllaDB Community
Faster than a Blink:
Globally Distributed Wasm
Functions on Akamai
Kate Goldenring
Senior Software Engineer

Kate Goldenring (she/her)

Senior Software Engineer
■Open source developer (Spin, Akri, Wasm
component-docs)
■Co-chair of the Bytecode Alliance Documentation SIG
■Passionate about software sustainability
■Mountaineering instructor

What a blink is worth
A blink of an eye takes 100ms
■Users start noticing latency after 100 ms - Nielsen, 1993
■Every 100ms in added page load time costs 1% in revenue - Amazon
Total latency = network time + compute time

Network Time
Serverless Functions (Azure Functions, AWS Lambda, etc.)
Compute Time
Network Time
Fermyon cuts down the compute time:
Compute
Time
Network
Time
Akamai cuts down network time:
Compute
Time
0 ms 400 ms

Fermyon Wasm Functions
A multi-tenant, hosted, globally distributed engine for edge functions running on
Akamai Cloud, the most distributed cloud network
■Faster than the blink of an eye
■Supports multiple languages
■Fast, global deployments
■Secure Wasm sandbox

https://www.fermyon.com/wasm-functions

Why Wasm on the Server
Small packages
A hello-world Spin
WebAssembly
application written in
Rust is a 284kB OCI
Artifact.


They start up
almost
immediately
A Spin WebAssembly
component will start
in less than a
millisecond (0.51ms)
They are
sandboxed
WebAssembly
components are
sandboxed and are by
default denied access
to resources on the
system.
They are portable
You can swap out the
underlying nodes
processor architecture
without having to
produce separate
pipelines and deploy
artifacts.

Traditional vs edge functions
Fastly / CloudFlare / Fermyon Wasm
Functions. Global functions with
instant cold starts.
Traditional Functions
Edge Functions
AWS Lambda / Azure Functions / GCF.
Expensive, unperformant.


Supported
Languages
Isolation
Mechanism
2-7
Languages
Wasm
V8 Isolates
Broad
support
MicroVMs
Containers
Regions
Cold
Starts
<5 ms
200+ ms
Global POPs
Single Region

Taking Edge functions further with FWF
Traditional Functions
Edge Functions
Fermyon Wasm Functions
Fastly / CloudFlare / Fermyon Wasm
Functions. Global functions with
instant cold starts.
AWS Lambda / Azure Functions / GCF.
Expensive, unperformant.


Extend your performance with OSS
Spin Wasm functions
Supported
Languages
Isolation
Mechanism
2-7
Languages
Wasm
V8 Isolates
Broad
support
MicroVMs
Containers
7 Languages Wasm
Regions
Cold
Starts
<5 ms
200+ ms
<1 ms
(0.51 ms)
Global POPs
Single Region
Notes
Global POPs
No cloud lock-in
Fast start up
OSS tooling
<1 min to deploy
Cloud lock-in
Fast start up
Cloud lock-in
Not suitable for latency
sensitive apps

Spin Up
https://www.loom.com/share/2330f822179d4dc18fb630ac624738cc?sid=2c6022f6-cef0-4609-bf22-40543aa76ba4

Spin Developer Experience
Develop, test locally and deploy your app using Spin, the open source CNCF tool
for serverless Wasm
https://spinframework.dev/

High Performance Redirects Wasm Function
Large-scale HTTP redirect service implemented as a Spin application.
■Fast: O(1) lookup times with minimal memory footprint
■Scalable: Easily handles millions of redirects
■Pre-initialized: Embeds optimized representations of redirect data into the
Wasm binary at build time for zero-cost cold starts
■Hosted: Runs on Fermyon Wasm Functions

https://github.com/fermyon/fwf-examples/tree/main/samples/large-scale-redirects

redirects.txt
/about/document/comment /about/document/item
/about/document/comment/example /about/featured/account/webinar
/about/document/coupon/datasheet/demo/settings /about/document/coupon/datasheet/category
/about/document/coupon/template /resource
/about/document/create/dashboard/brochure/portfolio /career/gallery/support/job/gallery
/about/document/demo/career /about/document/brochure/contact
/about/document/demo/coupon/product/pricing /coupon/marketing/tutorial/about
/about/document/demo/job/notification /about/document/demo/preferences
/about/document/demo/opening/meetup /subscription/category/report/creative/reference/manual
/about/document/details/edit/help /about/document/details/whitepaper/snippet/business
/about/document/details/engineering /about/document/career
/about/developer/manual /about/resource
/about/developer/marketing /about/featured/pricing/latest/featured
/about/developer/marketing/pricing/brochure /subscription

Pre-initializing the function with redirects
https://github.com/fermyon/fwf-examples/tree/main/samples/large-scale-redirects

Wizer to Preinitialize Redirects
#[export_name = "wizer.initialize"]
pub extern "C" fn init() {
let mut sources_file = File::open("sources.fst").unwrap();
let size = sources_file.metadata().unwrap().len();
let mut sources_bytes = vec![0; size as usize];
sources_file.read_exact(&mut sources_bytes).unwrap();
let sources_fst = fst::Map::new(sources_bytes).unwrap();
SOURCES.set(sources_fst).unwrap();
let targets_file = File::open("targets.fcsd").unwrap();
let reader = BufReader::new(targets_file);
let set = fcsd::Set::deserialize_from(reader).unwrap();
let _ = TARGETS.set(set);
}

The WASI Redirect Function
impl wasi::exports::http::incoming_handler::Guest for MyIncomingHandler {
fn handle(request: IncomingRequest, response_out: ResponseOutparam) {
let headers = Fields::new();
let sources = SOURCES.get().unwrap();
if let Some(index) = sources.get(request.path_with_query().unwrap()) {
let targets = TARGETS.get().unwrap();
let redirect = targets.decoder().run(index as usize);
let header = String::from("Location");
headers.set(&header, &[redirect]).unwrap();
}
ResponseOutparam::set(response_out, Ok(OutgoingResponse::new(headers)));
}
}

Small binaries, 1.25s builds, 1mil redirects
# Compile the application as a Wasm module
» cargo build --target wasm32-wasip1 --release

# Pre-initialize the Wasm module with the redirects data
» echo "sources.fst" "targets.fcsd" | wizer --allow-wasi --wasm-bulk-memory true
--dir . -o target/redirect.wasm target/wasm32-wasip1/release/redirects_rs.wasm

# Get the final size
» ls -lh target/redirect.wasm | awk '{print $5}'
35 M

Test locally
» spin up
Logging component stdio to ".spin/logs/"

Serving http://127.0.0.1:3000
Available Routes:
redirects-rs: http://127.0.0.1:3000 (wildcard)

Deploy globally in seconds
» spin aka deploy
Name of new app: redirects
Creating new app redirects in account kate-goldenring
Note: If you would instead like to deploy to an existing app, cancel this deploy
and link this workspace to the app with `spin aka app link`
OK to continue? yes
Workspace linked to app redirects
Waiting for app to be ready... ready

App Routes:
- redirects-rs: https://67eb48c9-8655-4ea8-bda1-32c14e8b1936.fwf.app (wildcard)

Example redirect
» curl --include
https://67eb48c9-8655-4ea8-bda1-32c14e8b1936.fwf.app/about/subscription

HTTP/2 302
location: /pricing/subscription
content-length: 0
date: Fri, 06 Jun 2025 18:55:40 GMT
x-envoy-upstream-service-time: 1
server: envoy

<2ms redirects
» hey -disable-redirects -c 200 -n 50000
https://67eb48c9-8655-4ea8-bda1-32c14e8b1936.fwf.app/about/subscription

Summary:
Total:2.8559 secs
Slowest:0.1632 secs
Fastest:0.0052 secs
Average:0.0104 secs
Requests/sec:17507.4513

Status code distribution:
[302]50000 responses

Getting Started

■Fermyon Wasm Functions: https://developer.fermyon.com/wasm-functions
■FWF examples: https://github.com/fermyon/fwf-examples
■Spin: https://github.com/spinframework/spin
■SpinKube: https://github.com/spinframework/spin-operator

Thank you! Let’s connect.
Kate Goldenring
[email protected]
@KateGoldenring
www.continued.education
Tags