Re: [asterisk-users] Asterisk AGI issues (at high load)

2009-06-04 Thread Danny Nicholas
You are keeping in mind that each call is actually two calls (SIP - CM --
CM - Asterisk/T1)?

 

  _  

From: asterisk-users-boun...@lists.digium.com
[mailto:asterisk-users-boun...@lists.digium.com] On Behalf Of Deepak
Sent: Thursday, June 04, 2009 11:15 AM
To: Asterisk Users Mailing List - Non-Commercial Discussion
Subject: [asterisk-users] Asterisk AGI issues (at high load)

 

Hi, we are experiencing a strange issue and I am hoping someone can point me
to the right direction or help out with some pointers.

 

We have asterisk 1.6.0.6 with a sangome a104DE card. We have basically 4
T1's for a total of DAHDI 96 channels. 

 

We have an agi application (php) that acts as a kind of a calling card
application.

 

All users are SIP users that make calls and asterisk then bridges the calls
over T1 to the PSTN (after running agi script). Codec between SIP clients
and Asterisk is G729 (96 G729 licenses installed on Asterisk).


System has 12 GB of RAM. 

 

 

What we are seeing is the following:

 

1) All is fine till about 70 calls (70 active calls as displayed by core
show channels). But as soon as traffic increases, we see the the a lot of
AGI Processes are running and the number of active calls keeps on GROWING to
120, 130, ... . THis makes no sense since we can have a maximum of 96 active
calls (4 T1). People calling start experiencing delays (10-15 seconds before
calls are answered or connected, etc.). Upon doing a ps -ef we see a lot
of AGI processes running that seem to keep growing

 

2) At that state, if we Decrease traffic, the number of active calls
starts going down and the system becomes normal again.

 

3) What we are seeing are NOT Zombie processes though. It is as-if AGI
processes are not exiting when traffic increases. But as soon as traffic
decreases things become normal.

 

4) We did follow standard suggestions for AGI scripts (exit, Softhangup,
etc)

 

5) We checked and the CPU utilization seems to be 25% idle at high loads..
so it does not seem like a CPU issue. We have a dual core 3.0GHz intel
processor and based upon benchmarking info, we should be easily able to
handle 96 calls (with transcoding). 

 

6) We see that each AGI process takes up 149 MB of Virtual Memory when it is
forked for each call. 

 

7) Asterisk is taking up 500 MB Of VM.

 

 

*Any* suggestions/help will be appreciated and I'd be happy to even pay if
someone is ready to help us resolve this issue we are having. 

 

Thanks

 

 

 

 

 

 

___
-- 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] Asterisk AGI issues (at high load)

2009-06-04 Thread David Backeberg
On Thu, Jun 4, 2009 at 12:15 PM, Deepak dlal...@gmail.com wrote:
 Hi, we are experiencing a strange issue and I am hoping someone can point me
 to the right direction or help out with some pointers.

 We have asterisk 1.6.0.6 with a sangome a104DE card. We have basically 4
 T1's for a total of DAHDI 96 channels.

 We have an agi application (php) that acts as a kind of a calling card
 application.

 All users are SIP users that make calls and asterisk then bridges the calls
 over T1 to the PSTN (after running agi script). Codec between SIP clients
 and Asterisk is G729 (96 G729 licenses installed on Asterisk).
 System has 12 GB of RAM.


 What we are seeing is the following:

 1) All is fine till about 70 calls (70 active calls as displayed by core
 show channels). But as soon as traffic increases, we see the the a lot of
 AGI Processes are running and the number of active calls keeps on GROWING to
 120, 130, ... . THis makes no sense since we can have a maximum of 96 active
 calls (4 T1). People calling start experiencing delays (10-15 seconds before
 calls are answered or connected, etc.). Upon doing a ps -ef we see a lot
 of AGI processes running that seem to keep growing

There could be a number of external constraints that are causing this.
One that comes to mind to is something waiting for a database
connection, then all the other processes that are waiting for the
database pile up and can't exit until they get their turn.

Do you have a max number of connections on your database? How does the
AGI know what to do based on the 'calling card information'? I'm
guessing you store all that in a database, then deduct what the caller
uses, etc.

You may also enjoy http://us3.php.net/set_time_limit

___
-- 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] Asterisk AGI issues (at high load)

2009-06-04 Thread Jeff LaCoursiere

On Thu, 4 Jun 2009, Deepak wrote:

 Hi, we are experiencing a strange issue and I am hoping someone can point me
 to the right direction or help out with some pointers.

 We have asterisk 1.6.0.6 with a sangome a104DE card. We have basically 4
 T1's for a total of DAHDI 96 channels.

 We have an agi application (php) that acts as a kind of a calling card
 application.

 All users are SIP users that make calls and asterisk then bridges the calls
 over T1 to the PSTN (after running agi script). Codec between SIP clients
 and Asterisk is G729 (96 G729 licenses installed on Asterisk).

 System has 12 GB of RAM.


 What we are seeing is the following:

 1) All is fine till about 70 calls (70 active calls as displayed by core
 show channels). But as soon as traffic increases, we see the the a lot of
 AGI Processes are running and the *number of active calls *keeps on GROWING
 to 120, 130, ... . THis makes no sense since we can have a maximum of 96
 active calls (4 T1). People calling start experiencing delays (10-15 seconds
 before calls are answered or connected, etc.). Upon doing a ps -ef we see
 a lot of AGI processes running that seem to keep growing

 2) At that state, if we Decrease traffic, the *number of active
 calls*starts going down and the system becomes normal again.

 3) What we are seeing are NOT Zombie processes though. It is as-if AGI
 processes are not exiting when traffic increases. But as soon as traffic
 decreases things become normal.

 4) We did follow standard suggestions for AGI scripts (exit, Softhangup,
 etc)

 5) We checked and the CPU utilization seems to be 25% idle at high loads..
 so it does not seem like a CPU issue. We have a dual core 3.0GHz intel
 processor and based upon benchmarking info, we should be easily able to
 handle 96 calls (with transcoding).

 6) We see that each AGI process takes up 149 MB of Virtual Memory when it is
 forked for each call.

 7) Asterisk is taking up 500 MB Of VM.


 *Any* suggestions/help will be appreciated and I'd be happy to even pay if
 someone is ready to help us resolve this issue we are having.


If each of 96 processes takes up 150MB you would need 15GB of RAM!  This 
is only because you are trying to do this with PHP, which is crazy. 
Rewrite your AGI in C.  My guess is you are dealing with large swap 
issues, which is degenerating into thrashing your disk.

I also run a calling card operation... my AGI is in C :)

j

___
-- 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] Asterisk AGI issues (at high load)

2009-06-04 Thread Steve Edwards
On Thu, 4 Jun 2009, Deepak wrote:

 Hi, we are experiencing a strange issue and I am hoping someone can 
 point me to the right direction or help out with some pointers.

 We have asterisk 1.6.0.6 with a sangome a104DE card. We have basically 4 
 T1's for a total of DAHDI 96 channels.

 We have an agi application (php) that acts as a kind of a calling card 
 application.

 All users are SIP users that make calls and asterisk then bridges the 
 calls over T1 to the PSTN (after running agi script). Codec between SIP 
 clients and Asterisk is G729 (96 G729 licenses installed on Asterisk).

 System has 12 GB of RAM.

 What we are seeing is the following:

 1) All is fine till about 70 calls (70 active calls as displayed by core 
 show channels). But as soon as traffic increases, we see the the a lot 
 of AGI Processes are running and the *number of active calls *keeps on 
 GROWING to 120, 130, ... . THis makes no sense since we can have a 
 maximum of 96 active calls (4 T1). People calling start experiencing 
 delays (10-15 seconds before calls are answered or connected, etc.). 
 Upon doing a ps -ef we see a lot of AGI processes running that seem to 
 keep growing

 2) At that state, if we Decrease traffic, the *number of active 
 calls*starts going down and the system becomes normal again.

 3) What we are seeing are NOT Zombie processes though. It is as-if AGI 
 processes are not exiting when traffic increases. But as soon as traffic 
 decreases things become normal.

 4) We did follow standard suggestions for AGI scripts (exit, Softhangup, 
 etc)

 5) We checked and the CPU utilization seems to be 25% idle at high 
 loads.. so it does not seem like a CPU issue. We have a dual core 3.0GHz 
 intel processor and based upon benchmarking info, we should be easily 
 able to handle 96 calls (with transcoding).

 6) We see that each AGI process takes up 149 MB of Virtual Memory when 
 it is forked for each call.

 7) Asterisk is taking up 500 MB Of VM.

 *Any* suggestions/help will be appreciated and I'd be happy to even pay 
 if someone is ready to help us resolve this issue we are having.

 Thanks

I'm just a 1.2 Luddite, but here's my two cents:

A couple of observations...

1) PHP would not get my vote for a high load environment. You can 
execute xxx AGI's in C before a single PHP script loads the interpreter 
and parses. Once you get over the startup overhead, the difference will 
not be so significant.

2) 12GB strikes me as just a ton of RAM. I have a chat system that 
processes several times that number of simultaneous callers, running 
dozens of AGIs (in C) per call. The Asterisk process (according to top) 
consumes less than 200mb. The AGI's (when I can catch one on top -- they 
execute so quickly) take less than 10mb. The host only has 2GB and doesn't 
swap.

3) 500 MB for Asterisk seems huge.

4) 149 MB for an AGI seems huge. Are you reading a bunch of stuff from the 
database?

5) Are you processing the HUP signal correctly in your AGI?

I'm guessing you have database issues.

I think your AGI is reading too much data from the database (149MB).

I think your database design is not handling locking well and could 
benefit from a bit of re-design, indexing, pruning, etc.

What can you tell us about the database?

What database is it? (MySQL?)

Is it on the same host?

What statistics have you collected from the database?

How many rows are in your tables?

What does your AGI do?

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] Asterisk AGI issues (at high load)

2009-06-04 Thread Deepak
Thanks. You are right in assumng that we query the database.  I was not
aware that there is  a limit to the number of DB connections to mysql. We
open/close db connections as needed. I will check if there is such a limit
and if yes, post the result.
Would you happen to know where to configure such a limit or what the default
is?

Thanks

On Thu, Jun 4, 2009 at 12:31 PM, David Backeberg dbackeb...@gmail.comwrote:

 On Thu, Jun 4, 2009 at 12:15 PM, Deepak dlal...@gmail.com wrote:
  Hi, we are experiencing a strange issue and I am hoping someone can point
 me
  to the right direction or help out with some pointers.
 
  We have asterisk 1.6.0.6 with a sangome a104DE card. We have basically 4
  T1's for a total of DAHDI 96 channels.
 
  We have an agi application (php) that acts as a kind of a calling card
  application.
 
  All users are SIP users that make calls and asterisk then bridges the
 calls
  over T1 to the PSTN (after running agi script). Codec between SIP clients
  and Asterisk is G729 (96 G729 licenses installed on Asterisk).
  System has 12 GB of RAM.
 
 
  What we are seeing is the following:
 
  1) All is fine till about 70 calls (70 active calls as displayed by core
  show channels). But as soon as traffic increases, we see the the a lot of
  AGI Processes are running and the number of active calls keeps on GROWING
 to
  120, 130, ... . THis makes no sense since we can have a maximum of 96
 active
  calls (4 T1). People calling start experiencing delays (10-15 seconds
 before
  calls are answered or connected, etc.). Upon doing a ps -ef we see a
 lot
  of AGI processes running that seem to keep growing

 There could be a number of external constraints that are causing this.
 One that comes to mind to is something waiting for a database
 connection, then all the other processes that are waiting for the
 database pile up and can't exit until they get their turn.

 Do you have a max number of connections on your database? How does the
 AGI know what to do based on the 'calling card information'? I'm
 guessing you store all that in a database, then deduct what the caller
 uses, etc.

 You may also enjoy http://us3.php.net/set_time_limit

 ___
 -- 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] Asterisk AGI issues (at high load)

2009-06-04 Thread Deepak
BTW,we are using an ODBC connection to Microsoft SQL Server.
We are not using MySQL.

Would that be a possible cause?

Thanks



On Thu, Jun 4, 2009 at 12:31 PM, David Backeberg dbackeb...@gmail.comwrote:

 On Thu, Jun 4, 2009 at 12:15 PM, Deepak dlal...@gmail.com wrote:
  Hi, we are experiencing a strange issue and I am hoping someone can point
 me
  to the right direction or help out with some pointers.
 
  We have asterisk 1.6.0.6 with a sangome a104DE card. We have basically 4
  T1's for a total of DAHDI 96 channels.
 
  We have an agi application (php) that acts as a kind of a calling card
  application.
 
  All users are SIP users that make calls and asterisk then bridges the
 calls
  over T1 to the PSTN (after running agi script). Codec between SIP clients
  and Asterisk is G729 (96 G729 licenses installed on Asterisk).
  System has 12 GB of RAM.
 
 
  What we are seeing is the following:
 
  1) All is fine till about 70 calls (70 active calls as displayed by core
  show channels). But as soon as traffic increases, we see the the a lot of
  AGI Processes are running and the number of active calls keeps on GROWING
 to
  120, 130, ... . THis makes no sense since we can have a maximum of 96
 active
  calls (4 T1). People calling start experiencing delays (10-15 seconds
 before
  calls are answered or connected, etc.). Upon doing a ps -ef we see a
 lot
  of AGI processes running that seem to keep growing

 There could be a number of external constraints that are causing this.
 One that comes to mind to is something waiting for a database
 connection, then all the other processes that are waiting for the
 database pile up and can't exit until they get their turn.

 Do you have a max number of connections on your database? How does the
 AGI know what to do based on the 'calling card information'? I'm
 guessing you store all that in a database, then deduct what the caller
 uses, etc.

 You may also enjoy http://us3.php.net/set_time_limit

 ___
 -- 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] Asterisk AGI issues (at high load)

2009-06-04 Thread Steve Edwards
On Thu, 4 Jun 2009, Deepak wrote:

 Thanks. You are right in assumng that we query the database.  I was not 
 aware that there is a limit to the number of DB connections to mysql. We 
 open/close db connections as needed. I will check if there is such a 
 limit and if yes, post the result.

 Would you happen to know where to configure such a limit or what the 
 default is?

/etc/my.cnf

[mysqld]
 max_connections = 300
 max_user_connections= 300

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] Asterisk AGI issues (at high load)

2009-06-04 Thread Jeff LaCoursiere

On Thu, 4 Jun 2009, Deepak wrote:

 BTW,we are using an ODBC connection to Microsoft SQL Server.
 We are not using MySQL.

 Would that be a possible cause?


Good lord who designed this mess?  Start over.

j

___
-- 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] Asterisk AGI issues (at high load)

2009-06-04 Thread Danny Nicholas
AMEN!!! - How you got that far is nothing short of miraculous.  Was Moses
your designer?

-Original Message-
From: asterisk-users-boun...@lists.digium.com
[mailto:asterisk-users-boun...@lists.digium.com] On Behalf Of Jeff
LaCoursiere
Sent: Thursday, June 04, 2009 12:23 PM
To: Asterisk Users Mailing List - Non-Commercial Discussion
Subject: Re: [asterisk-users] Asterisk AGI issues (at high load)


On Thu, 4 Jun 2009, Deepak wrote:

 BTW,we are using an ODBC connection to Microsoft SQL Server.
 We are not using MySQL.

 Would that be a possible cause?


Good lord who designed this mess?  Start over.

j

___
-- 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] Asterisk AGI issues (at high load)

2009-06-04 Thread Stefan Schmidt
Deepak schrieb:
 Thanks. You are right in assumng that we query the database.  I was not
 aware that there is  a limit to the number of DB connections to mysql.
 We open/close db connections as needed. I will check if there is such a
 limit and if yes, post the result.
 Would you happen to know where to configure such a limit or what the
 default is?

iam not sure about the default limit but normally you will find the
mysql config under /etc/mysql/my.cnf. There you have the connection limit.

best regards

steve

___
-- 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] Asterisk AGI issues (at high load)

2009-06-04 Thread David Backeberg
On Thu, Jun 4, 2009 at 1:18 PM, Deepak dlal...@gmail.com wrote:
 BTW,we are using an ODBC connection to Microsoft SQL Server.
 We are not using MySQL.

 Would that be a possible cause?

No idea what your settings are for the SQL server, but you should
certainly take a look there.
I don't know how to dig into the settings on a SQL server. I assume
there's some Control Panel-esque console that tells you your max
number of connections.

___
-- 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] Asterisk AGI issues (at high load)

2009-06-04 Thread Vinícius Fontes
I agree when people say that your problem is at the database and not 
Asterisk/AGI. Another thing came into my mind, thought: you're using G729 to 
your SIP peers, and that means Asterisk is doing all the transcoding.

How much idle CPU % top reports at high load? If this is too high (like 90%) 
you would need a dedicated transcoder: 
http://www.digium.com/en/products/voice/tc400b.php



Vinícius Fontes
www.asteriskforum.com.br - Informações e discussão sobre Asterisk e telefonia IP



- Deepak dlal...@gmail.com escreveu:

 Hi, we are experiencing a strange issue and I am hoping someone can
 point me to the right direction or help out with some pointers.
 
 We have asterisk 1.6.0.6 with a sangome a104DE card. We have basically
 4 T1's for a total of DAHDI 96 channels.
 
 We have an agi application (php) that acts as a kind of a calling card
 application.
 
 All users are SIP users that make calls and asterisk then bridges the
 calls over T1 to the PSTN (after running agi script). Codec between
 SIP clients and Asterisk is G729 (96 G729 licenses installed on
 Asterisk).
 
 System has 12 GB of RAM.
 
 
 What we are seeing is the following:
 
 1) All is fine till about 70 calls (70 active calls as displayed by
 core show channels). But as soon as traffic increases, we see the the
 a lot of AGI Processes are running and the number of active calls
 keeps on GROWING to 120, 130, ... . THis makes no sense since we can
 have a maximum of 96 active calls (4 T1). People calling start
 experiencing delays (10-15 seconds before calls are answered or
 connected, etc.). Upon doing a ps -ef we see a lot of AGI processes
 running that seem to keep growing
 
 2) At that state, if we Decrease traffic, the number of active calls
 starts going down and the system becomes normal again.
 
 3) What we are seeing are NOT Zombie processes though. It is as-if
 AGI processes are not exiting when traffic increases. But as soon as
 traffic decreases things become normal.
 
 4) We did follow standard suggestions for AGI scripts (exit,
 Softhangup, etc)
 
 5) We checked and the CPU utilization seems to be 25% idle at high
 loads.. so it does not seem like a CPU issue. We have a dual core
 3.0GHz intel processor and based upon benchmarking info, we should be
 easily able to handle 96 calls (with transcoding).
 
 6) We see that each AGI process takes up 149 MB of Virtual Memory when
 it is forked for each call.
 
 7) Asterisk is taking up 500 MB Of VM.
 
 
 *Any* suggestions/help will be appreciated and I'd be happy to even
 pay if someone is ready to help us resolve this issue we are having.
 
 Thanks
 
 
 
 
 
 
 ___
 -- 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] Asterisk AGI issues (at high load)

2009-06-04 Thread Steve Edwards
On Thu, 4 Jun 2009, Deepak wrote:

 BTW,we are using an ODBC connection to Microsoft SQL Server. We are not 
 using MySQL.

 Would that be a possible cause?

Probably not the cause, unless there is a bug in ODBC.

But, it does multiply your support costs.

Not because of the obvious you have to pay MS license fees, or it uses 
more resources, or even I can't ssh into it to fix it for you but 
because you have stepped outside of the norm of what people on this list 
use so we will not be able to help much.

If I was to guess, I'd say 99% use MySQL, 1% use PostgreSQL and something 
very close to 0% us MSSQL.

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] Asterisk AGI issues (at high load)

2009-06-04 Thread Deepak
It was not a conscious decision to use MS-SQL. We were forced to use
MS-SQL since the business rules were on MS-SQL and other apps are using
it.

If you think it is not ODBC, then what in your opinion is causing the issue?
I though you did mention that in your opinion database might be the
culprit...

Thanks in advance

On Thu, Jun 4, 2009 at 3:23 PM, Steve Edwards asterisk@sedwards.comwrote:

 On Thu, 4 Jun 2009, Deepak wrote:

  BTW,we are using an ODBC connection to Microsoft SQL Server. We are not
  using MySQL.
 
  Would that be a possible cause?

 Probably not the cause, unless there is a bug in ODBC.

 But, it does multiply your support costs.

 Not because of the obvious you have to pay MS license fees, or it uses
 more resources, or even I can't ssh into it to fix it for you but
 because you have stepped outside of the norm of what people on this list
 use so we will not be able to help much.

 If I was to guess, I'd say 99% use MySQL, 1% use PostgreSQL and something
 very close to 0% us MSSQL.

 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] Asterisk AGI issues (at high load)

2009-06-04 Thread Elliot Otchet
Are you using freetds?  Is it a recent version or something that is a few years 
old?  Are you using a freetds connection pool? 
http://www.freetds.org/userguide/tdspool.htm

Is unixODBC pooling turned on?  See: http://www.unixodbc.org/doc/conn_pool.html 
to understand why this doesn't work with AGI type applications.

Are the AGI's running for the entire duration of the call?   If so, are DB 
open/closes performed immediately before and after each SQL statement?  If not, 
and your AGI is in play during the entire call (which sounds like the case), 
your DB connections are probably timing out.

Does your SQL server have enough CALs to support one (or more depending on your 
logic) or more connections per AGI?  In your fully loaded model, you may be 
hitting a CAL limit.  Are you running server or processor licenses? MSSQL 
Server licenses have CALS, Processor licenses do not (generally speaking).  
For SQL2008 see: 
http://download.microsoft.com/download/1/e/6/1e68f92c-f334-4517-b610-e4dee946ef91/2008%20SQL%20Licensing%20Overview%20final.docx

Possible ways to move forward:
Re-engineer the application with the current language to only be an AGI when an 
AGI feature is needed.  Make use of DeadAGI or dialplan ODBC extensions (with 
channel variables) if you need to do post call processing (e.g. update the 
hangup time to deduct minutes).

Build your own PHP and optimize it for what you need to do AGI to get the 
memory usage down (if needed).  Yes you really do use significant amounts of 
memory on a vanilla php install per process if you use stock PHP.  If you can 
get away with moving to C, it is orders of magnitude more scalable.  Keep in 
mind though, you may be able to reduce (by significant amounts) the amount of 
system memory you're using by re-engineering the application.  You should also 
consider moving this off your call processing system so AGI processing (with 
scripting languages that use large amounts of memory) can impact your call 
quality.

Regards,

Elliot

From: asterisk-users-boun...@lists.digium.com 
[mailto:asterisk-users-boun...@lists.digium.com] On Behalf Of Deepak
Sent: Thursday, June 04, 2009 1:18 PM
To: Asterisk Users Mailing List - Non-Commercial Discussion
Subject: Re: [asterisk-users] Asterisk AGI issues (at high load)

BTW,we are using an ODBC connection to Microsoft SQL Server.
We are not using MySQL.

Would that be a possible cause?

Thanks



On Thu, Jun 4, 2009 at 12:31 PM, David Backeberg 
dbackeb...@gmail.commailto:dbackeb...@gmail.com wrote:
On Thu, Jun 4, 2009 at 12:15 PM, Deepak 
dlal...@gmail.commailto:dlal...@gmail.com wrote:
 Hi, we are experiencing a strange issue and I am hoping someone can point me
 to the right direction or help out with some pointers.

 We have asterisk 1.6.0.6 with a sangome a104DE card. We have basically 4
 T1's for a total of DAHDI 96 channels.

 We have an agi application (php) that acts as a kind of a calling card
 application.

 All users are SIP users that make calls and asterisk then bridges the calls
 over T1 to the PSTN (after running agi script). Codec between SIP clients
 and Asterisk is G729 (96 G729 licenses installed on Asterisk).
 System has 12 GB of RAM.


 What we are seeing is the following:

 1) All is fine till about 70 calls (70 active calls as displayed by core
 show channels). But as soon as traffic increases, we see the the a lot of
 AGI Processes are running and the number of active calls keeps on GROWING to
 120, 130, ... . THis makes no sense since we can have a maximum of 96 active
 calls (4 T1). People calling start experiencing delays (10-15 seconds before
 calls are answered or connected, etc.). Upon doing a ps -ef we see a lot
 of AGI processes running that seem to keep growing
There could be a number of external constraints that are causing this.
One that comes to mind to is something waiting for a database
connection, then all the other processes that are waiting for the
database pile up and can't exit until they get their turn.

Do you have a max number of connections on your database? How does the
AGI know what to do based on the 'calling card information'? I'm
guessing you store all that in a database, then deduct what the caller
uses, etc.

You may also enjoy http://us3.php.net/set_time_limit

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

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



This message is intended only for the use of the individual (s) or entity to 
which it is addressed and may contain information that is privileged, 
confidential, and/or proprietary to Calling Circles LLC and its affiliates. If 
the reader of this message is not the intended recipient, you are hereby 
notified that any dissemination, distribution, forwarding or copying of this 
communication is prohibited

Re: [asterisk-users] Asterisk AGI issues (at high load)

2009-06-04 Thread Dave Walker


 BTW,we are using an ODBC connection to Microsoft SQL Server.
 We are not using MySQL.

 Would that be a possible cause?


Good lord who designed this mess?  Start over.

I feel the cold evil darkness spread through our lands.. 




___
-- 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] Asterisk AGI issues (at high load)

2009-06-04 Thread Jeff LaCoursiere

On Thu, 4 Jun 2009, Deepak wrote:

 It was not a conscious decision to use MS-SQL. We were forced to use
 MS-SQL since the business rules were on MS-SQL and other apps are using
 it.

 If you think it is not ODBC, then what in your opinion is causing the issue?
 I though you did mention that in your opinion database might be the
 culprit...

 Thanks in advance

 On Thu, Jun 4, 2009 at 3:23 PM, Steve Edwards 
 asterisk@sedwards.comwrote:

 On Thu, 4 Jun 2009, Deepak wrote:

 BTW,we are using an ODBC connection to Microsoft SQL Server. We are not
 using MySQL.

 Would that be a possible cause?

 Probably not the cause, unless there is a bug in ODBC.

 But, it does multiply your support costs.

 Not because of the obvious you have to pay MS license fees, or it uses
 more resources, or even I can't ssh into it to fix it for you but
 because you have stepped outside of the norm of what people on this list
 use so we will not be able to help much.

 If I was to guess, I'd say 99% use MySQL, 1% use PostgreSQL and something
 very close to 0% us MSSQL.


It is more likely the *way* you are using the ODBC connection.  If your 
instances are taking up so much memory, your SQL calls are probably very 
inefficient.  It is going to be very hard for anyone on the list to 
pinpoint your actual problem without seeing your code.

j




___
-- 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