[erlang-patches] Add supervisor:start_child/3 to limit the number of children

Vance Shipley vances@REDACTED
Thu Apr 11 07:47:42 CEST 2013


On Wed, Apr 10, 2013 at 08:51:11AM -0400, Fred Hebert wrote:
}  Have you considered using ETS counters, and possibly a monitor process?
...
}  If you're in the kind of position where you need to limit the number of
}  transactions to avoid falling over, it will *not* reduce the number of
}  messages sent to the supervisor, and if you start going over the top,
}  you'll time out no matter what, just because the supervisor won't be
}  able to keep up with the demand.

Fred,

Your approach is quite valid however it addresses an issue I am not as
yet considering.  I am concerned not about overload protection but in
policy enforcement.  The supervisor should have no more than N workers.
The correct place to address that issue is in the supervisor.  True, I 
could address it otherwise but I propose a small change to support this
in the OTP implementation.

The alternative solution which my coworkers have historically used is
long lived pools of processes.  I believe that the Erlang way is to have
a process with a life cycle matching the transaction's.  It makes me much
happier to eliminate the pools.

-- 
	-Vance



More information about the erlang-patches mailing list