flink Operator State 是线程安全的吗? [英] flink Operator State is thread safe?

查看:51
本文介绍了flink Operator State 是线程安全的吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Operator State(或非键控状态)下,每个 operator state 都绑定到一个并行的 operator 实例

With Operator State (or non-keyed state), each operator state is bound to one parallel operator instance

以上引文来自Flink官网.每个并行算子实例可能有线程池.当这些线程访问 Operator State 时(如上所述,每个并行 operator 实例可以有一个 operator state),是否会遇到线程安全问题?我应该在 Java 中使用具有以下术语的 Operator State 吗?

The above quote is from the official Flink website. Each parallel operator instance may have thread pool. When these threads access the Operator State (as described above, each parallel operator instance can have one operator state), would it encounter a thread-safe problem? Should I use Operator State with terminology like below in Java?

synchronize(stateInstance){
//update state
}

推荐答案

我想知道线程池是什么意思,它将如何与 Flink 管理状态交互?

I wonder what do you mean thread pool and how will it interact with Flink managed state?

如果问题中提到的线程池是在Flink TaskManager上运行的Flink task.然后它是线程安全的.Flink 是一个分布式系统.它使用并行运算符实例执行任务,因此每个运算符实例的托管状态自然是线程安全的.

If the thread pool you mentioned in the question is Flink task running on the Flink TaskManager. Then it is thread-safe. Flink is a distributed system. It executes the task with parallel operator instances, so the managed state of each operator instance is thread-safe naturally.

这篇关于flink Operator State 是线程安全的吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆