diff --git a/frameworks/Java/baseio/baseio-http-lite.dockerfile b/frameworks/Java/baseio/baseio-http-lite.dockerfile index dad7a2470a8..028369011fb 100644 --- a/frameworks/Java/baseio/baseio-http-lite.dockerfile +++ b/frameworks/Java/baseio/baseio-http-lite.dockerfile @@ -15,6 +15,7 @@ CMD java \ -DreadBuf=512 \ -Dpool=true \ -Ddirect=true \ + -Dinline=true \ -Dlevel=1 \ -Dread=false \ -Depoll=true \ diff --git a/frameworks/Java/baseio/baseio.dockerfile b/frameworks/Java/baseio/baseio.dockerfile index 1b6df7d6aca..174bfbecc73 100644 --- a/frameworks/Java/baseio/baseio.dockerfile +++ b/frameworks/Java/baseio/baseio.dockerfile @@ -15,6 +15,7 @@ CMD java \ -DreadBuf=512 \ -Dpool=true \ -Ddirect=true \ + -Dinline=true \ -Dlevel=1 \ -Dread=false \ -Depoll=true \ diff --git a/frameworks/Java/baseio/pom.xml b/frameworks/Java/baseio/pom.xml index a335f4ada4f..acbf57920fc 100644 --- a/frameworks/Java/baseio/pom.xml +++ b/frameworks/Java/baseio/pom.xml @@ -19,7 +19,7 @@ com.firenio baseio-all - 3.2.9.beta7 + 3.2.9.beta8 diff --git a/frameworks/Java/baseio/src/main/java/hello/TestHttpLoadServer.java b/frameworks/Java/baseio/src/main/java/hello/TestHttpLoadServer.java index ff9c0e140d3..8c2a4519abb 100644 --- a/frameworks/Java/baseio/src/main/java/hello/TestHttpLoadServer.java +++ b/frameworks/Java/baseio/src/main/java/hello/TestHttpLoadServer.java @@ -19,6 +19,7 @@ import java.util.Arrays; import com.firenio.baseio.Options; +import com.firenio.baseio.codec.http11.HttpAttrListener; import com.firenio.baseio.codec.http11.HttpCodec; import com.firenio.baseio.codec.http11.HttpConnection; import com.firenio.baseio.codec.http11.HttpContentType; @@ -61,8 +62,9 @@ public static void main(String[] args) throws Exception { boolean lite = Util.getBooleanProperty("lite"); boolean read = Util.getBooleanProperty("read"); boolean pool = Util.getBooleanProperty("pool"); - boolean direct = Util.getBooleanProperty("direct"); boolean epoll = Util.getBooleanProperty("epoll"); + boolean direct = Util.getBooleanProperty("direct"); + boolean inline = Util.getBooleanProperty("inline"); boolean unsafeBuf = Util.getBooleanProperty("unsafeBuf"); int core = Util.getIntProperty("core", 1); int frame = Util.getIntProperty("frame", 16); @@ -82,6 +84,7 @@ public static void main(String[] args) throws Exception { DebugUtil.info("frame: {}", frame); DebugUtil.info("level: {}", level); DebugUtil.info("direct: {}", direct); + DebugUtil.info("inline: {}", inline); DebugUtil.info("readBuf: {}", readBuf); IoEventHandle eventHandle = new IoEventHandle() { @@ -110,19 +113,27 @@ public void accept(Channel ch, Frame frame) throws Exception { } }; - + + int fcache = 1024 * 16; + int pool_cap = 1024 * 128; + int pool_unit = 256; + if (inline) { + pool_cap = 1024 * 8; + pool_unit = 256 * 16; + } HttpDateUtil.start(); NioEventLoopGroup group = new NioEventLoopGroup(); ChannelAcceptor context = new ChannelAcceptor(group, 8080); - group.setMemoryPoolCapacity(1024 * 128); + group.setMemoryPoolCapacity(pool_cap); group.setEnableMemoryPoolDirect(direct); group.setEnableMemoryPool(pool); - group.setMemoryPoolUnit(256); + group.setMemoryPoolUnit(pool_unit); group.setWriteBuffers(32); group.setChannelReadBuffer(1024 * readBuf); group.setEventLoopSize(Util.availableProcessors() * core); group.setConcurrentFrameStack(false); - context.addProtocolCodec(new HttpCodec("baseio", 1024 * 16, lite)); + context.addProtocolCodec(new HttpCodec("baseio", fcache, lite, inline)); + context.addChannelEventListener(new HttpAttrListener()); context.addChannelEventListener(new ChannelEventListenerAdapter() { @Override