In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-09 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
The following brings you an introduction to the solution of WEB load balancing, hoping to give you some help in practical application. Load balancing involves many things, and there are not many theories. There are many books on the Internet. Today, we will use the accumulated experience in the industry to do an answer.
Web load balancing (Load Balancing) simply means assigning "work tasks" to our CVM cluster, and adopting a proper allocation method is very important for protecting Web servers at the back end.
Reverse proxy load balancing
The core work of reverse proxy service is to forward HTTP requests, which acts as a transit between the browser side and the background Web server. Because it works in the HTTP layer (application layer), which is the seventh layer in the seven-layer structure of the network, it is also called "seven-layer load balancing". There are many software that can do reverse proxy, one of the more common is Nginx.
Nginx is a very flexible reverse proxy software, which can freely customize the forwarding strategy and assign the weight of server traffic. A common problem in reverse proxy is the session data stored by the Web server, because the general load balancing strategy is to randomly allocate requests. The request of the same logged-in user cannot be guaranteed to be assigned to the same Web machine, which will lead to the problem that the session cannot be found.
There are two main solutions:
Configure the forwarding rules of the reverse proxy so that the requests of the same user must fall on the same machine (through the analysis of cookie), complex forwarding rules will consume more CPU and increase the burden of the proxy server.
It is recommended that information such as session be stored exclusively by a separate service, such as redis/memchache.
Reverse proxy service can also enable caching. If it is enabled, it will increase the burden of reverse proxy and need to be used with caution. This load balancing strategy is very simple to implement and deploy, and the performance is good. However, it has the problem of "single point of failure". If it fails, it will bring a lot of trouble. Moreover, at a later stage, the Web server continues to increase, and it itself may become a bottleneck of the system.
Sample profile:
# user nobody; worker_processes 1; # pid logs/nginx.pid; events {worker_connections 1024;} http {include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; upstream www.hcoder.net {server 192.168.1.188 weight=5; server 80 weight=5; server 192.168.1.158 worker_connections 80;} server {listen 80; server_name www.hcoder.net Location / {proxy_pass http://www.hcoder.net; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;}}
The above are the details of the website load balancing solution, please pay more attention to other related articles!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.