我有一个用java编写的apachebeam程序,它与directrunner一起运行。Apache beam使用线程来实现分布式处理。
- 在运行时,我如何知道apachebeam派生的线程数
- 如何设置运行时要使用的最大线程数
下面的链接可能会有所帮助。到2021年2月,在Java中你似乎做不到。在Python中你可以。
https://beam.apache.org/documentation/runners/direct/#parallel-执行
您可以为此使用getTargetParallelism
和setTargetParallelism
函数:
https://beam.apache.org/releases/javadoc/2.35.0/index.html?org/apache/beam/runners/direct/DirectOptions.html