You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by kotamrajuyashasvi <ko...@gmail.com> on 2017/09/01 08:20:48 UTC
hashcode() collisions for data having more than 2 power 32(around
4.3 billion) entries in ignite cache
Hi
I am using a user-defined java object as a cache key in my ignite cache.
Ignite uses the cache key objects overridden hashcode() method during
mapping in cache. But hashcode() method returns an int which is 32 bits. Now
if my cache has entries more than 2 power 32 which is around 4.3 billion ,
then definitely collisions occur. How to tackle this situation. Does ignite
provide an option where it could use some other own implemented method which
would return a hashcode presumably containing more number of bits(64,128,256
etc) which could be used by ignite while mapping.
--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/
Re: hashcode() collisions for data having more than 2 power 32(around
4.3 billion) entries in ignite cache
Posted by Denis Mekhanikov <dm...@gmail.com>.
Hi!
Hash code used by Ignite is indeed 32-bit, but it seems to be enough in
most use-cases.
If you put so many objects into a cache, then collisions will definitely
occur, but they will be resolved using 'equals' methods. Collisions happen
on much smaller datasets, this is part of normal work of a cache or a hash
table, but they may make the cache work slower.
Do you have a use-case when you want to put more than 4 billion objects
into cache?
Thank you!
Denis.
пт, 1 сент. 2017 г. в 11:20, kotamrajuyashasvi <kotamrajuyashasvi@gmail.com
>:
> Hi
>
> I am using a user-defined java object as a cache key in my ignite cache.
> Ignite uses the cache key objects overridden hashcode() method during
> mapping in cache. But hashcode() method returns an int which is 32 bits.
> Now
> if my cache has entries more than 2 power 32 which is around 4.3 billion ,
> then definitely collisions occur. How to tackle this situation. Does ignite
> provide an option where it could use some other own implemented method
> which
> would return a hashcode presumably containing more number of
> bits(64,128,256
> etc) which could be used by ignite while mapping.
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>