<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 12 (filtered medium)">
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.Section1
        {page:Section1;}
-->
</style><!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext="edit">
  <o:idmap v:ext="edit" data="1" />
 </o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="Section1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;
color:#1F497D">Are you using freetds?&nbsp; Is it a recent version or something that is a few years old?&nbsp; Are you using a freetds connection pool? http://www.freetds.org/userguide/tdspool.htm<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;
color:#1F497D"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;
color:#1F497D">Is unixODBC pooling turned on?&nbsp; See:
<a href="http://www.unixodbc.org/doc/conn_pool.html">http://www.unixodbc.org/doc/conn_pool.html</a> to understand why this doesn&#8217;t work with AGI type applications.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;
color:#1F497D"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;
color:#1F497D">Are the AGI&#8217;s running for the entire duration of the call?&nbsp;&nbsp; If so, are DB open/closes performed immediately before and after each SQL statement?&nbsp; If not,
 and your AGI is in play during the entire call (which sounds like the case), your DB connections are probably timing out.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;
color:#1F497D"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;
color:#1F497D">Does your SQL server have enough CALs to support one (or more depending on your logic) or more connections per AGI?&nbsp; In your fully loaded model, you may be
 hitting a CAL limit.&nbsp; Are you running server or processor licenses? MSSQL &#8220;Server&#8221; licenses have CALS, &#8220;Processor&#8221; licenses do not (generally speaking).&nbsp; For SQL2008 see: http://download.microsoft.com/download/1/e/6/1e68f92c-f334-4517-b610-e4dee946ef91/2008%20SQL%20Licensing%20Overview%20final.docx<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;
color:#1F497D"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;
color:#1F497D">Possible ways to move forward:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;
color:#1F497D">Re-engineer the application with the current language to only be an AGI when an AGI feature is needed.&nbsp; 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).<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;
color:#1F497D"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;
color:#1F497D">Build your own PHP and optimize it for what you need to do AGI to get the memory usage down (if needed).&nbsp; Yes you really do use significant amounts of memory
 on a vanilla php install per process if you use stock PHP.&nbsp; If you can get away with moving to C, it is orders of magnitude more scalable.&nbsp; Keep in mind though, you may be able to reduce (by significant amounts) the amount of system memory you&#8217;re using by
 re-engineering the application.&nbsp; 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.&nbsp;
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;
color:#1F497D"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;
color:#1F497D">Regards,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;
color:#1F497D"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;
color:#1F497D">Elliot<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;
color:#1F497D"><o:p>&nbsp;</o:p></span></p>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;">From:</span></b><span style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;"> asterisk-users-bounces@lists.digium.com [mailto:asterisk-users-bounces@lists.digium.com]
<b>On Behalf Of </b>Deepak<br>
<b>Sent:</b> Thursday, June 04, 2009 1:18 PM<br>
<b>To:</b> Asterisk Users Mailing List - Non-Commercial Discussion<br>
<b>Subject:</b> Re: [asterisk-users] Asterisk AGI issues (at high load)<o:p></o:p></span></p>
</div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<div>
<p class="MsoNormal">BTW,we are using an ODBC connection to Microsoft SQL Server.
<br>
We are not using MySQL. <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">&nbsp;<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Would that be a possible cause?<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">&nbsp;<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Thanks<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><br>
<br>
&nbsp;<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">On Thu, Jun 4, 2009 at 12:31 PM, David Backeberg &lt;<a href="mailto:dbackeberg@gmail.com">dbackeberg@gmail.com</a>&gt; wrote:<o:p></o:p></p>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt">On Thu, Jun 4, 2009 at 12:15 PM, Deepak &lt;<a href="mailto:dlalmtl@gmail.com">dlalmtl@gmail.com</a>&gt; wrote:<br>
&gt; Hi, we are experiencing a strange issue and I am hoping someone can point me<br>
&gt; to the right direction or help out with some pointers.<br>
&gt;<br>
&gt; We have asterisk 1.6.0.6 with a sangome a104DE card. We have basically 4<br>
&gt; T1's for a total of DAHDI 96 channels.<br>
&gt;<br>
&gt; We have an agi application (php) that acts as a kind of a calling card<br>
&gt; application.<br>
&gt;<br>
&gt; All users are SIP users that make calls and asterisk then bridges the calls<br>
&gt; over T1 to the PSTN (after running agi script). Codec between SIP clients<br>
&gt; and Asterisk is G729 (96 G729 licenses installed on Asterisk).<br>
&gt; System has 12 GB of RAM.<br>
&gt;<br>
&gt;<br>
&gt; What we are seeing is the following:<br>
&gt;<br>
&gt; 1) All is fine till about 70 calls (70 active calls as displayed by core<br>
&gt; show channels). But as soon as traffic increases, we see the the a lot of<br>
&gt; AGI Processes are running and the number of active calls keeps on GROWING to<br>
&gt; 120, 130, ... . THis makes no sense since we can have a maximum of 96 active<br>
&gt; calls (4 T1). People calling start experiencing delays (10-15 seconds before<br>
&gt; calls are answered or connected, etc.). Upon doing a &quot;ps -ef&quot; we see a lot<br>
&gt; of AGI processes running that seem to keep growing<o:p></o:p></p>
</div>
<p class="MsoNormal">There could be a number of external constraints that are causing this.<br>
One that comes to mind to is something waiting for a database<br>
connection, then all the other processes that are waiting for the<br>
database pile up and can't exit until they get their turn.<br>
<br>
Do you have a max number of connections on your database? How does the<br>
AGI know what to do based on the 'calling card information'? I'm<br>
guessing you store all that in a database, then deduct what the caller<br>
uses, etc.<br>
<br>
You may also enjoy <a href="http://us3.php.net/set_time_limit" target="_blank">http://us3.php.net/set_time_limit</a><br>
<br>
_______________________________________________<br>
-- Bandwidth and Colocation Provided by <a href="http://www.api-digital.com/" target="_blank">
http://www.api-digital.com</a> --<br>
<br>
asterisk-users mailing list<br>
To UNSUBSCRIBE or update options visit:<br>
&nbsp; <a href="http://lists.digium.com/mailman/listinfo/asterisk-users" target="_blank">
http://lists.digium.com/mailman/listinfo/asterisk-users</a><o:p></o:p></p>
</div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
<br>
<hr>
<font face="Arial" color="Gray" size="1">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 without the express permission of the sender. If you have received this communication
 in error, please notify the sender immediately and delete the original message.<br>
</font>
</body>
</html>