<div dir="ltr">thanks everyone for your help. it is clearer now.<div><br></div><div>I decided to just count my processes to make sure that I do not start more than some maximum number.</div><div><br></div><div>I have one more question. Are monitors designed to be used efficiently with a lot of very short lived processes? Are monitors inexpensive to set up? Is this a normal erlang programming practice to use monitors for a lot of short lived processes? Alternatively, I believe I can use spawn_linked to start my processes, and send a message from each worker, when the worker finishes (since otherwise I would only get a message if a linked process crashes). How does this latter approach compare to using monitors?</div>
<div><br></div><div>thanks for help</div><div>konstantin</div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/11/15 akonsu <span dir="ltr"><<a href="mailto:akonsu@gmail.com" target="_blank">akonsu@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hello,<div><br></div><div>I am looking for an advice on how to architect my system. I am just a beginner...</div>
<div><br></div><div>I have a process that receives messages and this process needs to parse each message, extract some information from the parsed message, and then send this information to the subscribers.</div>
<div><br></div><div>As I read somewhere, in a situation like this, people usually spawn a worker process per message, and let this worker do the work, and then send the results to the publishers.</div><div><br></div><div>
I have an overwhelming amount of incoming messages (these are tweets that I get from a twitter stream), and I am not experienced enough to be able to tell whether this worker-per-task approach is the right way to do it. I am afraid that my application will be flooded with workers and eventually can collapse.</div>
<div><br></div><div>I was thinking that maybe I can use a worker process pool? A process pool seems unusual in an Erlang application, does it not? Although the "Learn yourself Erlang..." does have a chapter on building a pool like this.</div>
<div><br></div><div>Or maybe rate-limit the number of incoming messages?</div><div><br></div><div>I would really appreciate an advice or two.</div><div><br></div><div>Thank you</div><div>Konstantin</div><div><br></div></div>
</blockquote></div><br></div>