[erlang-questions] how to break the problem. the erlang way?
Fri Jul 31 16:57:42 CEST 2009
A normal Erlang application can have thousands of processes, so 5 does
not seem to be too many.
If you write 5 processes, and time them, you can then start to move
functionality (say 3, 4, 5) to a single process and measure if that
makes things go faster.
On Fri, 2009-07-31 at 17:47 +0300, Ovidiu Deac wrote:
> I'm doing some evaluation of erlang so I came with the following problem:
> "The application has to subscribe to a multicast address and receive
> binary packets. One packet per datagram. Each packet has a lenght, a
> sequence number and a number of messages inside. Packets have to be
> processed in their sequence number order. The messages have to be
> extracted from the packets and written in a file."
> I come with C++/Python experience and in OO approach I would have the
> following components:
> 1. A Receiver who connects to the multicast and receives the packets
> 2. An Orderer who's responsability is to order the packets by their
> sequence number and detect the missing ones.
> 3. An Unpacker who's responsability is to unpack the incomming packets
> and extract the messages.
> 4. A Decoder who does the deserialization of the messages
> 5. A Writer who puts the messages in the file.
> Now if I move all this to Erlang I would map the objects to processes.
> Instead of having objects with methods being called I have processes
> which receive messages. So the 5 components would run as separate
> processes. Each one does a little job and passes the result to the
> next one.
> Is this the Erlang way? Or is it just too much message passing overhead?
> erlang-questions mailing list. See http://www.erlang.org/faq.html
> erlang-questions (at) erlang.org
More information about the erlang-questions