Re: [asterisk-users] call file concurrency

2009-02-27 Thread Christian Victor
2009/2/27 Bill Michaelson b...@cosi.com

 Is there a convenient way to limit the number of call files (outgoing
 directory) that are processed concurrently?


Afaik only by limiting the number of call files in the directory.
___
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Re: [asterisk-users] call file concurrency

2009-02-27 Thread Danny Nicholas
Some variant of the ulimit command would accomplish this but YMMV and
Caveat Emptor.


-Original Message-
From: asterisk-users-boun...@lists.digium.com
[mailto:asterisk-users-boun...@lists.digium.com] On Behalf Of Bill
Michaelson
Sent: Thursday, February 26, 2009 7:59 PM
To: asterisk-users@lists.digium.com
Subject: [asterisk-users] call file concurrency

Is there a convenient way to limit the number of call files (outgoing 
directory) that are processed concurrently?


___
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] call file concurrency

2009-02-27 Thread Steve Edwards
 Is there a convenient way to limit the number of call files (outgoing
 directory) that are processed concurrently?

On Fri, 27 Feb 2009, Danny Nicholas top posted:

 Some variant of the ulimit command would accomplish this but YMMV and
 Caveat Emptor.

Which one?

-fs::sedwards:~$ ulimit -a
core file size  (blocks, -c) 0
data seg size   (kbytes, -d) unlimited
file size   (blocks, -f) unlimited
pending signals (-i) 1024
max locked memory   (kbytes, -l) 32
max memory size (kbytes, -m) unlimited
open files  (-n) 1024
pipe size(512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
stack size  (kbytes, -s) 10240
cpu time   (seconds, -t) unlimited
max user processes  (-u) 16114
virtual memory  (kbytes, -v) unlimited
file locks  (-x) unlimited

Limiting the number of open files or file locks would not have the 
intended effect.

Thanks in advance,

Steve Edwards  sedwa...@sedwards.com  Voice: +1-760-468-3867 PST
Newline Fax: +1-760-731-3000

___
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] call file concurrency

2009-02-27 Thread Danny Nicholas
Here is a link to a better, but possibly dangerous answer.

http://www.netadmintools.com/art295.html

Since a typical linux box probably allows about 250K files to be
simultaneously open, and you need about 2K for system and * overhead, by
cutting the max number of files down to about 3K, you would limit the number
of calls to about 1K, assuming that each open call is one file handle.

-Original Message-
From: asterisk-users-boun...@lists.digium.com
[mailto:asterisk-users-boun...@lists.digium.com] On Behalf Of Steve Edwards
Sent: Friday, February 27, 2009 11:39 AM
To: Asterisk Users Mailing List - Non-Commercial Discussion
Subject: Re: [asterisk-users] call file concurrency

 Is there a convenient way to limit the number of call files (outgoing
 directory) that are processed concurrently?

On Fri, 27 Feb 2009, Danny Nicholas top posted:

 Some variant of the ulimit command would accomplish this but YMMV and
 Caveat Emptor.

Which one?

-fs::sedwards:~$ ulimit -a
core file size  (blocks, -c) 0
data seg size   (kbytes, -d) unlimited
file size   (blocks, -f) unlimited
pending signals (-i) 1024
max locked memory   (kbytes, -l) 32
max memory size (kbytes, -m) unlimited
open files  (-n) 1024
pipe size(512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
stack size  (kbytes, -s) 10240
cpu time   (seconds, -t) unlimited
max user processes  (-u) 16114
virtual memory  (kbytes, -v) unlimited
file locks  (-x) unlimited

Limiting the number of open files or file locks would not have the 
intended effect.

Thanks in advance,

Steve Edwards  sedwa...@sedwards.com  Voice: +1-760-468-3867 PST
Newline Fax: +1-760-731-3000

___
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


___
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] call file concurrency

2009-02-27 Thread Eric Wieling, Asteria Solutions Group
Set the ctime of the spool file in the future and Asterisk will not 
process the file until that time.

Danny Nicholas wrote:
 Here is a link to a better, but possibly dangerous answer.
 
 http://www.netadmintools.com/art295.html
 
 Since a typical linux box probably allows about 250K files to be
 simultaneously open, and you need about 2K for system and * overhead, by
 cutting the max number of files down to about 3K, you would limit the number
 of calls to about 1K, assuming that each open call is one file handle.
 
 -Original Message-
 From: asterisk-users-boun...@lists.digium.com
 [mailto:asterisk-users-boun...@lists.digium.com] On Behalf Of Steve Edwards
 Sent: Friday, February 27, 2009 11:39 AM
 To: Asterisk Users Mailing List - Non-Commercial Discussion
 Subject: Re: [asterisk-users] call file concurrency
 
 Is there a convenient way to limit the number of call files (outgoing
 directory) that are processed concurrently?
 
 On Fri, 27 Feb 2009, Danny Nicholas top posted:
 


-- 
Eric Wieling * Asteria Solutions Group * Huntsville, AL
Call centers * IVRs * Enterprise PBXs * Conferencing applications
256-705-0277 * http://www.asteriasgi.com/ * sa...@asteriasgi.com

___
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] call file concurrency

2009-02-27 Thread Steve Edwards
 -Original Message-
 From: asterisk-users-boun...@lists.digium.com
 [mailto:asterisk-users-boun...@lists.digium.com] On Behalf Of Steve Edwards
 Sent: Friday, February 27, 2009 11:39 AM
 To: Asterisk Users Mailing List - Non-Commercial Discussion
 Subject: Re: [asterisk-users] call file concurrency

 Is there a convenient way to limit the number of call files (outgoing
 directory) that are processed concurrently?

 On Fri, 27 Feb 2009, Danny Nicholas top posted:

 Some variant of the ulimit command would accomplish this but YMMV and
 Caveat Emptor.

On Fri, 27 Feb 2009, Steve Edwards wrote:

 Which one?

   -fs::sedwards:~$ ulimit -a
   core file size  (blocks, -c) 0
   data seg size   (kbytes, -d) unlimited
   file size   (blocks, -f) unlimited
   pending signals (-i) 1024
   max locked memory   (kbytes, -l) 32
   max memory size (kbytes, -m) unlimited
   open files  (-n) 1024
   pipe size(512 bytes, -p) 8
   POSIX message queues (bytes, -q) 819200
   stack size  (kbytes, -s) 10240
   cpu time   (seconds, -t) unlimited
   max user processes  (-u) 16114
   virtual memory  (kbytes, -v) unlimited
   file locks  (-x) unlimited

 Limiting the number of open files or file locks would not have the
 intended effect.

On Fri, 27 Feb 2009, Danny Nicholas top posted:

 Here is a link to a better, but possibly dangerous answer.

 http://www.netadmintools.com/art295.html

 Since a typical linux box probably allows about 250K files to be 
 simultaneously open, and you need about 2K for system and * overhead, by 
 cutting the max number of files down to about 3K, you would limit the 
 number of calls to about 1K, assuming that each open call is one file 
 handle.

I think proposing to control the number of concurrently processed call 
files by inducing file descriptor exhaustion is about 32 days premature.

Calls would fail at random and you may or may not be able to log in or 
even execute a command line depending on if you were currently exhausted 
at any particular instant.

I think the OP is looking for some knob to turn in pbx_spool.c

Thanks in advance,

Steve Edwards  sedwa...@sedwards.com  Voice: +1-760-468-3867 PST
Newline Fax: +1-760-731-3000

___
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] call file concurrency

2009-02-27 Thread Steve Edwards
 -Original Message-
 From: asterisk-users-boun...@lists.digium.com
 [mailto:asterisk-users-boun...@lists.digium.com] On Behalf Of Steve Edwards
 Sent: Friday, February 27, 2009 11:39 AM
 To: Asterisk Users Mailing List - Non-Commercial Discussion
 Subject: Re: [asterisk-users] call file concurrency

 Is there a convenient way to limit the number of call files (outgoing
 directory) that are processed concurrently?

On Fri, 27 Feb 2009, Eric Wieling, Asteria Solutions Group top posted:

 Set the ctime of the spool file in the future and Asterisk will not 
 process the file until that time.

This only controls when, not how many.

Thanks in advance,

Steve Edwards  sedwa...@sedwards.com  Voice: +1-760-468-3867 PST
Newline Fax: +1-760-731-3000

___
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] call file concurrency

2009-02-27 Thread Danny Nicholas
Agreed, but the OP seemed to be looking for a command-line solution, not a
C one.

-Original Message-
From: asterisk-users-boun...@lists.digium.com
[mailto:asterisk-users-boun...@lists.digium.com] On Behalf Of Steve Edwards
Sent: Friday, February 27, 2009 2:20 PM
To: Asterisk Users Mailing List - Non-Commercial Discussion
Subject: Re: [asterisk-users] call file concurrency

 -Original Message-
 From: asterisk-users-boun...@lists.digium.com
 [mailto:asterisk-users-boun...@lists.digium.com] On Behalf Of Steve
Edwards
 Sent: Friday, February 27, 2009 11:39 AM
 To: Asterisk Users Mailing List - Non-Commercial Discussion
 Subject: Re: [asterisk-users] call file concurrency

 Is there a convenient way to limit the number of call files (outgoing
 directory) that are processed concurrently?

 On Fri, 27 Feb 2009, Danny Nicholas top posted:

 Some variant of the ulimit command would accomplish this but YMMV and
 Caveat Emptor.

On Fri, 27 Feb 2009, Steve Edwards wrote:

 Which one?

   -fs::sedwards:~$ ulimit -a
   core file size  (blocks, -c) 0
   data seg size   (kbytes, -d) unlimited
   file size   (blocks, -f) unlimited
   pending signals (-i) 1024
   max locked memory   (kbytes, -l) 32
   max memory size (kbytes, -m) unlimited
   open files  (-n) 1024
   pipe size(512 bytes, -p) 8
   POSIX message queues (bytes, -q) 819200
   stack size  (kbytes, -s) 10240
   cpu time   (seconds, -t) unlimited
   max user processes  (-u) 16114
   virtual memory  (kbytes, -v) unlimited
   file locks  (-x) unlimited

 Limiting the number of open files or file locks would not have the
 intended effect.

On Fri, 27 Feb 2009, Danny Nicholas top posted:

 Here is a link to a better, but possibly dangerous answer.

 http://www.netadmintools.com/art295.html

 Since a typical linux box probably allows about 250K files to be 
 simultaneously open, and you need about 2K for system and * overhead, by 
 cutting the max number of files down to about 3K, you would limit the 
 number of calls to about 1K, assuming that each open call is one file 
 handle.

I think proposing to control the number of concurrently processed call 
files by inducing file descriptor exhaustion is about 32 days premature.

Calls would fail at random and you may or may not be able to log in or 
even execute a command line depending on if you were currently exhausted 
at any particular instant.

I think the OP is looking for some knob to turn in pbx_spool.c

Thanks in advance,

Steve Edwards  sedwa...@sedwards.com  Voice: +1-760-468-3867 PST
Newline Fax: +1-760-731-3000

___
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


___
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] call file concurrency

2009-02-27 Thread Steve Edwards
 Sent: Friday, February 27, 2009 11:39 AM
 To: Asterisk Users Mailing List - Non-Commercial Discussion
 Subject: Re: [asterisk-users] call file concurrency

 Is there a convenient way to limit the number of call files (outgoing
 directory) that are processed concurrently?

 On Fri, 27 Feb 2009, Danny Nicholas top posted:

 Some variant of the ulimit command would accomplish this but YMMV and
 Caveat Emptor.

 On Fri, 27 Feb 2009, Steve Edwards wrote:

 I think proposing to control the number of concurrently processed call
 files by inducing file descriptor exhaustion is about 32 days premature.

 Calls would fail at random and you may or may not be able to log in or
 even execute a command line depending on if you were currently exhausted
 at any particular instant.

 I think the OP is looking for some knob to turn in pbx_spool.c

On Fri, 27 Feb 2009, Danny Nicholas top posted:

 Agreed, but the OP seemed to be looking for a command-line solution, 
 not a C one.

The OP didn't specify what kind of solution they were looking for.

I wouldn't have considered introducing instability as a solution.

It seems a reasonable request. Maybe the OP would like to request a 
feature or offer a bounty?

Thanks in advance,

Steve Edwards  sedwa...@sedwards.com  Voice: +1-760-468-3867 PST
Newline Fax: +1-760-731-3000

___
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] call file concurrency

2009-02-27 Thread James Sneeringer
On Fri, Feb 27, 2009 at 4:14 AM, Christian Victor
christ...@victormedia.de wrote:
 2009/2/27 Bill Michaelson b...@cosi.com
 Is there a convenient way to limit the number of call files (outgoing
 directory) that are processed concurrently?

 Afaik only by limiting the number of call files in the directory.

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.

-James

___
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] call file concurrency

2009-02-27 Thread Steve Edwards
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  sedwa...@sedwards.com  Voice: +1-760-468-3867 PST
Newline Fax: +1-760-731-3000

___
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] call file concurrency

2009-02-27 Thread Mik Cheez
Steve Edwards wrote:
 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  sedwa...@sedwards.com  Voice: +1-760-468-3867 PST
 Newline Fax: +1-760-731-3000
 
 ___
 -- Bandwidth and Colocation Provided by http://www.api-digital.com --
 
 asterisk-users mailing list
 To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users
 
 

Just my 2c, but what I've done in the past is modify the sleep function 
in asterisk from one based on seconds to one based on either 
milliseconds or nanoseconds (don't remember which).  Then I have a 
background daemon which looks to see how many files are in the 
directory, and if it's under threshold it pushes a new file from a queue 
into the directory.

Then, as they say above, you set the ulimit to something like 'ulimit -n 
10' or whatever it is you want.

Of course, the purpose for sending out a bazillion calls is another 
question . . . play nice.



___
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] call file concurrency

2009-02-27 Thread Lenz Emilitri
IIRC, some early dialler of the pre-AMI era used this technique to control
the number of calls placed simoultaneously - they just counted the number of
call files in the spool dir. As they are deleted when the call is over, this
was a simple way to do the throttling.

You could use a similar technique; have call files written to a staging
directory and then use a simple process to transfer them to the actual spool
dir so that there are never more than N in the spool dir.

Thanks

l.


2009/2/27 Bill Michaelson b...@cosi.com

 Is there a convenient way to limit the number of call files (outgoing
 directory) that are processed concurrently?

 ___
 -- Bandwidth and Colocation Provided by http://www.api-digital.com --

 asterisk-users mailing list
 To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users




-- 
Loway - home of QueueMetrics - http://queuemetrics.com
___
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

[asterisk-users] call file concurrency

2009-02-26 Thread Bill Michaelson
Is there a convenient way to limit the number of call files (outgoing 
directory) that are processed concurrently?


smime.p7s
Description: S/MIME Cryptographic Signature
___
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users