我使用的是apachebeam,流式收集容量为1.5GB。
当我在没有侧输入的情况下运行 pipeline 时,我的 job 将在大约2分钟内完成。当我用侧边输入运行我的 job时,我的 job将永远不会完成,会死掉。
下面是我用来存储查找的代码(~1M条记录)
PCollectionView> sideData = pipeline.apply(JdbcIO.>read()
.withDataSourceConfiguration(JdbcIO.DataSourceConfiguration.create(
"com.mysql.jdbc.Driver", "jdbc:mysql://ip")
.withUsername("username")
.withPassword("password"))
.withQuery("select a_number from cell")
.withCoder(KvCoder.of(StringUtf8Coder.of(), StringUtf8Coder.of()))
.withRowMapper(new JdbcIO.RowMapper>() {
public KV mapRow(ResultSet resultSet) throws Exception {
return KV.of(resultSet.getString(1), resultSet.getString(1));
}
})).apply(View.asMap());
这是我的 streaming收藏代码
pipeline
.apply("ReadMyFile", TextIO.read().from("/home/data/**")
.watchForNewFiles(Duration.standardSeconds(60), Watch.Growth.never()))
.apply(Window.into(new GlobalWindows())
.triggering(Repeatedly.forever(AfterProcessingTime.pastFirstElementInPane().plusDelayOf(Duration.standardSeconds(30))))
.accumulatingFiredPanes()
.withAllowedLateness(ONE_DAY))
下面是我的parDo的代码,用于迭代每个事件行(共10M条记录)
.apply(ParDo.of(new DoFn,KV>() {
@ProcessElement
public void processElement(ProcessContext c) {
KV i = c.element();
String sideInputData = c.sideInput(sideData).get(i.getKey());
if (sideInputData == null) {
c.output(i);
}
}
}).withSideInputs(sideData));
我使用的是flink集群,但使用的是directrunner输出。
集群:
2个cpu
我做错什么了?