Skip to content

Commit

Permalink
[ci fw-only Java/baseio] update baseio to 3.2.9.beta8 ,try http inline (
Browse files Browse the repository at this point in the history
  • Loading branch information
wangkaish authored and NateBrady23 committed Mar 5, 2019
1 parent 6be3faa commit c97e366
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 6 deletions.
1 change: 1 addition & 0 deletions frameworks/Java/baseio/baseio-http-lite.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ CMD java \
-DreadBuf=512 \
-Dpool=true \
-Ddirect=true \
-Dinline=true \
-Dlevel=1 \
-Dread=false \
-Depoll=true \
Expand Down
1 change: 1 addition & 0 deletions frameworks/Java/baseio/baseio.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ CMD java \
-DreadBuf=512 \
-Dpool=true \
-Ddirect=true \
-Dinline=true \
-Dlevel=1 \
-Dread=false \
-Depoll=true \
Expand Down
2 changes: 1 addition & 1 deletion frameworks/Java/baseio/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<dependency>
<groupId>com.firenio</groupId>
<artifactId>baseio-all</artifactId>
<version>3.2.9.beta7</version>
<version>3.2.9.beta8</version>
</dependency>

<dependency>
Expand Down
21 changes: 16 additions & 5 deletions frameworks/Java/baseio/src/main/java/hello/TestHttpLoadServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand All @@ -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() {
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit c97e366

Please sign in to comment.