[asterisk-users] call file concurrency
Steve Edwards
asterisk.org at sedwards.com
Fri Feb 27 17:42:46 CST 2009
On Fri, 27 Feb 2009, James Sneeringer wrote:
> If you can get the outgoing directory (or a reaonable parent) on its own
> mountable partition or volume, you could accomplish this with disk
> quotas. It won't control how many Asterisk processes at once (does it
> even handle them in parallel?), but it will control how many can
> possibly be queued up waiting to be processed.
I'm thinking bad things could happen if a call fails (causing the call
file to be "appended") when you are at the limit. Also, this implies that
the process creating the call files can handle the quota error. This also
creates a bit of a "land mine" for the next admin when he replaces the
failed disk with one without the quota.
I think it should be handled by munging the code in pbx_spool.c.
I took a casual peek at the (1.2) code this morning, so don't hold me to
my opinions :)
The call file directory is scanned every once in a while and for each
eligible call file, a detached thread is kicked off to handle it.
Limiting the number of concurrent threads (call files) would mean
incrementing a [locked] counter as each thread is created and decrementing
the [locked, non-zero] counter as each thread finishes.
Then, in the loop that scans the directory, if the counter is greater than
the desired limit, exit the loop.
I'm sure there are more details to be worked out, but I think this could
be done easily.
At the same time, it might be nice to add a feature to "throttle" the
thread creation so that if a bunch of call files are dumped into the
directory Asterisk doesn't "spike" trying to create "concurrent-limit"
threads at "once."
Thanks in advance,
------------------------------------------------------------------------
Steve Edwards sedwards at sedwards.com Voice: +1-760-468-3867 PST
Newline Fax: +1-760-731-3000
More information about the asterisk-users
mailing list