Sponsor: VoiceMeUp - Corporate & Wholesale VoIP Services

VoIP Mailing List Archives
Mailing list archives for the VoIP community
 SearchSearch 

[asterisk-users] Asterisk -rx, how expensive is it? Should you avoid "spamming" it?


 
Post new topic   Reply to topic    VoIP Mailing List Archives Forum Index -> Asterisk Users
View previous topic :: View next topic  
Author Message
mikael at wiraya.com
Guest





PostPosted: Thu Apr 24, 2014 5:20 am    Post subject: [asterisk-users] Asterisk -rx, how expensive is it? Should y Reply with quote

Just like the subject sais - how expensive is it to execute a lot of these commands to keep track of different things in asterisk?


I have avoided doing this because it feels a bit like a risk to spam the asterisk CLI this way, but is it really?


CPU-wise it doesn't seem very expensive to do it 100 times a second (from a simple test I did), but is it possible it will affect the asterisk service in any other negative way?


Regards,
Mikael
Back to top
sgriepentrog at digium...
Guest





PostPosted: Thu Apr 24, 2014 10:58 am    Post subject: [asterisk-users] Asterisk -rx, how expensive is it? Should y Reply with quote

How much Asterisk is affected depends on both how often you run a command, and even more significantly, what command you run (and which version of Asterisk).


Commands that display information about every active channel, for example "sip show peers", may slow other processing significantly because they have to briefly lock the data structures to insure valid information.  There have been improvements in more recent versions of Asterisk that reduce the negative affects of this by looking at cached information instead of locking everything.


On the other hand, requesting specific information (sip show peer X) or more generic information (sip show inuse) will have much less affect on other activity in Asterisk.





On Thu, Apr 24, 2014 at 5:20 AM, Mikael Fredin <mikael@wiraya.com (mikael@wiraya.com)> wrote:
Quote:
Just like the subject sais - how expensive is it to execute a lot of these commands to keep track of different things in asterisk?


I have avoided doing this because it feels a bit like a risk to spam the asterisk CLI this way, but is it really?


CPU-wise it doesn't seem very expensive to do it 100 times a second (from a simple test I did), but is it possible it will affect the asterisk service in any other negative way?


Regards,
Mikael


--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
               http://www.asterisk.org/hello

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




--
Scott Griepentrog
Digium, Inc ˇ Software Developer
445 Jan Davis Drive NW ˇ Huntsville, AL 35806 ˇ US
direct/fax: +1 256 428 6239 ˇ mobile: +1 317 507 4029
Check us out at: http://digium.com ˇ http://asterisk.org
Back to top
tzafrir.cohen at xorco...
Guest





PostPosted: Thu Apr 24, 2014 12:48 pm    Post subject: [asterisk-users] Asterisk -rx, how expensive is it? Should y Reply with quote

On Thu, Apr 24, 2014 at 12:20:37PM +0200, Mikael Fredin wrote:
Quote:
Just like the subject sais - how expensive is it to execute a lot of these
commands to keep track of different things in asterisk?

I have avoided doing this because it feels a bit like a risk to spam the
asterisk CLI this way, but is it really?

CPU-wise it doesn't seem very expensive to do it 100 times a second (from a
simple test I did), but is it possible it will affect the asterisk service
in any other negative way?

It "feels" very expensive. Part of it is because of starting a new
instance of Asterisk. It will not load any module and such, but if you
care about speed, you can use netcat (it takes some care).

You'll also encounter some artificial delays in the response which make
it feel more expensive.

The main reason to avoid it is because its output is not intended for
automated parsing.

--
Tzafrir Cohen
icq#16849755 jabber:tzafrir.cohen@xorcom.com
+972-50-7952406 mailto:tzafrir.cohen@xorcom.com
http://www.xorcom.com

--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users
Back to top
sgriepentrog at digium...
Guest





PostPosted: Thu Apr 24, 2014 1:58 pm    Post subject: [asterisk-users] Asterisk -rx, how expensive is it? Should y Reply with quote

That's a good point also - if you're doing something automated, AMI is likely a better option.  The connection to Asterisk is persistent, and information output is structured and we take pains not to break the API definition, which is not true of CLI output.



On Thu, Apr 24, 2014 at 12:47 PM, Tzafrir Cohen <tzafrir.cohen@xorcom.com (tzafrir.cohen@xorcom.com)> wrote:
Quote:
On Thu, Apr 24, 2014 at 12:20:37PM +0200, Mikael Fredin wrote:
Quote:
Just like the subject sais - how expensive is it to execute a lot of these
commands to keep track of different things in asterisk?

I have avoided doing this because it feels a bit like a risk to spam the
asterisk CLI this way, but is it really?

CPU-wise it doesn't seem very expensive to do it 100 times a second (from a
simple test I did), but is it possible it will affect the asterisk service
in any other negative way?



It "feels" very expensive. Part of it is because of starting a new
instance of Asterisk. It will not load any module and such, but if you
care about speed, you can use netcat (it takes some care).

You'll also encounter some artificial delays in the response which make
it feel more expensive.

The main reason to avoid it is because its output is not intended for
automated parsing.

--
               Tzafrir Cohen
icq#16849755              jabber:tzafrir.cohen@xorcom.com ([email]jabber%3Atzafrir.cohen@xorcom.com[/email])
+972-50-7952406           mailto:tzafrir.cohen@xorcom.com (tzafrir.cohen@xorcom.com)
http://www.xorcom.com

--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
               http://www.asterisk.org/hello

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






--
Scott Griepentrog
Digium, Inc ˇ Software Developer
445 Jan Davis Drive NW ˇ Huntsville, AL 35806 ˇ US
direct/fax: +1 256 428 6239 ˇ mobile: +1 317 507 4029
Check us out at: http://digium.com ˇ http://asterisk.org
Back to top
mikael at wiraya.com
Guest





PostPosted: Thu Apr 24, 2014 2:12 pm    Post subject: [asterisk-users] Asterisk -rx, how expensive is it? Should y Reply with quote

Thank you, that's very useful information! Does the same go for issuing a "sip show peers" through the AMI? And do you know where I could find information of what asterisk versions may use cached information instead?

What would you suggest be better ways to monitor asterisk information?








On 24 April 2014 17:58, Scott Griepentrog <sgriepentrog@digium.com (sgriepentrog@digium.com)> wrote:
Quote:
How much Asterisk is affected depends on both how often you run a command, and even more significantly, what command you run (and which version of Asterisk).


Commands that display information about every active channel, for example "sip show peers", may slow other processing significantly because they have to briefly lock the data structures to insure valid information.  There have been improvements in more recent versions of Asterisk that reduce the negative affects of this by looking at cached information instead of locking everything.


On the other hand, requesting specific information (sip show peer X) or more generic information (sip show inuse) will have much less affect on other activity in Asterisk.





On Thu, Apr 24, 2014 at 5:20 AM, Mikael Fredin <mikael@wiraya.com (mikael@wiraya.com)> wrote:


Quote:
Just like the subject sais - how expensive is it to execute a lot of these commands to keep track of different things in asterisk?


I have avoided doing this because it feels a bit like a risk to spam the asterisk CLI this way, but is it really?


CPU-wise it doesn't seem very expensive to do it 100 times a second (from a simple test I did), but is it possible it will affect the asterisk service in any other negative way?


Regards,
Mikael




--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
               http://www.asterisk.org/hello

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




--
Scott Griepentrog
Digium, Inc ˇ Software Developer
445 Jan Davis Drive NW ˇ Huntsville, AL 35806 ˇ US
direct/fax: [url=tel:%2B1%20256%20428%206239]+1 256 428 6239[/url] ˇ mobile: [url=tel:%2B1%20317%20507%204029]+1 317 507 4029[/url]
Check us out at: http://digium.com ˇ http://asterisk.org




--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
               http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users
Back to top
mikael at wiraya.com
Guest





PostPosted: Thu Apr 24, 2014 2:14 pm    Post subject: [asterisk-users] Asterisk -rx, how expensive is it? Should y Reply with quote

I will look into netcat as well, thank you


On 24 April 2014 19:47, Tzafrir Cohen <tzafrir.cohen@xorcom.com (tzafrir.cohen@xorcom.com)> wrote:
Quote:
On Thu, Apr 24, 2014 at 12:20:37PM +0200, Mikael Fredin wrote:
Quote:
Just like the subject sais - how expensive is it to execute a lot of these
commands to keep track of different things in asterisk?

I have avoided doing this because it feels a bit like a risk to spam the
asterisk CLI this way, but is it really?

CPU-wise it doesn't seem very expensive to do it 100 times a second (from a
simple test I did), but is it possible it will affect the asterisk service
in any other negative way?



It "feels" very expensive. Part of it is because of starting a new
instance of Asterisk. It will not load any module and such, but if you
care about speed, you can use netcat (it takes some care).

You'll also encounter some artificial delays in the response which make
it feel more expensive.

The main reason to avoid it is because its output is not intended for
automated parsing.

--
               Tzafrir Cohen
icq#16849755              jabber:tzafrir.cohen@xorcom.com ([email]jabber%3Atzafrir.cohen@xorcom.com[/email])
tzafrir.cohen@xorcom.com (tzafrir.cohen@xorcom.com)
http://www.xorcom.com

--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
               http://www.asterisk.org/hello

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


Back to top
mikael at wiraya.com
Guest





PostPosted: Thu Apr 24, 2014 2:15 pm    Post subject: [asterisk-users] Asterisk -rx, how expensive is it? Should y Reply with quote

Ah read your reply too late, yeah I will look into using the AMI.


On 24 April 2014 20:58, Scott Griepentrog <sgriepentrog@digium.com (sgriepentrog@digium.com)> wrote:
Quote:
That's a good point also - if you're doing something automated, AMI is likely a better option.  The connection to Asterisk is persistent, and information output is structured and we take pains not to break the API definition, which is not true of CLI output.



On Thu, Apr 24, 2014 at 12:47 PM, Tzafrir Cohen <tzafrir.cohen@xorcom.com (tzafrir.cohen@xorcom.com)> wrote:
Quote:
On Thu, Apr 24, 2014 at 12:20:37PM +0200, Mikael Fredin wrote:
Quote:
Just like the subject sais - how expensive is it to execute a lot of these
commands to keep track of different things in asterisk?

I have avoided doing this because it feels a bit like a risk to spam the
asterisk CLI this way, but is it really?

CPU-wise it doesn't seem very expensive to do it 100 times a second (from a
simple test I did), but is it possible it will affect the asterisk service
in any other negative way?



It "feels" very expensive. Part of it is because of starting a new
instance of Asterisk. It will not load any module and such, but if you
care about speed, you can use netcat (it takes some care).

You'll also encounter some artificial delays in the response which make
it feel more expensive.

The main reason to avoid it is because its output is not intended for
automated parsing.

--
               Tzafrir Cohen
icq#16849755              jabber:tzafrir.cohen@xorcom.com ([email]jabber%3Atzafrir.cohen@xorcom.com[/email])
tzafrir.cohen@xorcom.com (tzafrir.cohen@xorcom.com)
http://www.xorcom.com

--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
               http://www.asterisk.org/hello

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








--
Scott Griepentrog
Digium, Inc ˇ Software Developer
445 Jan Davis Drive NW ˇ Huntsville, AL 35806 ˇ US
direct/fax: [url=tel:%2B1%20256%20428%206239]+1 256 428 6239[/url] ˇ mobile: [url=tel:%2B1%20317%20507%204029]+1 317 507 4029[/url]
Check us out at: http://digium.com ˇ http://asterisk.org





--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
               http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users
Back to top
sgriepentrog at digium...
Guest





PostPosted: Thu Apr 24, 2014 2:36 pm    Post subject: [asterisk-users] Asterisk -rx, how expensive is it? Should y Reply with quote

The Stasis message bus and caching is introduced in Asterisk 12.  https://wiki.asterisk.org/wiki/display/AST/Asterisk+12+API+Improvements  Note that as it's fairly new, in some cases older code may still lock data structures during operations rather than read the cache.


You will also want to see if ARI (https://wiki.asterisk.org/wiki/display/AST/Getting+Started+with+ARI) can provide what you need.  This is newer code and more likely to use the cache and be efficient.





On Thu, Apr 24, 2014 at 2:12 PM, Mikael Fredin <mikael@wiraya.com (mikael@wiraya.com)> wrote:
Quote:
Thank you, that's very useful information! Does the same go for issuing a "sip show peers" through the AMI? And do you know where I could find information of what asterisk versions may use cached information instead?

What would you suggest be better ways to monitor asterisk information?








On 24 April 2014 17:58, Scott Griepentrog <sgriepentrog@digium.com (sgriepentrog@digium.com)> wrote:
Quote:
How much Asterisk is affected depends on both how often you run a command, and even more significantly, what command you run (and which version of Asterisk).


Commands that display information about every active channel, for example "sip show peers", may slow other processing significantly because they have to briefly lock the data structures to insure valid information.  There have been improvements in more recent versions of Asterisk that reduce the negative affects of this by looking at cached information instead of locking everything.


On the other hand, requesting specific information (sip show peer X) or more generic information (sip show inuse) will have much less affect on other activity in Asterisk.





On Thu, Apr 24, 2014 at 5:20 AM, Mikael Fredin <mikael@wiraya.com (mikael@wiraya.com)> wrote:


Quote:
Just like the subject sais - how expensive is it to execute a lot of these commands to keep track of different things in asterisk?


I have avoided doing this because it feels a bit like a risk to spam the asterisk CLI this way, but is it really?


CPU-wise it doesn't seem very expensive to do it 100 times a second (from a simple test I did), but is it possible it will affect the asterisk service in any other negative way?


Regards,
Mikael




--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
               http://www.asterisk.org/hello

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




--
Scott Griepentrog
Digium, Inc ˇ Software Developer
445 Jan Davis Drive NW ˇ Huntsville, AL 35806 ˇ US
direct/fax: [url=tel:%2B1%20256%20428%206239]+1 256 428 6239[/url] ˇ mobile: [url=tel:%2B1%20317%20507%204029]+1 317 507 4029[/url]
Check us out at: http://digium.com ˇ http://asterisk.org




--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
               http://www.asterisk.org/hello

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 --
New to Asterisk? Join us for a live introductory webinar every Thurs:
               http://www.asterisk.org/hello

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




--
Scott Griepentrog
Digium, Inc ˇ Software Developer
445 Jan Davis Drive NW ˇ Huntsville, AL 35806 ˇ US
direct/fax: +1 256 428 6239 ˇ mobile: +1 317 507 4029
Check us out at: http://digium.com ˇ http://asterisk.org
Back to top
asterisk_list at earth...
Guest





PostPosted: Fri Apr 25, 2014 5:49 am    Post subject: [asterisk-users] Asterisk -rx, how expensive is it? Should y Reply with quote

On Thursday 24 Apr 2014, Mikael Fredin wrote:
Quote:
I will look into netcat as well, thank you

There's not much to look into, really! It's just a command-line tool for
connecting STDIN and STDOUT to a network socket.

$ echo -e "WIBBLE\nWIBBLE\nWIBBLE" | nc somehost.co.uk 3245

will send
WIBBLE
WIBBLE
WIBBLE
to port 3245 of host somehost.co.uk , and display any response coming back on
STDOUT. It really is that simple!

Another example:

$ echo -e "USER fred\nPASS b00bies\nQUIT" | nc pop3.myisp.co.uk 110

will quickly login to your POP3 server and then logout without retrieving any
messages; this can be useful if you need to make a POP3 connection before you
can send mail using SMTP.

--
AJS

Note: Originating address only accepts e-mail from list! If replying off-
list, change address to asterisk1list at earthshod dot co dot uk .

--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users
Back to top
tzafrir.cohen at xorco...
Guest





PostPosted: Sun Apr 27, 2014 12:56 pm    Post subject: [asterisk-users] Asterisk -rx, how expensive is it? Should y Reply with quote

On Fri, Apr 25, 2014 at 11:48:42AM +0100, A J Stiles wrote:
Quote:
On Thursday 24 Apr 2014, Mikael Fredin wrote:
Quote:
I will look into netcat as well, thank you

There's not much to look into, really! It's just a command-line tool for
connecting STDIN and STDOUT to a network socket.

$ echo -e "WIBBLE\nWIBBLE\nWIBBLE" | nc somehost.co.uk 3245

will send
WIBBLE
WIBBLE
WIBBLE
to port 3245 of host somehost.co.uk , and display any response coming back on
STDOUT. It really is that simple!

Another example:

$ echo -e "USER fred\nPASS b00bies\nQUIT" | nc pop3.myisp.co.uk 110

will quickly login to your POP3 server and then logout without retrieving any
messages; this can be useful if you need to make a POP3 connection before you
can send mail using SMTP.

Which is a bit irrelevant if you want to connect to Asterisk through the
unix-domain socket [/var]/run/asterisk/asterisk.ctl .

--
Tzafrir Cohen
icq#16849755 jabber:tzafrir.cohen@xorcom.com
+972-50-7952406 mailto:tzafrir.cohen@xorcom.com
http://www.xorcom.com

--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users
Back to top
Display posts from previous:   
Post new topic   Reply to topic    VoIP Mailing List Archives Forum Index -> Asterisk Users All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group

VoiceMeUp - Corporate & Wholesale VoIP Services