Hello I am having one question in regards of the latest Hazecast versions and serialization. Lets have the following class:
class Customer implements DataSerializeable {
List<Address> adresses;
CustomerDetails details;
}
Both classes Address and CustomerDetails implement DataSerializeable. The way we are serializing them at the moment is:
public void writeData(ObjectDataOutput out) throws IOException {
out.writeObject(address);
out.writeObject(details);
}
In some examples online I saw that the way they are serializing the same class is:
public void writeData(ObjectDataOutput out) throws IOException {
address.writeData(out);
short size = details.size();
out.writeShort(size);
for (CustomerDetail detail: details) {
detail.writeData(out);
}
}
I ran some performance test over couple of milion records I was not able to observe significant difference in performance.
What is the recommended way to do serialization of the Nested Objects. Can someone comment on that with regards of the latest Hazelcast version 3.6.
Thank you
These days there is no noticeable difference since we have optimized serializers for ArrayList, LinkedList, HashMap. That way you get the almost same benefit as handwriting it.
The ArrayList serializer classes can be found here: https://github.com/hazelcast/hazelcast/blob/master/hazelcast/src/main/java/com/hazelcast/internal/serialization/impl/ArrayListStreamSerializer.java
Looking at the code you'll see, that it'll give you almost the same benefit.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With