开发者

java multi server chat architecture

开发者 https://www.devze.com 2023-02-28 15:41 出处:网络
I\'m currently on the stage to begin developing a chat (actually porting an older single server version ) using multiple servers(machines).

I'm currently on the stage to begin developing a chat (actually porting an older single server version ) using multiple servers(machines).

I want to use java NIO library.

The reason why I'm doing this is because the current implementation is working very slow when a huge number of clients are being connected(around 10k), also the current implementation is based on the IO socket library. I also estimate that in 1 year to have around 40-50k开发者_运维问答 live clients.

So.. I have a few questions:

  1. How many client do you think/estimate NIO can handle since I heard is much better than the old socket implementation?
  2. do you have any ideas or you can point me to some already implemented architecture of using multi server chat.
  3. what are the major problems that I might face when using a multi server architecture?

Thanks in advance


I don't think there is any limitation from the NIO library point of view. At the end of the day performance depends on your Server and Network configuration.


You might like to take a look at Apache MINA Project for NIO framework.

Apache MINA is a network application framework which helps users develop high performance and high scalability network applications easily. It provides an abstract ·event-driven · asynchronous API over various transports such as TCP/IP and UDP/IP via Java NIO.

Apache MINA is often called:
. NIO framework · library,
. client · server framework · library, or
. a networking · socket library.


Estimates are difficult to give without performance testing; the number of clients you can support will vary based on memory, processor speed/load, bandwidth/volume, latency requirements, storage requirements...

There are a couple of approaches you could use to share data between servers; I'd go for broadcast/multicast UDP between them, as it is the most scalable approach.

The biggest issue you're likely to face is coping with server outages, and properly handling load-balancing.

EDIT If you're not tied to NIO for the server-to-server, JMS in pub/sub mode may be a good solution.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号