This commit is contained in:
Redkale
2018-08-06 17:38:03 +08:00
parent fd1197e8dc
commit be2c803f82
2 changed files with 3 additions and 2 deletions

View File

@@ -171,6 +171,7 @@ public final class Application {
this.singletonrun = singletonrun;
this.config = config;
System.setProperty("redkale.version", Redkale.getDotedVersion());
System.setProperty("sun.nio.ch.maxCompletionHandlersOnStack", String.valueOf(Runtime.getRuntime().availableProcessors() * 32));
final File root = new File(System.getProperty(RESNAME_APP_HOME));
this.resourceFactory.register(RESNAME_APP_TIME, long.class, this.startTime);
@@ -388,7 +389,6 @@ public final class Application {
}
public void init() throws Exception {
System.setProperty("sun.nio.ch.internalThreadPoolSize", "" + Runtime.getRuntime().availableProcessors() * 4);
System.setProperty("java.util.concurrent.ForkJoinPool.common.parallelism", "" + Runtime.getRuntime().availableProcessors() * 4);
System.setProperty("net.transport.poolmaxconns", "100");
System.setProperty("net.transport.pinginterval", "30");

View File

@@ -32,7 +32,8 @@ public class TcpAioProtocolServer extends ProtocolServer {
@Override
public void open(AnyValue config) throws IOException {
group = AsynchronousChannelGroup.withThreadPool(context.executor);
//group = AsynchronousChannelGroup.withThreadPool(context.executor);
group = AsynchronousChannelGroup.withFixedThreadPool(context.executor.getCorePoolSize(), context.executor.getThreadFactory());
this.serverChannel = AsynchronousServerSocketChannel.open(group);
final Set<SocketOption<?>> options = this.serverChannel.supportedOptions();