java输入流输入集合_java—哪种方法是读取更改查找和丰富流式输入集合的最佳方法?...

我使用的是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

我做错什么了?

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值