window算子会丢弃迟到数据,可以看看是不是这个原因。如果是的话,可以调整一下watermark生成策略,适当增加点延迟,可以看一下:BoundedOutOfOrdernessTimestampExtractor

> 在 2019年12月25日,上午10:39,1530130567 <1530130...@qq.com> 写道:
> 
> 大佬们好:
> 
> 最近使用window+processfunction处理数据,并加了watermark延迟处理。
> 
> 发现当数据input到达一定峰值后就会出现数据丢失的现象,请问是processfunction处理能力不够导致的吗?
> 具体数据处理情况可看下图:(如图片无法显示,请打开此链接查看)
> https://www.imageoss.com/image/sTn2U
> 
> 看了一下metric,确实是recordsIn&gt;recordsOut
> 代码里就是用了一个window然后配processfunction,也没有任何的filter操作。
> 代码如下:
> .window(TumblingEventTimeWindows.of(org.apache.flink.streaming.api.windowing.time.Time.minutes(1)))
> .process(new ProcessWindowFunction<Row, Row, Integer, TimeWindow&gt;() {
>     @Override
>     public void process(Integer integer, Context context, Iterable<Row&gt; 
> elements, Collector<Row&gt; out) {
>         for (Row element : elements) {
>                 out.collect(element);
>         }
>     }
> })

回复