[asterisk-dev] [Code Review] 2881: Performance: Taskprocessor optimization; switch Stasis to use taskprocessors

Matt Jordan reviewboard at asterisk.org
Mon Sep 30 10:51:56 CDT 2013


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



/team/dlee/performance/include/asterisk/sem.h
<https://reviewboard.asterisk.org/r/2881/#comment19049>

    I'd add a comment here that this is here to protect the ABI for when we need to add process level semaphores. Currently, however, the implementation doesn't support it.



/team/dlee/performance/main/taskprocessor.c
<https://reviewboard.asterisk.org/r/2881/#comment19050>

    Your call, but since this is only called in one place, you could probably combine these two functions now.
    
    



/team/dlee/performance/main/taskprocessor.c
<https://reviewboard.asterisk.org/r/2881/#comment19051>

    Just for easier maintenance, reference in the comment that this is bumped in default_listener_shutdown.
    
    (You could also use ao2_t_ref and put some tags on these reference changes, as correlating a pair of ref change across multiple functions is tricky)


- Matt Jordan


On Sept. 27, 2013, 7:58 p.m., David Lee wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/2881/
> -----------------------------------------------------------
> 
> (Updated Sept. 27, 2013, 7:58 p.m.)
> 
> 
> Review request for Asterisk Developers.
> 
> 
> Repository: Asterisk
> 
> 
> Description
> -------
> 
> This patch optimizes taskprocessor to use a semaphore for signaling,
> which the OS can do a better job at managing contention and waiting
> that we can with a mutex and condition.
> 
> The taskprocessor execution was also slightly optimized to reduce the
> number of locks taken.
> 
> The only observable difference in the taskprocessor implementation is
> that when the final reference to the taskprocessor goes away, it will
> execute all tasks to completion instead of discarding the unexecuted
> tasks.
> 
> For systems where unnamed semaphores are not supported, a really
> simple semaphore implementation is provided. (Which gives identical
> performance as the original taskprocessor implementation).
> 
> The way we ended up implementing Stasis caused the threadpool to be a
> burden instead of a boost to performance. This was switched to just
> use taskprocessors directly for subscriptions.
> 
> 
> Diffs
> -----
> 
>   /team/dlee/performance/configs/stasis.conf.sample 399869 
>   /team/dlee/performance/configure UNKNOWN 
>   /team/dlee/performance/configure.ac 399869 
>   /team/dlee/performance/include/asterisk/autoconfig.h.in 399869 
>   /team/dlee/performance/include/asterisk/sem.h PRE-CREATION 
>   /team/dlee/performance/include/asterisk/stasis.h 399869 
>   /team/dlee/performance/include/asterisk/taskprocessor.h 399869 
>   /team/dlee/performance/main/sem.c PRE-CREATION 
>   /team/dlee/performance/main/stasis.c 399869 
>   /team/dlee/performance/main/stasis_config.c 399869 
>   /team/dlee/performance/main/taskprocessor.c 399869 
> 
> Diff: https://reviewboard.asterisk.org/r/2881/diff/
> 
> 
> Testing
> -------
> 
> Unit tests pass.
> 
> Same performance test as from https://reviewboard.asterisk.org/r/2873/
> 
> 
> Thanks,
> 
> David Lee
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20130930/999fa19b/attachment.html>


More information about the asterisk-dev mailing list