jxm

jxm

Generally strive to remove all backpressure

The topic’s name is a quote from a slide in WhatsApp’s Anton Lavrik’s talk at Code BEAM 2018.

He basically describes WhatsApp approach to handling distribution in their Erlang cluster and casually mentions that the BEAM is not really made to handle overload, which is a problem. He goes on to list a few things to consider to manage that, including prominently :

Generally strive to remove all backpressure

Well, that got me scratching my head a bit. Voluntary backpressure is a powerful mechanism to manage message queues length and regulate throughtput. Projects like gen_stage and flow leverage that.

Sure, it has a cost associated to it. In Designing for scalability with Erlang/OTP, @FrancescoC and @rvirding (well, at least one of you two :slight_smile: ) state

Start controlling load only if you have to.

So, unless Anton Lavrik meant a different kind of involuntary backpressure (silent message drops on process failure/restart, something like that?), and not backpressure as a load control tool, it means (I’m assuming the WhatsApp engineers do know full well what they’re doing) that the regulation costs more than it helps. The major cost that seems to be presented in the rest of the talk is that backpressure due to a hotspot or failure in the cluster in effect propagates failure to the rest of the cluster.

It feels counter-intuitive, as my mental model shows increased benefits with scale, unless you’re in the kind of system where to apply backpressure you need to serialize requests into dispatcher processes acting as a bottleneck in front of your workers. But given the efforts the WhatsApp team made to partition their data to reduce locking and optimize replication/recovery granularity, I doubt this is the case.

Then it got me thinking in terms not of two cost/benefit ratio curves that might intersect several times but a bit more like the modern approach to buffering in network communications. The industry used to solve real-time stream ordering issues and several other network warts by using increasingly large buffers in L2 and L3 network equipment until the buffer bloat problem became a thing. Both buffered and wire-speed approaches work well, but in different domains. The fix that buffering gives you is very comfortable in terms of capacity management and micro-bursts handling (typical of stuff like iSCSI storage) but is untenable when you do a lot of VoIP for example, because of an accordion effect in time distribution of delivery caused by injected jitter and much higher 10th percentile latencies.

Is it the same kind of tradeoff at play here? Is the important consideration inbound traffic characteristics like bursty-ness and jitter?

For the particular case of Erlang process message queues, how would one start from Little’s Law and cook a model to estimate the impact of both approaches?

What do you guys think?

Most Liked

blatyo

blatyo

Conduit Core Team

Any place where you have back pressure, you have created a bottleneck. Not every kind of system needs to care about bottle necks in the same way. If you’re building a real time messaging platform, you don’t want anything to build up behind a bottleneck. If you’re building a streaming ETL system, which GenStage is good at, you may just care that you don’t drop events and it doesn’t matter a ton that everything is calculated immediately.

Where Next?

Popular in Discussions Top

sashaafm
I’m trying to evaluate the best combo/stack for a BEAM Web app. Right now I’m exploring Yaws a bit, after having dealt with Phoenix for a...
New
pillaiindu
In django there is a cache framework backed by memcached. Rails also puts a lot of emphasis on caching, and even the idea of russian-doll...
New
AngeloChecked
What learn first? Rust or Elixir Hi Elixir community! I’m here because i want learn a new language. I’m a junior developer and mainly i ...
New
marciol
Please, let me know if this kind of discussion already took place in another topic . Hi all, how do you consider if is better to build ...
New
sergio
There’s a new TIOBE index report that came out that shows Elixir is still not in the top 50 used languages. It also goes on to call Elix...
New
restack_oslo
Hello, Please pardon me for any faux paux. I am 46 and this is my first time on a forum of any kind. I wanted to to get answers from tho...
New
ben-pr-p
In general I’ve been sticking to this community style guide GitHub - christopheradams/elixir_style_guide: A community driven style guide ...
New
tomekowal
Hey guys! I want to create a toy project that shows a chart of temperature over time and updates every 5 seconds. I feel LiveView is per...
New
AstonJ
Can you believe the first professionally published Elixir book was published just 8 years ago? Since then I think we’ve seen more books f...
New
opsb
We’re considering our architecture from a viewpoint of scaling our traffic heavily over the next 6 months. Our current deployment is runn...
New

Other popular topics Top

AstonJ
Posting this to see if we can make things easier for people to get into Neovim. If you use Neovim and have a favourite distro please let ...
New
gshaw
What is the idiomatic way of matching for not nil in Elixir? E.g., First way: defp halt_if_not_signed_in(conn, signed_in_account) when...
New
ovidiubadita
Hey all, I discovered Elixir and I love it. I always wanted to learn a functional programming and I intended to go for Haskell, but afte...
New
JakeBecker
TL;DR: I’ve just released an implementation of Microsoft’s IDE-independent Language Server Protocol for Elixir. It adds language support ...
1144 53690 245
New
chrismccord
This release brings a number of exciting features, including integration with the new Phoenix LiveDashboard and Phoenix LiveView. There h...
New
jay1
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New
joeerl
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New
pmjoe
I have a relationship of love and hate with Elixir. Lots of things are just absolutely right, but there are some things that are kind of ...
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
jononomo
For some reason my phoenix channels are working for me in my local dev environment, but as soon as I deploy via Docker, I get a 403 error...
New

We're in Beta

About us Mission Statement