in tchannel-benchmark/src/main/java/com/uber/tchannel/benchmarks/LargePayloadBenchmark.java [105:139]
public void benchmark(final AdditionalCounters counters) throws Exception {
RawRequest request = new RawRequest.Builder("ping-server", "ping")
.setArg3(payload.retain())
.setTimeout(20000)
.build();
TFuture<RawResponse> future = this.subClient
.send(
request,
this.host,
this.port
);
future.addCallback(new TFutureCallback<RawResponse>() {
@Override
public void onResponse(RawResponse pongResponse) {
if (!pongResponse.isError()) {
counters.actualQPS.incrementAndGet();
} else {
switch (pongResponse.getError().getErrorType()) {
case Busy:
counters.busyQPS.incrementAndGet();
break;
case Timeout:
counters.timeoutQPS.incrementAndGet();
break;
case NetworkError:
counters.networkQPS.incrementAndGet();
break;
default:
counters.errorQPS.incrementAndGet();
}
}
}
});
}