Rust blog.discordapp.com

Using Rust to scale Elixir for 11 million concurrent users  ↦

The Discord team bumped up against some limitations of the BEAM (Erlang’s virtual machine) when dealing with rather large data structures:

The double-edged sword of immutable data structures is that mutations are modeled by taking an existing data structure and an operation and creating a brand new data structure that is the result of applying that operation to the existing data structure.

This meant that when someone joined a server — internally referred to as guilds — with a Member List of 100,000 members, we would have to build a new list with 100,001 members in it.

You’ll want to click through and read all of the data structures they tried to fix this problem. It’s some seriously solid engineering and I love how they continued to measure and push themselves further. Finally, they reached for Rust thanks to BEAM’s NIF feature and really scaled up the speed.


Discussion

Sign in or Join to comment or subscribe

0:00 / 0:00