title: Flink Serialization: POJO type vs. GenericType
body: <p>In my Flink application, I use java.time.Instant to represent UTC timestamps. The application is running fine, but I recently noticed this message in the Flink logs:</p>
  
  <p>"Class class java.time.Instant cannot be used as a POJO type because not all fields are valid POJO fields, and must be processed as GenericType. Please read the Flink documentation on \"Data Types &amp; Serialization\" for details of the effect on performance."</p>
  
  <p>When I went to read the documentation, there is not much discussion on the performance hit of using something like Instant. My general understanding is that Kryo must be used instead of Flink's built in serializers. I am currently using Flink 1.6 and see that Flink 1.7 and above appear to have an InstantSerializer class. Does this mean that if I upgrade Flink versions, that my POJOs that use Instant will no longer need to be processed as a GenericType? </p>
  
  <p>In general, what is the best java class to use to represent time? Is there a way to use Instant and mitigate or eliminate any effect on performance?</p>