@@ -33,10 +33,9 @@ import scala.util.{Failure, Success, Try}
33
33
*
34
34
* Typical results on 2012 vintage MacBook Pro with 8 cores
35
35
* with default dispatcher and default JVM param:
36
- * JDK 11.0.11 41 seconds
37
- * JDK 17.0.2 33 seconds
38
- * JDK 21.0.3 27 seconds
39
- * graalvm-jdk-21 25 seconds
36
+ * temurin-11 31 seconds
37
+ * temurin-21 21 seconds
38
+ * graalvm-jdk-21 18 seconds
40
39
*
41
40
* Doc:
42
41
* https://fullgc.github.io/how-to-tune-akka-to-get-the-most-from-your-actor-based-system-part-1
@@ -48,7 +47,7 @@ object FlightDelayStreaming extends App {
48
47
49
48
import system .dispatcher
50
49
51
- val sourceOfLines = FileIO .fromPath(Paths .get(" src/main/resources/2008 .csv" ))
50
+ val sourceOfLines = FileIO .fromPath(Paths .get(" src/main/resources/2008_subset .csv" ))
52
51
.via(Framing .delimiter(ByteString (System .lineSeparator), maximumFrameLength = 1024 , allowTruncation = true )
53
52
.map(_.utf8String))
54
53
@@ -66,15 +65,15 @@ object FlightDelayStreaming extends App {
66
65
val filterAndConvert : Flow [FlightEvent , FlightDelayRecord , NotUsed ] =
67
66
Flow [FlightEvent ]
68
67
.filter(r => Try (r.arrDelayMins.toInt).getOrElse(- 1 ) > 0 ) // convert arrival delays to ints, filter out non delays
69
- .mapAsyncUnordered(parallelism = 2 ) { r =>
68
+ .mapAsyncUnordered(parallelism = 100_000 ) { r =>
70
69
Future (FlightDelayRecord (r.year, r.month, r.dayOfMonth, r.flightNum, r.uniqueCarrier, r.arrDelayMins))
71
70
}
72
71
73
72
// Aggregate number of delays and totalMins
74
73
val averageCarrierDelay : Flow [FlightDelayRecord , FlightDelayAggregate , NotUsed ] =
75
74
Flow [FlightDelayRecord ]
76
75
// maxSubstreams must be larger than the number of UniqueCarrier in the file
77
- .groupBy(30 , _.uniqueCarrier, allowClosedSubstreamRecreation = true )
76
+ .groupBy(100 , _.uniqueCarrier, allowClosedSubstreamRecreation = true )
78
77
// .wireTap(each => println(s"Processing FlightDelayRecord: $each"))
79
78
.fold(FlightDelayAggregate (" " , 0 , 0 )) {
80
79
(x : FlightDelayAggregate , y : FlightDelayRecord ) =>
0 commit comments