What's the maximum count of active websocket connections supported by tomcat 7.0

TO reach the max alive websocket connections in Tomcat, the following config changes need to be done.

  1. {CATALINA_HOME}/conf/server.xml

    <Connector connectionTimeout="-1" port="8080" 
           protocol="org.apache.coyote.http11.Http11NioProtocol" 
           redirectPort="8443" maxConnections="100000" acceptCount="300"/>
    
  2. Check the number of ports which are available for use on the machiine where Tomcat is deployed:

    $ cat /proc/sys/net/ipv4/ip_local_port_range
    

    Change this from 50 to 65535.

    $ sysctl -w net.ipv4.ip_local_port_range="500   65535"
    

The above configuration changes allow around ~50k live connections in a 2GB Intel Core i5 machine provided the server and client are running on different machines.


  1. The upper limit is the number of TCP connections your server can support.
  2. The default enforced limit will depend on the connector you are using - information that you failed to provided. For NIO and APOR/native you'll want to increase maxConnections. For bIO you;'ll want to increase maxThreads.
  3. That depends on the load balancer you are using - again information you failed to provide.