How Discord Scaled Elixir to 5,000,000 Concurrent Users

How Discord Scaled Elixir to 5,000,000 Concurrent Users

And some discussion on Hacker News about it (including some OTP 20.0 optimizations).

Their published libraries described in the blog post:

  • manifold: Fast batch message passing between nodes for Erlang/Elixir
  • ex_hash_ring: A fast consistent hash ring implementation in Elixir
  • fastglobal: Fast no copy globals for Elixir & Erlang
  • semaphore: Fast semaphore using ETS

At last the praised free book from Fred Hebert: Stuff Goes Bad: Erlang in Anger

27 Likes

Nice :023:

I’ve made some changes to our Showcase section and moved this there :003:

Oh now that is very cool, they made a lot of little micro-libraries (micro as in one-file) that are very useful and simple.

3 Likes

Recompiling code on the fly so that the datastructure is “constant” is impossibly cool xD best cache ever

4 Likes

Using Rust to Scale Elixir for 11 Million Concurrent Users

Nowadays it seems like they use a faster implementation with NIFs, here’s the library: SortedSet

9 Likes

Thanks for the link, that is really handy. I implemented a custom MapSet with Erlang 21+ features which is 25% faster than the native MapSet, I expect this can be an even bigger improvement.

6 Likes

You should submit a PR to Elixir then!

3 Likes

Absolutely, I planned on submitting a PR after support for Erlang 20 was dropped. That will probably be quite a while though, so I’ll probably investigate conditional compilation instead.

3 Likes

The top link has moved to How Discord Scaled Elixir to 5,000,000 Concurrent Users, and the update is at Using Rust to Scale Elixir for 11 Million Concurrent Users . Too bad that the original permalinks don’t redirect!

8 Likes