We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
使用wrk对 getty/getty-example/test/src/main/java/test/http/TcpServer.java 压力测试,QPS非常低,大概在700左右; 相同代码功能使用netty实现进行压测,QPS能到11万
The text was updated successfully, but these errors were encountered:
首先感谢你的关注。qps压测需要相同的配置。代码中,netty的http示例使用了keep-live。response.headers().set(CONNECTION, HttpHeaderValues.KEEP_ALIVE); 因此qps才能到达你所说的11W,如果netty 使用 response.headers().set(CONNECTION, HttpHeaderValues.CLOSE); 是压不到这个量的,这一点很重要。因为配置了KEEP_ALIVE,连接是不会断开的,避免了每次请求重复握手。 而getty提供的TcpServer.java并没有配置这个特性,所以才压不到这个量。getty中注释掉 //aioChannel.setKeepAlive(false); 并且把 response.getHttpHeaders().setHeader(HttpHeaders.Names.CONNECTION, HttpHeaders.Values.KEEP_ALIVE); response.getHttpHeaders().setHeader(HttpHeaders.Names.CONTENT_LENGTH, response.getHttpBody().getContent().length); 这两句配置上,qps与netty是接近的。 通常在生产环境中,http请求都是请求完马上就会关闭连接。再次请求会再次握手,TcpServer.java 示例是模仿通常的使用场景。 当然,目前getty提供的编解码器比较多,都是个人业余抽时间写,难以所有都兼顾上。目前http编解码器还有优化的空间,后续会抽时间优化一下,争取提高性能。最后再次感谢你的关注
response.headers().set(CONNECTION, HttpHeaderValues.KEEP_ALIVE);
response.headers().set(CONNECTION, HttpHeaderValues.CLOSE);
//aioChannel.setKeepAlive(false);
response.getHttpHeaders().setHeader(HttpHeaders.Names.CONNECTION, HttpHeaders.Values.KEEP_ALIVE); response.getHttpHeaders().setHeader(HttpHeaders.Names.CONTENT_LENGTH, response.getHttpBody().getContent().length);
Sorry, something went wrong.
No branches or pull requests
使用wrk对 getty/getty-example/test/src/main/java/test/http/TcpServer.java 压力测试,QPS非常低,大概在700左右;
相同代码功能使用netty实现进行压测,QPS能到11万
The text was updated successfully, but these errors were encountered: