[sr-dev] Long running callbacks

Jason Penton jason.penton at gmail.com
Wed Jun 6 10:34:27 CEST 2012


Hi All,

I was wondering if there was an existing pattern is Kamailio to deal with
long-running code being executed on a callback. If we take, for example,
usrloc. Lets say the domains are synced every 60 seconds. Assume there are
going to be 200 expired contacts at the next fire. Now imagine the callback
for each expired contact having to do some long IO (viz talking to DB, in
IMS case doing diameter, etc). Under load, some of these task can be in
excess of 100ms. In this specific case your timer (albeit most likely a
slow timer in this case) will be "stuck" running the callbacks for a good
(100ms x 200) = 20 seconds :-/

I can only think of using some form of async model to get around this. I
know there would be the pain of most likely having to use reference
counting, for example in usrloc on urecords and ucontacts.

Does anyone have any ideas around this? Is there a gap to look at some core
functionality for handling async callbacks? does it already exist and I
have missed it?

ideas/comments welcome.

cheers
jason
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-dev/attachments/20120606/b918c857/attachment.htm>


More information about the sr-dev mailing list