Collections within POJOs/tuples

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Collections within POJOs/tuples

Kruse, Sebastian
Hello everyone,

I was just wondering, which class would be most efficient to store collections of primitive elements, and which one to store objects, within POJOs and tuples from a serialization point of view. And would it make any difference if such a collection is not embedded within a POJO/tuple but is the "top-level element"?

Cheers,
Sebastian
Reply | Threaded
Open this post in threaded view
|

Re: Collections within POJOs/tuples

Stephan Ewen
Here are some rough cornerpoints for serialization efficiency in Flink:

 - Tuples are a bit more efficient than POJOs, because they do not support (and encode) possible subclasses and they do not involve and reflection code at all.

 - Arrays are more efficient than collections (collections go in Scala through the collection serializer, sometimes through Kryo, arrays are handles directly)

 - The efficiency of a "Tuple1<Type>" is virtually the same as that of "Type", since the Tuple is never serialized, it is just in the TypeInformation metadata and not in the serialized data

 - Arrays or lists as a top level element are good. Don't pout them into a POJO or a tuple unless you need to add also other fields.


Let us know if you have more questions.

On Fri, Apr 17, 2015 at 8:54 AM, Kruse, Sebastian <[hidden email]> wrote:
Hello everyone,

I was just wondering, which class would be most efficient to store collections of primitive elements, and which one to store objects, within POJOs and tuples from a serialization point of view. And would it make any difference if such a collection is not embedded within a POJO/tuple but is the "top-level element"?

Cheers,
Sebastian