Re: [asterisk-users] Concurrent calls including mysql taking lot of time for execution

2009-11-06 Thread das sandesh
Thanks Dave, I added a new SSD harddrive instead of a normal SATA harddrive
as well as included my ip in the hosts file also I have included
'skip-name-resolv' as you mentioned to not to resolv and tested for around
250 concurrent calls, connection was going through fine...next week I
would be testing it for some more additional calls..Thanks for all your
replies.

Best Regards
Sandesh

On Fri, Nov 6, 2009 at 8:01 AM, David Gibbons d...@videon-central.comwrote:

 I've seen asterisk really bog in internal networks if the mysql server has
 name resolution turned on (dns issues of course). The query will be blocked
 until the name resolution times out.

 Try adding this line the [mysqld] section of your my.cnf:

 [mysqld]
 skip-name-resolv

 That sent a server from ~10 seconds/query down to milliseconds.

 --Dave


 ___
 -- 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] Concurrent calls including mysql taking lot of time for execution

2009-11-05 Thread Matt Riddell
On 23/10/09 6:11 AM, jonas kellens wrote:
 On Thu, 2009-10-22 at 13:45 +1300, Matt Riddell wrote:

 It's really simple you just read from standard input and write to
 standard output.

 If you tell us a programming language you'd like to use (i.e.
 php/c/perl/bash etc) we can give you a link to some docs and examples.


 Might I highjack this thread to ask for this documentation ? I want to
 use php.

:) Sorry been moving house for the week - easiest one to use for PHP is 
PHPAGI:

http://phpagi.sourceforge.net/

-- 
Cheers,

Matt Riddell
Director
___

http://www.venturevoip.com/news.php (Daily Asterisk News)
http://www.venturevoip.com/st.php (SmoothTorque Predictive Dialer)
http://www.venturevoip.com/c3.php (ConduIT3 PABX Systems)

___
-- 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] Concurrent calls including mysql taking lot of time for execution

2009-10-26 Thread das sandesh
Thanks for all the information.

Benaiad: I will try adding in the hosts file and try it once again, also one
more that I was in regards to the harddrive, so I thought of replacing with
a SSD with high read and write speeds just to check whether its going to
reduce the dealy...

Regards
Sandesh

On Thu, Oct 22, 2009 at 6:20 PM, Benaiad bena...@gmail.com wrote:


 Abdulmnem Benaiad
   Almontaha CTO
   Almontaha IT Co.
   cell: +218 92 5200025
   fax: +218 21 4835263
   www.almontaha.com.ly


 On Wed, Oct 21, 2009 at 11:57 PM, das sandesh sandesh...@gmail.comwrote:

 Hi Matt,

 I already used the tuning-primer.sh script to enhance the values for the
 parameters,  but still it was being slow to connect when there are lot of
 calls (calls around 150-200 calls). Also I reduced mysql queries in the code
 as well as many other steps, but only problem coming is with repect to the
 connection from asterisk to mysql (also I am using direct ip address and
 not the dns name).is it better to use any additional mysql server apart
 from this application server? or adding additional hardware would help (like
 dual quad core)?

 Thanks
 Sandesh


 On Wed, Oct 21, 2009 at 3:57 PM, Matt Riddell li...@venturevoip.comwrote:

 On 22/10/09 7:30 AM, das sandesh wrote:
  Hi,
 
  I tried getting our server setup for 400-500 simultaneous calls, calls
  were going through properly but at around 200-250 calls, mysql (connect
  ...) statement was taking at least 5-10 sec to connect to the database.
  I optimized all possible parameters in my.cnf:

 Without knowing what you're optimising you're unlikely to have much luck
 just setting values.

 We have had quite good success with the tunish-primer.sh script:

 http://www.day32.com/MySQL/
 http://www.day32.com/MySQL/tuning-primer.sh

 We run with MySQL at about 500 queries per second with no problems - we
 don't however use Asterisk's MySQL libraries.

 --
 Cheers,

 Matt Riddell
 Director
 ___

 http://www.venturevoip.com/news.php (Daily Asterisk News)
 http://www.venturevoip.com/st.php (SmoothTorque Predictive Dialer)
 http://www.venturevoip.com/c3.php (ConduIT3 PABX Systems)



 Regarding Mysql delay, I've faced this problem before in my local network
 and this problem has been solved by adding all of my servers IP's and names
 in the /etc/hosts file.
 even when connecting locally, I think , asterisk will use a real IP instead
 of 127.0.0.1 when connecting to mysql and mysql will try to resolve it's
 name, and this step will take some time.

 Regards.

 --
 Benaiad



 ___
 -- 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] Concurrent calls including mysql taking lot of time for execution

2009-10-22 Thread Matt Riddell
On 22/10/09 6:52 PM, das sandesh wrote:
 There were 2 problems that we faced, one was at around 50 calls, few
 calls were just dead air, and when I saw the logs I could see that it
 was sent to the sip provider and after that there was no log for that
 particular call that was having dead air, but at around 200 to 250, we
 could see that MySQL(Connect connid ipaddr uname pwd db) statement
 took around 5-10 sec to connect to the database and then the 2 queries
 in that code got executed pretty fast (1-2sec), and so here we had the
 dead air untill the call got connected (after 5-10sec).

1-2 seconds for a query isn't really that quick.

You might also want to do

explain SQLSTATEMENT

where SQLSTATEMENT is the SQL query you are running.

-- 
Cheers,

Matt Riddell
Director
___

http://www.venturevoip.com/news.php (Daily Asterisk News)
http://www.venturevoip.com/st.php (SmoothTorque Predictive Dialer)
http://www.venturevoip.com/c3.php (ConduIT3 PABX Systems)

___
-- 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] Concurrent calls including mysql taking lot of time for execution

2009-10-22 Thread jonas kellens
On Thu, 2009-10-22 at 13:45 +1300, Matt Riddell wrote:

 
 It's really simple you just read from standard input and write to 
 standard output.
 
 If you tell us a programming language you'd like to use (i.e. 
 php/c/perl/bash etc) we can give you a link to some docs and examples.
 


Might I highjack this thread to ask for this documentation ? I want to
use php.

Jonas.
___
-- 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] Concurrent calls including mysql taking lot of time for execution

2009-10-22 Thread Steve Edwards
On Thu, 22 Oct 2009, jonas kellens wrote:

 On Thu, 2009-10-22 at 13:45 +1300, Matt Riddell wrote:

 It's really simple you just read from standard input and write to
 standard output.

 If you tell us a programming language you'd like to use (i.e.
 php/c/perl/bash etc) we can give you a link to some docs and examples.

 Might I highjack this thread to ask for this documentation ? I want to
 use php.

Nope. No hijacking -- but google will help.

FYI, in my informal testing, PHP was even slower that Perl in loading and 
executing a null agi*. Both were xxx times slower than C.

* An AGI that just read the AGI environment and returned.

-- 
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] Concurrent calls including mysql taking lot of time for execution

2009-10-22 Thread Benaiad
Abdulmnem Benaiad
  Almontaha CTO
  Almontaha IT Co.
  cell: +218 92 5200025
  fax: +218 21 4835263
  www.almontaha.com.ly


On Wed, Oct 21, 2009 at 11:57 PM, das sandesh sandesh...@gmail.com wrote:

 Hi Matt,

 I already used the tuning-primer.sh script to enhance the values for the
 parameters,  but still it was being slow to connect when there are lot of
 calls (calls around 150-200 calls). Also I reduced mysql queries in the code
 as well as many other steps, but only problem coming is with repect to the
 connection from asterisk to mysql (also I am using direct ip address and
 not the dns name).is it better to use any additional mysql server apart
 from this application server? or adding additional hardware would help (like
 dual quad core)?

 Thanks
 Sandesh


 On Wed, Oct 21, 2009 at 3:57 PM, Matt Riddell li...@venturevoip.comwrote:

 On 22/10/09 7:30 AM, das sandesh wrote:
  Hi,
 
  I tried getting our server setup for 400-500 simultaneous calls, calls
  were going through properly but at around 200-250 calls, mysql (connect
  ...) statement was taking at least 5-10 sec to connect to the database.
  I optimized all possible parameters in my.cnf:

 Without knowing what you're optimising you're unlikely to have much luck
 just setting values.

 We have had quite good success with the tunish-primer.sh script:

 http://www.day32.com/MySQL/
 http://www.day32.com/MySQL/tuning-primer.sh

 We run with MySQL at about 500 queries per second with no problems - we
 don't however use Asterisk's MySQL libraries.

 --
 Cheers,

 Matt Riddell
 Director
 ___

 http://www.venturevoip.com/news.php (Daily Asterisk News)
 http://www.venturevoip.com/st.php (SmoothTorque Predictive Dialer)
 http://www.venturevoip.com/c3.php (ConduIT3 PABX Systems)



Regarding Mysql delay, I've faced this problem before in my local network
and this problem has been solved by adding all of my servers IP's and names
in the /etc/hosts file.
even when connecting locally, I think , asterisk will use a real IP instead
of 127.0.0.1 when connecting to mysql and mysql will try to resolve it's
name, and this step will take some time.

Regards.

--
Benaiad
___
-- 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] Concurrent calls including mysql taking lot of time for execution

2009-10-21 Thread Steve Edwards
On Wed, 21 Oct 2009, das sandesh wrote:

 I tried getting our server setup for 400-500 simultaneous calls, calls 
 were going through properly but at around 200-250 calls, mysql (connect 
 ...) statement was taking at least 5-10 sec to connect to the database. 
 I optimized all possible parameters in my.cnf:

This isn't a MySQL performance list and I'm not an expert, but...

I cobbled up a little C program that created 1,000 concurrent connections 
to my database and it takes 0.15 seconds on an AMD Phenom(tm) 8650 
Triple-Core Processor. I confirmed via netstat that there were 1,000 
connections. Opening and closing a single connection 1,000 times was still 
less than a second.

This was connecting to localhost so it used the UNIX socket. Changing to 
a TCP socket took 0.19 seconds.

I'd look elsewhere -- it's not the MySQL connection that's the problem.

How are you connecting? Is in in an AGI? What language are you using? What 
are you doing with MySQL? A few more details will help :)

-- 
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] Concurrent calls including mysql taking lot of time for execution

2009-10-21 Thread David Backeberg
On Wed, Oct 21, 2009 at 2:30 PM, das sandesh sandesh...@gmail.com wrote:
 I tried getting our server setup for 400-500 simultaneous calls, calls were
 going through properly but at around 200-250 calls, mysql (connect ...)
 statement was taking at least 5-10 sec to connect to the database. I
 optimized all possible parameters in my.cnf:

My guess is DNS taking a long time to timeout?

Trying changing the connection string to use straight ip address
rather than hostname.

___
-- 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] Concurrent calls including mysql taking lot of time for execution

2009-10-21 Thread das sandesh
Hi Steve,

Thanks for your reply.

I am using only asterisk code (dial plan) in extensions.conf which also
includes connection to the database: like
exten =n,1, MYSQL(connect connid ipaddr uname pwd database) and
then the required select queries and the clear and Disconnect the
connection.

When the live calls are made to test and at 200th or at around 250th call
there is a point where it took like 5-10 sec just to connect to the database
and in the mean time we get dead air for that period of time..how can we
change the type of connection that you mentioned? Or might be is it good to
go with dual quad core processor instead of just one inorder to handle the
call capacity as well as connections?

Regards
Sandesh.

On Wed, Oct 21, 2009 at 2:21 PM, Steve Edwards asterisk@sedwards.comwrote:

 On Wed, 21 Oct 2009, das sandesh wrote:

  I tried getting our server setup for 400-500 simultaneous calls, calls
  were going through properly but at around 200-250 calls, mysql (connect
  ...) statement was taking at least 5-10 sec to connect to the database.
  I optimized all possible parameters in my.cnf:

 This isn't a MySQL performance list and I'm not an expert, but...

 I cobbled up a little C program that created 1,000 concurrent connections
 to my database and it takes 0.15 seconds on an AMD Phenom(tm) 8650
 Triple-Core Processor. I confirmed via netstat that there were 1,000
 connections. Opening and closing a single connection 1,000 times was still
 less than a second.

 This was connecting to localhost so it used the UNIX socket. Changing to
 a TCP socket took 0.19 seconds.

 I'd look elsewhere -- it's not the MySQL connection that's the problem.

 How are you connecting? Is in in an AGI? What language are you using? What
 are you doing with MySQL? A few more details will help :)

 --
 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] Concurrent calls including mysql taking lot of time for execution

2009-10-21 Thread Jai Rangi
I think the key point is how many calls per second. That's what mysql is
concerned about. Other than that it is just asterisk. Did you monitor the
mysql, try log-slow-queries and set the time to 1 second.

-Jai

On Wed, Oct 21, 2009 at 12:57 PM, das sandesh sandesh...@gmail.com wrote:

 Hi Steve,

 Thanks for your reply.

 I am using only asterisk code (dial plan) in extensions.conf which also
 includes connection to the database: like
 exten =n,1, MYSQL(connect connid ipaddr uname pwd database) and
 then the required select queries and the clear and Disconnect the
 connection.

 When the live calls are made to test and at 200th or at around 250th call
 there is a point where it took like 5-10 sec just to connect to the database
 and in the mean time we get dead air for that period of time..how can we
 change the type of connection that you mentioned? Or might be is it good to
 go with dual quad core processor instead of just one inorder to handle the
 call capacity as well as connections?

 Regards
 Sandesh.


 On Wed, Oct 21, 2009 at 2:21 PM, Steve Edwards 
 asterisk@sedwards.comwrote:

 On Wed, 21 Oct 2009, das sandesh wrote:

  I tried getting our server setup for 400-500 simultaneous calls, calls
  were going through properly but at around 200-250 calls, mysql (connect
  ...) statement was taking at least 5-10 sec to connect to the database.
  I optimized all possible parameters in my.cnf:

 This isn't a MySQL performance list and I'm not an expert, but...

 I cobbled up a little C program that created 1,000 concurrent connections
 to my database and it takes 0.15 seconds on an AMD Phenom(tm) 8650
 Triple-Core Processor. I confirmed via netstat that there were 1,000
 connections. Opening and closing a single connection 1,000 times was still
 less than a second.

 This was connecting to localhost so it used the UNIX socket. Changing to
 a TCP socket took 0.19 seconds.

 I'd look elsewhere -- it's not the MySQL connection that's the problem.

 How are you connecting? Is in in an AGI? What language are you using? What
 are you doing with MySQL? A few more details will help :)

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

___
-- 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] Concurrent calls including mysql taking lot of time for execution

2009-10-21 Thread Matt Riddell
On 22/10/09 7:30 AM, das sandesh wrote:
 Hi,

 I tried getting our server setup for 400-500 simultaneous calls, calls
 were going through properly but at around 200-250 calls, mysql (connect
 ...) statement was taking at least 5-10 sec to connect to the database.
 I optimized all possible parameters in my.cnf:

Without knowing what you're optimising you're unlikely to have much luck 
just setting values.

We have had quite good success with the tunish-primer.sh script:

http://www.day32.com/MySQL/
http://www.day32.com/MySQL/tuning-primer.sh

We run with MySQL at about 500 queries per second with no problems - we 
don't however use Asterisk's MySQL libraries.

-- 
Cheers,

Matt Riddell
Director
___

http://www.venturevoip.com/news.php (Daily Asterisk News)
http://www.venturevoip.com/st.php (SmoothTorque Predictive Dialer)
http://www.venturevoip.com/c3.php (ConduIT3 PABX Systems)

___
-- 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] Concurrent calls including mysql taking lot of time for execution

2009-10-21 Thread Matt Riddell
On 22/10/09 8:56 AM, David Backeberg wrote:
 On Wed, Oct 21, 2009 at 2:30 PM, das sandeshsandesh...@gmail.com  wrote:
 I tried getting our server setup for 400-500 simultaneous calls, calls were
 going through properly but at around 200-250 calls, mysql (connect ...)
 statement was taking at least 5-10 sec to connect to the database. I
 optimized all possible parameters in my.cnf:

 My guess is DNS taking a long time to timeout?

 Trying changing the connection string to use straight ip address
 rather than hostname.

Alternatively install a caching name server.  In debian just do apt-get 
install bind9 then change your nameserver to 127.0.0.1

-- 
Cheers,

Matt Riddell
Director
___

http://www.venturevoip.com/news.php (Daily Asterisk News)
http://www.venturevoip.com/st.php (SmoothTorque Predictive Dialer)
http://www.venturevoip.com/c3.php (ConduIT3 PABX Systems)

___
-- 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] Concurrent calls including mysql taking lot of time for execution

2009-10-21 Thread Steve Edwards
On Wed, 21 Oct 2009, das sandesh wrote:

 I am using only asterisk code (dial plan) in extensions.conf which also 
 includes connection to the database: like exten =n,1, 
 MYSQL(connect connid ipaddr uname pwd database) and then the required 
 select queries and the clear and Disconnect the connection.

I'm not a big fan of doing anything performance sensitive in scripting 
languages.

I'm also not a big fan of doing MySQL in dialplan. I think it makes for a 
very ugly and difficult to maintain dialplan. Since there is no 
substantial syntax checking, every time you edit your dialplan you risk 
fat-fingering something that you (or somebody less skilled than you) 
may not notice and may take considerable effort to debug.

 When the live calls are made to test and at 200th or at around 250th 
 call there is a point where it took like 5-10 sec just to connect to the 
 database and in the mean time we get dead air for that period of 
 time..how can we change the type of connection that you mentioned?

Since I don't do MySQL in dialplan, I may be wrong here, but in C all you 
have to do is change the host (or IP address) to localhost.

I'd take a look at using AGIs written in C. They make nice little building 
blocks. They execute very quickly and can cleanup your dialplan. Here's 
how I broke down part of a recent project:

) block-ani -- lookup the caller's ANI in the database and set STATUS (a 
channel variable) to BLOCK, PASS, FAILURE.

) lookup-dnis -- lookup the dialed number in the database and set a bunch 
of channel variables from the database. My current project sets around 350 
variables in the blink of an eye -- at least less than a second. Sets 
STATUS to SUCCESS or FAILURE.

) auth-card -- creates a thread to play Please hold while your card is 
being verified... while the mainline code checks to see if the credit 
card is in a known bad database and issues an authorization request via 
TCP to the card processor. Usually we get the response before the prompt 
completes playing so it appears instantaneous to the caller. Sets STATUS 
to SUCCESS or FAILURE.

) messages -- kind of like a voicemail system where callers can record 
messages for other callers and listen to messages left for them. Lots of 
database activity.

) most-idle-agent -- find the online agent who has been idle the longest 
and has the skills (from the database) needed for the caller. Sets AGENT 
(a channel variable) to the agent's ID or GROUP.

) settle-card -- called when the caller hangs up, rates the call based on 
how much time they spent in each product and issues the card sale request.

Most of these could have been done in the dialplan, but it would have been 
completely un-maintainable and prone to failure.

 Or might be is it good to go with dual quad core processor instead of 
 just one inorder to handle the call capacity as well as connections?

I'm not a big fan of throwing hardware at something that may be easy to 
fix. What will you do if your business doubles?

You mentioned 400-500 simultaneous calls. You may want to re-think your 
architecture to split that across several hosts. I'd rather tell my client 
a host smoked and only took 100 calls with it -- each call in the above 
project is worth about US$30.

-- 
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] Concurrent calls including mysql taking lot of time for execution

2009-10-21 Thread das sandesh
Hi Matt,

I already used the tuning-primer.sh script to enhance the values for the
parameters,  but still it was being slow to connect when there are lot of
calls (calls around 150-200 calls). Also I reduced mysql queries in the code
as well as many other steps, but only problem coming is with repect to the
connection from asterisk to mysql (also I am using direct ip address and
not the dns name).is it better to use any additional mysql server apart
from this application server? or adding additional hardware would help (like
dual quad core)?

Thanks
Sandesh

On Wed, Oct 21, 2009 at 3:57 PM, Matt Riddell li...@venturevoip.com wrote:

 On 22/10/09 7:30 AM, das sandesh wrote:
  Hi,
 
  I tried getting our server setup for 400-500 simultaneous calls, calls
  were going through properly but at around 200-250 calls, mysql (connect
  ...) statement was taking at least 5-10 sec to connect to the database.
  I optimized all possible parameters in my.cnf:

 Without knowing what you're optimising you're unlikely to have much luck
 just setting values.

 We have had quite good success with the tunish-primer.sh script:

 http://www.day32.com/MySQL/
 http://www.day32.com/MySQL/tuning-primer.sh

 We run with MySQL at about 500 queries per second with no problems - we
 don't however use Asterisk's MySQL libraries.

 --
 Cheers,

 Matt Riddell
 Director
 ___

 http://www.venturevoip.com/news.php (Daily Asterisk News)
 http://www.venturevoip.com/st.php (SmoothTorque Predictive Dialer)
 http://www.venturevoip.com/c3.php (ConduIT3 PABX Systems)

 ___
 -- 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] Concurrent calls including mysql taking lot of time for execution

2009-10-21 Thread Steve Edwards
On Wed, 21 Oct 2009, Steve Edwards wrote:

 I'd take a look at using AGIs written in C. They make nice little 
 building blocks. They execute very quickly and can cleanup your 
 dialplan.

And you can debug them (AGIs in any language) from the command line 
completely outside of Asterisk.

-- 
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] Concurrent calls including mysql taking lot of time for execution

2009-10-21 Thread Matt Riddell
On 22/10/09 10:57 AM, das sandesh wrote:
 Hi Matt,

 I already used the tuning-primer.sh script to enhance the values for the
 parameters,  but still it was being slow to connect when there are lot
 of calls (calls around 150-200 calls). Also I reduced mysql queries in
 the code as well as many other steps, but only problem coming is with
 repect to the connection from asterisk to mysql (also I am using direct
 ip address and not the dns name).is it better to use any additional
 mysql server apart from this application server? or adding additional
 hardware would help (like dual quad core)?

The thing is, concurrent calls won't make any difference, it's the calls 
per second.

And really you're unlikely to use too many queries per sec.

Seriously, use at least AGI (fastAGI would be better but AGI will at 
least give you a start).

So:

1. Do you get the same delay if you use MySQL command line at the same time?

2. Do you have a programming language you know well enough to connect to 
MySQL in?

-- 
Cheers,

Matt Riddell
Director
___

http://www.venturevoip.com/news.php (Daily Asterisk News)
http://www.venturevoip.com/st.php (SmoothTorque Predictive Dialer)
http://www.venturevoip.com/c3.php (ConduIT3 PABX Systems)

___
-- 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] Concurrent calls including mysql taking lot of time for execution

2009-10-21 Thread Jai Rangi
 The thing is, concurrent calls won't make any difference, it's the calls
per second.
And really you're unlikely to use too many queries per sec. 
Exactly and you can see the slow-log-queries if mysql is taking time.

-Jai




On Wed, Oct 21, 2009 at 3:51 PM, Matt Riddell li...@venturevoip.com wrote:

 On 22/10/09 10:57 AM, das sandesh wrote:
  Hi Matt,
 
  I already used the tuning-primer.sh script to enhance the values for the
  parameters,  but still it was being slow to connect when there are lot
  of calls (calls around 150-200 calls). Also I reduced mysql queries in
  the code as well as many other steps, but only problem coming is with
  repect to the connection from asterisk to mysql (also I am using direct
  ip address and not the dns name).is it better to use any additional
  mysql server apart from this application server? or adding additional
  hardware would help (like dual quad core)?

 The thing is, concurrent calls won't make any difference, it's the calls
 per second.

 And really you're unlikely to use too many queries per sec.

 Seriously, use at least AGI (fastAGI would be better but AGI will at
 least give you a start).

 So:

 1. Do you get the same delay if you use MySQL command line at the same
 time?

 2. Do you have a programming language you know well enough to connect to
 MySQL in?

 --
 Cheers,

 Matt Riddell
 Director
 ___

 http://www.venturevoip.com/news.php (Daily Asterisk News)
 http://www.venturevoip.com/st.php (SmoothTorque Predictive Dialer)
 http://www.venturevoip.com/c3.php (ConduIT3 PABX Systems)

 ___
 -- 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] Concurrent calls including mysql taking lot of time for execution

2009-10-21 Thread covici
Steve Edwards asterisk@sedwards.com wrote:

 On Wed, 21 Oct 2009, Steve Edwards wrote:
 
  I'd take a look at using AGIs written in C. They make nice little 
  building blocks. They execute very quickly and can cleanup your 
  dialplan.
 
 And you can debug them (AGIs in any language) from the command line 
 completely outside of Asterisk.

OK, are there include files available for the appropriate functionality?
Sounds like it might be very nice.

-- 
Your life is like a penny.  You're going to lose it.  The question is:
How do
you spend it?

 John Covici
 cov...@ccs.covici.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] Concurrent calls including mysql taking lot of time for execution

2009-10-21 Thread Matt Riddell
On 22/10/09 1:41 PM, cov...@ccs.covici.com wrote:
 Steve Edwardsasterisk@sedwards.com  wrote:

 On Wed, 21 Oct 2009, Steve Edwards wrote:

 I'd take a look at using AGIs written in C. They make nice little
 building blocks. They execute very quickly and can cleanup your
 dialplan.

 And you can debug them (AGIs in any language) from the command line
 completely outside of Asterisk.

 OK, are there include files available for the appropriate functionality?
 Sounds like it might be very nice.

It's really simple you just read from standard input and write to 
standard output.

If you tell us a programming language you'd like to use (i.e. 
php/c/perl/bash etc) we can give you a link to some docs and examples.

-- 
Cheers,

Matt Riddell
Director
___

http://www.venturevoip.com/news.php (Daily Asterisk News)
http://www.venturevoip.com/st.php (SmoothTorque Predictive Dialer)
http://www.venturevoip.com/c3.php (ConduIT3 PABX Systems)

___
-- 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] Concurrent calls including mysql taking lot of time for execution

2009-10-21 Thread Steve Edwards
 On Wed, 21 Oct 2009, Steve Edwards wrote:

 I'd take a look at using AGIs written in C. They make nice little 
 building blocks. They execute very quickly and can cleanup your 
 dialplan.

 And you can debug them (AGIs in any language) from the command line 
 completely outside of Asterisk.

On Wed, 21 Oct 2009, cov...@ccs.covici.com wrote:

 OK, are there include files available for the appropriate functionality? 
 Sounds like it might be very nice.

If you're referring to debugging outside of Asterisk, it's dead obvious 
-- once you know the secret.

The AGI protocol is just communications over STDIN and STDOUT in a 
specific format.

Thus, running outside of Asterisk just means feeding the right stuff going 
in and observing the right stuff coming out.

For example:

./block-ani dummy-input-for-block-ani

where dummy-input-for-block-ani contains:

agi_accountcode:
agi_callerid: 1234567890
agi_calleridname: sedwards
agi_callingani2: 0
agi_callingpres: 0
agi_callingtns: 0
agi_callington: 0
agi_channel: SIP/201-09456478
agi_context: newline
agi_dnid: *
agi_enhanced: 0.0
agi_extension: *
agi_language: en
agi_priority: 1
agi_rdnis: unknown
agi_request: block-ani
agi_type: SIP
agi_uniqueid: 1195070681.28

200 result=1 (551212)
200 result=1 (localhost)
200 result=1 (example)
200 result=1 (example)
200 result=1 (example)

The first block is the standard AGI environment. The second block is 
specific to this AGI and supplies the answers to the AGI requests GET 
VARIABLE ANI, GET VARIABLE DATABASE-SERVER, GET DATABASE-DATABASE, 
GET DATABASE-USERNAME, and GET DATABASE PASSWORD.

I prefer to use an executable script so I can include comments. The script 
looks like:

# agi-environment.sh

# the standard AGI environment variables
 echo agi_accountcode: 
 echo agi_callerid: 1234567890
 echo agi_calleridname: sedwards
 echo agi_callingani2: 0
 echo agi_callingpres: 0
 echo agi_callingtns: 0
 echo agi_callington: 0
 echo agi_channel: SIP/201-09456478
 echo agi_context: newline
 echo agi_dnid: *
 echo agi_enhanced: 0.0
 echo agi_extension: *
 echo agi_language: en
 echo agi_priority: 1
 echo agi_rdnis: unknown
 echo agi_request: block-ani
 echo agi_type: SIP
 echo agi_uniqueid: 1195070681.28
 echo 

# cruft specific to my AGI

# AGI Rx  GET VARIABLE ANI
 echo 200 result=1 (551212)
# AGI Rx  GET VARIABLE DATABASE-SERVER
 echo 200 result=1 (localhost)
# AGI Rx  GET VARIABLE DATABASE-DATABASE
 echo 200 result=1 (example)
# AGI Rx  GET VARIABLE DATABASE-USERNAME
 echo 200 result=1 (example)
# AGI Rx  GET VARIABLE DATABASE-PASSWORD
 echo 200 result=1 (example)

# (end of agi-environment.sh)

And you use it like:

./agi-environment.sh | ./block-ani

or

./agi-environment.sh dummy-input-for-block-ani
./block-ani dummy-input-for-block-ani

Since I'm an old-school C programmer, I use emacs as my editor. I fire 
up gdb (the GNU C (amongst other languages) debugger) in a window, give it 
a command like b main; r dummy-input-for-block-ani and I can step 
through my program line by line, examining and changing variables at will.

Beats the hell out of peppering your code with prints/puts/echos and 
crossing your fingers.

-- 
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] Concurrent calls including mysql taking lot of time for execution

2009-10-21 Thread covici
Steve Edwards asterisk@sedwards.com wrote:

  On Wed, 21 Oct 2009, Steve Edwards wrote:
 
  I'd take a look at using AGIs written in C. They make nice little 
  building blocks. They execute very quickly and can cleanup your 
  dialplan.
 
  And you can debug them (AGIs in any language) from the command line 
  completely outside of Asterisk.
 
 On Wed, 21 Oct 2009, cov...@ccs.covici.com wrote:
 
  OK, are there include files available for the appropriate functionality? 
  Sounds like it might be very nice.
 
 If you're referring to debugging outside of Asterisk, it's dead obvious 
 -- once you know the secret.
 
 The AGI protocol is just communications over STDIN and STDOUT in a 
 specific format.
 
 Thus, running outside of Asterisk just means feeding the right stuff going 
 in and observing the right stuff coming out.
 
 For example:
 
   ./block-ani dummy-input-for-block-ani
 
 where dummy-input-for-block-ani contains:
 
 agi_accountcode:
 agi_callerid: 1234567890
 agi_calleridname: sedwards
 agi_callingani2: 0
 agi_callingpres: 0
 agi_callingtns: 0
 agi_callington: 0
 agi_channel: SIP/201-09456478
 agi_context: newline
 agi_dnid: *
 agi_enhanced: 0.0
 agi_extension: *
 agi_language: en
 agi_priority: 1
 agi_rdnis: unknown
 agi_request: block-ani
 agi_type: SIP
 agi_uniqueid: 1195070681.28
 
 200 result=1 (551212)
 200 result=1 (localhost)
 200 result=1 (example)
 200 result=1 (example)
 200 result=1 (example)
 
 The first block is the standard AGI environment. The second block is 
 specific to this AGI and supplies the answers to the AGI requests GET 
 VARIABLE ANI, GET VARIABLE DATABASE-SERVER, GET DATABASE-DATABASE, 
 GET DATABASE-USERNAME, and GET DATABASE PASSWORD.
 
 I prefer to use an executable script so I can include comments. The script 
 looks like:
 
 # agi-environment.sh
 
 # the standard AGI environment variables
  echo agi_accountcode: 
  echo agi_callerid: 1234567890
  echo agi_calleridname: sedwards
  echo agi_callingani2: 0
  echo agi_callingpres: 0
  echo agi_callingtns: 0
  echo agi_callington: 0
  echo agi_channel: SIP/201-09456478
  echo agi_context: newline
  echo agi_dnid: *
  echo agi_enhanced: 0.0
  echo agi_extension: *
  echo agi_language: en
  echo agi_priority: 1
  echo agi_rdnis: unknown
  echo agi_request: block-ani
  echo agi_type: SIP
  echo agi_uniqueid: 1195070681.28
  echo 
 
 # cruft specific to my AGI
 
 # AGI Rx  GET VARIABLE ANI
  echo 200 result=1 (551212)
 # AGI Rx  GET VARIABLE DATABASE-SERVER
  echo 200 result=1 (localhost)
 # AGI Rx  GET VARIABLE DATABASE-DATABASE
  echo 200 result=1 (example)
 # AGI Rx  GET VARIABLE DATABASE-USERNAME
  echo 200 result=1 (example)
 # AGI Rx  GET VARIABLE DATABASE-PASSWORD
  echo 200 result=1 (example)
 
 # (end of agi-environment.sh)
 
 And you use it like:
 
   ./agi-environment.sh | ./block-ani
 
 or
 
   ./agi-environment.sh dummy-input-for-block-ani
   ./block-ani dummy-input-for-block-ani
 
 Since I'm an old-school C programmer, I use emacs as my editor. I fire 
 up gdb (the GNU C (amongst other languages) debugger) in a window, give it 
 a command like b main; r dummy-input-for-block-ani and I can step 
 through my program line by line, examining and changing variables at will.
 
 Beats the hell out of peppering your code with prints/puts/echos and 
 crossing your fingers.
 
 -- 
 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
OK, but how do write the C program -- the Perl and php agis have defined
functions for the agi commands, how do you do this in c?


-- 
Your life is like a penny.  You're going to lose it.  The question is:
How do
you spend it?

 John Covici
 cov...@ccs.covici.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] Concurrent calls including mysql taking lot of time for execution

2009-10-21 Thread Jeff LaCoursiere

 Steve Edwards asterisk@sedwards.com wrote:

 Since I'm an old-school C programmer, I use emacs as my editor. I fire
 up gdb (the GNU C (amongst other languages) debugger) in a window, give it
 a command like b main; r dummy-input-for-block-ani and I can step
 through my program line by line, examining and changing variables at will.


Bah.  If you were really old school you would use vi.  [ducking!]  :)

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] Concurrent calls including mysql taking lot of time for execution

2009-10-21 Thread Andrew Hakman
Hey now, I'm a newschool programmer and I use vim (and vi, when necessary).

Andrew

On Wed, Oct 21, 2009 at 8:02 PM, Jeff LaCoursiere j...@jeff.net wrote:

 Steve Edwards asterisk@sedwards.com wrote:

 Since I'm an old-school C programmer, I use emacs as my editor. I fire
 up gdb (the GNU C (amongst other languages) debugger) in a window, give it
 a command like b main; r dummy-input-for-block-ani and I can step
 through my program line by line, examining and changing variables at will.


 Bah.  If you were really old school you would use vi.  [ducking!]  :)

 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] Concurrent calls including mysql taking lot of time for execution

2009-10-21 Thread Matt Riddell
On 22/10/09 2:54 PM, cov...@ccs.covici.com wrote:
 OK, but how do write the C program -- the Perl and php agis have defined
 functions for the agi commands, how do you do this in c?

There is a library (haven't used it myself)

http://sourceforge.net/projects/cagi/

Basically you read from the standard input (i.e. fgets or similar) and 
write to the standard output (printf or similar).

-- 
Cheers,

Matt Riddell
Director
___

http://www.venturevoip.com/news.php (Daily Asterisk News)
http://www.venturevoip.com/st.php (SmoothTorque Predictive Dialer)
http://www.venturevoip.com/c3.php (ConduIT3 PABX Systems)

___
-- 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] Concurrent calls including mysql taking lot of time for execution

2009-10-21 Thread Paul Hales
Jeff LaCoursiere wrote:
 Steve Edwards asterisk@sedwards.com wrote:

 
 Since I'm an old-school C programmer, I use emacs as my editor. I fire
 up gdb (the GNU C (amongst other languages) debugger) in a window, give it
 a command like b main; r dummy-input-for-block-ani and I can step
 through my program line by line, examining and changing variables at will.

   

 Bah.  If you were really old school you would use vi.  [ducking!]  :)

 j

   
Old school? I tried to use 'ed' the other day, and failed.

PaulH

___
-- 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] Concurrent calls including mysql taking lot of time for execution

2009-10-21 Thread Steve Edwards
On Wed, 21 Oct 2009, cov...@ccs.covici.com wrote:

 OK, but how do write the C program -- the Perl and php agis have defined 
 functions for the agi commands, how do you do this in c?

The same way. All languages need a library. Either you find a library that 
talks AGI or you write one. I wrote mine because when I started writing 
AGIs about 5 years ago, I didn't have much luck finding one.

-- 
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] Concurrent calls including mysql taking lot of time for execution

2009-10-21 Thread das sandesh
There were 2 problems that we faced, one was at around 50 calls, few calls
were just dead air, and when I saw the logs I could see that it was sent to
the sip provider and after that there was no log for that particular call
that was having dead air, but at around 200 to 250, we could see that
MySQL(Connect connid ipaddr uname pwd db) statement took around 5-10 sec
to connect to the database and then the 2 queries in that code got executed
pretty fast (1-2sec), and so here we had the dead air untill the call got
connected (after 5-10sec).

We also monitored the processor usage and it was around 15-20% CPU and
memory was around 300M to 400M, so we concluded that it was not the hardware
issue.based on all of your opinions i will try to see whether I can use
any other language and try to do those operations.Thanks for all of your
information!

On Wed, Oct 21, 2009 at 10:51 PM, Steve Edwards
asterisk@sedwards.comwrote:

 On Wed, 21 Oct 2009, cov...@ccs.covici.com wrote:

  OK, but how do write the C program -- the Perl and php agis have defined
  functions for the agi commands, how do you do this in c?

 The same way. All languages need a library. Either you find a library that
 talks AGI or you write one. I wrote mine because when I started writing
 AGIs about 5 years ago, I didn't have much luck finding one.

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