views:

138

answers:

1

What is the best way to make a standalone java server built using J2SE Socket API high available? Using an HTTP server would have been a good choice specially for the built-in features e.g. security, clustering, transactions, etc. but the server should be capable of accepting TCP/IP socket connection from java & non-java clients (mainly legacy). Tomcat does not accept non-http TCP/IP requests? Moreover this post points out servlet for implementing socket connection it's not a good practice. What would be good approach?

A: 

After exploring online, this is what I have compe up with. A standalone java application can be made high available by using a combination of the following:

  1. 2 VM deployed with HAproxy and keepalived to form the highly available load balancing layer. Keepalived will keep the load balancers in active-passive mode and the HAproxy will forward the requests to a cluster of backend socket based java server apps

  2. At least 2 VM deployed with the custom socket based java server apps. The HAproxy servers will distribute the requests over these 2 VMs

  3. Use at least 2 terracotta server to share the java server apps. Terracotta will provide the sharing of the memory and help the custom java servers to scale.

  4. Use MySQL NDB Cluster for the database.

Any suggestions?

hbagchi