Servo engines written in Rust deliver memory safety and multithreading

Servo engine

What is Servo?

In 2012, Mozilla started the Servo project, a community effort to create a new, open source browser engine that can take advantage of multicore hardware to improve speed, stability, and responsiveness. Servo is comparable to WebKit, an open source browser engine that is the foundation of Apple’s Safari browser. (Other browser engines include Blink, EdgeHTML, and Gecko.) The difference is that Servo is written in the Rust programming language, bringing lightning-fast performance and memory safety to browser internals. Rust code can drastically cut down the number of critical bugs that affect browser engines. Servo uses a modular architecture and currently runs on Linux, macOS, Windows, and Android operating systems.

What components will Servo offer?

Like WebKit, the Servo project is not a complete browser. It is an experimental project that delivers components that can load, run, and display web sites and applications. These components include:

  • A parallelized CSS Style engine that can speed page load times and improve stability
  • A Paint engine, called WebRender, that moves drawing almost entirely to GPUs, ensuring high frame rates and freeing up the CPU to do other work

Developers can integrate these web-friendly components into their own projects, including products, applications, user interfaces, and more.

How does it work?

Servo takes full advantage of Rust’s parallelization to bring multiprocess, multithreaded, GPU-accelerated browsing to today’s PCs, tablets, and smartphones. Servo code lets the browser run high-priority tasks in a thread that’s independent of the main thread. That means it’s less likely that unstable content or slow code will disrupt the browser’s critical functions.

Servo code is memory-safe by default, because it is written in Rust. The Rust ownership model helps the compiler ensure memory safety. It also makes writing parallel code safe and easy. With Rust, developers can safely reuse code to shorten development cycles. That gives Servo a low barrier to entry, allowing new programmers to make meaningful contributions to the code base without triggering costly, extended review cycles. Rust code can also shrink attack surfaces on applications, because it prevents common software faults such as “use after free” errors that hackers could exploit to gain access to the machine. Lastly, Rust’s memory safety can drastically reduce the time needed to complete peer reviews and QA.

Why does it matter?

Servo is very fast. Many parts are much faster than existing browser components written in C++. These gains in performance and reliability mean Servo engines can run modern applications with headroom to spare — and scale to new hardware such as virtual reality (VR) headsets.

Servo is simpler and easier to work with than legacy browser engines. That makes it a great base for new projects and experimentation. Servo promises to open up new use cases for web engines and allow more things to be built out of web technologies.

What does it replace or change?

Servo gives developers an alternative prototype browser engine written in Rust. Like WebKit, Servo can be easily embedded and used for a diverse set of use cases.

What Web standards does it support?

The Servo engine already supports many web standards such as HTML, CSS, JavaScript, WebSockets, WebVR, and WebGL. However, we are still working on full web compatibility. Over time, we expect to support additional web standards such as WebRTC, WebAudio, Gamepad, and others.

Who is using it?

Mozilla incorporated the Servo CSS Style engine in release 57 of its Firefox Quantum browser. The Servo project is now focused on tackling new challenges in the virtual and augmented reality space.