3 ms·
Curious, how is the back pressure actually implemented? ACK message or ETS public table?
by lpgauth 10y ago
Curious, how is the back pressure actually implemented? ACK message or ETS public table?
- strmpnk 10y agoIt's demand based. The consumer will request a fixed size of input and then the producer will send up to but no more than that until more demand is made.
- josevalim 10y agoIn addition to that, demand is asynchronous: the consumer can request for more events, at any amount, any time it wants to. The default implementation requests more when half of the current demand is processed. So if you set :max_demand to 100, when the consumer has processed 50 events, we request 50 more.
- lpgauth 10y agoSure it's demand based, but how is it implemented? How is the demand communicated between the processes?
- querulous 10y agoi believe it's similar to window updates in http2. consumers send an async message to producers with a count of messages they are willing to accept and it's up to producers to not exceed the count
- josevalim 10y agoI am on my phone (sorry) but the documentation for the GenStage module has a section on the message protocol between consumers and producers. GenStage is simply one implementation of this message protocol.