News for hackers. Stuff that matters.
Re:How Discord Scaled Elixir to 5M Concurrent Users (2017) by denart2203 on Sunday February 24, 2019 @07:37AM (#19238345)
Really neat post. Did y’all consider GenStage or another demand based approach for your overflow problem? I’d be interested in hearing about the tradeoffs between demand vs semaphore, it seems like the two have some similarities.
Re:How Discord Scaled Elixir to 5M Concurrent Users (2017) by cuddlecake on Sunday February 24, 2019 @10:39AM (#19238952)
I think the main difference is that "demand" in GenStage tells the producer how much work the producer should do to satisfy the consumer. The consumer sets the demand, the producer does not limit it.

With how discord uses semaphores, the Consumer will not even make a demand for more events from the producer.

Other than that, I think in the case of Discord, it's more of an RPC thing, and GenStage is rather made for concurrent streaming and processing of data.