In the two kinds of load balancing strategy Tianyi cloud testing of Nginx

         The last article, Nginx is a very popular reverse proxy server. Previous article, we explained mainly by Nginx do load balancing polling strategy. The Nginx load balancing strategy actually still too many. Today we actually tested two different ways.

First, load balancing weights

      Polling a probability proportional to weight ratio and access, for the case where unevenness backend server performance. 

    upstream 182.151.48.47{

    server 192.168.189.2:9000 weight 1;

    server 192.168.189.100:9000 weight 3;

    }

      The actual test results, refresh the page once targeted to webServer1, three times to locate webServer2. The same configuration.

Second, the weight load balancing

Each request is assigned according ip hash result of the visit, so that each visitor to access a fixed back-end server, can solve the problem of session.

    upstream 182.151.48.47{

    ip_hash;

    server 192.168.189.2:9000;

    server 192.168.189.100:9000;

    }

The actual test results, refresh the page to locate all webServer1. The same configuration.

Third, the summary

1, nginx can basically replace F5 hardware, there is a regular demand of customers in the public cloud "session remains" in fact must be resolved, in the nginx can sticky_cookie_insert srv_id expires = 1h domain = dns.com (example domain name) path = /; to solve

2, nginx can also solve saved the source ip http problems will remain in the user's head tcp ip source by removing the head of the source tcp ip, you can get the user to restore the source ip on webServer.

 

I hope this article can help you.

More real-time updates, visit public number.    

 

Click here to get the highest ¥ 1888 Ali cloud offering universal vouchers

Guess you like

Origin blog.csdn.net/qq_29718979/article/details/90487008