One more way to optimize your Flink application is to provide some information about what your user-defined functions are doing with input data. Since Flink can’t parse and understand code, you can provide crucial information that will help to build a more efficient execution plan. There are three annotations that we can use:
@ForwardedFields: Specifies what fields in an input value were left unchanged and are used in an output value.
@NotForwardedFields: Specifies fields that were not preserved in the same positions in the output.
@ReadFields: Specifies what fields were used to compute a result value. You should only specify fields that were used in computations and not merely copied to the output.
Click through for his four tips.