4
votes

I have looked at a similar question : Netty High Availability Cluster. The scenario I have is : There is a netty websocket server to which various native javascript web socket clients connect to. I am looking at basic high availability of the websocket server and want that it should fail over to a backup server if required.

The question in the above given link talks of netty clients but since I dont have the clients written in netty , I was thinking my scenario would be different from that question. Am I right?

Can someone suggest some way to do this since I guess this would be a fairly important requirement sometimes??

3

3 Answers

3
votes

Because web sockets is connection oriented, if your server goes does, so does your web socket connection.

So, for high availability, I think you will need to adjust your javascript code to catch connection errors and reconnect/login.

In this way, you can put several netty servers behind a load balancer.

Hope this helps.

2
votes

Assuming that you don't have control of your clients how about having a number of netty servers behind a traditional load balancer and storing session state in a hazelcast or infinispan cluster? Both platforms allow you to either embed them directly in your server, or have a remote cache.

2
votes

Xitrum is very suitable for your need. It uses Hazelcast to scale out to multiple servers.

You can try the WebSocket demo.

To enable cluster mode, just set "multicast" and/or "tcp-ip" in config/hazelcast_cluster_member_or_super_client.xml to "true" and start multiple servers.