Network Edge Applications

Authors: Ian Marsh (RISE) and Remo Scolati (KTH, now CanaryBit), within the ANIARA consortium: Wolfgang John, Ali Balador, Jalil Taghia, Andreas Johnsson, Johan Sjöberg, Ian Marsh, Jonas Gustafsson, Federico Tonini, Paolo Monti, Pontus Sköldström and Jim Dowling
Venue: ACM SIGAda Ada Letters 42(2), pp. 92–95 (project paper, 2023). WebAssembly study: manuscript, February 2024
Year: 2023–2024
Topic: Edge networking
Project: ANIARA (Automation of Network edge Infrastructure and Applications with aRtificiAl intelligence), CELTIC-NEXT C2019/3-2, Vinnova 2020-00763

Project paper (ACM) · Remo Scolati’s thesis · Code and data · Technical blog · Welding video

Summary

Smart factories and smart cities need answers in milliseconds. A distant data centre cannot always deliver that. Edge networks put compute close to the machines, but the edge is distributed, short of compute and fails in many ways. ANIARA was a CELTIC-NEXT project, led by Ericsson, that used AI and machine learning to automate the infrastructure and the applications running on it.

In ANIARA, RISE worked on the applications side. If code is to run in the cloud one day, at the network edge the next and next to the robot after that, it has to be portable. WebAssembly (WASM) offers that: compile once, run on any CPU and operating system, inside a secure sandbox. The cost is speed. So we asked: is WASM fast enough to control an industrial robot over a network?

We built a welding task, three robots (two in software, one on the desk), three WASM runtimes and three edge computers. We found that WASM runs about 1.2–1.5× slower than native code on its own. Over a network, that gap mostly disappears into the end-to-end delay. A 100 ms robotics deadline can be met from the edge, and only just missed from the cloud on a Raspberry Pi 4.

A networked factory: data centre, core network, network edge, on-premises control and the robot cell

A networked factory. Blue blocks are the network, orange blocks the robot cell. The prompt boxes mark where a WASM application could run: red in the cloud, yellow at the edge, green beside the robot.

Why 100 ms?

Every layer between the task and the light in the fibre adds delay. Industrial robots are commonly polled about every 100 ms, so we took that as the end-to-end budget.

SourceLatency
Industrial applications (Industry 4.0)5–500 ms
Robot interpolation along a toolpath (HAL Robotics, arc welding)50 ms
Polling a robot for an action (HAL Robotics)100 ms
4G (3GPP Rel. 8)< 50 ms
5G (3GPP Rel. 16/17)< 10 ms
5G edge (ANIARA proposal)1–10 ms
6G (Ericsson)< 1 ms

Selected latency requirements for Industry 4.0, industrial robotics and 3GPP networks.

Responsiveness in perspective: execution, network and kinematics times against a 15-second task

Delays on a log scale. Running the code and crossing the network take milliseconds. The welding task itself (grey, right) takes 15 seconds.

The robot task

The task imitates welding a metal seam, a common industrial job. Moving an arm well needs kinematics. Forward kinematics turns joint angles into the position of the tool. Inverse kinematics (IK) does the reverse: given where the tool should be, it finds the joint angles. IK is our workload.

Forward and inverse kinematics for a three-joint arm

Not every point in space is reachable, because the arm’s links and joints have limits. Checking thousands of target points, reachable or not, makes the workload general rather than tied to one weld. In WASM, an unreachable point cost 2.5 ms on average over 100 points.

Reachable (blue) and unreachable (orange) points for a five-degree-of-freedom arm

The robots are described in the Unified Robot Description Format (URDF), from ROS. The k Rust library reads the description and solves the IK, and Rust compiles cleanly to WASM. We used plain TCP/IP and a REST API rather than the ROS network stack:

Task → URDF → Rust → WASM → IK → workload → timings

Three robots ran the task: a four-joint “torso” and a five-joint “arm” in software, and a six-joint Tinkerkit Braccio desktop arm in hardware.

Tabletop set-up: the Tinkerkit Braccio arm with Raspberry Pi 3, 4 and 5 edge nodes

The tabletop demonstrator: the Braccio arm and its Arduino controller, with three Raspberry Pis as edge nodes.

WebAssembly and the test harness

A WASM module holds the code and declares its memory and functions. A runtime executes it in a sandbox, cut off from the operating system. The WebAssembly System Interface (WASI) gives controlled access to files and network sockets, and our timings include its overhead.

RuntimeVersionCompilationSystem interface
wasm30.5.0Interpreter onlynone
wasmer3.1.1JIT and AOT (Singlepass, Cranelift or LLVM)WASI
wasmtime6.0.0JIT and AOT (Cranelift)WASI

The three runtimes compared. JIT = just-in-time compilation, AOT = ahead-of-time.

The harness runs the same workloads as native binaries and as WASM, locally or over the network, and times each step. The workloads were a no-op (runtime start-up only), Fibonacci sequences (many function calls) and the IK search. Placements were the cloud, a near edge and a far edge, with Raspberry Pi 3 and 4 boards and a laptop under WSL2.

Software architecture: timing utility, local and remote clients, native and WASM workload libraries

Results

On its own, WASM takes about twice as long. Run locally, the WASM IK workloads took 1.8–2.2× the native time, in line with other recent benchmarks.

Ratio of WASM to native execution time, by placement and robot

Over the network the gap shrinks. End to end, response times on the far edge were around 7–9 ms native and 12 ms with WASM. The further away the code runs, the more the network dominates. From the cloud, WASM was only 1.03–1.04× slower than native.

End-to-end response times on the far edge device, native versus WASM, for the arm and torso robots
Ratio of WASM to native end-to-end response time: 1.33–1.69 at the far edge, 1.39–1.40 at the near edge, 1.03–1.04 in the cloud

The way the code is compiled matters. Compiled ahead of time, both robots stayed under 100 ms with wasmtime and wasmer. The wasm3 interpreter was about 20× slower than native and missed the deadline. Under JIT, loading the robotics libraries made start-up almost 10× slower than an empty program.

Standalone execution times for wasm3, wasmtime AOT, wasmer AOT and native binaries

Against the 100 ms budget. On a Raspberry Pi 4, the URDF move took 114 ± 4 ms in wasmtime and 77 ± 2 ms natively, about 1.4× slower. Add a cloud-to-device network delay measured with mtr (about 36 ms, Luleå to Stockholm), and the native binary fits the budget while WASM on a Pi 4 just exceeds it. Newer boards are about 50% faster, and the Raspberry Pi 5 came out during the work.

Stacked end-to-end delay for native and WASM against a 100 ms deadline

Blue: runtime and IK workload. Orange: network. Green: other delays, such as system calls. The black line is the 100 ms deadline.

Conclusions

  • WASM costs some speed, about 1.2–1.5× native for this task, and the gap keeps closing as compilers and runtimes improve. wasmtime went from version 0.8 to 18 during the project.
  • In a networked deployment the penalty is largely hidden by the end-to-end delay, so it is not prohibitive for robot control.
  • Ahead-of-time compilation is a must. Interpreters and cold JIT start-ups can break a real-time deadline.
  • WASM also brings a secure sandbox, many source languages and hardware portability, which makes moving code between cloud, edge and robot simpler.

Student thesis

Citation

Wolfgang John, Ali Balador, Jalil Taghia, Andreas Johnsson, Johan Sjöberg, Ian Marsh, Jonas Gustafsson, Federico Tonini, Paolo Monti, Pontus Sköldström and Jim Dowling. ANIARA Project: Automation of Network Edge Infrastructure and Applications with Artificial Intelligence. ACM SIGAda Ada Letters 42(2), 92–95, 2023. doi:10.1145/3591335.3591347

Ian Marsh and Remo Scolati. The Responsiveness and Deployment of WebAssembly Runtimes in Cyber-Physical Systems. Manuscript, RISE, February 2024.

@article{john2023aniara,
  title   = {ANIARA Project -- Automation of Network Edge Infrastructure and Applications with Artificial Intelligence},
  author  = {John, Wolfgang and Balador, Ali and Taghia, Jalil and Johnsson, Andreas and Sj{\"o}berg, Johan and Marsh, Ian and Gustafsson, Jonas and Tonini, Federico and Monti, Paolo and Sk{\"o}ldstr{\"o}m, Pontus and Dowling, Jim},
  journal = {ACM SIGAda Ada Letters},
  volume  = {42},
  number  = {2},
  pages   = {92--95},
  year    = {2023},
  doi     = {10.1145/3591335.3591347}
}

Acknowledgements

CELTIC-NEXT project C2019/3-2 and Vinnova, Sweden, project 2020-00763 (ANIARA). Thanks to Wolfgang John and Andrew Williams (Ericsson), Sebastian Andraos (HAL Robotics), Pontus Sköldström (Qamcom) and Anders Lindgren (RISE).

More in Edge networking: Evolving 5G: ANIARA, an Edge-Cloud perspective (SNCNW workshop) →

← All publications