this.notifications.add(new SimpleApnsPushNotification(token, builder.buildWithDefaultMaximumLength()));
}
}
public void runAllBenchmarks() throws InterruptedException {
this.serverEventLoopGroup = new NioEventLoopGroup(2);
this.server = new MockApnsServer(GATEWAY_PORT, serverEventLoopGroup);
// We want to do a dummy run first to let the JVM warm up
final NioEventLoopGroup warmupGroup = new NioEventLoopGroup(1);
this.runBenchmark(warmupGroup, 1, this.notifications);
warmupGroup.shutdownGracefully().await();
System.out.println("threads, connections, throughput [k/sec]");
for (int eventLoopGroupThreadCount : new int[] {1, 2, 4, 8, 16}) {
final NioEventLoopGroup eventLoopGroup = new NioEventLoopGroup(eventLoopGroupThreadCount);
for (int concurrentConnectionCount : new int[] {1, 2, 4, 8, 16, 32}) {
if (concurrentConnectionCount >= eventLoopGroupThreadCount) {
System.gc();
double throughput = this.runBenchmark(eventLoopGroup, concurrentConnectionCount, this.notifications);
System.out.format("%d, %d, %.1f\n",
eventLoopGroupThreadCount,
concurrentConnectionCount,
throughput / 1000.0);
}
}
eventLoopGroup.shutdownGracefully().await();
}
this.serverEventLoopGroup.shutdownGracefully().await();
}