【发布时间】:2019-07-08 10:11:16
【问题描述】:
我编写了一个 Python 数据流作业来处理一些数据:
pipeline
| "read" >> beam.io.ReadFromText(known_args.input) # 9 min 44 sec
| "parse_line" >> beam.Map(parse_line) # 4 min 55 sec
| "add_key" >> beam.Map(add_key) # 48 sec
| "group_by_key" >> beam.GroupByKey() # 11 min 56 sec
| "map_values" >> beam.ParDo(MapValuesFn()) # 11 min 40 sec
| "json_encode" >> beam.Map(json.dumps) # 26 sec
| "output" >> beam.io.textio.WriteToText(known_args.output) # 22 sec
(我已删除业务特定语言。)
输入是 1.36 GiB gz 压缩的 CSV,但该作业需要 37 分 34 秒才能运行(我正在使用 Dataflow,因为我预计输入的大小会迅速增长)。
如何识别管道中的瓶颈并加快其执行速度?没有一个单独的函数在计算上是昂贵的。
来自 Dataflow 控制台的自动缩放信息:
12:00:35 PM Starting a pool of 1 workers.
12:05:02 PM Autoscaling: Raised the number of workers to 2 based on the rate of progress in the currently running step(s).
12:10:02 PM Autoscaling: Reduced the number of workers to 1 based on the rate of progress in the currently running step(s).
12:29:09 PM Autoscaling: Raised the number of workers to 3 based on the rate of progress in the currently running step(s).
12:35:10 PM Stopping worker pool.
【问题讨论】:
-
也许您可以通过 dev@beam.apache.org 询问?
标签: python google-cloud-dataflow