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

前端 未结 1 1689
Happy的楠姐
Happy的楠姐 2021-01-31 13:04

I tried testing things on a VPS, and came close to 10K requests per second, and that was a simple \'hello world\' servlet, let alone making a call to membase.

相关标签:
1条回答
  • 2021-01-31 13:42

    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" />
    
    0 讨论(0)
提交回复
热议问题