Showing
1 changed file
with
5 additions
and
5 deletions
| ... | @@ -36,9 +36,8 @@ public final class SimpleNettyClient { | ... | @@ -36,9 +36,8 @@ public final class SimpleNettyClient { |
| 36 | metrics.activate(); | 36 | metrics.activate(); |
| 37 | MetricsFeature feature = new MetricsFeature("latency"); | 37 | MetricsFeature feature = new MetricsFeature("latency"); |
| 38 | MetricsComponent component = metrics.registerComponent("NettyMessaging"); | 38 | MetricsComponent component = metrics.registerComponent("NettyMessaging"); |
| 39 | - Timer sendAsyncTimer = metrics.createTimer(component, feature, "AsyncSender"); | ||
| 40 | 39 | ||
| 41 | - final int warmup = 1000000; | 40 | + final int warmup = 10000; |
| 42 | for (int i = 0; i < warmup; i++) { | 41 | for (int i = 0; i < warmup; i++) { |
| 43 | messaging.sendAsync(new Endpoint("localhost", 8081), "simple", "Hello World".getBytes()); | 42 | messaging.sendAsync(new Endpoint("localhost", 8081), "simple", "Hello World".getBytes()); |
| 44 | Response response = messaging | 43 | Response response = messaging |
| ... | @@ -46,15 +45,16 @@ public final class SimpleNettyClient { | ... | @@ -46,15 +45,16 @@ public final class SimpleNettyClient { |
| 46 | "Hello World".getBytes()); | 45 | "Hello World".getBytes()); |
| 47 | } | 46 | } |
| 48 | 47 | ||
| 49 | - final int iterations = 1000000000; | 48 | + Timer sendAsyncTimer = metrics.createTimer(component, feature, "AsyncSender"); |
| 49 | + Timer sendAndReceiveTimer = metrics.createTimer(component, feature, "SendAndReceive"); | ||
| 50 | + | ||
| 51 | + final int iterations = 10000000; | ||
| 50 | for (int i = 0; i < iterations; i++) { | 52 | for (int i = 0; i < iterations; i++) { |
| 51 | Timer.Context context = sendAsyncTimer.time(); | 53 | Timer.Context context = sendAsyncTimer.time(); |
| 52 | messaging.sendAsync(new Endpoint("localhost", 8081), "simple", "Hello World".getBytes()); | 54 | messaging.sendAsync(new Endpoint("localhost", 8081), "simple", "Hello World".getBytes()); |
| 53 | context.stop(); | 55 | context.stop(); |
| 54 | } | 56 | } |
| 55 | 57 | ||
| 56 | - Timer sendAndReceiveTimer = metrics.createTimer(component, feature, "SendAndReceive"); | ||
| 57 | - | ||
| 58 | for (int i = 0; i < iterations; i++) { | 58 | for (int i = 0; i < iterations; i++) { |
| 59 | Timer.Context context = sendAndReceiveTimer.time(); | 59 | Timer.Context context = sendAndReceiveTimer.time(); |
| 60 | Response response = messaging | 60 | Response response = messaging | ... | ... |
-
Please register or login to post a comment