Note that there are some explanatory texts on larger screens.

plurals
  1. POArchitectural issue with Tomcat cluster environment
    text
    copied!<p>I am working on project in which we have an authentication mechanism. We are following the below steps in the authentication mechanism.</p> <ol> <li>The user opens a browser and enter his/her email in a text box and click the login button.</li> <li>The request goes to a server. We generate a random string (for example, 123456) and send a notification to the user's <a href="http://en.wikipedia.org/wiki/Android_%28operating_system%29" rel="nofollow">Android</a>/<a href="http://en.wikipedia.org/wiki/IPhone" rel="nofollow">iPhone</a> and makes the the current thread wait with the help of the <code>wait()</code> method.</li> <li>The user enters a password on his/her phone and clicks the submit button on his/her phone.</li> <li>Once the user clicks the submit button, we are making a webservice hit the server and passing the previously generated string (for example, 123456) and password.</li> <li>If the password is correct against the previously entered email, we call the <code>notify()</code> method to the previously waiting thread and send <em>success</em> as the response and the user gets entered into our system.</li> <li>If the password is incorrect against the previously entered email, we call the <code>notify()</code> method to the previously waiting thread and send <em>failed</em> as the response and display an invalid credential message to the user.</li> </ol> <p>Everything is working fine, but recently we moved to a clustered environment. We found that some threads are not notified even after replied by the user and for an unlimited waiting time.</p> <p>For the server, we are using Tomcat 5.5, and we are following <em><a href="http://tomcat.apache.org/tomcat-5.5-doc/cluster-howto.html" rel="nofollow">The Apache Tomcat 5.5 Servlet/JSP Container</a></em> for making tomcat cluster environment.</p> <p><strong>Answer :: Possible problem and solution</strong></p> <p>The possible problem is the multiple JVMs in a clustered environment. Now we are also sending the clustered Tomcat URL to the user Android application along with generated string. </p> <p>And when the user clicks on the reply button, we are sending the generated string along with the clustered Tomcat URL so in this case both requests are going to the same JVM, and it works fine.</p> <p>But I am wondering if there is a single solution for the above issue.</p> <p>There is a problem in this solution. <strong>What happens if the clustered Tomcat crashes?</strong> The load balancer will send a request to the second clustered Tomcat and again the same problem will arise.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload