0

I have a custom object which I am converting to BinaryObject (using the BinaryObjectBuilder) before putting it into ignite cache. I calculated the deep size of my custom object and it is about 500 bytes.

But when I calculate the size of BinaryObject, it is a whopping ~8 MB.

Is this expected?

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
CaptainHastings
  • 1,557
  • 1
  • 15
  • 32

1 Answers1

4

If you take a look at BinaryObjectImpl class, you will see, that some fields have @GridDirectTransient annotations, meaning that these fields are ignored during serialization. These are pretty big objects, like BinaryContext, which contains quite a lot of system stuff.

If you want to get approximation of size of a BinaryObject, you can cast it to BinaryObjectImpl and call BinaryObjectImpl#array() method on it. You will get a byte array which is a serialized representation of your object. Size of this array will give you an approximation of the BinaryObject's size.

Denis
  • 3,573
  • 8
  • 13
  • Thank you! I knew it had to something similar. Can't possibly get the type of performance they claim to get by sending ~8MB across the wire. :) Cheers. – CaptainHastings Apr 11 '18 at 18:03