Giter Club home page Giter Club logo

Comments (1)

gogym avatar gogym commented on August 28, 2024

使用wrk对 getty/getty-example/test/src/main/java/test/http/TcpServer.java 压力测试,QPS非常低,大概在700左右;
相同代码功能使用netty实现进行压测,QPS能到11万

首先感谢你的关注。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编解码器还有优化的空间,后续会抽时间优化一下,争取提高性能。最后再次感谢你的关注

from getty.

Related Issues (3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.