Windows platform Distributed architecture practice: Load Balancing

Source: Internet
Author: User
Tags session id linux

Overview

Recent. NET world began to be noisy, Microsoft official finally joined to the right. NET Cross-platform support, and in the near future, the code we write in VS may be able to run directly on Linux and Mac via Mono. So why are people (developers and businesses) so desperate for hope. NET Cross platform? The first reason is cheap, Taobao claims that more than 40,000 servers all run under the Linux,linux platform there are free MySQL, these are free, these are directly to save profits Ah, the cost of doing business can be reduced without any loss, why not? The second reason is that there are a lot of very good architectures (and, of course, free) under the Linux system, distributed cache memcached, large data-processing architectures, Hadoop, and so on, which provide a good support for some large distributed systems, There are, of course, some security and networking advantages such as the LINIUX system itself, and so on. So it's no wonder that the big boys have no choice. NET.

But if. NET also supports Cross-platform, that pattern may be about to change. All of the above advantages can still be retained, and the advantages of its syntax, as well as the rapid development of efficiency, will still be a place for it.

But is it not possible to implement these large distributed systems under the Windows platform? I believe this question has been widely discussed, but at least I don't see a clearer, complete case. With these questions, I decided to upgrade my machine and build a highly scalable distributed Web site from start to finish under the Windows platform. My experience is shallow, a lot of things are still in the groping stage, so if there is a mistake, but also please master a lot of advice.

What is load balancing

Load Balancing can help us solve two aspects of the problem, the first one is to improve usability . This usability is mainly from the Web server, from the point of view, if we have only one Web server, and it encountered an unknown error caused IIS can not start, then our site can not be accessed, which is a relatively low availability. So using load balancing, put it in front of our web server, it collects all the requests and forwards them to our web server, at which point we can add two Web servers, and if one of them is broken, at least another one is working and not causing our network to be inaccessible.

Of course, one might ask, what if the load balancer is broken? Wouldn't that be a visit to a website? What we're talking about here is increased availability, 365-day 24-hour uninterrupted service that requires additional components to support, and we'll stay behind to discuss it. In addition to usability, load balancing can also help us improve scalability, which, of course, refers to the Web server level. From the point of view of the performance of the website, several programmers spend several days to do some optimization results that may not be able to directly add a single memory to the fast. Memory is finished, we can change a better cpu,cpu, we can also use solid-state drives, and even many companies have begun to put data directly into memory (note: Specific scenes to treat). What if none of this can be added? Then add the machine, a server can handle 1000 concurrent, then two is theoretically 2000, so this has our horizontal expansion.

The type that is responsible for equalizer distribution requests

All requests first reach the load balancer, which are forwarded to the specific Web server, and are forwarded in the following ways:

Rotation Scheduling (Round-robin): The simplest way, this approach is basically not a load balance. The first request to Web1, next to Web2, and then the next to web3 ... Do not consider a server is not too heavy load and so on.

allocation based on weights (weight-based): You can configure the proportions of each server to process request data, especially for scenarios where a server configuration is not the same. For example, a server configuration is particularly good, then we can let it deal with a number of requests.

random (Random): randomly assigned.

StickySessions (Sticky session): Load balancer tracks requests to ensure that the same server is requested for the same session ID.

Most idle first (least current request): forwards the most recent requests to the server with the smallest number of processing requests.

Response Time priority (Response time): Which server is given the shortest response times.

user or URL parameter selection (User or URL information) : part of the load balancer also provides a number of parameters to determine which server to process, for example, according to user information, address location, URL parameters, cookie information and so on.

We can also divide them into the following categories based on the technology used by the load balancer:

Reverse proxy: The Load Balancer acts as a proxy, maintaining two TCP requests, receiving requests from the client, and then forwarding the request to the appropriate Web server, which is returned to the proxy server when the Web returns to response. The proxy server is then forwarded to the real client. This will cause some features are not available, such as in the Web server environment to view the source of the request IP is actually the IP of our proxy server.

Transparent Reverse proxy: the same as the above proxy server, except that the information that the Web server obtains from the request is the true client information, and it seems that no proxy is used.

Direct Server return: by changing the Web server's MAC address to implement the distribution request, in this way, the Web server will not be like the use of Proxy server above, the request processing is returned directly to the client, all relative to the reverse proxy this way performance will be faster.

NAT Load Balancing: NAT (network address translation), which converts a destination IP address in a network packet (which can be understood as a TCP packet) to the address of the Web server that implements the request.

Microsoft Network Load Balancing: Windows comes with a load-balancing component that we'll use to test it for a while.

Do not use load-balanced test results

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.