Thank you for your response!

I am currently replacing the call_control module used with CDRTool Prepaid with the dialog module using hash tables. The speed and stability are tremendously better!

My concern is two-fold:
1) I do not want calls to be blocked because I set the hash table size too small.  
2) I do not want any memory usage problems that could cause kamailio stability issues.

My understanding, or at least how I want to use the "hash_size" modparam, is that hash_size gives dialog a set memory space (aka slots and buckets) to store the dialogs being tracked.  This is great since I "think" I will have constant memory consumption that will be a fixed amount and never "grow".  However, I wanted to get a rough idea of how many dialogs (customer calls) I could track per kamailio instance to properly choose the hash size.

I thought it would be easy to set the value to something very small in the lab and just run up the number of calls until kamailio hits an upper limit and fails to create any more dialogs. 
modparam("dialog", "hash_size", 32)

However, I am able to create almost 2000 dialogs no matter what size I choose.  After, reading the information in the link about hash tables and your response, I see how a larger table with more "hashing" increases lookup performance, but I still do not see how the total number of dialogs that the module tracks can be set so that the kamailio memory usage is protected.  I still look at the hash_size as the key here and that there should be a relationship, perhaps rough at best, to the maximum number of dialogs supported in the table.

Thanks so much for your time,
Mark Blackord
Digium Cloud Services

On Sat, Dec 2, 2017 at 2:50 AM, Daniel-Constantin Mierla <miconda@gmail.com> wrote:

Hello,

hash size does not set any limitation to the number of dialogs (active calls), it has impact on searching the dialogs, so if you have a lot of active calls, increasing the hash size might improve performances. Effectively the hash size is used to compute the number of slots (aka buckets) the hash table is going to have, see more technical details about hash tables at:

  - https://en.wikipedia.org/wiki/Hash_table

Can you elaborate on your statement:

> but even setting the hash size to a very tiny number does stop me from creating hundreds of dialogs

Do you mean you are not able to create as many dialogs as you want?

Cheers,
Daniel


On 01.12.17 19:54, Mark Blackford wrote:
Hello,

I am trying to properly size the use of the Dialog Module hash for our implementation using:

modparam("dialog", "hash_size", <number that is power of two>)

However, in my testing, I have been unable to figure out the relationship between the hash size and a number of dialogs I need to support.  I think the hash size is specifying a memory block in kB, but even setting the hash size to a very tiny number does stop me from creating hundreds of dialogs.

Is there a way to determine a relationship between the hash size and a rough number of dialogs that would be expected?

An example of a a dialog looks like this from kamctl:

[root@kamailio01 ~]# kamctl dialog show
dialog memory records
dialog::  hash=22:70
state:: 4
ref_count:: 2
timestart:: 1512151205
timeout:: 36083666
from_tag:: 10.155.8.40+1+689d7e5e+8fcf481a
caller_cseq:: 24115
caller_route_set:: 
caller_bind_addr:: udp:10.155.8.11:5060
callee_bind_addr:: udp:10.155.8.11:5060
to_tag:: sip+1+bdcd0004+2038f37c
callee_cseq:: 0
callee_route_set:: 

 

Thanks!
--
Mark Blackford
Digium Cloud Services
678.230.8769



_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users

-- 
Daniel-Constantin Mierla
www.twitter.com/miconda -- www.linkedin.com/in/miconda
Kamailio Advanced Training - www.asipto.com
Kamailio World Conference - May 14-16, 2018 - www.kamailioworld.com



--
Mark Blackford
Digium Cloud Services
678.230.8769