[prev in list] [next in list] [prev in thread] [next in thread] 

List:       asterisk-dev
Subject:    Re: [asterisk-dev] [Code Review] 2873: Stasis performance improvements
From:       "svnbot" <reviewboard () asterisk ! org>
Date:       2013-09-30 15:24:16
Message-ID: 20130930152416.30059.59515 () hotblack ! digium ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/2873/
-----------------------------------------------------------

(Updated Sept. 30, 2013, 10:24 a.m.)


Status
------

This change has been marked as submitted.


Review request for Asterisk Developers.


Changes
-------

Committed in revision 400138


Repository: Asterisk


Description
-------

This patch addresses several performance problems that were found in
the initial performance testing of Asterisk 12.

The Stasis dispatch object was allocated as an AO2 object, even though
it has a very confined lifecycle. This was replaced with a straight
ast_malloc().

The Stasis message router was spending an inordinate amount of time
searching hash tables. In this case, most of our routers had 6 or
fewer routes in them to begin with. This was replaced with an array
that's searched linearly for the route.

We more heavily rely on AO2 objects in Asterisk 12, and the memset()
in ao2_ref() actually became noticeable on the profile. This was
#ifdef'ed to only run when AO2_DEBUG was enabled.

After being misled by an erroneous comment in taskprocessor.c during
profiling, the wrong comment was removed.


Diffs
-----

  /branches/12/include/asterisk/stasis_message_router.h 399650 
  /branches/12/main/astobj2.c 399650 
  /branches/12/main/stasis.c 399650 
  /branches/12/main/stasis_message_router.c 399650 
  /branches/12/main/taskprocessor.c 399650 
  /branches/12/res/res_pjsip/include/res_pjsip_private.h 399650 
  /branches/12/tests/test_stasis.c 399650 

Diff: https://reviewboard.asterisk.org/r/2873/diff/


Testing
-------

Unit tests pass.

Using the setup below, sipp was run against the 12 branch both with
and without my changes.

==
[test-server]$ cat extensions.conf 

[performance]
exten => service,1,Answer
exten => service,n,Wait(1)
exten => service,n,Hangup

[test-server]$ cat sip.conf 

[perf](!)
type=peer
qualify=no
disallow=all
allow=g722
allow=ulaw
insecure=invite,port
context=performance

[test-client](perf)
host=test-client

Simple sipp scenario:
[test-client]$ sipp -sn uac -l 100 -r 50 tests-server


Thanks,

David Lee


[Attachment #5 (text/html)]

<html>
 <body>
  <div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
   <table bgcolor="#f9f3c9" width="100%" cellpadding="8" style="border: 1px #c9c399 \
solid;">  <tr>
     <td>
      This is an automatically generated e-mail. To reply, visit:
      <a href="https://reviewboard.asterisk.org/r/2873/">https://reviewboard.asterisk.org/r/2873/</a>
  </td>
    </tr>
   </table>
   <br />



<table bgcolor="#e0e0e0" width="100%" cellpadding="8" style="border: 1px gray \
solid;">  <tr>
  <td>
   <h1 style="margin-right: 0.2em; padding: 0; font-size: 10pt;">This change has been \
marked as submitted.</h1>  </td>
 </tr>
</table>
<br />


<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" \
style="background-image: \
url('https://reviewboard.asterisk.org/static/rb/images/review_request_box_top_bg.png'); \
background-position: left top; background-repeat: repeat-x; border: 1px black \
solid;">  <tr>
  <td>

<div>Review request for Asterisk Developers.</div>
<div>By David Lee.</div>


<p style="color: grey;"><i>Updated Sept. 30, 2013, 10:24 a.m.</i></p>



<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Changes</h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: \
1px solid #b8b5a0">  <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: \
-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;">Committed in revision 400138</pre>  </td>
 </tr>
</table>







<div style="margin-top: 1.5em;">
 <b style="color: #575012; font-size: 10pt;">Repository: </b>
Asterisk
</div>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
 <table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" \
style="border: 1px solid #b8b5a0">  <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: \
-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;">This patch addresses several performance problems that were found in the \
initial performance testing of Asterisk 12.

The Stasis dispatch object was allocated as an AO2 object, even though
it has a very confined lifecycle. This was replaced with a straight
ast_malloc().

The Stasis message router was spending an inordinate amount of time
searching hash tables. In this case, most of our routers had 6 or
fewer routes in them to begin with. This was replaced with an array
that&#39;s searched linearly for the route.

We more heavily rely on AO2 objects in Asterisk 12, and the memset()
in ao2_ref() actually became noticeable on the profile. This was
#ifdef&#39;ed to only run when AO2_DEBUG was enabled.

After being misled by an erroneous comment in taskprocessor.c during
profiling, the wrong comment was removed.
</pre>
  </td>
 </tr>
</table>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: \
1px solid #b8b5a0">  <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: \
-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;">Unit tests pass.

Using the setup below, sipp was run against the 12 branch both with
and without my changes.

==
[test-server]$ cat extensions.conf 

[performance]
exten =&gt; service,1,Answer
exten =&gt; service,n,Wait(1)
exten =&gt; service,n,Hangup

[test-server]$ cat sip.conf 

[perf](!)
type=peer
qualify=no
disallow=all
allow=g722
allow=ulaw
insecure=invite,port
context=performance

[test-client](perf)
host=test-client

Simple sipp scenario:
[test-client]$ sipp -sn uac -l 100 -r 50 tests-server</pre>
  </td>
 </tr>
</table>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">

 <li>/branches/12/include/asterisk/stasis_message_router.h <span style="color: \
grey">(399650)</span></li>

 <li>/branches/12/main/astobj2.c <span style="color: grey">(399650)</span></li>

 <li>/branches/12/main/stasis.c <span style="color: grey">(399650)</span></li>

 <li>/branches/12/main/stasis_message_router.c <span style="color: \
grey">(399650)</span></li>

 <li>/branches/12/main/taskprocessor.c <span style="color: grey">(399650)</span></li>

 <li>/branches/12/res/res_pjsip/include/res_pjsip_private.h <span style="color: \
grey">(399650)</span></li>

 <li>/branches/12/tests/test_stasis.c <span style="color: grey">(399650)</span></li>

</ul>

<p><a href="https://reviewboard.asterisk.org/r/2873/diff/" style="margin-left: \
3em;">View Diff</a></p>







  </td>
 </tr>
</table>




  </div>
 </body>
</html>



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

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

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic