Reputation: 445
Is it possible to replicated a complete JVM and in case of failover simply flip the load to the replicated JVM?
If yes then how can we do it?
Upvotes: 4
Views: 510
Reputation: 533510
Yes in theory, but the main problem would be that your applications will be much, much slower (like 100 to 1000x) and this is what puts most people off doing a full replication.
Instead you need produce a data stream of the important pieces of information e.g. all the input or out messages (or both) and send this to the second machine and re-build the state from the existing data.
BTW: When you lose a TCP connection with the server, these have to be closed and re-connected. These are not failed over transparently. UDP avoids this issue by not having connections but is much harder to work with reliably. One way around this is to have a simple proxy/load balancing server which sits between the client and the server. Because it is simple is less likely to fail, and it hides the reconnection with the server. However you have a data centre failure, it will be gone as well.
Upvotes: 1
Reputation: 3968
In case your application is a web app, read about "Clustering" and "Load Balancing". Most application servers support clustering.
You can also have a look at JGroups, which provides inter-JVM communication.
Upvotes: 2
Reputation: 19443
This is not something that's done at the JVM level, but there are many products out there that handle this in processing of messages. Usually this is a feature of an Enterprise Service Bus. Google that and you will get some ideas.
Upvotes: 1