This is a ringless implementation of millisecond precision timer and millisecond async_sleep function. I've added the functionality to the current async mod but this can me moved to a dedicated module.
For now only the async_ms_sleep is implemented but async_ms_route is just a few lines.
Anyway how should I proceed with cleanup so this can be accepted ?
With millisecond precision sleep one can easily implement a leaky bucket request shaper that delays incoming requests to achieve perfect rate limits per customer/sip-trunk/whatever without dropping requests. No more spikes and no more 503s.
I've implemented external HTTP microservice that returns millisecond delays per dialog initiating request and tested it with SIPP with 3 flows/streams each with 250 CAPS. No leaks nor other issues in 24hrs of testing.
You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/2008
-- Commit Summary --
* ms resolution sleep * fix leak * add functions * register additional timer * don't forget the tail * timeradd expects normalized parameteres * Don not eat the chain links
-- File Changes --
M src/modules/async/async_mod.c (83) M src/modules/async/async_sleep.c (210) M src/modules/async/async_sleep.h (8)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/2008.patch https://github.com/kamailio/kamailio/pull/2008.diff