Two session loss problems caused by mutual invocation of applications

Source: Internet
Author: User
Tags nginx load balancing

The problem is this, there are two applications, the two applications have mutual invocation relationship, and is a two-way call, a will call B,b will also call a, and through the nginx to the background of the two Tomcat load balancing, the result of the visit will occasionally appear session loss, F12 View route constantly change, prompting for a login error. If the background is a stand-alone tomcat, there is no such problem.

after constant thinking and trying, we thought out two solutions and successfully tested them.

The solution is as follows:

1, modify the Nginx load balancing strategy, from the original sticky changed to Ip_hash;

2, load balance strategy does not move, or use sticky, but sticky to more configuration, as follows:

Upstream loadbalancer_01{

Sticky name=route1;//purpose is to ensure that the name of the two route is not the same

server srv1.example.com;

server srv2.example.com;

server srv3.example.com;

}

Upstream loadbalancer_02{

Sticky name=route2//purpose is to ensure that the name of the two route is not the same

server srv1.example.com;

server srv2.example.com;

server srv3.example.com;

Reason analysis: The two application load Balancer's route name is the same, the default is called route, which results in two application route covering each other.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.