Flink 中并行度的设置

Flink中并行度的设置

  1. 算子级别(Operator Level)
actions.filter(new FilterFunction<UserAction>(){
    
    
   @Override
   public boolean filter(UserAction value) throws Exception{
    
    
   	return false;
   }
}).setParallelism(4);
  1. 执行环境级别(Excution Environment Level)
StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
env.setParallelism(4)
  1. 客户端级别(Client Level)
./flink run -p 10 WordCount-java.jar
  1. 系统默认级别 (System Level)

可以使用flink-conf.yaml 中的parallelism.default 属性来指定执行环境的默认并行度

除系统默认级别外,其他都可以使用。优先级:
算子 >env>客户端>系统默认

猜你喜欢

转载自blog.csdn.net/weixin_38813363/article/details/113605081