This commit is contained in:
@@ -116,12 +116,12 @@
|
|||||||
excludelibs: 排除lib.path与excludes中的正则表达式匹配的路径, 多个正则表达式用分号;隔开
|
excludelibs: 排除lib.path与excludes中的正则表达式匹配的路径, 多个正则表达式用分号;隔开
|
||||||
charset: 文本编码, 默认: UTF-8
|
charset: 文本编码, 默认: UTF-8
|
||||||
backlog: 默认10K
|
backlog: 默认10K
|
||||||
threads: 线程总数, 默认: CPU核数*8
|
threads: 线程数, 默认: CPU核数*32
|
||||||
maxconns:最大连接数, 小于1表示无限制, 默认: 0
|
maxconns:最大连接数, 小于1表示无限制, 默认: 0
|
||||||
maxbody: request.body最大值, 默认: 64K
|
maxbody: request.body最大值, 默认: 64K
|
||||||
bufferCapacity: ByteBuffer的初始化大小, 默认: 32K; (HTTP 2.0、WebSocket,必须要16k以上)
|
bufferCapacity: ByteBuffer的初始化大小, 默认: 32K; (HTTP 2.0、WebSocket,必须要16k以上)
|
||||||
bufferPoolSize: ByteBuffer池的大小,默认: 线程总数*4
|
bufferPoolSize: ByteBuffer池的大小,默认: 线程数*4
|
||||||
responsePoolSize: Response池的大小,默认: 线程总数*2
|
responsePoolSize: Response池的大小,默认: 线程数*2
|
||||||
aliveTimeoutSeconds: KeepAlive读操作超时秒数, 默认30, 0表示永久不超时; -1表示禁止KeepAlive
|
aliveTimeoutSeconds: KeepAlive读操作超时秒数, 默认30, 0表示永久不超时; -1表示禁止KeepAlive
|
||||||
readTimeoutSeconds: 读操作超时秒数, 默认0, 表示永久不超时
|
readTimeoutSeconds: 读操作超时秒数, 默认0, 表示永久不超时
|
||||||
writeTimeoutSeconds: 写操作超时秒数, 默认0, 表示永久不超时
|
writeTimeoutSeconds: 写操作超时秒数, 默认0, 表示永久不超时
|
||||||
|
|||||||
@@ -361,6 +361,7 @@ public final class Application {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void init() throws Exception {
|
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("java.util.concurrent.ForkJoinPool.common.parallelism", "" + Runtime.getRuntime().availableProcessors() * 4);
|
||||||
System.setProperty("net.transport.poolmaxconns", "100");
|
System.setProperty("net.transport.poolmaxconns", "100");
|
||||||
System.setProperty("net.transport.pinginterval", "30");
|
System.setProperty("net.transport.pinginterval", "30");
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ public abstract class Server<K extends Serializable, C extends Context, R extend
|
|||||||
this.maxbody = parseLenth(config.getValue("maxbody"), 64 * 1024);
|
this.maxbody = parseLenth(config.getValue("maxbody"), 64 * 1024);
|
||||||
int bufCapacity = parseLenth(config.getValue("bufferCapacity"), 32 * 1024);
|
int bufCapacity = parseLenth(config.getValue("bufferCapacity"), 32 * 1024);
|
||||||
this.bufferCapacity = bufCapacity < 8 * 1024 ? 8 * 1024 : bufCapacity;
|
this.bufferCapacity = bufCapacity < 8 * 1024 ? 8 * 1024 : bufCapacity;
|
||||||
this.threads = config.getIntValue("threads", Runtime.getRuntime().availableProcessors() * 8);
|
this.threads = config.getIntValue("threads", Runtime.getRuntime().availableProcessors() * 32);
|
||||||
this.bufferPoolSize = config.getIntValue("bufferPoolSize", this.threads * 4);
|
this.bufferPoolSize = config.getIntValue("bufferPoolSize", this.threads * 4);
|
||||||
this.responsePoolSize = config.getIntValue("responsePoolSize", this.threads * 2);
|
this.responsePoolSize = config.getIntValue("responsePoolSize", this.threads * 2);
|
||||||
this.name = config.getValue("name", "Server-" + protocol + "-" + this.address.getPort());
|
this.name = config.getValue("name", "Server-" + protocol + "-" + this.address.getPort());
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ public class TcpAioProtocolServer extends ProtocolServer {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void open(AnyValue config) throws IOException {
|
public void open(AnyValue config) throws IOException {
|
||||||
group = AsynchronousChannelGroup.withCachedThreadPool(context.executor, 1);
|
group = AsynchronousChannelGroup.withThreadPool(context.executor);
|
||||||
this.serverChannel = AsynchronousServerSocketChannel.open(group);
|
this.serverChannel = AsynchronousServerSocketChannel.open(group);
|
||||||
|
|
||||||
final Set<SocketOption<?>> options = this.serverChannel.supportedOptions();
|
final Set<SocketOption<?>> options = this.serverChannel.supportedOptions();
|
||||||
|
|||||||
Reference in New Issue
Block a user