Logging to one process from thousands: How does it work?

chandru <>
Thu Jan 5 17:11:05 CET 2006


On 03/01/06, Ulf Wiger <> wrote:
> Den 2006-01-03 22:03:43 skrev Joel Reymont <>:
>
> > How do you implement a bounded queue in Erlang without busy-waiting?
>
> Difficult, but you can achieve back-pressure by
> making the communication with the logger synchronous.

We've had the same problem of multiple processes sending log messages
to one process. As other people have written, you can do caching
before writing, use synchronous calls etc. But none of these will
guarantee any protection. You can still overwhelm a process employing
all these techniques.

What will be nice though is support for bounded queues where a process
can specify the maximum size for it's message queue. New messages
which arrive once this max size id reached can then be thrown away by
the runtime system. At the moment, the result of sending a message to
a process is the message itself(*) - in the case of the recipient
having a bounded queue, maybe the result can be an error (**) ?

Chandru

(*) Unless you are sending a message using the process name in which
case the caller will exit with badarg.

(**) I don't think anyone uses the return value of the ! operator so
old code should be ok?



More information about the erlang-questions mailing list