[erlang-questions] Configuring Messaging Back Pressure

Darach Ennis <>
Fri Nov 21 11:19:58 CET 2014

On 21 Nov 2014 04:53, "Andy Till" <> wrote:

> Short outline of how erts_use_sender_punish works, please comment if there
> are any errors in the description.
> erts_use_sender_punish is a flag hard coded to 1 (true), when it is true a
> process sending messages to another process will have its reduction count
> reduced by the number of messages in the receivers message queue multiplied
> by four.  Sending messages to processes with zero messages in the queue is
> free in terms of reductions, but sending messages to load queues is very
> expensive and will lead the scheduler to context switch to another process
> more often.
> In the case where the the relationship between of producers and consumers
> is one to one, this makes sense.  It provides back pressure when part of
> the system is loaded.
> In the case where there is one producer to many consumers, if one consumer
> gets a flood of messages and the producer is punished then the punishment
> is not only on the producer but on all other consumers because the producer
> cannot create enough work for them as it used all of its reductions.
> This makes performance unpredictable when work cannot be spread evenly.
> Could this be made to be configurable using a process flag?
> Cheers
> Andy
> Code:
> https://github.com/erlang/otp/blob/a70f0ce9b34e4db61dacb8db24f9ab
> 5671ed4c8a/erts/emulator/beam/erl_init.c#L694
> https://github.com/erlang/otp/blob/682a6082159568f40615f03d12d44e
> e70edd14c6/erts/emulator/beam/bif.c#L2058
> https://github.com/erlang/otp/blob/a8e12f7168c14cc765a63a51c838d0
> 65412795d7/erts/emulator/beam/erl_message.c#L504
> Previous mentions and issues with this feature:
> http://erlang.org/pipermail/erlang-questions/2011-July/060314.html
> http://erlang.org/pipermail/erlang-questions/2011-July/060042.html
> _______________________________________________
> erlang-questions mailing list
> http://erlang.org/mailman/listinfo/erlang-questions
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20141121/22f247bb/attachment.html>

More information about the erlang-questions mailing list