Review Board 1.7.16

res_sorcery_config: Improve object lookup times using SCIENCE!

Review Request #4423 - Created Feb. 14, 2015 and submitted

Joshua Colp
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.
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.
Review request changed
Updated (Feb. 15, 2015, 12:23 p.m.)
  • changed from pending to submitted
Committed in revision 431859 runs on a server provided by Digium, Inc. and uses bandwidth donated to the open source Asterisk community by API Digital Communications in Huntsville, AL USA.
Please report problems with this site to