All Documents
Current Document

Content is empty

If you don't find the content you expect, please try another search term

Documentation

Listener overview

Last updated:2021-05-26 16:59:41

After you create a Server Load Balancing (SLB) instance, you must configure one or more listeners for it. A listener listens to client requests and distributes the client requests to backend servers based on the configured forwarding policy. An SLB listener can also have a session persistence policy and a health check policy.

An SLB listener can listen to Layer 4 and Layer 7 requests and distribute these requests to backend servers. The difference between Layer 4 SLB instances and Layer 7 SLB instances lies in whether load balancing is based on Layer 4 information or Layer 7 information. A Layer 4 SLB instance receives and distributes traffic based on the virtual IP address (VIP) and port information. A Layer 7 SLB instance distributes traffic based on the application layer protocol information such as the URL and HTTP header.

Supported protocols

Communication between typical web applications goes through all layers in the Open Systems Interconnection (OSI) network model. Each layer provides a specific communication function, and a standard format for communication is implemented in these layers. Kingsoft Cloud SLB involves Layer 4 (transport layer) and Layer 7 (application layer) in the network model.

Kingsoft Cloud SLB supports forwarding requests of the following protocols:

Public SLB instances

  • HTTP: All regions
  • HTTPS: All regions
  • TCP: All regions
  • UDP: regions except Hong Kong

Private SLB instances

  • HTTP: CN North 1 (Beijing) and CN East 1 (Shanghai)
  • TCP: All regions
  • UDP: regions except Hong Kong

Layer 4 protocols

After SLB receives a request forwarded using a Layer 4 protocol, it attempts to open a protocol-based connection to the corresponding backend server on the port specified in the listener configuration. Then, SLB forwards the request to the backend server without modifying the request packet.

Layer 7 protocols

If both the frontend and backend connections use a Layer 7 protocol to forward requests, SLB resolves the application layer information in requests and then selects a backend server based on the information. A Layer 7 SLB instance must first act as a backend server agent to complete the three-way handshake to establish a connection to the client before a request packet can be received. After receiving a request packet, the Layer 7 SLB instance selects a backend server based on the configured server selection method and the specific application layer fields in the request packet.

HTTPS listener security mechanism

HTTPS supports secure HTTP connections and uses certificates to implement authentication between the server and the client. SLB uses information in certificates to decrypt requests from clients and then forwards the requests to backend servers. For more information, see What is Kingsoft Cloud SSL Certificate Management.

Difference between Layer 4 SLB instances and Layer 7 SLB instances

The difference between Layer 4 SLB instances and Layer 7 SLB instances lies in whether load balancing is based on Layer 4 information or Layer 7 information.

A Layer 4 SLB instance uses a Layer 3 IP address (VIP) and a Layer 4 port number to identify the traffic that requires load balancing. Then, the instance performs Network Address Translation (NAT) for the traffic and redirects the traffic to backend servers.

A Layer 7 SLB instance uses application layer information, including the HTTP header and URL, in addition to Layer 4 information. For a web server, a Layer 7 SLB instance first identifies the traffic to be processed based on the VIP and port number. Then, the Layer 7 SLB instance identifies whether load balancing is required based on the URL. Layer 7 load balancing is also called content exchange. A Layer 7 SLB instance selects a backend server based on the configured server selection method and the specific application layer fields in a request packet. To obtain application layer field information, a Layer 7 SLB instance must first act as a backend server agent to complete the three-way handshake to establish a connection to a client. In this scenario, Layer 7 SLB is more like an agent. It must respectively establish a connection to the client and the backend server.

On this page
Pure ModeNormal Mode

Pure Mode

Click to preview the document content in full screen
Feedback