Go [Website, cloud service and virtual machine] understand the mechanism of load balancing

Source: Internet
Author: User

Transferred from: http://blog.csdn.net/shaunfang/article/details/9091491

Azure provides free load balancing for websites, cloud services, and virtual machines. What we need to pay attention to about load balancing is its handling of the session. In general, the traditional load balancer has a mechanism called session sticky (sticky), that is, according to the user's session information to forward the user request to a fixed machine, so that if the application on the server side store session information, Then the user interacts with the server will be smooth, otherwise, the user session is lost and the application of logical exceptions

On azure, the load balancer for cloud services and virtual machines is purely network-level, and its equalization mechanism is to rotate the request to the backend server without supporting session stickiness. This requires the background server is stateless, that is, regardless of the customer request to any one server, can be processed correctly. If the existing application is stateful, there are two workarounds:

    1. The session information is shared among all servers. Implementation methods include: Distributed cache (such as Memcache,azure Caching), Session persistence (. NET and Java both support the use of databases to store session information, while Azure also supports persisting. NET session information with cache and Azure storage: http://blogs.msdn.com/b/cie/archive/2013/05 /17/session-state-management-in-windows-azure-web-roles.aspx)
    2. Configure your own load Balancing cluster on a virtual machine, such as squid (Linux), IIS ARR (Windows). Microsoft's Msopentech team provides a way to automatically configure IIS arr: https://github.com/MSOpenTech/WindowsAzureToolkitForEclipseWithJava/tree/ Master/utils/arrconfigurationagent. It was originally intended to configure the Java cluster within the cloud service, or it could be used to configure other IIS clusters
The Web service has a slightly different load balancer, and its load balancing is implemented by IIS arr, so it natively supports session sticky. The implementation principle is to add arraffinity this cookie in each response, so that the next time the same user's request is identified and sent to the last server. That is, regardless of whether the app is actively writing cookies or accessing Session,iis, it maintains the server's binding relationship for each user.

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.