[sr-dev] [kamailio] rtpengine: hash table implementation with entry expire

smititelu stefan.mititelu at 1and1.ro
Wed Nov 4 15:11:21 CET 2015


Hello,

We are working to improve the rtpengine module node selection mechanism. 
Right now, the selection is stateless, and assumes that rtpengine 
machines don't often break.

Our idea is to maintain a "callid(key)<->node(value)" global shared hash 
table with a global lock. When the "offer" comes, a new entry is 
inserted in the hash table. When subsequent commands come (e.g. 
"answer", "delete") the lookup is done and the specific node is 
selected. When the "delete" comes, the entry is freed from the 
hashtable. We've already implemented most of the rtpengine hash table API.

The question is, if _no_ "delete" comes, how to eventually free the old 
entries? The idea is to introduce a modparam for a hastable entry 
timeout and:
     1: create a separate process that looks into the hashtable and does 
the cleanup
or
     2: every time an insert/remove/lookup in the table is done, on the 
way of doing the action, check also for expired entries and free them. 
(this will free only the expired entries in the list at 
index=hash(callid) but will prevent the hash table growing too big)

What do you think about the whole hashtable idea? And how about the 
expired entries deletion?

Do you have any other advices/proposals?

Best Regards,
1&1 Team



More information about the sr-dev mailing list