diff options
author | Kjetil Ørbekk <kjetil.orbekk@gmail.com> | 2012-04-10 19:05:28 +0200 |
---|---|---|
committer | Kjetil Ørbekk <kjetil.orbekk@gmail.com> | 2012-04-10 19:05:28 +0200 |
commit | cdf87ca3be8bccf8026fda928b30e959771cbaa4 (patch) | |
tree | b2c38684e45bc63fd60a34e25beaa749cccf2f40 /same/src/main/java/com/orbekk/same/benchmark | |
parent | e100caf587fb7e9db626cf59c6f9dbf9114d72f7 (diff) |
Convert Directory service to using a protobuffer based service.
Diffstat (limited to 'same/src/main/java/com/orbekk/same/benchmark')
-rw-r--r-- | same/src/main/java/com/orbekk/same/benchmark/ClientBenchmark.java | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/same/src/main/java/com/orbekk/same/benchmark/ClientBenchmark.java b/same/src/main/java/com/orbekk/same/benchmark/ClientBenchmark.java index 85d839e..1fad871 100644 --- a/same/src/main/java/com/orbekk/same/benchmark/ClientBenchmark.java +++ b/same/src/main/java/com/orbekk/same/benchmark/ClientBenchmark.java @@ -1,8 +1,11 @@ package com.orbekk.same.benchmark; +import java.io.IOException; +import java.net.UnknownHostException; import java.util.concurrent.CountDownLatch; import com.google.protobuf.RpcCallback; +import com.orbekk.protobuf.NewRpcChannel; import com.orbekk.protobuf.Rpc; import com.orbekk.protobuf.RpcChannel; import com.orbekk.same.benchmark.Example.Data; @@ -14,13 +17,17 @@ public class ClientBenchmark { public static void benchmark(String host, int port, int warmupIterations, int iterations) throws InterruptedException { - RpcChannel channel = null; + NewRpcChannel channel = null; try { - channel = RpcChannel.create(host, port); + channel = NewRpcChannel.create(host, port); Example.Service service = Example.Service.newStub(channel); ClientBenchmark benchmark = new ClientBenchmark( service, warmupIterations, iterations); benchmark.benchmark(); + } catch (UnknownHostException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); } finally { if (channel != null) { channel.close(); @@ -74,7 +81,7 @@ public class ClientBenchmark { String host = args[0]; int port = Integer.valueOf(args[1]); try { - benchmark(host, port, 100, 100000); + benchmark(host, port, 1000, 5000); } catch (InterruptedException e) { System.out.println("Benchmark failed."); } |