Hazelcast Portable serialization

假装没事ソ 提交于 2019-12-13 02:37:02

问题


I want to use Portable serialization for objects stored in IMap to achieve:

  • fast indexing during insertion (without deserializing objects and reflection)
  • class evolution (versioning)

Is it possible to store my classes without implementing Portableinterface?

Is it possible to store 3rd party classes like Date or BigDecimal (or with nested structure) which can not implement Portable interface, while still being indexable?


回答1:


You can achieve fast indexing using Portable, yes. You'll also see benefits when you're querying on non-indexed fields since there'll be no full deserialization. VersionedPortable support versioning as well but

  1. You must implement Portable interface
  2. For types that doesn't supported by portable, you need to convert the data to a supported format, For date Long for example. And you need to code serialization/deserialization for each property & handle versioning yourself.
  3. Portable is backward compatible only for read. If you update the data from an app who has a previous version, then you'll lost the new field updates done previously by an app has higher version of the Portable object.

So depends on your exact requirements, you need to chose the correct serialization format.

If versioning is not so important or you can handle it manually, but query performance is, then yes Portable make sense. But if you're planning to use versioning heavily, I would suggest using a backward/forward compatible serialization format like Google Protocol Buffers.

You can check this example to get an idea: https://github.com/gokhanoner/data-versioning-protobuf



来源:https://stackoverflow.com/questions/54751602/hazelcast-portable-serialization

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