This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Source(1 to 10) | |
.via(nonLinearFlow) | |
.withAttributes(ActorAttributes.supervisionStrategy(Supervision.resumingDecider)) | |
.runForeach(println) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val dangerousFlow = Flow[Int].map { | |
case 5 => Failure(new RuntimeException(“BOOM!”)) | |
case x => Try(x) | |
} | |
val safeFlow = Flow[Int].map(Try(_)) | |
val bcast = builder.add(Broadcast[Int](2)) | |
val zip = builder.add(Zip[Try[Int], Try[Int]]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Source(1 to 10) | |
.via(nonLinearFlow) | |
.collect { | |
case (Success(a), Success(b)) => (a, b) | |
} | |
.runForeach(println) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Source(1 to 10) | |
.map(toKafkaRecord) | |
.via(Producer.flow(producerSettings)) | |
.runForeach(i => println(s"${i.message.passThrough} sent to kafka")) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Source(1 to 10) | |
.flatMapConcat { i => | |
Source.single(i) | |
.map(toKafkaRecord) | |
.via(Producer.flow(producerSettings)) | |
} | |
.runForeach(i => println(s"${i.message.passThrough} sent to kafka")) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Source(1 to 10) | |
.map(_ / 0) | |
.runWith(Sink.ignore) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object DropWizardTest extends App { | |
val random = Random | |
val times = | |
//normal behavior | |
(1 to 100000).map(_ => random.nextInt(100)) ++ | |
//standard peacks | |
(1 to 100).map(_ => 1000) ++ | |
//very high peacks | |
(1 to 10).map(_ => 10000) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-----------1 | |
75: 75.000000 | |
95: 95.000000 | |
99: 98.000000 | |
99.9: 1000.000000 | |
max: 1000 | |
-----------2 | |
75: 75.000000 | |
95: 94.000000 | |
99: 98.000000 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def printHdrHistogram(times: Seq[Int]) = { | |
val histogram = new Histogram(1000000, 0) | |
times.map(time => histogram.recordValue(time)) | |
histogram.outputPercentileDistribution(System.out, 1, 1.0) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Value Percentile TotalCount 1/(1-Percentile) | |
0 0.000000000000 970 1.00 | |
63 0.500000000000 64196 2.00 | |
127 0.750000000000 100000 4.00 | |
127 0.875000000000 100000 8.00 | |
127 0.937500000000 100000 16.00 | |
127 0.968750000000 100000 32.00 | |
127 0.984375000000 100000 64.00 | |
127 0.992187500000 100000 128.00 | |
127 0.996093750000 100000 256.00 |