问题
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?
回答1:
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.
来源:https://stackoverflow.com/questions/49780044/apache-ignite-binaryobject-bloat