gpt4 book ai didi

apache-flink - wordcount 测试显示 Flink 运行缓慢

转载 作者:行者123 更新时间:2023-12-05 01:30:20 27 4
gpt4 key购买 nike

我正在做一些流处理框架之间的基准比较,

我在这方面选择了WordCount这样的“Hello world”任务(有点曲折),目前测试了Flink和Hazelcast Jet,结果Flink需要80+s完成,而Jet只需要30+s

我知道 Flink 很流行,我哪里做错了?对此很好奇

我的示例代码在这里

https://github.com/ChinW/stream-processing-compare


以下是详细信息(规范、管道、日志)

经过测试的 WordCount 管道

Source (read from file, 5MB)
-> Process: Split line into words (Here here is a bomb, every word emit 1000 times)
-> Group/Count
-> Sink (do nothing)
我的本地结果
  • MacBook Pro(13 英寸,2020 年,四个 Thunderbolt 3 端口)
  • 2 GHz 四核英特尔酷睿 i5(8 个逻辑处理器)
  • 16 GB 3733 MHz LPDDR4X
  • JDK 11
喷射 4.4

管道:

digraph DAG {
"items" [localParallelism=1];
"fused(flat-map, filter)" [localParallelism=8];
"group-and-aggregate-prepare" [localParallelism=8];
"group-and-aggregate" [localParallelism=8];
"do-nothing-sink" [localParallelism=1];
"items" -> "fused(flat-map, filter)" [queueSize=1024];
"fused(flat-map, filter)" -> "group-and-aggregate-prepare" [label="partitioned", queueSize=1024];
subgraph cluster_0 {
"group-and-aggregate-prepare" -> "group-and-aggregate" [label="distributed-partitioned", queueSize=1024];
}
"group-and-aggregate" -> "do-nothing-sink" [queueSize=1024];
}

日志:

Start time: 2021-04-18T13:52:52.106
Duration: 00:00:36.459
Jet: finish in 36.45935081 seconds.

Start time: 2021-04-19T16:51:53.806
Duration: 00:00:30.143
Jet: finish in 30.625740453 seconds.

Start time: 2021-04-19T16:52:48.906
Duration: 00:00:37.207
Jet: finish in 37.862554137 seconds.
用于 Scala 2.11 的 Flink 1.12.2

flink-config.yaml 配置:

jobmanager.rpc.address: localhost
jobmanager.rpc.port: 6123
jobmanager.memory.process.size: 2096m
taskmanager.memory.process.size: 12288m
taskmanager.numberOfTaskSlots: 8
parallelism.default: 8

管道:

{
"nodes" : [ {
"id" : 1,
"type" : "Source: Custom Source",
"pact" : "Data Source",
"contents" : "Source: Custom Source",
"parallelism" : 1
}, {
"id" : 2,
"type" : "Flat Map",
"pact" : "Operator",
"contents" : "Flat Map",
"parallelism" : 8,
"predecessors" : [ {
"id" : 1,
"ship_strategy" : "REBALANCE",
"side" : "second"
} ]
}, {
"id" : 4,
"type" : "Keyed Aggregation",
"pact" : "Operator",
"contents" : "Keyed Aggregation",
"parallelism" : 8,
"predecessors" : [ {
"id" : 2,
"ship_strategy" : "HASH",
"side" : "second"
} ]
}, {
"id" : 5,
"type" : "Sink: Unnamed",
"pact" : "Data Sink",
"contents" : "Sink: Unnamed",
"parallelism" : 8,
"predecessors" : [ {
"id" : 4,
"ship_strategy" : "FORWARD",
"side" : "second"
} ]
} ]
}

日志:

❯ flink run -c chiw.spc.flink.FlinkWordCountKt stream-processing-compare-1.0-SNAPSHOT.jar
Job has been submitted with JobID 163ce849a663e45f3c3028a98f260e7c
Program execution finished
Job with JobID 163ce849a663e45f3c3028a98f260e7c has finished.
Job Runtime: 88614 ms

❯ flink run -c chiw.spc.flink.FlinkWordCountKt stream-processing-compare-1.0-SNAPSHOT.jar
Job has been submitted with JobID fcf12488204969299e4e5d7f23f4ea6e
Program execution finished
Job with JobID fcf12488204969299e4e5d7f23f4ea6e has finished.
Job Runtime: 90165 ms

❯ flink run -c chiw.spc.flink.FlinkWordCountKt stream-processing-compare-1.0-SNAPSHOT.jar
Job has been submitted with JobID 37e349e4fad90cd7405546d30239afa4
Program execution finished
Job with JobID 37e349e4fad90cd7405546d30239afa4 has finished.
Job Runtime: 78908 ms

非常感谢您的帮助!

最佳答案

我认为您没有做错任何事,我们的测试表明 Jet 比 Spark 和 Flink 快得多,字数统计是我们用来衡量它的示例之一。

关于apache-flink - wordcount 测试显示 Flink 运行缓慢,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67163773/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com