[erlang-questions] "been there done that"
Wed Mar 12 01:24:38 CET 2014
On 03/11/2014 04:00 PM, Raoul Duke wrote:
> there's an off hand comment about not going overboard, like spawning a
> new process for every request. i'd love to hear more about such
> pragmatism. please, people speak up with rules of thumb, and
> erlang-questions mailing list
There is no reason not to spawn a process per request. The reason to spawn a process per request, is it helps the garbage collector keep up with heap and binary garbage collection as you do message deserialization and/or serialization. That way, you can avoid the complexity of trying to tune the garbage collection parameters in erts, when you don't need to. If instead you decide to not use a process per request, and you get higher throughput than your previous testing, any previous garbage collection tuning can become invalid due to the rate increase. The Erlang process for the request, when using a process per request, is a short-lived process, to make sure there is a benefit (so this is something separate from using an Erlang process per connection, since an Erlang connection process could have a longer lifetime).
More information about the erlang-questions