Apache Ignite BinaryObject Bloat

不想你离开。 提交于 2019-12-24 20:11:39

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!