First, the problem description
System name: In-company customer Relationship Management (CRM) system
System Architecture: The front-end is an nginx server as a load balancer, the backend for two Tomcat server to provide Web services, Nginx Server distribution request to hash IP address, to ensure that the same IP request is distributed to the same machine, so do not need to do session sharing.
The problem appears: the company system operation has been normal, one day, the system in the Business Management page request processing has not finished on the landing page to jump to the situation, the problem can be reproduced, other page request is normal.
Second, the analysis process
This kind of problem is better solved, because the other pages in the system request is normal, which provides a great help to troubleshoot the problem.
Page particularity: The first thought is that the page and other pages compared to the particularity, repeated observation of the page after the Dynamic Data volume, SQL execution time is longer (SQL has not been optimized), request processing time is longer (may reach a few seconds or even 10 seconds).
The possibility of jumping to the login page: The system to jump to the login page only two possible (the system error, after a few seconds to jump to the login page and the user is not logged in to jump to the landing page), it is easy to exclude the request error situation, that is, the user login is invalid.
How to Manage Login: The system checks the login is done in the filter, the user session management is not shared, the first reaction is the session out of the problem, suddenly think of nginx distribution request, the time of the request is controlled, relying on this to determine whether the back-end service is normal, If the backend request time-out does not return, the service is considered to be an exception, which in turn forwards the request to another machine. Such a thought makes sense, if the distribution to other machines, is definitely not logged in, this will definitely jump to the login page.
Third, solve the problem
Use Memcache to do session sharing, when users log in to query, record and update session information, user exit is to delete session information. Ensure that all back-end services share the session so that requests are forwarded immediately and no re-login is required.
Individual pages in the system intermittently jump to the login page exception