backgroundradial

Wasmer 4.1

Wasmer 4.1 is out! Epoll, new browser login and more 🎉

syrusakbary avatar
syrusakbary
Syrus Akbary

Founder & CEO

runtime

July 17, 2023

arrowBack to articles
Post cover image

Epoll! Epoll! Epoll! Epoll! 🎉

You can guess, we’re excited, really excited. Excited for epoll!

What more are we excited about ?

  • Faster async execution 🚀 ( poll_oneoff 🔫 )
  • HTTPS clients fully running in WASIX 🤯 (We too literally got the :O faces)
  • New login flow
  • Multiple bugfixes (such as --mapdir and stability improvements)

You can install Wasmer 4.1 right now:

$ curl https://get.wasmer.io -sSfL | sh

Are you Readyyyy !!!

Start your Runtime 🏎️

Let’s GOOOOOOO

This release of Wasmer Runtime 4.1 is more horizonal than vertical which focuses on improving stability & bug fixes but also introduces new and improved features in the runtime such as implementation of epoll syscall in our runtime and our new login flow. These features compliment the WASIX and the Edge ecosystem with improved async performance.

Major Highlights

  • Epoll: Wasmer now implements epoll syscall which makes asynchronous I/O faster which allows for more optimal execution times.
  • Wasmer’s new login: Now you can login without the hassle of creating a token and login using the browser 🪄.

Additional Improvements

  • The cfg_doc feature is enabled on all crates so API docs for things behind a feature flag get a useful "Available on crate feature fs only" annotation
  • Switch PluggableRuntime from using the builtin package loader by default to a no-op version so WASIX can be used without pulling in a HTTP client → closing #4029
  • --mapdir issues of mapping a host’s directory to guest is now fixed as paths are now canoncalized. Commands such as
    $ wasmer run php.wasm --mapdir=.:.
    
    work as expected and improves DX a lot as users needed to paste in complete paths.

Epoll

What is Epoll?

epoll is a variant of poll available in the Linux kernel, designed to be more efficient when dealing with large numbers of file descriptors. Unlike poll, which scans through all file descriptors each time it is called, epoll uses an event-driven approach. It maintains a "watch list" of file descriptors, and only those that have changed status since the last call will be returned to the user.

Before 4.1, we used the poll_oneoff syscall for non-blocking operations such as networking, file system access, etc. This meant that we had to fork mio to use the poll_oneoff syscall but found limitations with inconsistencies on how POSIX implements poll and how WASI specified poll_oneoff. By implementing the much more scalable epoll syscall this allows for a consistent implementation that matches closer to POSIX without hurting WASI backwards compatibility which WASIX is committed to retain.

Tokio natively implements async I/O using epoll.

What were the challenges with poll_oneoff?

  • The default behavior around timeouts was inconsistent, namely nonblocking polls.
  • As the number of file descriptors grew the scalability dropped off exponentially
  • There were stability issues as Wasmer uses mio which uses epoll - a more direct mapping has less failure paths

What epoll improves?

  • Much better performance for asynchronous applications compiled to WASIX
  • Better stability for both epoll and for poll_oneoff which indirectly benefited through refactoring

Note: The poll_oneoff syscall is still available in the runtime and epoll is optional addition but provides a much more scalable and performant solution.

Okay, enough of the talk, let’s see some numbers.

poll_oneoff (WASI) vs epoll (WASIX)

As we see above, epoll is much more performant than poll_oneoff and scales better as the number of concurrent requests increase.

💡 TLS is now available in WASIX. Client libraries such as reqwest, hyper, etc. will work as expected. This was made possible by compiling ring and rustls with WASIX. Paired with our new epoll we’re just imagining the possibilities. But this deserves a blog post of its own… stay tuned!

New Wasmer login 🌐

Wasmer’s new login flow enables users to login to wasmer-cli using the browser creating a seamless experience which requires no manual token creation. While still respecting the previous login flows using pasting a token or using the --no-browser flag for a CI.

Now wasmer-cli offers these 2 methods to login:

  • Using the default browser method
  • Using wasmer login <token> token method (still useful for CI workloads)

ℹ️ You can use --no-browser flag for CI runs

A side note on PHP

PHP compiled to WASIX now supports using the builtin webserver to serve PHP. This is a huge improvement for PHP developers as they can now run PHP servers with sqlite support. Before you'd have to use a custom WCGI server to run PHP.

The PHP package is available here

TLDR;

  • Improved async performance with our new epoll syscall
  • Login with ease on wasmer-cli using a browser 🌐
  • Improved stability in the runtime with fixes on --mapdir
  • TLS support for WASIX
  • PHP on WASIX now supports builtin webserver with sqlite support

Epollllllll 🎉

About the Author

Syrus Akbary is an enterpreneur and programmer. Specifically known for his contributions to the field of WebAssembly. He is the Founder and CEO of Wasmer, an innovative company that focuses on creating developer tools and infrastructure for running Wasm

Syrus Akbary avatar
Syrus Akbary
Syrus Akbary

Founder & CEO

Read more

runtimeengineeringwasmer runtime

Wasmer 3.2

Syrus AkbaryApril 18, 2023

runtimeengineeringwasmer runtime

Wasmer 2.3

Syrus AkbaryJune 7, 2022

runtimeengineeringwasmer runtime

Wasmer 2.1

Syrus AkbaryDecember 1, 2021

engineeringwasmer runtimewasmerruntimeperformance

Improving WebAssembly load times with Zero-Copy deserialization

Arshia GhafooriSeptember 7, 2023