Nginx load balancing, forward proxy and reverse proxy

Forward Proxy:

definition:      

       It refers to a server located between the client and the original server. In order to obtain content from the original server, the client sends a request to the agent and specifies the target (original server), and then the agent forwards the request to the original server and returns the obtained content To the client. The client can use the forward proxy.

For example:

      When a group of customers want foreign genuine bags, they will choose to buy them from the purchasing agent. After receiving the customer's request, the purchasing agent will go to the specialty store to purchase the bags that the customers need, and distribute the bags to the customers according to their needs. The specialty store here does not know who the specific customer is, he only knows how many bags the agent bought.

The purpose of forward proxy:

 

  1. Improve access speed: Generally, proxy servers set up a larger hard disk buffer and save part of the requested response in the buffer. When other users access the same information again, the information is directly retrieved from the buffer and sent to Users to improve access speed.
  2. Hide the real IP of the client

Reverse Proxy:

 definition:  

       Refers to the proxy server to accept the connection request on the Internet, and then forward the request to the server on the internal network, and return the result from the server to the client requesting the connection on the Internet. At this time, the proxy server behaves as A reverse proxy server.

For example:

       When the accumulated goods of bags produced by multiple branches of a certain brand are dumped, they find agents to sell them, and customers buy the bags at the agents. Here, when the customer does not know the bag of this brand, the specialty store in that area only knows that it belongs to this brand. it's here

The purpose of reverse proxy:

  1. Hide the real IP of the server
  2. Load balancing
  3. Improve access speed: The reverse proxy server can provide caching services for static content and dynamic content that has a large number of access requests in a short period of time to improve access speed.
  4. Provide security

 

What the two have in common:

  1. Are used as the middle layer between the server and the client
  2. Can strengthen the security of the intranet and prevent web attacks
  3. Can be used as a caching mechanism to improve access speed

The difference between the two:

  1. The forward proxy is actually the client's proxy, and the reverse proxy is the server's proxy.
  2. In the forward proxy, the server does not know who the real client is; in the reverse proxy, the client does not know who the real server is.
  3. The role is different. The forward proxy is mainly used to solve the problem of access restriction; while the reverse proxy is to provide load balancing and security protection.

 

Through concepts and examples, we found

     The process of forward proxy and reverse proxy is relative. These two definitions just look at the same thing from different angles. The forward proxy only hides the client's information, while the reverse proxy hides the server's information.

Load balancing

  If the user sends a request to the server, the server will resolve a request. If a server resolves too many user requests, the processing speed of the server will be affected. In order to solve this problem, the reverse proxy divides the user's request according to a certain distribution method, and divides the request to different servers to improve the processing speed of the server.

Load balancing algorithm:

  1. polling
  2. Minimal link
  3. Hash

Algorithm reference

 

Guess you like

Origin blog.csdn.net/weixin_44663188/article/details/114581636