Tomcat doing 15K req/second on a single server using Jersey Jax-RS

不想你离开。 提交于 2019-12-02 17:47:49

Turn on NIO (Non-Blocking IO). This is not by default turned on. Without NIO, every HTTP connection is handled by a single thread and the limit is dependent on the amount of threads available. With NIO, multiple HTTP connections can be handled by a single thread and the limit is dependent on amount of heap memory available. With about 2GB you can go up to 20K connections.

Turning on NIO is a matter of changing the protocol attribute of the <Connector> element in Tomcat's /conf/server.xml to "org.apache.coyote.http11.Http11NioProtocol".

<Connector
    protocol="org.apache.coyote.http11.Http11NioProtocol"
    port="80"
    redirectPort="8443"
    connectionTimeout="20000"
    compression="on" />
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!