One thread per client. Doable?

后端 未结 10 1759
走了就别回头了
走了就别回头了 2020-12-15 18:43

I\'m writing a Java server which uses plain sockets to accept connections from clients. I\'m using the fairly simple model where each connection has its own thread reading f

10条回答
  •  悲&欢浪女
    2020-12-15 19:22

    It is possible this will scale to thousands of clients. But how many thousands is the next question.

    A common alternative is to use Selectors and non-blocking I/O found in the java.nio package.

    Eventually you get into the question of whether it's useful to set up your server in a clustered configuration, balancing the load over multiple physical machines.

提交回复
热议问题