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

25 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.

2 Likes

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

3 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.

5 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