[asterisk-commits] russell: branch 1.6.2 r185433 - /branches/1.6.2/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Mar 31 14:08:19 CDT 2009
Author: russell
Date: Tue Mar 31 14:08:16 2009
New Revision: 185433
URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=185433
Log:
Blocked revisions 185432 via svnmerge
........
r185432 | russell | 2009-03-31 14:07:58 -0500 (Tue, 31 Mar 2009) | 40 lines
Improve performance of the code handling the frame queue in chan_iax2.
In my tests that exercised full frame handling in chan_iax2, the version with
these changes took 30% to 40% of the CPU time compared to the same test of
Asterisk trunk before these modifications.
While doing some profiling for <http://reviewboard.digium.com/r/205/>,
one function that caught my eye was network_thread() in chan_iax2.c.
After the things that I was working on there, it was the next target
for analysis and optimization. I used oprofile's source annotation
functionality and found that the loop traversing the frame queue in
network_thread() was to blame for the excessive CPU cycle consumption.
The frame_queue in chan_iax2 previously held all frames that either were
pending transmission or had been transmitted and are still pending
acknowledgment.
In network_thread(), the previous code would go back through the main
for loop after reading a single incoming frame or after being signaled
because a frame had been queued up for initial transmission. In each
iteration of the loop, it traverses the entire frame queue looking for
frames that need to be transmitted. On a busy server, this could easily
be quite a few entries.
This patch is actually quite simple. The frame_queue has become only a list
of frames pending acknowledgment. Frames that need to be transmitted are
queued up to a dedicated transmit thread via the taskprocessor API.
As a result, the code in network_thread() becomes much simpler, as its only
job is to read incoming frames.
In addition to the previously described changes, this patch includes some
additional changes to the frame_queue. Instead of one big frame_queue, now
there is a list per call number to further reduce wasted list traversals.
The biggest impact of this change is in socket_process().
For additional details on testing and test results, see the review request.
Review: http://reviewboard.digium.com/r/212/
........
Modified:
branches/1.6.2/ (props changed)
Propchange: branches/1.6.2/
------------------------------------------------------------------------------
--- trunk-blocked (original)
+++ trunk-blocked Tue Mar 31 14:08:16 2009
@@ -1,1 +1,1 @@
-/trunk:182362,182521,182762,182960,183124,183148,183196,183239,183553-183555,184986
+/trunk:182362,182521,182762,182960,183124,183148,183196,183239,183553-183555,184986,185432
More information about the asterisk-commits
mailing list