Server-side WebAssembly

A presentation at SophiaConf in June 2021 in Sophia Antipolis, France by Horacio Gonzalez

Slide 1

Slide 1

Server-side WebAssembly Horacio Gonzalez 2021-06-24

Slide 2

Slide 2

Who are we? Introducing myself and introducing OVH OVHcloud

Slide 3

Slide 3

Horacio Gonzalez @LostInBrittany Spaniard lost in Brittany, developer, dreamer and all-around geek Flutter

Slide 4

Slide 4

OVHcloud: A global leader Web Cloud & Telcom 30 Data Centers in 12 locations 1 Million+ Servers produced since 1999 Private Cloud 34 Points of Presence on a 20 TBPS Bandwidth Network 1.5 Million Customers across 132 countries Public Cloud 2200 Employees worldwide 3.8 Million Websites hosting Storage 115K Private Cloud VMS running 1.5 Billion Euros Invested since 2016 300K Public Cloud instances running P.U.E. 1.09 Energy efficiency indicator 380K Physical Servers running in our data centers 20+ Years in Business Disrupting since 1999 Network & Security

Slide 5

Slide 5

Did I say WebAssembly? Wasm for friends…

Slide 6

Slide 6

WebAssembly, what’s that?

Slide 7

Slide 7

A low-level binary format Not a programming language, a compilation target

Slide 8

Slide 8

That runs on a stack-based virtual machine A portable binary format that runs on all modern browsers… but also on NodeJS and elsewhere!!

Slide 9

Slide 9

With several key advantages

Slide 10

Slide 10

But above all… Wasm is not meant to replace JavaScript

Slide 11

Slide 11

Who is using WebAssembly today? And many more others…

Slide 12

Slide 12

A bit of history Remembering the past to better understand the present

Slide 13

Slide 13

Executing other languages in the browser A long story, with many failures…

Slide 14

Slide 14

2012 - From C to JS: enter emscripten Passing by LLVM pivot

Slide 15

Slide 15

2013 - Generated JS is slow… Let’s use only a strict subset of JS: asm.js Only features adapted to AOT optimization

Slide 16

Slide 16

WebAssembly project Joint effort

Slide 17

Slide 17

Server-side WebAssembly Too good to not to use it

Slide 18

Slide 18

Solomon on Web Assembly

Slide 19

Slide 19

Solomon on Web Assembly

Slide 20

Slide 20

A very interesting feature set

Slide 21

Slide 21

Features of Wasm Why is everybody looking at it?

Slide 22

Slide 22

Near native speed https://medium.com/wasmer/benchmarking-webassembly-runtimes-18497ce0d76e

Slide 23

Slide 23

Highly portable It can be run almost everywhere…

Slide 24

Slide 24

Readable and debuggable Each .wasm file with it .wat companion file

Slide 25

Slide 25

Memory safe & secure Running in a fully sandboxed environment

Slide 26

Slide 26

Accepting many source languages And more and more…

Slide 27

Slide 27

Still a young platform… But growing up fast!

Slide 28

Slide 28

Native WASM types are limited WASM currently has four available types: ● i32: 32-bit integer ● i64: 64-bit integer ● f32: 32-bit float ● f64: 64-bit float Types from languages compiled to WASM are mapped to these types

Slide 29

Slide 29

How can we share data? Using the same data in WASM and JS? Shared linear memory between them, and serializing the data to one Wasm types

Slide 30

Slide 30

Solution is coming: Interface types Beautiful description at: https://hacks.mozilla.org/2019/08/webassembly-interface-types

Slide 31

Slide 31

No outside access By design, communication is done using the shared linear memory only

Slide 32

Slide 32

Solution exists: WASI

Slide 33

Slide 33

Mono-thread and scalar operations only Not the most efficient way…

Slide 34

Slide 34

Solution exists: SIMD

Slide 35

Slide 35

Solutions are coming too: Wasm Threads Threads on Web Workers with shared linear memory

Slide 36

Slide 36

Incoming proposals: Garbage collector And exception handling

Slide 37

Slide 37

The Bytecode Alliance Taking WASM out of the browser

Slide 38

Slide 38

The Bytecode Alliance

Slide 39

Slide 39

Bytecode Alliance projects

Slide 40

Slide 40

Wasmtime

Slide 41

Slide 41

Cranelift

Slide 42

Slide 42

WebAssembly Micro Runtime (wamr)

Slide 43

Slide 43

Lucet

Slide 44

Slide 44

Other runtimes Runtimes, runtimes everywhere

Slide 45

Slide 45

Wasmer Run any code* on any client… almost * Languages compiling to WASM

Slide 46

Slide 46

Wasmer

Slide 47

Slide 47

Wasmer ecosystem

Slide 48

Slide 48

Wasmer ecosystem

Slide 49

Slide 49

Wasm3

Slide 50

Slide 50

Wasm3

Slide 51

Slide 51

And even Wasm over GraalVM!

Slide 52

Slide 52

Or in Kubernetes…

Slide 53

Slide 53

Some examples IRL? Like companies using these things

Slide 54

Slide 54

Cloudflare Workers (FaaS)

Slide 55

Slide 55

Cloudflare Workers (FaaS)

Slide 56

Slide 56

Fastly works on the edge of the cloud

Slide 57

Slide 57

Fastly works on the edge of the cloud

Slide 58

Slide 58

Clever Cloud FaaS infrastructure https://www.youtube.com/watch?v=wchehMIsu80

Slide 59

Slide 59

Clever Cloud FaaS Infrastructure Already used in internal projects Able to execute complex loads (neural networks models)

Slide 60

Slide 60

Clever Cloud FaaS Infrastructure Blazing fast

Slide 61

Slide 61

Clever Cloud FaaS Infrastructure Blazing fast

Slide 62

Slide 62

That’s all, folks! Thank you all!