Java/C++ applications and application re-connecting

During the failover, any in-flight application that uses database access will fail. After the failover, any application will succeed on retry. For the Java applications, you can catch the StaleConnectionException in your database try block and retry your connection a limited number of times, with the sample code discussed in Catch StaleConnectionException.

We have three comments regarding this coding practice: This coding practice is not required for the HA solution to work; it is only an option. We tested both situations with and without this coding practice. A typical database failover takes approximately one to five minutes. If you code this try block in your application with an unlimited number of retries, then your application will hang there for one to five minutes during a failover. There is not much to gain by trying hundreds of times during a failover; it may impact the performance of other WebSphere and application processes that do not need to access the database. We suggest that you either do nothing in your application code, or code a limited number of retries (no more than five times with a controlled retry interval). We tested all of these scenarios and we suggest that you consider the trade-off for each option before you develop your application. You need to pay attention to transaction ACID properties (atomicity, consistency, isolation, and durability) when coding retry.

  Prev | Home | Next

 

WebSphere is a trademark of the IBM Corporation in the United States, other countries, or both.

 

IBM is a trademark of the IBM Corporation in the United States, other countries, or both.