[asterisk-dev] [Code Review] 4423: res_sorcery_config: Improve object lookup times using SCIENCE!

Joshua Colp reviewboard at asterisk.org
Sun Feb 15 11:42:46 CST 2015


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

(Updated Feb. 15, 2015, 11:42 a.m.)


Status
------

This change has been marked as submitted.


Review request for Asterisk Developers.


Changes
-------

Committed in revision 431841


Repository: Asterisk


Description
-------

The res_sorcery_config module currently uses a fixed bucket size of 53. This means that depending on the number of objects you either end up with excess buckets or a lot of collisions. Due to the way that res_sorcery_config is implemented it's actually possible to make the bucket size dynamic based on the number of objects. This is due to the fact that each loading of the config file produces a new container and does not modify the existing one. This change uses the number of expected objects and finds a prime number near it. In practice depending on the number of objects this can speed up lookups anywhere from 2X to 15X. This change also removes the lock from the container as it is not needed.


Diffs
-----

  /branches/13/res/res_sorcery_config.c 431750 

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


Testing
-------

Confirmed that a close prime number was chosen using the debug message depending on the number of objects. Confirmed that objects can still be looked up. Did some spot checking with 10,000+ endpoints to see performance impact.


Thanks,

Joshua Colp

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20150215/dfb35fe1/attachment-0001.html>


More information about the asterisk-dev mailing list