Performance issues with using java Sockets


Performance and scalability: Performance issues with using java Sockets

  1. Performance issues with using java Sockets (2 messages)

      We are exploring the possibility to use Java Sockets for an online gaming application. The VC rich client would connect to the Socket on the server.
       We were wondering about the following issues with Sockets:

    1. What are the factors affecting the Socket performance
    2. Scalability: Can the server handle more than 20k concurrent connections, what factors affect the scalability
    3. Security: How secure is using the sockets over the internet? what are the suggested security measures?

    Please give some inputs on this.

  2. Rajit,

    You will want to invest in a good load-balancing appliance that has hardware SSL acceleration. That will allow you to have servers that handle regular sockets, but the clients will have SSL connections. (If your servers have to process SLL, your performance will suck.) The load balancers today can easily handle 50,000 simultaneous connections, if their literature is to be believed. If you have to support 20,000, you may be able to split that up across a number of servers behind the load balancer, so that no one server is over-burdened. See the latest Volano benchmark to understand the extent that JVMs are able to handle many connections.


    Cameron Purdy
    Tangosol, Inc.
    Coherence: Easily share live data across a cluster!
  3. If you want to write a scalable socket server you ought to look into the New IO library (java.nio) in JDK1.4. It allows you to perform non-blocking calls and handle multiple sockets with one thread (e.g. like Unix select()) with Selectors.
    Make sure you get the latest version of the JDK because in some of the early versions (betas) this lib had a lot of bugs.]