The size from JMX is coming from the BinaryMemoryCalculator class. This class adds some padding onto the calculation to account for various fields in the entry among other things. If you change your code to use the same class you might get comparable results.
BinaryMemoryCalculator calculator = new BinaryMemoryCalculator(); Serializer serializer = cache.getCacheService().getSerializer(); int entrySize = calculator.calculateUnits(ExternalizableHelper.toBinary(tKey, serializer), ExternalizableHelper.toBinary(tEntry, serializer));
Thanks very much JK.
In one of the old coherence documentation I can accross that there is roughly 150byte coherence overhead per entry stored in cache. So is it fair to say
1. Size returned by JMX includes the actual entry size and also the overhead added.
2. Size returned by ExternalizableHelper, is just the size of the entry in Binary form?