Previously GridMetadataAwareAdapter used LeanMap to store entry's metadata.
But LeanMap was not so lean as expected.

I've created test (GridMetadataAwareAdapterLoadSelfTest) shows how much
time and memory need to create 1_000_000 GridCacheMockEntry.

Each case creates 1_000_000 entries and adds meta as described:

LeanMap (initial implementation)

all 10 keys [time=5140 ms, memory=940.3 mb]

all 3 keys [time=1748 ms, memory=176.3 mb]

first key only [time=968 ms, memory=97.9 mb]

second key only [time=902 ms, memory=97.9 mb]

third key only [time=953 ms, memory=97.9 mb]

tenth key only [time=988 ms, memory=97.9 mb]

random (1-3) key [time=1041 ms, memory=97.9 mb]

no meta [time=276 ms, memory=39.1 mb]

first key is random UUID, second is random UUID too and so on...


I've changed LeanMap to regular array and gain these results:

all 10 keys [time=1410 ms, memory=78.6 mb]

all 3 keys [time=801 ms, memory=39.3 mb]

first key only [time=636 ms, memory=39.3 mb]

second key only [time=722 ms, memory=39.3 mb]

third key only [time=750 ms, memory=39.3 mb]

tenth key only [time=765 ms, memory=78.6 mb]

random (1-3) key [time=664 ms, memory=39.3 mb]

no meta [time=173 ms, memory=19.6 mb]

first key is 0, second is 1 and so on...

Currently maximum key index used to create meta is 2, so results should be
compared at "all 3 keys", "third key only" and "no meta" cases.

So, extra costs was reduced.

Reply via email to