|
@@ -19,6 +19,7 @@ import java.io.IOException;
|
|
|
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 class TestHttpLoadServer {
|
|
|
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 class TestHttpLoadServer {
|
|
|
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 class TestHttpLoadServer {
|
|
|
}
|
|
|
|
|
|
};
|
|
|
-
|
|
|
+
|
|
|
+ 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
|