[erlang-questions] Not an Erlang fan

David King dking@REDACTED
Tue Sep 25 18:06:58 CEST 2007

> spawning cat is actually a very bad idea - It'll lead to all
> kinds of havoc since ports don't by themselves have any means
> to do flow control.
> Spawning cat will lead to a situation where a whole lot of messages
> will be sent to the owner of the port. When we do socket I/O this is
> the equivalent of having {active ,true} on a socket, we'll just get
> a lot of messages and if we cannot process the messages at the same
> speed or higher than we receive them our message inbox will fill up
> and we'll just be spending time in the garbage collector - bad.

Would it be enough to have one process that accepts all of these  
incoming Port messages, adding them to a queue, and then making them  
available to another process to request?

In theory that should be able to keep up with the rate of messages as  
long as it's receiving them more slowly or equal to the speed at  
which it can add them to the queue, and allows them to come in line- 
by-line (and be fetched line-by-line by the second process)

More information about the erlang-questions mailing list