从Eclipse运行Flink程序时,我遇到以下异常:
Caused by: java.io.IOException: Insufficient number of network buffers: required 8, but only 4 available. The total number of network buffers is currently set to 2048. You can increase this number by setting the configuration key 'taskmanager.network.numberOfBuffers'.
at org.apache.flink.runtime.io.network.buffer.NetworkBufferPool.createBufferPool(NetworkBufferPool.java:196)
at org.apache.flink.runtime.io.network.NetworkEnvironment.registerTask(NetworkEnvironment.java:173)
at org.apache.flink.runtime.taskmanager.Task.run(Task.java:577)
at java.lang.Thread.run(Thread.java:745)
文档(https://ci.apache.org/projects/flink/flink-docs-release-1.3/setup/config.html#configuring-the-network-buffers)表示可以通过conf/flink-conf.yaml
更改网络缓冲区的数量。但是,从IDE运行程序时,如何更改它还不清楚。
感谢任何帮助!
答案 0 :(得分:0)
通过使用Configuration对象
创建执行环境来解决它Configuration cfg = new Configuration();
int defaultLocalParallelism = Runtime.getRuntime().availableProcessors();
cfg.setString("taskmanager.network.numberOfBuffers", "3000");
env = StreamExecutionEnvironment.createLocalEnvironment(defaultLocalParallelism, cfg);