简体   繁体   English

flink运营商状态是线程安全的吗?

[英]flink Operator State is thread safe?

With Operator State (or non-keyed state), each operator state is bound to one parallel operator instance 使用运算符状态(或非键状态),每个运算符状态都绑定到一个并行运算符实例

The above quote is from the official Flink website. 以上报价来自Flink官方网站。 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? 我应该在Java中使用具有如下术语的运算符状态吗?

synchronize(stateInstance){
//update state
}

I wonder what do you mean thread pool and how will it interact with Flink managed state? 我想知道你的意思是什么线程池以及它如何与Flink托管状态交互?

If the thread pool you mentioned in the question is Flink task running on the Flink TaskManager. 如果您在问题中提到的线程池是在Flink TaskManager上运行的Flink任务。 Then it is thread-safe . 然后它是线程安全的 Flink is a distributed system. Flink是一个分布式系统。 It executes the task with parallel operator instances, so the managed state of each operator instance is thread-safe naturally. 它使用并行运算符实例执行任务,因此每个运算符实例的托管状态自然是线程安全的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM