Based on my experience with using it for session storage for acl plugin.

 Short answer - “it really depends on distribution of your keys and their 
evolution in time”.

The bucket doubles upon a hash collision and converts into a linear search mode 
of there is still a hash collision then.

It never shrinks, but is freed up if there is no values there.

Consequently, if you are unlucky and get a bunch of hash hits which cause the 
growth of one bucket and one key remains there that holds the bucket, then your 
distribution changes and the process repeats for each of the buckets, the 
memory usage can be quite large.

Given the above properties, might be interesting to experiment by grabbing more 
buckets than 64k, this way a chance to have a bucket freed will be higher. But 
(again, a hunch) at a sufficiently large number of buckets. Till then the 
overhead of having more buckets will probably be more a loss than win...

In the acl plugin I went with 1GB for 1m entries, and made changeable both the 
number of buckets and the max amount of memory.

Hope this helps.

--a

> On 9 Oct 2018, at 16:06, Prashant Upadhyaya <[email protected]> wrote:
> 
> Hi,
> 
> I am using clib_bihash_40_8_t  (VPP version 18.01)
> The number of buckets is 65536.
> 
> I am going to add 1 million records into the bihash. My application
> takes care that at any point of time there will never be more than 1
> million records going into the bihash.
> 
> Given the above, what should be the memory size which I should pass
> into the init function of bihash to guarantee that there will no panic
> memory allocation failures during the record additions into the bihash
> (assuming that init succeeds).
> Please make no assumptions about hash collisions.
> 
> Regards
> -Prashant
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> 
> View/Reply Online (#10780): https://lists.fd.io/g/vpp-dev/message/10780
> Mute This Topic: https://lists.fd.io/mt/27122953/675608
> Group Owner: [email protected]
> Unsubscribe: https://lists.fd.io/g/vpp-dev/unsub  [[email protected]]
> -=-=-=-=-=-=-=-=-=-=-=-
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.

View/Reply Online (#10782): https://lists.fd.io/g/vpp-dev/message/10782
Mute This Topic: https://lists.fd.io/mt/27122953/21656
Group Owner: [email protected]
Unsubscribe: https://lists.fd.io/g/vpp-dev/unsub  [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to