Mercurial > stress-tester
changeset 549:4bdd968d121b
ReporterClient tuning
author | Devel 1 |
---|---|
date | Fri, 15 Sep 2017 11:39:04 +0200 |
parents | e3aa81458572 |
children | 87e1444c7bab |
files | stress-tester-reporter/src/main/java/com/passus/st/reporter/server/ReporterClient.java |
diffstat | 1 files changed, 9 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/stress-tester-reporter/src/main/java/com/passus/st/reporter/server/ReporterClient.java Fri Sep 15 09:59:06 2017 +0200 +++ b/stress-tester-reporter/src/main/java/com/passus/st/reporter/server/ReporterClient.java Fri Sep 15 11:39:04 2017 +0200 @@ -13,7 +13,9 @@ import java.util.concurrent.ArrayBlockingQueue; import java.util.concurrent.BlockingQueue; import java.util.concurrent.Executor; -import java.util.concurrent.Executors; +import java.util.concurrent.SynchronousQueue; +import java.util.concurrent.ThreadPoolExecutor; +import java.util.concurrent.TimeUnit; import org.apache.avro.AvroRemoteException; import org.apache.avro.ipc.NettyTransceiver; import org.apache.avro.ipc.specific.SpecificRequestor; @@ -84,8 +86,10 @@ } } - private static Executor pool(String name) { - return Executors.newCachedThreadPool(new SimpleThreadFactory("Avro NettyTransceiver" + name)); + private static Executor pool(String name, int corePoolSize) { + SimpleThreadFactory factory = new SimpleThreadFactory("Avro NettyTransceiver" + name); + return new ThreadPoolExecutor(corePoolSize, Integer.MAX_VALUE, 60L, TimeUnit.SECONDS, + new SynchronousQueue<>(), factory); } private class SenderThread extends Thread { @@ -101,7 +105,8 @@ return; } - NioClientSocketChannelFactory factory = new NioClientSocketChannelFactory(pool(" Boss"), pool(" I/O Worker")); + NioClientSocketChannelFactory factory = new NioClientSocketChannelFactory( + pool(" Boss", 1), pool(" I/O Worker", 4)); try { client = new NettyTransceiver(serverAddress, factory, 10_000L); proxy = (Reporter) SpecificRequestor.getClient(Reporter.class, client);