[go: up one dir, main page]
More Web Proxy on the site http://driver.im/

WO2023151264A1 - Load balancing method and apparatus, node, and storage medium - Google Patents

Load balancing method and apparatus, node, and storage medium Download PDF

Info

Publication number
WO2023151264A1
WO2023151264A1 PCT/CN2022/116443 CN2022116443W WO2023151264A1 WO 2023151264 A1 WO2023151264 A1 WO 2023151264A1 CN 2022116443 W CN2022116443 W CN 2022116443W WO 2023151264 A1 WO2023151264 A1 WO 2023151264A1
Authority
WO
WIPO (PCT)
Prior art keywords
load balancing
node
resource request
client
information
Prior art date
Application number
PCT/CN2022/116443
Other languages
French (fr)
Chinese (zh)
Inventor
单卫华
王建
Original Assignee
华为云计算技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为云计算技术有限公司 filed Critical 华为云计算技术有限公司
Publication of WO2023151264A1 publication Critical patent/WO2023151264A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/02Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1001Protocols in which an application is distributed across nodes in the network for accessing one among a plurality of replicated servers
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1001Protocols in which an application is distributed across nodes in the network for accessing one among a plurality of replicated servers
    • H04L67/1004Server selection for load balancing

Definitions

  • the present application relates to the technical field of communications, and in particular to a load balancing method, device, node and storage medium.
  • CDN services enable users to obtain the required resources nearby and reduce network congestion through functions such as load balancing, content distribution, and scheduling.
  • the CDN service directs the user's resource request to the CDN cluster (or region) closest to the user through domain name resolution (DNS) scheduling, and then directs the resource request to the CDN cluster in the CDN cluster through the load balancer.
  • DNS domain name resolution
  • the service node which returns the resources required by the user.
  • load balancers can be divided into four-layer load balancers and seven-layer load balancers according to the open system interconnection reference model (OSI) layer in which they work.
  • OSI open system interconnection reference model
  • the layer-4 load balancer after receiving the user's resource request, sends the resource request to the layer-7 load balancer, and the layer-7 load balancer analyzes the resource request, and sends the resource request to corresponding service node.
  • the resource request needs to go through the four-layer load balancer and the seven-layer load balancer in turn, and finally reach the corresponding service node.
  • the service node needs to send the resource request Forwarding to the layer-7 load balancer corresponding to other service nodes, other service nodes return the resources to the service node, and the service node returns the resources required by the user, resulting in a large amount of cross-device east-west traffic, causing the device
  • the north-south traffic is squeezed, the pressure on switches and service nodes is high, and the efficiency of CDN services is low.
  • Embodiments of the present application provide a load balancing method, device, node, and storage medium, which can improve the efficiency of CDN services.
  • the technical solution is as follows:
  • the present application provides a load balancing method, which is executed by a first load balancing node, and the method includes:
  • connection protocol information between the first load balancing node and the client to the first service node
  • the connection protocol information includes the adopted network protocol, the address information of the client, and the first load balancing node
  • the address information of the node, the connection protocol information is used for the service node to send the response message of the resource request to the client, so as to transmit the target resource to the client, and the source address information of the response message is the first payload The address information of the balance node.
  • the target resources can be pictures, audio, video, text, etc., which are not limited in this embodiment of the application.
  • the load balancing node receives the resource request from the client, it can locate the resource at one time. Accurate service nodes, so as to avoid a large amount of cross-device east-west traffic and reduce the pressure on switches and service nodes. Further, the load balancing node sends resource requests and connection protocol information to the service node, where the connection protocol information includes the adopted The network protocol, the address information of the client and the address information of the load balancing node. In this way, based on the connection protocol information, the service node can pretend to be the response message of the load balancing node and send it to the client. The response message bypasses the load balancing node and realizes the separation and flow of resource requests and response messages. , form the efficient forwarding of the DR mode of the application layer, and improve the efficiency of CDN services.
  • the sending the resource request, the connection protocol information between the first load balancing node and the client to the first service node includes:
  • the target message carries the connection protocol information, the network protocol used by the target message and the network protocol used to establish a connection between the first load balancing node and the service node are: the same network protocol.
  • the first load balancing node transmits the connection protocol information to the first service node in the form of a separate data packet.
  • the network protocol used to establish the connection between the first load balancing node and the client is the first network protocol
  • the network protocol used to establish the connection between the first load balancing node and the service node is For the second network protocol
  • the first network protocol is different from the second network protocol
  • the connection protocol information also includes the information carried in the difference field in the packet headers of the first network protocol and the second network protocol.
  • the first load balancing node can obtain the resource request using the first Necessary information for data transmission between the network protocol and the client, so that there is no need to parse the complete resource request, reducing the request delay.
  • the first network protocol is HTTPS
  • the second network protocol is HTTP
  • the connection protocol information also includes the connection protocol established between the first load balancing node and the client. Key information required to connect.
  • the first network protocol is a full-duplex communication protocol websocket based on transmission control protocol TCP
  • the second network protocol is hypertext transfer protocol HTTP
  • the connection protocol information also includes the first load balancing node and The key information required to establish a connection between the clients and the request type of the resource request, the request type is used to identify that the resource request is a web socket type request.
  • the first network protocol is Hypertext Transfer Protocol HTTP1.1
  • the second network protocol is Hypertext Transfer Protocol HTTP
  • the connection protocol information also includes the connection between the first load balancing node and the client Data range information required to establish a connection.
  • the method also includes:
  • the sending of the resource request and the connection protocol information between the first load balancing node and the client to the first service node includes:
  • the response report of the first service node can still be directly returned to the client without going through the first load balancing node again, realizing the separation and flow of resource requests and response messages, forming efficient forwarding in the DR mode of the application layer, and improving the efficiency of CDN services.
  • the first service node and the first load balancing node belong to the same data center.
  • the method also includes:
  • the target resource In response to the resource request, if the target resource does not exist in the data center where the first load balancing node is located, send the resource request and the connection protocol information to the second load balancing node, and the second load balancing node and the second load balancing node A load balancing node belongs to different data centers.
  • the first load balancing node can transfer resource requests and connection protocol information to load balancing nodes in other data centers in a timely manner when there is no target resource, thus realizing Resource request and response messages are separated and transferred to form efficient forwarding in the DR mode of the application layer, which improves the efficiency of CDN services.
  • the connection protocol information between the first load balancing node and the client can be transferred across data centers, so that data centers can be interconnected and mutually scheduled, forming a distributed protocol scheduling capability, which effectively improves The efficiency of CDN services.
  • the present application provides a load balancing method, which is performed by a service node, and the method includes:
  • connection protocol information between the first load balancing node and the client, the connection protocol information including the adopted network protocol, the address information of the client and the address information of the first load balancing node, the The resource request is used to obtain the target resource;
  • the source address information of the response message is the first load balancing Node address information.
  • a response message of the resource request is sent to the client, including:
  • the service node and the first load balancing node belong to the same data center.
  • the resource request and the connection protocol information are sent by the first load balancing node.
  • the resource request and the connection agreement information are sent by another service node of the data center.
  • connection protocol information between the first load balancing node and the client can be transferred across devices, enabling devices to communicate with each other and schedule each other, forming a distributed protocol scheduling capability and effectively improving the efficiency of CDN services .
  • the service node and the first load balancing node belong to different data centers.
  • the resource request and the connection protocol information are sent by the first load balancing node to the second load balancing node, they are sent by the second load balancing node, and the second load balancing node and the service node belong to In the same data center, the second load balancing node and the first load balancing node belong to different data centers.
  • connection protocol information between the first load balancing node and the client can be transferred across data centers, enabling data centers to communicate with each other and schedule each other, forming a distributed protocol scheduling capability, which effectively improves the CDN service. efficiency.
  • the present application provides a load balancing device, which includes:
  • a service node determination module configured to determine a first service node in response to a resource request from a client, where the resource request is used to obtain a target resource;
  • a connection protocol information transfer module configured to send the resource request, connection protocol information between the first load balancing node and the client to the first service node, the connection protocol information includes the adopted network protocol, the client's address information and the address information of the first load balancing node, the connection protocol information is used for the service node to send the response message of the resource request to the client, so as to transmit the target resource to the client, and the response message is
  • the source address information is address information of the first load balancing node.
  • connection protocol information transfer module is used for:
  • the target message carries the connection protocol information, the network protocol used by the target message and the network protocol used to establish a connection between the first load balancing node and the service node are: the same network protocol.
  • the network protocol used to establish the connection between the first load balancing node and the client is the first network protocol
  • the network protocol used to establish the connection between the first load balancing node and the service node is For the second network protocol
  • the first network protocol is different from the second network protocol
  • the connection protocol information also includes the information carried in the difference field in the packet headers of the first network protocol and the second network protocol.
  • the first network protocol is HTTPS
  • the second network protocol is HTTP
  • the connection protocol information also includes the connection protocol established between the first load balancing node and the client. Key information required to connect.
  • the first network protocol is a full-duplex communication protocol websocket based on transmission control protocol TCP
  • the second network protocol is hypertext transfer protocol HTTP
  • the connection protocol information also includes the first load balancing node and The key information required to establish a connection between the clients and the request type of the resource request, the request type is used to identify that the resource request is a web socket type request.
  • the first network protocol is Hypertext Transfer Protocol HTTP1.1
  • the second network protocol is Hypertext Transfer Protocol HTTP
  • the connection protocol information also includes the connection between the first load balancing node and the client Data range information required to establish a connection.
  • the device further includes a protocol conversion module, configured to perform protocol conversion on the resource request based on the target protocol when the resource request is not generated based on the target protocol, to obtain the resource request after protocol conversion , the target protocol represents the protocol used between the first load balancing node and the service node;
  • connection protocol information transfer module is used for:
  • the first service node and the first load balancing node belong to the same data center.
  • connection protocol information transfer module is also used for:
  • the target resource In response to the resource request, if the target resource does not exist in the data center where the first load balancing node is located, send the resource request and the connection protocol information to the second load balancing node, and the second load balancing node and the second load balancing node A load balancing node belongs to different data centers.
  • the present application provides a data processing device, which includes:
  • An information receiving module configured to receive a resource request from a client, connection protocol information between the first load balancing node and the client, the connection protocol information including the adopted network protocol, address information of the client, and the first load balancing node The address information of the node, the resource request is used to obtain the target resource;
  • the response message sending module is used to respond to the resource request, based on the connection protocol information, send the response message of the resource request to the client, so as to transmit the target resource to the client, the source of the response message
  • the address information is the address information of the first load balancing node.
  • the response message sending module is configured to respond to the resource request, based on the connection protocol information, using the address information of the first load balancing node as the source address information, and using the client's address information as the destination address information, and send the response message of the resource request to the client.
  • the service node and the first load balancing node belong to the same data center.
  • the resource request and the connection protocol information are sent by the first load balancing node.
  • the resource request and the connection agreement information are sent by another service node of the data center.
  • the service node and the first load balancing node belong to different data centers.
  • the resource request and the connection protocol information are sent by the first load balancing node to the second load balancing node, they are sent by the second load balancing node, and the second load balancing node and the service node belong to In the same data center, the second load balancing node and the first load balancing node belong to different data centers.
  • the present application provides a load balancing node, the load balancing node includes a processor and a memory, and the memory is used to store at least one piece of program code, and the at least one piece of program code is loaded by the processor and executes the aforementioned first aspect Or the load balancing method provided by any possible implementation manner of the first aspect.
  • the present application provides a service node, the service node includes a processor and a memory, the memory is used to store at least one piece of program code, the at least one piece of program code is loaded by the processor and executes the aforementioned second aspect or the first A load balancing method provided by any possible implementation of the two aspects.
  • the present application provides a computer-readable storage medium, the computer-readable storage medium is used to store at least one piece of program code, and the at least one piece of program code is used to implement any one of the aforementioned first aspect or any one of the first aspects.
  • the storage medium includes but not limited to volatile memory, such as random access memory, and nonvolatile memory, such as flash memory, hard disk drive (hard disk drive, HDD), and solid state drive (solid state drive, SSD).
  • the present application provides a computer program product, the computer program product includes computer program code, and when the computer program code is executed by a load balancing node, the load balancing node executes any possibility of the aforementioned first aspect or the first aspect
  • the load balancing method provided in the implementation manner of the above-mentioned second aspect or the load balancing method provided in any possible implementation manner of the second aspect when the computer program code is executed by the service node.
  • the computer program product may be a software installation package, and the computer program product may be downloaded and executed on a load balancing node or a service node when the aforementioned load balancing method needs to be used.
  • FIG. 1 is a schematic diagram of an implementation environment of a load balancing method provided in an embodiment of the present application
  • FIG. 2 is a schematic structural diagram of a network device provided by an embodiment of the present application.
  • FIG. 3 is a flow chart of a load balancing method provided in an embodiment of the present application.
  • FIG. 4 is a schematic diagram of a load balancing method provided by an embodiment of the present application.
  • FIG. 5 is a schematic diagram of a load balancing method provided by a related technology and a load balancing method provided by an embodiment of the present application;
  • FIG. 6 is a flowchart of a load balancing method provided by an embodiment of the present application.
  • FIG. 7 is a schematic diagram of a load balancing method provided by an embodiment of the present application.
  • FIG. 8 is a flowchart of a load balancing method provided by an embodiment of the present application.
  • FIG. 9 is a schematic diagram of a load balancing method provided by an embodiment of the present application.
  • FIG. 10 is a flowchart of a load balancing method provided by an embodiment of the present application.
  • FIG. 11 is a schematic diagram of a load balancing method provided by an embodiment of the present application.
  • FIG. 12 is a schematic structural diagram of a load balancing device provided by an embodiment of the present application.
  • Fig. 13 is a schematic structural diagram of a data processing device provided by an embodiment of the present application.
  • the content delivery network is an intelligent virtual network built on the basis of the existing network, relying on the edge servers deployed in various places, and through the load balancing, content distribution, scheduling and other functions of the central platform, it makes users nearby Obtain the desired content, reduce network congestion, and improve user access response speed and hit rate.
  • Load balancing is a scheduling method based on the existing network structure, which can expand the bandwidth of network devices and servers, increase throughput, strengthen network data processing capabilities, and improve network flexibility and availability.
  • a uniform resource locator (uniform resource locator, URL) is the address of a standard resource on the Internet, also known as a web page address.
  • the direct routing (director routing, DR) mode is a method of sending the resource request to the application server by modifying the target media access control address (MAC) address of the resource request, so that the application server will respond to the processing The result is directly returned to the client's working mode.
  • the DR mode at the application layer is called the mode of separation and flow of requests and responses.
  • 302 scheduling is a resource scheduling method.
  • the scheduling center finds that the resource requested by the client has a more suitable CDN node to provide services, it uses the hypertext transfer protocol (hyper text transfer protocol) , HTTP) 302 status code, allowing the client to initiate a resource request to a more suitable CDN node.
  • hypertext transfer protocol hypertext transfer protocol
  • HTTP Hypertext transfer protocol
  • the load balancing method provided by the embodiment of the present application can be applied in a network system that stores, schedules and distributes resources through CDN services.
  • resources are usually stored in a service cluster composed of hundreds or thousands of service nodes, and the service nodes provide external services through load balancing nodes.
  • the load balancing node receives the resource request sent by the client, the load balancing node parses the resource request and forwards the resource request to the corresponding service node to ensure a high resource hit rate.
  • the embodiment of the present application provides a load balancing method.
  • a load balancing node receives a resource request from a client, it can locate an accurate service node at one time, thereby avoiding a large amount of cross-device east-west traffic and reducing the cost of switches and Service node pressure, further, the load balancing node sends a resource request and connection protocol information to the service node, wherein the connection protocol information includes the adopted network protocol, address information of the client and address information of the load balancing node.
  • the service node can pretend to be the response message of the load balancing node and send it to the client.
  • the response message bypasses the load balancing node and realizes the separation and flow of resource requests and response messages. , form the efficient forwarding of the DR mode of the application layer, and improve the efficiency of CDN services.
  • FIG. 1 is a schematic diagram of an implementation environment of a load balancing method provided by an embodiment of the present application.
  • the implementation environment includes a client 101, a load balancing node 102 and a service node 103, and the client 101, the load balancing node 102 and the service node 103 are directly or indirectly connected through a wired network or a wireless network.
  • the client 101 is configured to send a corresponding resource request to the load balancing node 102 according to the user's resource requirement.
  • the client 101 may be a user-side terminal or a server.
  • a terminal is also called a smart terminal or a mobile smart terminal, which refers to a type of device that has rich human-computer interaction methods, has the ability to access the Internet, is usually equipped with various operating systems, and has strong processing capabilities.
  • the types of mobile smart terminals include, but are not limited to, smart phones, tablet computers, desktop computers, vehicle-mounted terminals, handheld game consoles, etc., but are not limited thereto.
  • a server may be a server cluster composed of one or more computing devices. It should be noted that the client 101 may generally refer to one of multiple clients, and this embodiment of the present application only uses the client 101 as an example for illustration.
  • the load balancing node 102 is used to realize the load balancing function, and can distribute the resource request to the corresponding service node 103 according to the resource request of the client 101 .
  • the load balancing node 102 implements the load balancing function through a server or a server cluster composed of multiple servers.
  • the load balancing node 102 implements the load balancing function through a virtual machine or a container engine (docker), which is not limited in this embodiment of the present application.
  • the load balancing nodes 102 include a first load balancing node 1021 and a second load balancing node 1022, etc., wherein, the first load balancing node 1021 belongs to the first data center, and the second load balancing node 1022 belongs to the second data center, and the embodiment of the present application does not limit the number of load balancing nodes.
  • the service node 103 is used to provide a resource storage function, and can feed back resources corresponding to the resource request to the client 101 according to the received resource request.
  • the service node 103 refers to a service node capable of providing CDN services.
  • the service node 103 is an independent physical server, or a server cluster or a distributed file system composed of multiple physical servers, and can also provide cloud services, cloud databases, cloud computing, cloud functions, cloud storage Cloud servers for basic cloud computing services such as network services, cloud communications, middleware services, domain name services, security services, big data and artificial intelligence platforms.
  • the service nodes 103 may belong to different data centers, for example, the first load balancing node 1021 belongs to the first data center, and the first data center It includes a plurality of service nodes 1031 ; the second load balancing node 1022 belongs to a second data center, and the second data center includes a plurality of service nodes 1032 . It should be noted that what is shown in the figure is only illustrative, and the number of service nodes 103 may be more or less, which is not limited in this embodiment of the present application.
  • the wireless or wired network described above uses standard communication technologies and/or protocols.
  • the network is usually the Internet, but can be any network, including but not limited to local area network (LAN), metropolitan area network (MAN), wide area network (WAN), mobile, wired or wireless Any combination of network, private network, or virtual private network.
  • data exchanged over the network is represented using technologies and/or formats including hyper text markup language (HTML), extensible markup language (XML), and the like.
  • HTTP hyper text markup language
  • XML extensible markup language
  • custom and/or dedicated data communication techniques can also be used instead of or in addition to the data communication techniques described above.
  • FIG. 2 is a schematic structural diagram of a network device provided by an embodiment of the present application.
  • the network device 200 includes a memory 201 , a processor 202 , a communication interface 203 and a bus 204 .
  • the memory 201 , the processor 202 , and the communication interface 203 are connected to each other through the bus 204 .
  • the memory 201 may be a read-only memory (read-only memory, ROM) or other types of static storage devices that can store static information and instructions, a random access memory (random access memory, RAM) or other types that can store information and instructions It can also be an electrically erasable programmable read-only memory (EEPROM), compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compact discs, laser discs, optical discs, digital versatile discs, Blu-ray discs, etc.), magnetic disk storage media or other magnetic storage devices, or can be used to carry or store desired program code in the form of instructions or data structures and can be programmed by a computer Any other medium accessed, but not limited to.
  • the memory 201 can store at least one piece of program code. When the program code stored in the memory 201 is executed by the processor 202, the processor 202 and the communication interface 203 are used to execute the load balancing node or service node in the following method embodiments. balanced approach.
  • the processor 202 may be a network processor (network processor, NP), a central processing unit (central processing unit, CPU), a specific application integrated circuit (application-specific integrated circuit, ASIC), or an integrated circuit for controlling the execution of the program program of this application. circuit.
  • the processor 202 may be a single-core (single-CPU) processor, or a multi-core (multi-CPU) processor. The number of the processor 202 may be one or more. Each of these processors is, for example, a single-core processor, or a multi-core processor.
  • a processor herein alternatively refers to one or more devices, circuits, and/or processing cores for processing data such as computer program instructions.
  • the communication interface 203 uses a transceiver module such as a transceiver to implement communication between the network device 200 and other devices or communication networks. For example, data can be acquired through the communication interface 203 .
  • the memory 201 and the processor 202 may be provided separately, or may be integrated together.
  • the bus 204 may include a path for transferring information between various components of the network device 200 (eg, memory 201 , processor 202 , communication interface 203 ).
  • the processor 202 implements the methods in the following embodiments by reading the program code stored in the memory 201, or, the processor 202 implements the methods in the following embodiments through the program code stored internally. In the case that the processor 202 implements the methods in the following embodiments by reading the program code stored in the memory 201, the memory 201 stores the program code for implementing the load balancing method provided in the embodiment of the present application.
  • processor 202 implements the above functions, please refer to the descriptions in the various method embodiments below, which will not be repeated here.
  • the embodiment of the present application also provides a computer-readable storage medium including program codes, such as the memory 201 including program codes.
  • the above program codes can be executed by the processor 202 of the network device 200 to complete the load balancing method.
  • the computer-readable storage medium is a read-only memory (read-only memory, ROM), a random access memory (random access memory, RAM), a compact-disc read-only memory (CD- ROM), magnetic tape, floppy disk, and optical data storage devices, etc.
  • FIG. 3 is a flowchart of a load balancing method provided by an embodiment of the present application. As shown in FIG. 3 , the interaction among the client, the first load balancing node and the first service node is taken as an example for illustration.
  • the load balancing method includes the following steps 301 to 305 .
  • the client sends a resource request to the first load balancing node, where the resource request is used to obtain a target resource.
  • the first load balancing node refers to any load balancing node in the network system that provides CDN services.
  • the client establishes a connection with the first load balancing node according to the request behavior initiated by the user for the target resource, and sends a resource request to the first load balancing node through the connection, and the resource request is used to obtain the target resource.
  • the target resource is a picture, audio, video, text, etc., and the embodiment of the present application does not limit the type of the target resource.
  • the client uses a transmission control protocol (transmission control protocol, TCP)/user datagram protocol (user datagram protocol, UDP) and an upper layer network protocol to establish a connection with the first load balancing node.
  • TCP transmission control protocol
  • UDP user datagram protocol
  • the connection is a transmission tunnel, which can support efficient transmission of data. It should be noted that, in some embodiments, the client can select different network protocols to establish a connection with the first load node according to actual needs.
  • the network protocols include: HTTP, HTTP1.1, HTTP2.0, HTTP3.0, hyper text transfer protocol over SecureSocket layer (HTTPS), high-speed UDP Internet connection protocol (quick UDP internet connection, QUIC) and TCP-based full-duplex communication protocol (web socket), etc.,
  • HTTPS hyper text transfer protocol over SecureSocket layer
  • QUIC high-speed UDP Internet connection protocol
  • QUIC TCP-based full-duplex communication protocol
  • the first load balancing node determines a first service node in response to the resource request of the client.
  • the first service node is used to provide target resources
  • the first load balancing node receives the resource request sent by the client, and determines the first service node from multiple service nodes in response to the resource request.
  • the plurality of service nodes and the first load balancing node belong to the same data center.
  • the first load balancing node 1021 belongs to the first data center
  • the first data center includes a plurality of service nodes 1031 .
  • this step 302 includes the following two steps:
  • Step 1 the first load balancing node responds to the resource request, analyzes the resource request, and obtains the application layer characteristics of the resource request.
  • the first load balancing node parses the target field in the resource request to obtain the application layer characteristics of the resource request.
  • the application layer feature of the resource request includes the URL identifier of the resource request, and the URL identifier can uniquely identify the target resource requested by the resource request.
  • the application layer feature of the resource request further includes a resource type corresponding to the resource request, and the resource type is used to indicate the type of the target resource requested by the resource request.
  • the application layer feature of the resource request further includes other information, which is not limited in this embodiment of the present application.
  • the position of the target field can be set according to actual needs, which is not limited in this embodiment of the present application.
  • the resource request of the client is a resource request under the HTTP protocol
  • the resource request is used to request http://a.com/x
  • the target field of the resource request is a.com/x
  • the first load balancing The node parses the resource request, and obtains that the application layer characteristic of the resource request is a.com/x, which is the URL identifier of the resource request.
  • Step 2 The first load balancing node determines the first service node corresponding to the application layer feature based on the application layer feature.
  • the first load balancing node invokes the target algorithm, and based on the application layer feature, determines the first service node corresponding to the application layer feature.
  • the target algorithm is a consistent hashing algorithm.
  • the first load balancing node uses a hash function to process the application layer feature to obtain a hash value corresponding to the application feature, and then uses a modulo function according to the number of multiple service nodes to obtain the hash value The value is modulo the number, so as to determine the first service node from the plurality of service nodes.
  • a plurality of service nodes include service node A, service node B, and service node C, which are respectively represented by numbers 0, 1, and 2.
  • the first load balancing node invokes a consistent hash algorithm, and the application layer feature a.com/ x is processed to obtain a hash value of 5, and the modulo function is used to take the modulus of the number of service nodes 3 to obtain 2, which corresponds to service node C, and then the service node C is determined as the first service node. Since each service node in the network system is used to store resources corresponding to a certain hash value, the process of determining the first service node by the first load balancing node can also be understood as that the first load balancing node calculates the hash value based on the characteristics of the application layer. The hash value corresponding to the application layer feature determines where the target resource should be stored.
  • the above-mentioned target algorithm can be set according to actual requirements, for example, weighted round-robin algorithm, weighted random algorithm, minimum connection number algorithm, etc., which are not limited in this embodiment of the present application.
  • the first load balancing node can locate the accurate first service node at one time according to the application layer characteristics of resource requests, thereby avoiding a large amount of cross-device east-west traffic and effectively reducing the number of switches and service nodes. pressure. Moreover, by sensing the application layer characteristics in the resource request in real time, request scheduling is performed according to the application layer characteristics, which expands the flexibility of scheduling.
  • the first load balancing node sends the resource request, the connection protocol information between the first load balancing node and the client to the first service node, and the connection protocol information includes the adopted network protocol and the address of the client information and address information of the first load balancing node.
  • the first load balancing node after determining the first service node, sends the client's resource request and connection protocol information to the first service node.
  • the connection protocol information is used by the service node to send a response message of the resource request to the client to transmit the target resource to the client, and the source address information of the response message is the address information of the first load balancing node .
  • any service node in the network system can implement data transmission with the client based on the connection protocol information, that is, the connection protocol information includes necessary information for data transmission between the client and the service node.
  • the address information of the client includes a port number and an Internet protocol (internet protocol, IP) address of the client; the address information of the first load balancing node includes the port number and the address of the first load balancing node IP address.
  • IP Internet protocol
  • the first load balancing node sends the resource request to the first service node, and sends a target message to the first service node, the target message carries the connection protocol information, and the network protocol adopted by the target message
  • the network protocol used to establish the connection between the first load balancing node and the service node is the same network protocol. That is, the first load balancing node transmits the connection protocol information to the first service node in the form of a separate data packet. For example, taking HTTP as an example for establishing a connection between the first load balancing node and the service node, when the first load balancing node sends the resource request to the first service node, it uses HTTP to send the resource request to the first The service node sends the target message.
  • the network protocol used to establish the connection between the first load balancing node and the client is the same network protocol as the network protocol used to establish the connection between the first load balancing node and the service node.
  • the connection protocol information may be obtained when the first load balancing node establishes a connection with the client, or it may be obtained by analyzing the resource request when the first load balancing node receives the resource request from the client. This embodiment of the present application does not limit it.
  • connection protocol information also includes the connection status (such as established connection) between the first load balancing node and the client, the connection holding time, the sequence number based on the TCP protocol, the first load balancing node and the client
  • connection status such as established connection
  • the network protocol used to establish the connection between the first load balancing node and the client and the network protocol used to establish the connection between the first load balancing node and the service node can also be different network protocols.
  • the connection protocol information will be introduced in the subsequent embodiment shown in FIG. 6 , and will not be repeated here.
  • the first service node receives the resource request and the connection protocol information.
  • the first service node In response to the resource request, based on the connection protocol information, the first service node sends a response packet of the resource request to the client, so as to transmit the target resource to the client.
  • the first service node in response to the resource request, based on the connection protocol information, uses the address information of the first load balancing node as the source address information, and uses the address information of the client as the destination address information to send The client sends a response message to the resource request (that is, to construct a response message in the DR mode of the application layer), and the response message carries the target resource.
  • the response message of the first service node can be directly returned to the client without going through the first load balancing node again, thereby realizing the separation and flow of resource requests and response messages, forming efficient forwarding of the DR mode of the application layer, Improved CDN service efficiency.
  • FIG. 4 is a schematic diagram of a load balancing method provided by an embodiment of the present application.
  • the client uses HTTP to request target resources from the service node through the first load balancing node as an example.
  • the client establishes a connection with the first load balancing node, and uses HTTPS to send a resource request to the first load balancing node through the switch, and the resource request is used to request the target resource http://a.com/x.
  • the first load balancing node responds to the resource request, parses the resource request, and obtains the URL identifier a.com/x of the resource request, that is, extracts the application layer feature in the resource request, and determines the first resource request based on the URL identifier.
  • a service node thereby avoiding the generation of a large amount of cross-device east-west traffic, reducing the pressure on switches and service nodes.
  • the first load balancing node sends the resource request and connection protocol information to the first service node, and the first service node After the node receives the resource request and the connection protocol information, based on the connection protocol information, the address information of the first load balancing node is used as the source address information, and the address information of the client is used as the destination address information to generate a response corresponding to the resource request message, the response message carries the target resource, and the response message is sent directly to the client through the switch, which realizes the separation and transfer of resource request and response message, forms the efficient forwarding of the DR mode of the application layer, and improves the CDN service efficiency. Moreover, in this process, by real-time perception of the application layer characteristics in the resource request of the client, request scheduling is performed according to the application layer characteristics, which expands the flexibility of scheduling.
  • FIG. 5 is a schematic diagram of a load balancing method provided by a related technology and a load balancing method provided by an embodiment of the present application.
  • the load balancing method provided by the related technology includes the following steps:
  • the client sends a resource request for the target resource to the Layer 4 load balancer through the switch, with the address of the Layer 4 load balancer as the destination address and the address of the client as the source address;
  • the four-layer load balancer performs load balancing based on the received resource request, takes the address of the four-layer load balancer as the destination address, and takes the client's address as the source address, and transparently transmits the resource request to the seven-layer load balancer ;
  • the seven-layer load balancer establishes a connection with the client based on the received resource request, and performs load balancing based on the application layer characteristics in the resource request, with the address of the service node as the destination address and the seven-layer load balancer's The address is the source address, and the resource request is sent to the service node;
  • the service node Based on the received resource request, the service node sends the target resource to the layer-7 load balancer with the address of the layer-7 load balancer as the destination address and the address of the service node as the source address;
  • the seven-layer load balancer uses the address of the client as the destination address and the address of the four-layer load balancer as the source address to generate a response message for the resource request, bypassing the four-layer load balancing device and transmit it to the client through the switch.
  • resource requests need to pass through the four-layer load balancer and the seven-layer load balancer in sequence, and finally reach the corresponding service node, resulting in a high request delay.
  • the service node will obtain the target resource from other service nodes, thereby generating a large amount of cross-device east-west traffic, resulting in greater pressure on switches and service nodes.
  • related technologies often need to deploy tens of thousands of seven-layer load balancers to ensure the efficiency of CDN services, resulting in load balancing problems. The cost is greatly increased.
  • the load balancing method includes the following steps:
  • the client sends a resource request for the target resource to the load balancing node with the address of the load balancing node as the destination address and the address of the client as the source address through the switch;
  • the load balancing node establishes a connection with the client based on the received resource request, and performs load balancing based on the application layer characteristics in the resource request, with the address of the service node as the destination address and the address of the load balancing node as the source address , sending the resource request and connection protocol information to the service node;
  • the service node uses the address of the load balancing node as the source address information and the address of the client as the destination address to generate a response message for the resource request, and sends the response message
  • the file bypasses the load balancing node and is transmitted to the client through the switch.
  • the load balancing node when the load balancing node receives the resource request from the client, it can locate the accurate service node at one time, thereby avoiding the generation of a large amount of cross-device east-west traffic and reducing the cost of switches and services. Node pressure. Further, the load balancing node sends a resource request and connection protocol information to the service node, wherein the connection protocol information includes the adopted network protocol, address information of the client and address information of the load balancing node. In this way, based on the connection protocol information, the service node can pretend to be the response message of the load balancing node and send it to the client.
  • the response message bypasses the load balancing node and realizes the separation of resource requests and response messages. Transfer, form the efficient forwarding of DR mode at the application layer, and improve the efficiency of CDN services. Moreover, in the load balancing method provided by the embodiment of the present application, the load balancing node does not need to parse the complete resource request, which takes a short time. Therefore, on the basis of ensuring the CDN service efficiency, there is no need to configure too many load balancing nodes in the network system. nodes, thus effectively reducing the cost of load balancing.
  • the above load balancing methods shown in FIG. 3 and FIG. 4 introduce a basic implementation manner of the load balancing solution provided by the embodiment of the present application.
  • the network protocol used between the client and the first load balancing node and the network protocol used between the first load balancing node and the service node are the same network protocol.
  • the network protocol used to establish the connection between the first load balancing node and the client is the first network protocol
  • the network protocol used to establish the connection between the first load balancing node and the service node is the first network protocol.
  • Two network protocols, the first network protocol and the second network protocol are different. Based on the embodiment shown in FIG. 6 , the load balancing method in this case will be introduced below.
  • FIG. 6 is a flowchart of a load balancing method provided by an embodiment of the present application. As shown in FIG. 6 , the interaction among the client, the first load balancing node and the first service node is taken as an example for illustration.
  • the load balancing method includes the following steps 601 to 606 .
  • the client sends a resource request to the first load balancing node, where the resource request is used to obtain a target resource.
  • this step 601 is the same as that of the above-mentioned step 301, so details are not repeated here.
  • the first load balancing node performs protocol conversion on the resource request based on the second network protocol, and obtains the resource request after the protocol conversion.
  • the second network protocol indicates a network protocol used to establish a connection between the first load balancing node and the service node.
  • the first load balancing node receives the resource request, based on the first network protocol and the second network protocol adopted by the resource request, it determines that the resource request is not generated based on the second network protocol, and the resource request Perform protocol conversion, so that the protocol used by the resource request after protocol conversion is the second network protocol.
  • the first network protocol used by the client's resource request is HTTPS
  • the resource request includes https://a.com/x
  • the second network protocol is HTTP
  • the first load balancing node is based on HTTP.
  • Protocol conversion the resource request obtained after the protocol conversion is http://a.com/x. It should be noted that the example here is only for illustration, and the embodiment of the present application does not limit the types of the first network protocol and the second network protocol.
  • the first load balancing node determines the first service node based on the resource request.
  • the first service node is used to provide target resources, and the process for the first load balancing node to determine the first service node based on the resource request is the same as the above step 302, so it will not be repeated here.
  • the first load balancing node determines the first service node based on the protocol-converted resource request during the process of performing the above step 603 .
  • the first load balancing node first performs the above step 603 to determine the first service node, and then performs the above step 602 to obtain the resource request after the protocol conversion. That is, the embodiment of the present application does not limit the timing of protocol conversion by the first load balancing node and the determination of the protocol type of the resource request on which the first service node depends.
  • the first load balancing node sends the protocol-converted resource request and connection protocol information between the first load balancing node and the client to the first service node, where the connection protocol information includes the adopted network protocol, the The address information of the client and the address information of the first load balancing node.
  • the process of the first load balancing node sending the resource request and the connection protocol information to the first service node in step 604 is the same as that of step 303 above, so it will not be repeated here.
  • the first load balancing node can obtain The necessary information for data transmission between the first network protocol and the client, so that there is no need to parse a complete resource request, and the request delay is reduced.
  • the connection protocol information also includes the information carried in the difference fields in the packet headers of the first network protocol and the second network protocol. That is, in response to the resource request, the first load balancing node parses the difference field in the packet header corresponding to the second network protocol in the resource request to obtain corresponding information.
  • the first network protocol is HTTPS
  • the second network protocol is HTTP.
  • HTTPS is a protocol for encrypting and transmitting data on the basis of HTTP.
  • the difference fields of the corresponding messages of the two network protocols include the field where the key information is located.
  • the first load balancing node parses the field where the key information is located in the resource request, and obtains the key information required for establishing a connection between the first load balancing node and the client. That is, in this case, the above connection protocol information also includes key information required to establish a connection between the first load balancing node and the client, such as a public key, a private key, and a digital certificate.
  • the first network protocol is web socket
  • the second network protocol is HTTP
  • web socket is a protocol that realizes full-duplex communication in the form of long connection.
  • the difference fields between websocket and HTTP corresponding messages include the field where the key information is located and the field where the request type is located.
  • web socket upgrade: web socket
  • Sec-WebSocket-Key is a base64-encoded ciphertext, which is the key information.
  • the first load balancing node parses the key information and the field of the request type in the resource request, and obtains the key information required for establishing a connection between the first load balancing node and the client and the request type of the resource request. That is, in this case, the above connection protocol information also includes key information required to establish a connection between the first load balancing node and the client and the request type of the resource request, and the request type is used to identify the resource
  • the request is a web socket type request.
  • the first network protocol is HTTP1.1
  • the second network protocol is HTTP.
  • HTTP1.1 is a protocol that supports communication in the form of long connections on the basis of HTTP.
  • the difference fields of the packets corresponding to the two network protocols include the field where the data range is located and the like. For example, there will be a range (range) field in the header of the HTTP1.1 corresponding message, which is used to identify the data range in bytes.
  • the first load balancing node parses the data range field in the resource request to obtain data range information required for establishing a connection between the first load balancing node and the client. That is, in this case, the above connection protocol information also includes data range information required to establish a connection between the first load balancing node and the client.
  • the first load balancing node stores difference field information corresponding to different network protocols, and the first load balancing node can determine the corresponding difference field information according to the network protocol type of the resource request received, thereby parsing the resource
  • the corresponding difference field in the request header can get the corresponding information and improve the efficiency of load balancing.
  • the first load balancing node stores the difference field information corresponding to HTTPS and HTTP, such as the field where the key information is located, in the first load balancing node
  • the difference field information corresponding to HTTPS and HTTP, such as the field where the key information is located
  • the field where the key information is located in the resource request can be parsed to obtain corresponding key information, etc., which is not limited in this embodiment of the present application.
  • the above-mentioned types are only examples. In practical applications, the difference fields of packets corresponding to different network protocols may also include more content.
  • the above-mentioned first network protocol and second network protocol may also adopt other forms. There is no limit to this.
  • the first load balancing node when establishing a connection with the client using the first network protocol, the first load balancing node obtains the connection protocol information based on the established connection, which is not limited in this embodiment of the present application.
  • the first service node receives the protocol-converted resource request and the connection protocol information.
  • the first service node In response to the protocol-converted resource request, the first service node sends a response message of the resource request to the client based on the connection protocol information, so as to transmit the target resource to the client.
  • this step 606 the specific implementation of this step 606 is the same as the above step 303.
  • the network protocol used by the response message generated by the first service node is the first network The protocol is the same as the network protocol used to establish the connection between the first load balancing node and the client, thereby realizing the network protocol adopted between the client and the first load balancing node and the connection between the first load balancing node and the service node.
  • the response message of the first service node can still be returned directly to the client without going through the first load balancing node again, realizing the separation and flow of resource requests and response messages, forming an application Efficient forwarding of layer DR mode improves CDN service efficiency.
  • FIG. 7 is a schematic diagram of a load balancing method provided by an embodiment of the present application.
  • the client uses the first network protocol HTTPS to request the target resource from the service node through the first load balancing node.
  • the client establishes a connection with the first load balancing node, and uses the first network protocol HTTPS to send a resource request to the first load balancing node through the switch, and the resource request is used to request the target resource https://a.com/x.
  • the first load balancing node determines that the protocol adopted by the resource request is not the second network protocol HTTP, performs protocol conversion on the resource request, and obtains a resource request after protocol conversion.
  • the resource request after protocol conversion uses to request http://a.com/x. Therefore, the first load balancing node sends the protocol-converted resource request and connection protocol information to the first service node, and after receiving the resource request and connection protocol information, the first service node uses the first connection protocol information based on the connection protocol information.
  • the address information of the load balancing node is the source address information, and the address information of the client is used as the destination address information to generate a response message corresponding to the resource request.
  • the response message carries the target resource, and the response message is directly transmitted through the switch. sent to the client, so that when the network protocol adopted between the client and the first load balancer is different from the network protocol adopted between the first load balancer node and the service node, the response of the first service node
  • the message can still be directly returned to the client without going through the first load balancing node again, which realizes the separation and flow of resource request and response messages, forms the efficient forwarding of the DR mode at the application layer, and improves the efficiency of CDN services.
  • a load balancing node when a load balancing node receives a resource request from a client, it can locate an accurate resource at one time when the network protocol used by the resource request is different from the network protocol used between the load balancing node and the service node.
  • Service nodes so as to avoid a large amount of cross-device east-west traffic and reduce the pressure on switches and service nodes.
  • the load balancing node sends resource requests and connection protocol information to the service node, where the connection protocol information includes the adopted network Protocol, client address information and load balancing node address information.
  • the service node can pretend to be the response message of the load balancing node and send it to the client.
  • the response message bypasses the load balancing node and realizes the separation and flow of resource requests and response messages. , form the efficient forwarding of the DR mode of the application layer, and improve the efficiency of CDN services.
  • the load balancing node can locate the accurate service node storing the target resource at one time, and the service node provides the target resource to the client. Based on the embodiment shown in FIG. 8 , the load balancing method provided by the embodiment of the present application will be introduced below in the case that the service node determined by the load balancing node does not have the target resource.
  • FIG. 8 is a flowchart of a load balancing method provided by an embodiment of the present application. As shown in FIG. 8 , the interaction among the client, the first load balancing node, the first service node and the second service node is taken as an example for illustration.
  • the load balancing method includes the following steps 801 to 807 .
  • the client sends a resource request to the first load balancing node, where the resource request is used to obtain a target resource.
  • this step 801 is the same as that of the above-mentioned step 301, so it will not be repeated here.
  • the first load balancing node determines a second service node in response to the client's resource request.
  • step 802 the specific implementation manner of step 802 is the same as that of step 302 above, that is, the first load balancing node determines the second service node from multiple service nodes in response to the resource request.
  • the first load balancing node sends the resource request, the connection protocol information between the first load balancing node and the client to the second service node, and the connection protocol information includes the adopted network protocol and the address of the client information and address information of the first load balancing node.
  • this step 803 is the same as that of the above-mentioned step 303, so it will not be repeated here.
  • the second service node receives the resource request and the connection protocol information.
  • the second service node determines the first service node when the target resource does not exist on the second service node.
  • the first service node is used to provide the target resource. After the second service node receives the resource request, if the target resource does not exist in the second service node, based on the target resource, The first service node storing the target resource is re-determined from multiple service nodes, where the multiple service nodes and the first load balancing node belong to the same data center.
  • the multiple service nodes can update the resources stored by themselves in time according to the target rules.
  • the target rule can be set according to actual requirements, which is not limited.
  • the service node stores a certain resource, and if the resource has not been accessed for a long time, the service node deletes the resource; another example, the service node stores a certain resource, and the storage time of the resource exceeds the preset time In the case of , the service node deletes the resource, etc., which is not limited in this embodiment of the present application.
  • the second service node may have deleted the original stored target resource. Therefore, The second service node needs to re-determine the service node storing the target resource.
  • the second service node invokes a target algorithm to determine the first service node corresponding to the resource request based on the resource request. This process is the same as the process of determining the first service node by the first load balancing node in step 302 above, so it will not be repeated here. In this way, each of the multiple service nodes can quickly locate the service node storing the target resource when the target resource does not exist in its own service node, thereby improving CDN service efficiency.
  • the second service node can also determine the service node adjacent to itself as the first service node, and so on, that is, the embodiment of the present application determines the specific The method is not limited.
  • the second service node sends the resource request and the connection protocol information to the first service node.
  • the first service node In response to the resource request, based on the connection protocol information, the first service node sends a response packet of the resource request to the client, so as to transmit the target resource to the client.
  • this step 807 is the same as that of the above-mentioned step 305 .
  • the service node will determine the first service node that can provide the target resource by itself, and send a resource request to the first service node and connection protocol information, so that the response message of the first service node can be directly returned to the client without going through the first load balancing node again, so that the resource request and response message can be separated and transferred without the client's perception , form the efficient forwarding of the DR mode of the application layer, and improve the service efficiency of the CDN.
  • the first service node when the target resource does not exist, continues to determine other service nodes from multiple service nodes, and sends resource requests and connection protocol information to other service nodes, The target resource is provided to the client by other service nodes.
  • FIG. 9 is a schematic diagram of a load balancing method provided by an embodiment of the present application. As shown in FIG. 9 , it is taken as an example that a client requests a target resource from a service node through a first load balancing node.
  • the client establishes a connection with the first load balancing node, sends a resource request to the first load balancing node, and the first load balancing node determines the second service node in response to the resource request, and sends the resource request and connection to the second service node Protocol information, the second service node determines the first service node when there is no target resource, sends a resource request and connection protocol information to the first service node, and the first service node receives the resource request and connection protocol information Then, based on the connection protocol information, the address information of the first load balancing node is used as the source address information, and the address information of the client is used as the destination address information to generate a response message corresponding to the resource request, and the response message carries the target Resource, and the response message is sent directly to the client through the switch, so that when the service node determined by the first load balancing node does not have the target resource and the client has no perception, the resource request and response message are separated and flowed , form the efficient
  • the resource request and connection protocol information received by the first service node that provides the target resource to the client are sent by the first load balancing node
  • the resource request and connection protocol information received by the first service node that provides the target resource to the client is sent by another service node, that is, in this way , the connection protocol information between the first load balancing node and the client can be transferred across devices, so that the devices can be interconnected and mutually scheduled, forming a distributed protocol scheduling capability, and effectively improving the efficiency of CDN services.
  • the above load balancing methods shown in FIG. 3 to FIG. 9 introduce several implementation manners of the load balancing solution provided by the embodiment of the present application. Among them, the load balancing node and the service node belong to the same data center. Based on the embodiment shown in FIG. 10 , the load balancing method provided by the embodiment of the present application will be introduced below when the implementation environment of the load balancing method includes multiple data centers.
  • FIG. 10 is a flowchart of a load balancing method provided by an embodiment of the present application. As shown in FIG. 10 , taking the interaction among the client, the first load balancing node, the second load balancing node and the third service node as an example for illustration, the load balancing method includes the following steps 1001 to 1007 .
  • a client sends a resource request to a first load balancing node, where the resource request is used to obtain a target resource.
  • this step 1001 is the same as that of the above step 301, so it will not be repeated here.
  • the first load balancing node In response to the client's resource request, the first load balancing node sends the resource request, the first load balancing node and The connection protocol information between the clients, the connection protocol information includes the adopted network protocol, the address information of the client and the address information of the first load balancing node.
  • the first load balancing node and the second load balancing node belong to different data centers.
  • Each data center corresponds to multiple service nodes.
  • the first load balancing node 1021 belongs to a first data center, and the first data center includes a plurality of service nodes 1031; the second load balancing node 1022 belongs to a second data center, and the second data center
  • the center includes multiple service nodes 1032 .
  • the first load balancing node receives the resource request, if the target resource does not exist in the data center where the first load balancing node is located, it determines the second load balancing node based on the target resource, and sends The second load balancing node sends the resource request and connection protocol information.
  • the first load balancing node can transfer resource requests and connection protocol information to load balancing nodes in other data centers in a timely manner when the target resource does not exist in the data center where it is located, so that when the client does not perceive , realizing the separation and transfer of resource requests and response messages, forming efficient forwarding in the DR mode of the application layer, and improving the efficiency of CDN services.
  • the first load balancing node stores resource storage conditions of multiple data centers, and the resource storage conditions of multiple data centers are used to indicate the resources stored in each data center and the network address of each data center.
  • the first load balancing node determines the second load balancing node based on resource storage conditions of multiple data centers stored by the first load balancing node. In this way, each load balancing node can quickly locate the data center that stores the target resource when the target resource does not exist in its own data center, improving CDN service efficiency.
  • the first load balancing node can also determine the load balancing node of the adjacent data center as the second load balancing node, and so on, that is, the embodiment of the present application determines the second load balancing node for the first load balancing node
  • the specific manner of the load balancing node is not limited.
  • the second load balancing node receives the resource request and the connection protocol information.
  • the second load balancing node determines a third service node in response to the resource request, and the third service node is used to provide the target resource.
  • this step 1004 is the same as that of the above-mentioned step 302 . It should be noted that the third service node and the second service node belong to the same data center, that is, the third service node and the first load balancing node belong to different data centers.
  • the second load balancing node sends the resource request and connection protocol information to the third service node.
  • the third service node receives the resource request and the connection protocol information.
  • the third service node In response to the resource request, based on the connection protocol information, the third service node sends a response message of the resource request to the client, so as to transmit the target resource to the client.
  • this step 1007 is the same as that of the above-mentioned step 305 .
  • the first load balancer can determine other data centers that can provide the target resource by itself, and send the data to the second load balancer corresponding to the data center.
  • the node sends the resource request and connection protocol information, so that the second load balancing node can determine the third service node from its own data center, and the response message of the third service node can be directly returned to the client without having to
  • the first load balancing node and the second load balancing node resource requests and response messages are separated and transferred without the client being aware, forming efficient forwarding in the DR mode of the application layer, and improving CDN service efficiency.
  • the second load balancing node when the second load balancing node does not have the target resource in the data center where the second load balancing node is located, continue to determine other data centers, and report to the corresponding load balancing nodes of other data centers Send the resource request and connection protocol information, and the service nodes in other data centers will provide the target resource to the client.
  • FIG. 11 is a schematic diagram of a load balancing method provided by an embodiment of the present application.
  • a client requests a target resource from a service node through a first load balancing node.
  • the client establishes a connection with the first load balancing node, sends a resource request to the first load balancing node, and the first load balancing node responds to the resource request, and if the data center where the first load balancing node is located does not have the target resource , send the resource request and connection protocol information to the second load balancing node.
  • the second load balancing node After receiving the resource request and connection protocol information, the second load balancing node responds to the resource request and selects Determine the third service node, send the resource request and connection protocol information to the third service node, based on the connection protocol information, the third service node uses the address information of the first load balancing node as the source address information, and uses the address information of the client
  • the information is the destination address information, and a response message corresponding to the resource request is generated, the response message carries the target resource, and the response message is directly sent to the client through the switch, so that the data center where the first load balancing node is located
  • the resource request and response packets are separated and transferred, and the efficient forwarding of the DR mode at the application layer is formed without the client being aware of it, which improves the efficiency of CDN services.
  • the resource request and connection protocol information received by the third service node that provides the target resource to the client is sent by the first load balancing node to the second load balancing node.
  • the connection protocol information between the first load balancing node and the client can be transferred across data centers, so that the data centers can be interconnected and communicate with each other. Scheduling, forming a distributed protocol scheduling capability, effectively improving the efficiency of CDN services.
  • the scheduling center finds that the resource requested by the client has a more suitable CDN node to provide services, it needs to pass the HTTP 302 status code to let the client initiate a request to a more suitable CDN node.
  • the resource request requires the client to establish more than 2 connections, and the resource request delay is doubled.
  • the client when the load balancing node finds that the resource requested by the client has a more suitable data center
  • the client does not need to re-initiate the resource request through the HTTP 302 status code, but can directly transfer the resource request and connection protocol information to the corresponding load balancing nodes of other data centers, realizing the situation that the client has no perception
  • resource requests and response messages are separated and flowed to form efficient forwarding in the DR mode of the application layer. Compared with 302 scheduling, it can effectively reduce the delay of resource requests while improving CDN service efficiency.
  • FIG. 12 is a schematic structural diagram of a load balancing device provided by an embodiment of the present application.
  • the load balancing device 1200 shown in FIG. 12 implements, for example, the function of the first load balancing node in the load balancing methods shown in FIGS. 3 to 11 above.
  • the load balancing device 1200 includes a service node determination module 1201 and a connection protocol information transfer module 1202 .
  • a service node determining module 1201, configured to determine a first service node in response to a resource request from a client, where the resource request is used to obtain a target resource;
  • a connection protocol information transfer module 1202 configured to send the resource request, connection protocol information between the first load balancing node and the client to the first service node, the connection protocol information includes the adopted network protocol, the client The address information of the terminal and the address information of the first load balancing node, the connection protocol information is used for the service node to send the response message of the resource request to the client, so as to transmit the target resource to the client, the response message
  • the source address information of is the address information of the first load balancing node.
  • connection protocol information transfer module 1202 is configured to:
  • the target message carries the connection protocol information, the network protocol used by the target message and the network protocol used to establish a connection between the first load balancing node and the service node are: the same network protocol.
  • the network protocol used to establish the connection between the first load balancing node and the client is the first network protocol
  • the network protocol used to establish the connection between the first load balancing node and the service node is For the second network protocol
  • the first network protocol is different from the second network protocol
  • the connection protocol information also includes the information carried in the difference field in the packet headers of the first network protocol and the second network protocol.
  • the first network protocol is HTTPS
  • the second network protocol is HTTP
  • the connection protocol information also includes the connection protocol established between the first load balancing node and the client. Key information required to connect.
  • the first network protocol is a full-duplex communication protocol websocket based on transmission control protocol TCP
  • the second network protocol is hypertext transfer protocol HTTP
  • the connection protocol information also includes the first load balancing node The key information required to establish a connection with the client and the request type of the resource request, which is used to identify the resource request as a web socket type request.
  • the first network protocol is Hypertext Transfer Protocol HTTP1.1
  • the second network protocol is Hypertext Transfer Protocol HTTP
  • the connection protocol information also includes the connection between the first load balancing node and the client Data range information required to establish a connection.
  • the device further includes a protocol conversion module, configured to perform protocol conversion on the resource request based on the target protocol when the resource request is not generated based on the target protocol, to obtain the resource request after protocol conversion , the target protocol represents the protocol used between the first load balancing node and the service node;
  • connection protocol information transfer module 1202 is used for:
  • the first service node and the first load balancing node belong to the same data center.
  • connection protocol information transfer module 1202 is also used to:
  • the target resource In response to the resource request, if the target resource does not exist in the data center where the first load balancing node is located, send the resource request and the connection protocol information to the second load balancing node, and the second load balancing node and the second load balancing node A load balancing node belongs to different data centers.
  • the load balancing device provided in the above embodiment performs load balancing
  • the division of the above-mentioned functional modules is used as an example for illustration.
  • the above-mentioned function distribution can be completed by different functional modules according to needs. That is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above.
  • the load balancing device and the load balancing method embodiments provided in the above embodiments belong to the same idea, and the specific implementation process thereof is detailed in the method embodiments, and will not be repeated here.
  • Fig. 13 is a schematic structural diagram of a data processing device provided by an embodiment of the present application.
  • the data processing apparatus 1300 shown in FIG. 13 implements, for example, the function of a service node in the load balancing method shown in FIGS. 3 to 11 above.
  • the data processing device 1300 includes an information receiving module 1301 and a response packet sending module 1302 .
  • the information receiving module 1301 is configured to receive the resource request of the client, the connection protocol information between the first load balancing node and the client, the connection protocol information includes the adopted network protocol, the address information of the client and the first load The address information of the balance node, the resource request is used to obtain the target resource;
  • Response message sending module 1302 configured to respond to the resource request, based on the connection protocol information, send a response message of the resource request to the client, so as to transmit the target resource to the client, the response message
  • the source address information is address information of the first load balancing node.
  • the response message sending module 1302 is configured to respond to the resource request, based on the connection protocol information, use the address information of the first load balancing node as the source address information, and use the client address information as the destination address information, and send the response message of the resource request to the client.
  • the service node and the first load balancing node belong to the same data center.
  • the resource request and the connection protocol information are sent by the first load balancing node.
  • the resource request and the connection agreement information are sent by another service node of the data center.
  • the service node and the first load balancing node belong to different data centers.
  • the resource request and the connection protocol information are sent by the first load balancing node to the second load balancing node, they are sent by the second load balancing node, and the second load balancing node and the service node belong to In the same data center, the second load balancing node and the first load balancing node belong to different data centers.
  • the data processing device provided in the above-mentioned embodiments performs data processing
  • the division of the above-mentioned functional modules is used as an example for illustration.
  • the above-mentioned function allocation can be completed by different functional modules according to needs. That is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above.
  • the data processing device provided by the above embodiment and the embodiment of the load balancing method belong to the same idea, and the specific implementation process thereof is detailed in the method embodiment, and will not be repeated here.
  • first and second are used to distinguish the same or similar items with basically the same function and function. It should be understood that “first”, “second” and “nth” There are no logical or timing dependencies, nor are there restrictions on quantity or order of execution. It should also be understood that although the following description uses the terms first, second, etc. to describe various elements, these elements should not be limited by the terms. These terms are only used to distinguish one element from another. For example, a first service node could be termed a second service node, and, similarly, a second service node could be termed a first service node, without departing from the scope of the various described examples. Both the first service node and the second service node may be service nodes, and in some cases may be separate and distinct service nodes.
  • all or part of them may be implemented by software, hardware, firmware or any combination thereof.
  • software When implemented using software, it may be implemented in whole or in part in the form of a program product.
  • the program product includes one or more program instructions. When the program instructions are loaded and executed on the computing device, all or part of the processes or functions according to the embodiments of the present application will be generated.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The present application belongs to the technical field of communications. Disclosed are a load balancing method and apparatus, a node, and a storage medium. The method comprises: after receiving a resource request of a client, a load balancing node being able to locate an accurate service node in one step, thereby preventing the generation of a large amount of cross-device east-west traffic, and reducing the pressure of a switch and the service node; furthermore, the load balancing node sending the resource request and connection protocol information to the service node, wherein the connection protocol information comprises a used network protocol, address information of the client, and address information of the load balancing node. In this way, a service node can disguise a response message of a load balancing node on the basis of connection protocol information, and sends the response message to a client, and the response message bypasses the load balancing node, such that separated circulation of a resource request and the response message is realized, and efficient forwarding of an application layer directly routing a DR mode is formed, thereby improving the service efficiency of a CDN.

Description

负载均衡方法、装置、节点及存储介质Load balancing method, device, node and storage medium
本申请要求于2022年02月10日提交的申请号为202210124714.8、发明名称为“负载均衡方法、装置、节点及存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of the Chinese patent application with the application number 202210124714.8 and the title of the invention "load balancing method, device, node and storage medium" filed on February 10, 2022, the entire contents of which are incorporated by reference in this application .
技术领域technical field
本申请涉及通信技术领域,特别涉及一种负载均衡方法、装置、节点及存储介质。The present application relates to the technical field of communications, and in particular to a load balancing method, device, node and storage medium.
背景技术Background technique
随着互联网业务的迅速发展,越来越多的业务提供商选择将资源接入内容分发网络(content delivery network,CDN),通过CDN对资源进行存储、调度和分发,以提升互联网业务的服务质量。目前,CDN服务通过负载均衡、内容分发以及调度等功能,使用户就近获取所需资源,降低网络拥塞。例如,CDN服务通过域名解析(domain name resolution,DNS)调度,将用户的资源请求定向到距离用户最近的CDN集群(或者区域),再通过负载均衡器将该资源请求定向到该CDN集群中的服务节点,由该服务节点返回用户所需的资源。With the rapid development of Internet services, more and more service providers choose to connect resources to content delivery network (CDN), and store, schedule and distribute resources through CDN to improve the service quality of Internet services . At present, CDN services enable users to obtain the required resources nearby and reduce network congestion through functions such as load balancing, content distribution, and scheduling. For example, the CDN service directs the user's resource request to the CDN cluster (or region) closest to the user through domain name resolution (DNS) scheduling, and then directs the resource request to the CDN cluster in the CDN cluster through the load balancer. The service node, which returns the resources required by the user.
相关技术中,负载均衡器根据工作所处的开放式系统互联通信参考模型(open system interconnection reference model,OSI)层,可以分为四层负载均衡器和七层负载均衡器。其中,四层负载均衡器在接收到用户的资源请求后,将该资源请求发送给七层负载均衡器,七层负载均衡器对该资源请求进行解析,按照调度策略,将该资源请求发送给相应的服务节点。In related technologies, load balancers can be divided into four-layer load balancers and seven-layer load balancers according to the open system interconnection reference model (OSI) layer in which they work. Among them, after receiving the user's resource request, the layer-4 load balancer sends the resource request to the layer-7 load balancer, and the layer-7 load balancer analyzes the resource request, and sends the resource request to corresponding service node.
然而,上述方法中,资源请求需要依次经过四层负载均衡器和七层负载均衡器,最终到达相应的服务节点,一旦该服务节点不存在该资源请求对应的资源,该服务节点需要将资源请求转发给其他服务节点对应的七层负载均衡器,由其他服务节点将资源返回给该服务节点,并由该服务节点返回用户所需的资源,从而产生了大量跨设备的东西向流量,导致设备间南北流量受到挤压,交换机和服务节点的压力较大,CDN服务的效率较低。However, in the above method, the resource request needs to go through the four-layer load balancer and the seven-layer load balancer in turn, and finally reach the corresponding service node. Once the service node does not have the resource corresponding to the resource request, the service node needs to send the resource request Forwarding to the layer-7 load balancer corresponding to other service nodes, other service nodes return the resources to the service node, and the service node returns the resources required by the user, resulting in a large amount of cross-device east-west traffic, causing the device The north-south traffic is squeezed, the pressure on switches and service nodes is high, and the efficiency of CDN services is low.
发明内容Contents of the invention
本申请实施例提供了一种负载均衡方法、装置、节点及存储介质,能够提高CDN服务的效率。该技术方案如下:Embodiments of the present application provide a load balancing method, device, node, and storage medium, which can improve the efficiency of CDN services. The technical solution is as follows:
第一方面,本申请提供了一种负载均衡方法,由第一负载均衡节点执行,该方法包括:In a first aspect, the present application provides a load balancing method, which is executed by a first load balancing node, and the method includes:
响应于客户端的资源请求,确定第一服务节点,该资源请求用于获取目标资源;determining a first service node in response to a resource request from a client, where the resource request is used to obtain a target resource;
向该第一服务节点发送该资源请求、该第一负载均衡节点与该客户端之间的连接协议信息,该连接协议信息包括所采用的网络协议、该客户端的地址信息和该第一负载均衡节点的地址信息,该连接协议信息用于服务节点向该客户端发送该资源请求的响应报文,以将该目标资源传输给该客户端,该响应报文的源地址信息为该第一负载均衡节点的地址信息。Send the resource request, the connection protocol information between the first load balancing node and the client to the first service node, the connection protocol information includes the adopted network protocol, the address information of the client, and the first load balancing node The address information of the node, the connection protocol information is used for the service node to send the response message of the resource request to the client, so as to transmit the target resource to the client, and the source address information of the response message is the first payload The address information of the balance node.
在本申请提供的负载均衡方法中,目标资源可以为图片、音频、视频以及文本等等,本申请实施例对此不作限定,负载均衡节点在接收到客户端的资源请求时,能够一次性定位到 准确的服务节点,从而避免产生大量跨设备东西向流量,降低交换机和服务节点的压力,进一步地,负载均衡节点向该服务节点发送资源请求和连接协议信息,其中,该连接协议信息包括所采用的网络协议、客户端的地址信息和负载均衡节点的地址信息。通过这种方式,服务节点能够基于该连接协议信息,伪装成该负载均衡节点的响应报文,发送给客户端,该响应报文绕过了负载均衡节点,实现资源请求与响应报文分离流转,形成应用层DR模式的高效转发,提高了CDN服务的效率。In the load balancing method provided by this application, the target resources can be pictures, audio, video, text, etc., which are not limited in this embodiment of the application. When the load balancing node receives the resource request from the client, it can locate the resource at one time. Accurate service nodes, so as to avoid a large amount of cross-device east-west traffic and reduce the pressure on switches and service nodes. Further, the load balancing node sends resource requests and connection protocol information to the service node, where the connection protocol information includes the adopted The network protocol, the address information of the client and the address information of the load balancing node. In this way, based on the connection protocol information, the service node can pretend to be the response message of the load balancing node and send it to the client. The response message bypasses the load balancing node and realizes the separation and flow of resource requests and response messages. , form the efficient forwarding of the DR mode of the application layer, and improve the efficiency of CDN services.
在一些实施例中,该向该第一服务节点发送该资源请求、该第一负载均衡节点与该客户端之间的连接协议信息,包括:In some embodiments, the sending the resource request, the connection protocol information between the first load balancing node and the client to the first service node includes:
向该第一服务节点发送该资源请求;sending the resource request to the first service node;
向该第一服务节点发送目标报文,该目标报文携带该连接协议信息,该目标报文所采用的网络协议和该第一负载均衡节点与服务节点之间建立连接所采用的网络协议为同一网络协议。Send a target message to the first service node, the target message carries the connection protocol information, the network protocol used by the target message and the network protocol used to establish a connection between the first load balancing node and the service node are: the same network protocol.
通过这种方式,第一负载均衡节点以单独数据包的形式将连接协议信息传输给第一服务节点。In this way, the first load balancing node transmits the connection protocol information to the first service node in the form of a separate data packet.
在一些实施例中,该第一负载均衡节点与该客户端之间建立连接所采用的网络协议为第一网络协议,该第一负载均衡节点与服务节点之间建立连接所采用的网络协议为第二网络协议,第一网络协议和第二网络协议不同,该连接协议信息还包括该第一网络协议和第二网络协议的报文头中的差异字段所携带的信息。In some embodiments, the network protocol used to establish the connection between the first load balancing node and the client is the first network protocol, and the network protocol used to establish the connection between the first load balancing node and the service node is For the second network protocol, the first network protocol is different from the second network protocol, and the connection protocol information also includes the information carried in the difference field in the packet headers of the first network protocol and the second network protocol.
其中,由于第一网络协议与第二网络协议不同,其对应报文存在差异字段,因此,第一负载均衡节点能够根据资源请求中与第二网络协议对应报文的差异字段,得到采用第一网络协议与客户端之间实现数据传输的必要信息,从而无需解析完整的资源请求,降低了请求时延。Wherein, since the first network protocol is different from the second network protocol, there is a difference field in the corresponding message, therefore, the first load balancing node can obtain the resource request using the first Necessary information for data transmission between the network protocol and the client, so that there is no need to parse the complete resource request, reducing the request delay.
在一些实施例中,该第一网络协议为超文本传输安全协议HTTPS,该第二网络协议为超文本传输协议HTTP,该连接协议信息还包括该第一负载均衡节点和该客户端之间建立连接所需的密钥信息。In some embodiments, the first network protocol is HTTPS, the second network protocol is HTTP, and the connection protocol information also includes the connection protocol established between the first load balancing node and the client. Key information required to connect.
在一些实施例中,该第一网络协议为基于传输控制协议TCP的全双工通信协议websocket,该第二网络协议为超文本传输协议HTTP,该连接协议信息还包括该第一负载均衡节点和该客户端之间建立连接所需的密钥信息和该资源请求的请求类型,该请求类型用于标识该资源请求为web socket类型的请求。In some embodiments, the first network protocol is a full-duplex communication protocol websocket based on transmission control protocol TCP, the second network protocol is hypertext transfer protocol HTTP, and the connection protocol information also includes the first load balancing node and The key information required to establish a connection between the clients and the request type of the resource request, the request type is used to identify that the resource request is a web socket type request.
在一些实施例中,该第一网络协议为超文本传输协议HTTP1.1,该第二网络协议为超文本传输协议HTTP,该连接协议信息还包括该第一负载均衡节点和该客户端之间建立连接所需的数据范围信息。In some embodiments, the first network protocol is Hypertext Transfer Protocol HTTP1.1, the second network protocol is Hypertext Transfer Protocol HTTP, and the connection protocol information also includes the connection between the first load balancing node and the client Data range information required to establish a connection.
在一些实施例中,该方法还包括:In some embodiments, the method also includes:
基于该第二网络协议,对该资源请求进行协议转换,得到协议转换后的该资源请求;performing protocol conversion on the resource request based on the second network protocol, to obtain the resource request after protocol conversion;
该向该第一服务节点发送该资源请求、该第一负载均衡节点与该客户端之间的连接协议信息,包括:The sending of the resource request and the connection protocol information between the first load balancing node and the client to the first service node includes:
向该第一服务节点发送协议转换后的该资源请求和该连接协议信息。Send the protocol-converted resource request and the connection protocol information to the first service node.
通过这种方式,实现了在客户端与第一负载均衡之间所采用的网络协议和第一负载均衡节点与服务节点之间所采用的网络协议不同的情况下,第一服务节点的响应报文依然可以直 接返回给客户端,而无需再次经过第一负载均衡节点,实现了资源请求与响应报文分离流转,形成应用层DR模式的高效转发,提高了CDN服务效率。In this way, when the network protocol adopted between the client and the first load balancer is different from the network protocol adopted between the first load balancer node and the service node, the response report of the first service node The text can still be directly returned to the client without going through the first load balancing node again, realizing the separation and flow of resource requests and response messages, forming efficient forwarding in the DR mode of the application layer, and improving the efficiency of CDN services.
在一些实施例中,该第一服务节点与该第一负载均衡节点属于同一数据中心。In some embodiments, the first service node and the first load balancing node belong to the same data center.
在一些实施例中,该方法还包括:In some embodiments, the method also includes:
响应于该资源请求,在该第一负载均衡节点所在数据中心不存在该目标资源的情况下,向第二负载均衡节点发送该资源请求和该连接协议信息,该第二负载均衡节点与该第一负载均衡节点属于不同数据中心。In response to the resource request, if the target resource does not exist in the data center where the first load balancing node is located, send the resource request and the connection protocol information to the second load balancing node, and the second load balancing node and the second load balancing node A load balancing node belongs to different data centers.
通过这种方式,第一负载均衡节点能够在不存在目标资源的情况下,及时将资源请求和连接协议信息转移给其他数据中心的负载均衡节点,从而在客户端无感知的情况下,实现了资源请求与响应报文分离流转,形成应用层DR模式的高效转发,提高了CDN服务效率。而且,通过这种方式,第一负载均衡节点与客户端之间的连接协议信息能够实现跨数据中心进行转移,使得数据中心间能够互联互通,相互调度,形成分布式协议调度能力,有效提升了CDN服务的效率。In this way, the first load balancing node can transfer resource requests and connection protocol information to load balancing nodes in other data centers in a timely manner when there is no target resource, thus realizing Resource request and response messages are separated and transferred to form efficient forwarding in the DR mode of the application layer, which improves the efficiency of CDN services. Moreover, in this way, the connection protocol information between the first load balancing node and the client can be transferred across data centers, so that data centers can be interconnected and mutually scheduled, forming a distributed protocol scheduling capability, which effectively improves The efficiency of CDN services.
第二方面,本申请提供了一种负载均衡方法,由服务节点执行,该方法包括:In a second aspect, the present application provides a load balancing method, which is performed by a service node, and the method includes:
接收客户端的资源请求、第一负载均衡节点与该客户端之间的连接协议信息,该连接协议信息包括所采用的网络协议、该客户端的地址信息和该第一负载均衡节点的地址信息,该资源请求用于获取目标资源;receiving the resource request from the client, the connection protocol information between the first load balancing node and the client, the connection protocol information including the adopted network protocol, the address information of the client and the address information of the first load balancing node, the The resource request is used to obtain the target resource;
响应于该资源请求,基于该连接协议信息,向该客户端发送该资源请求的响应报文,以将该目标资源传输给该客户端,该响应报文的源地址信息为该第一负载均衡节点的地址信息。In response to the resource request, based on the connection protocol information, send a response message of the resource request to the client to transmit the target resource to the client, the source address information of the response message is the first load balancing Node address information.
在一些实施例中,该响应于该资源请求,基于该连接协议信息,向该客户端发送该资源请求的响应报文,包括:In some embodiments, in response to the resource request, based on the connection protocol information, a response message of the resource request is sent to the client, including:
响应于该资源请求,基于该连接协议信息,以该第一负载均衡节点的地址信息为源地址信息,以该客户端的地址信息为目的地址信息,向该客户端发送该资源请求的响应报文。In response to the resource request, based on the connection protocol information, using the address information of the first load balancing node as source address information, and using the client address information as destination address information, send a response message of the resource request to the client .
在一些实施例中,该服务节点与该第一负载均衡节点属于同一数据中心。In some embodiments, the service node and the first load balancing node belong to the same data center.
在一些实施例中,该资源请求和该连接协议信息由该第一负载均衡节点发送。In some embodiments, the resource request and the connection protocol information are sent by the first load balancing node.
在一些实施例中,该资源请求和该连接协议信息由该数据中心的另一服务节点发送。In some embodiments, the resource request and the connection agreement information are sent by another service node of the data center.
通过这种方式,第一负载均衡节点与客户端之间的连接协议信息能够实现跨设备进行转移,使得设备间能够互联互通,相互调度,形成分布式协议调度能力,有效提升了CDN服务的效率。In this way, the connection protocol information between the first load balancing node and the client can be transferred across devices, enabling devices to communicate with each other and schedule each other, forming a distributed protocol scheduling capability and effectively improving the efficiency of CDN services .
在一些实施例中,该服务节点与该第一负载均衡节点属于不同数据中心。In some embodiments, the service node and the first load balancing node belong to different data centers.
在一些实施例中,该资源请求和该连接协议信息由该第一负载均衡节点发送给第二负载均衡节点后,由该第二负载均衡节点发送,该第二负载均衡节点与该服务节点属于同一数据中心,该第二负载均衡节点和该第一负载均衡节点属于不同数据中心。In some embodiments, after the resource request and the connection protocol information are sent by the first load balancing node to the second load balancing node, they are sent by the second load balancing node, and the second load balancing node and the service node belong to In the same data center, the second load balancing node and the first load balancing node belong to different data centers.
通过这种方式,第一负载均衡节点与客户端之间的连接协议信息能够实现跨数据中心转移,使得数据中心间能够互联互通,相互调度,形成分布式协议调度能力,有效提升了CDN服务的效率。In this way, the connection protocol information between the first load balancing node and the client can be transferred across data centers, enabling data centers to communicate with each other and schedule each other, forming a distributed protocol scheduling capability, which effectively improves the CDN service. efficiency.
第三方面,本申请提供了一种负载均衡装置,该装置包括:In a third aspect, the present application provides a load balancing device, which includes:
服务节点确定模块,用于响应于客户端的资源请求,确定第一服务节点,该资源请求用于获取目标资源;A service node determination module, configured to determine a first service node in response to a resource request from a client, where the resource request is used to obtain a target resource;
连接协议信息转移模块,用于向该第一服务节点发送该资源请求、该第一负载均衡节点与该客户端之间的连接协议信息,该连接协议信息包括所采用的网络协议、该客户端的地址信息和该第一负载均衡节点的地址信息,该连接协议信息用于服务节点向该客户端发送该资源请求的响应报文,以将该目标资源传输给该客户端,该响应报文的源地址信息为该第一负载均衡节点的地址信息。A connection protocol information transfer module, configured to send the resource request, connection protocol information between the first load balancing node and the client to the first service node, the connection protocol information includes the adopted network protocol, the client's address information and the address information of the first load balancing node, the connection protocol information is used for the service node to send the response message of the resource request to the client, so as to transmit the target resource to the client, and the response message is The source address information is address information of the first load balancing node.
在一些实施例中,该连接协议信息转移模块,用于:In some embodiments, the connection protocol information transfer module is used for:
向该第一服务节点发送该资源请求;sending the resource request to the first service node;
向该第一服务节点发送目标报文,该目标报文携带该连接协议信息,该目标报文所采用的网络协议和该第一负载均衡节点与服务节点之间建立连接所采用的网络协议为同一网络协议。Send a target message to the first service node, the target message carries the connection protocol information, the network protocol used by the target message and the network protocol used to establish a connection between the first load balancing node and the service node are: the same network protocol.
在一些实施例中,该第一负载均衡节点与该客户端之间建立连接所采用的网络协议为第一网络协议,该第一负载均衡节点与服务节点之间建立连接所采用的网络协议为第二网络协议,第一网络协议和第二网络协议不同,该连接协议信息还包括该第一网络协议和第二网络协议的报文头中的差异字段所携带的信息。In some embodiments, the network protocol used to establish the connection between the first load balancing node and the client is the first network protocol, and the network protocol used to establish the connection between the first load balancing node and the service node is For the second network protocol, the first network protocol is different from the second network protocol, and the connection protocol information also includes the information carried in the difference field in the packet headers of the first network protocol and the second network protocol.
在一些实施例中,该第一网络协议为超文本传输安全协议HTTPS,该第二网络协议为超文本传输协议HTTP,该连接协议信息还包括该第一负载均衡节点和该客户端之间建立连接所需的密钥信息。In some embodiments, the first network protocol is HTTPS, the second network protocol is HTTP, and the connection protocol information also includes the connection protocol established between the first load balancing node and the client. Key information required to connect.
在一些实施例中,该第一网络协议为基于传输控制协议TCP的全双工通信协议websocket,该第二网络协议为超文本传输协议HTTP,该连接协议信息还包括该第一负载均衡节点和该客户端之间建立连接所需的密钥信息和该资源请求的请求类型,该请求类型用于标识该资源请求为web socket类型的请求。In some embodiments, the first network protocol is a full-duplex communication protocol websocket based on transmission control protocol TCP, the second network protocol is hypertext transfer protocol HTTP, and the connection protocol information also includes the first load balancing node and The key information required to establish a connection between the clients and the request type of the resource request, the request type is used to identify that the resource request is a web socket type request.
在一些实施例中,该第一网络协议为超文本传输协议HTTP1.1,该第二网络协议为超文本传输协议HTTP,该连接协议信息还包括该第一负载均衡节点和该客户端之间建立连接所需的数据范围信息。In some embodiments, the first network protocol is Hypertext Transfer Protocol HTTP1.1, the second network protocol is Hypertext Transfer Protocol HTTP, and the connection protocol information also includes the connection between the first load balancing node and the client Data range information required to establish a connection.
在一些实施例中,该装置还包括协议转换模块,用于在该资源请求不是基于目标协议生成的情况下,基于该目标协议,对该资源请求进行协议转换,得到协议转换后的该资源请求,该目标协议表示该第一负载均衡节点和服务节点之间所使用的协议;In some embodiments, the device further includes a protocol conversion module, configured to perform protocol conversion on the resource request based on the target protocol when the resource request is not generated based on the target protocol, to obtain the resource request after protocol conversion , the target protocol represents the protocol used between the first load balancing node and the service node;
该连接协议信息转移模块,用于:The connection protocol information transfer module is used for:
向该第一服务节点发送协议转换后的该资源请求和该连接协议信息。Send the protocol-converted resource request and the connection protocol information to the first service node.
在一些实施例中,该第一服务节点与该第一负载均衡节点属于同一数据中心。In some embodiments, the first service node and the first load balancing node belong to the same data center.
在一些实施例中,该连接协议信息转移模块,还用于:In some embodiments, the connection protocol information transfer module is also used for:
响应于该资源请求,在该第一负载均衡节点所在数据中心不存在该目标资源的情况下,向第二负载均衡节点发送该资源请求和该连接协议信息,该第二负载均衡节点与该第一负载均衡节点属于不同数据中心。In response to the resource request, if the target resource does not exist in the data center where the first load balancing node is located, send the resource request and the connection protocol information to the second load balancing node, and the second load balancing node and the second load balancing node A load balancing node belongs to different data centers.
第四方面,本申请提供了一种数据处理装置,该装置包括:In a fourth aspect, the present application provides a data processing device, which includes:
信息接收模块,用于接收客户端的资源请求、第一负载均衡节点与该客户端之间的连接 协议信息,该连接协议信息包括所采用的网络协议、该客户端的地址信息和该第一负载均衡节点的地址信息,该资源请求用于获取目标资源;An information receiving module, configured to receive a resource request from a client, connection protocol information between the first load balancing node and the client, the connection protocol information including the adopted network protocol, address information of the client, and the first load balancing node The address information of the node, the resource request is used to obtain the target resource;
响应报文发送模块,用于响应于该资源请求,基于该连接协议信息,向该客户端发送该资源请求的响应报文,以将该目标资源传输给该客户端,该响应报文的源地址信息为该第一负载均衡节点的地址信息。The response message sending module is used to respond to the resource request, based on the connection protocol information, send the response message of the resource request to the client, so as to transmit the target resource to the client, the source of the response message The address information is the address information of the first load balancing node.
在一些实施例中,该响应报文发送模块用于响应于该资源请求,基于该连接协议信息,以该第一负载均衡节点的地址信息为源地址信息,以该客户端的地址信息为目的地址信息,向该客户端发送该资源请求的响应报文。In some embodiments, the response message sending module is configured to respond to the resource request, based on the connection protocol information, using the address information of the first load balancing node as the source address information, and using the client's address information as the destination address information, and send the response message of the resource request to the client.
在一些实施例中,该服务节点与该第一负载均衡节点属于同一数据中心。In some embodiments, the service node and the first load balancing node belong to the same data center.
在一些实施例中,该资源请求和该连接协议信息由该第一负载均衡节点发送。In some embodiments, the resource request and the connection protocol information are sent by the first load balancing node.
在一些实施例中,该资源请求和该连接协议信息由该数据中心的另一服务节点发送。In some embodiments, the resource request and the connection agreement information are sent by another service node of the data center.
在一些实施例中,该服务节点与该第一负载均衡节点属于不同数据中心。In some embodiments, the service node and the first load balancing node belong to different data centers.
在一些实施例中,该资源请求和该连接协议信息由该第一负载均衡节点发送给第二负载均衡节点后,由该第二负载均衡节点发送,该第二负载均衡节点与该服务节点属于同一数据中心,该第二负载均衡节点和该第一负载均衡节点属于不同数据中心。In some embodiments, after the resource request and the connection protocol information are sent by the first load balancing node to the second load balancing node, they are sent by the second load balancing node, and the second load balancing node and the service node belong to In the same data center, the second load balancing node and the first load balancing node belong to different data centers.
第五方面,本申请提供了一种负载均衡节点,该负载均衡节点包括处理器和存储器,该存储器用于存储至少一段程序代码,该至少一段程序代码由该处理器加载并执行前述第一方面或第一方面的任意一种可能的实现方式提供的负载均衡方法。In a fifth aspect, the present application provides a load balancing node, the load balancing node includes a processor and a memory, and the memory is used to store at least one piece of program code, and the at least one piece of program code is loaded by the processor and executes the aforementioned first aspect Or the load balancing method provided by any possible implementation manner of the first aspect.
第六方面,本申请提供了一种服务节点,该服务节点包括处理器和存储器,该存储器用于存储至少一段程序代码,该至少一段程序代码由该处理器加载并执行前述第二方面或第二方面的任意一种可能的实现方式提供的负载均衡方法。In a sixth aspect, the present application provides a service node, the service node includes a processor and a memory, the memory is used to store at least one piece of program code, the at least one piece of program code is loaded by the processor and executes the aforementioned second aspect or the first A load balancing method provided by any possible implementation of the two aspects.
第七方面,本申请提供一种计算机可读存储介质,该计算机可读存储介质用于存储至少一段程序代码,该至少一段程序代码用于执行前述第一方面或第一方面的任意一种可能的实现方式中提供的负载均衡方法,或执行第二方面或第二方面的任意一种可能的实现方式提供的负载均衡方法。该存储介质包括但不限于易失性存储器,例如随机访问存储器,非易失性存储器,例如快闪存储器、硬盘(hard disk drive,HDD)、固态硬盘(solid state drive,SSD)。In a seventh aspect, the present application provides a computer-readable storage medium, the computer-readable storage medium is used to store at least one piece of program code, and the at least one piece of program code is used to implement any one of the aforementioned first aspect or any one of the first aspects. The load balancing method provided in the implementation manner of the second aspect, or the load balancing method provided in the second aspect or any possible implementation manner of the second aspect. The storage medium includes but not limited to volatile memory, such as random access memory, and nonvolatile memory, such as flash memory, hard disk drive (hard disk drive, HDD), and solid state drive (solid state drive, SSD).
第八方面,本申请提供一种计算机程序产品,该计算机程序产品包括计算机程序代码,在该计算机程序代码被负载均衡节点执行时,该负载均衡节点执行前述第一方面或第一方面的任意可能的实现方式中提供的负载均衡方法,在该计算机程序代码被服务节点执行时,该服务节点或执行前述第二方面或第二方面的任意一种可能的实现方式提供的负载均衡方法。该计算机程序产品可以为一个软件安装包,在需要使用前述负载均衡方法的情况下,可以下载该计算机程序产品并在负载均衡节点或服务节点上执行该计算机程序产品。In an eighth aspect, the present application provides a computer program product, the computer program product includes computer program code, and when the computer program code is executed by a load balancing node, the load balancing node executes any possibility of the aforementioned first aspect or the first aspect The load balancing method provided in the implementation manner of the above-mentioned second aspect or the load balancing method provided in any possible implementation manner of the second aspect when the computer program code is executed by the service node. The computer program product may be a software installation package, and the computer program product may be downloaded and executed on a load balancing node or a service node when the aforementioned load balancing method needs to be used.
附图说明Description of drawings
图1是本申请实施例提供的一种负载均衡方法的实施环境示意图;FIG. 1 is a schematic diagram of an implementation environment of a load balancing method provided in an embodiment of the present application;
图2是本申请实施例提供的一种网络设备的结构示意图;FIG. 2 is a schematic structural diagram of a network device provided by an embodiment of the present application;
图3是本申请实施例提供的一种负载均衡方法的流程图;FIG. 3 is a flow chart of a load balancing method provided in an embodiment of the present application;
图4是本申请实施例提供的一种负载均衡方法的示意图;FIG. 4 is a schematic diagram of a load balancing method provided by an embodiment of the present application;
图5是一种相关技术提供的负载均衡方法和本申请实施例提供的负载均衡方法的示意图;FIG. 5 is a schematic diagram of a load balancing method provided by a related technology and a load balancing method provided by an embodiment of the present application;
图6是本申请实施例提供的一种负载均衡方法的流程图;FIG. 6 is a flowchart of a load balancing method provided by an embodiment of the present application;
图7是本申请实施例提供的一种负载均衡方法的示意图;FIG. 7 is a schematic diagram of a load balancing method provided by an embodiment of the present application;
图8是本申请实施例提供的一种负载均衡方法的流程图;FIG. 8 is a flowchart of a load balancing method provided by an embodiment of the present application;
图9是本申请实施例提供的一种负载均衡方法的示意图;FIG. 9 is a schematic diagram of a load balancing method provided by an embodiment of the present application;
图10是本申请实施例提供的一种负载均衡方法的流程图;FIG. 10 is a flowchart of a load balancing method provided by an embodiment of the present application;
图11是本申请实施例提供的一种负载均衡方法的示意图;FIG. 11 is a schematic diagram of a load balancing method provided by an embodiment of the present application;
图12是本申请实施例提供的一种负载均衡装置的结构示意图;FIG. 12 is a schematic structural diagram of a load balancing device provided by an embodiment of the present application;
图13是本申请实施例提供的一种数据处理装置的结构示意图。Fig. 13 is a schematic structural diagram of a data processing device provided by an embodiment of the present application.
具体实施方式Detailed ways
为使本申请的目的、技术方案和优点更加清楚,下面将结合附图对本申请实施方式作进一步地详细描述。In order to make the purpose, technical solution and advantages of the present application clearer, the implementation manners of the present application will be further described in detail below in conjunction with the accompanying drawings.
为了方便理解,下面先对本申请涉及的关键术语和关键概念进行说明。For the convenience of understanding, key terms and key concepts involved in this application will be described below first.
内容分发网络(content delivery network,CDN),是构建在现有网络基础之上的智能虚拟网络,依靠部署在各地的边缘服务器,通过中心平台的负载均衡、内容分发、调度等功能,使用户就近获取所需内容,降低网络拥塞,提高用户访问响应速度和命中率。The content delivery network (CDN) is an intelligent virtual network built on the basis of the existing network, relying on the edge servers deployed in various places, and through the load balancing, content distribution, scheduling and other functions of the central platform, it makes users nearby Obtain the desired content, reduce network congestion, and improve user access response speed and hit rate.
负载均衡,是一种建立在现有网络结构之上的调度方式,能够扩展网络设备和服务器的带宽,增加吞吐量,加强网络数据处理能力,提高网络的灵活性和可用性。Load balancing is a scheduling method based on the existing network structure, which can expand the bandwidth of network devices and servers, increase throughput, strengthen network data processing capabilities, and improve network flexibility and availability.
统一资源定位符(uniform resource locator,URL),是因特网上标准的资源的地址,也被称为网页地址。A uniform resource locator (uniform resource locator, URL) is the address of a standard resource on the Internet, also known as a web page address.
直接路由(director routing,DR)模式,是一种通过修改资源请求的目标媒体存取控制(media access control address,MAC)地址,将该资源请求发给应用服务器,使得应用服务器将响应后的处理结果直接返回给客户端的工作模式。在一些实施例中,将处于应用层的DR模式称为请求与响应分离流转的模式,示意性地,网络设备A在接收到来自客户端的资源请求后,进行相应处理,并发送给网络设备B,使得网络设备B在不经过网络设备A的情况下,将该资源请求的响应直接返回给客户端,实现了对应同一客户端的请求与响应是分离在不同网络设备之间流转的。The direct routing (director routing, DR) mode is a method of sending the resource request to the application server by modifying the target media access control address (MAC) address of the resource request, so that the application server will respond to the processing The result is directly returned to the client's working mode. In some embodiments, the DR mode at the application layer is called the mode of separation and flow of requests and responses. Schematically, after network device A receives a resource request from the client, it performs corresponding processing and sends it to network device B , so that network device B directly returns the response to the resource request to the client without passing through network device A, so that the request and response corresponding to the same client are separated and flowed between different network devices.
302调度,是一种资源调度方法,在提供CDN服务的网络系统中,当调度中心发现客户端所请求的资源有更合适的CDN节点来提供服务时,通过超文本传输协议(hyper text transfer protocol,HTTP)302状态码,让客户端向更合适的CDN节点发起资源请求。302 scheduling is a resource scheduling method. In a network system that provides CDN services, when the scheduling center finds that the resource requested by the client has a more suitable CDN node to provide services, it uses the hypertext transfer protocol (hyper text transfer protocol) , HTTP) 302 status code, allowing the client to initiate a resource request to a more suitable CDN node.
下面对本申请提供的负载均衡方法的应用场景进行简要介绍。The application scenarios of the load balancing method provided by this application are briefly introduced below.
本申请实施例提供的负载均衡方法能够应用在通过CDN服务对资源进行存储、调度和分发的网络系统中。例如,在提供CDN服务的网络系统中,资源通常存储在成百上千个服务节 点组成的服务集群中,服务节点通过负载均衡节点对外提供服务。当负载均衡节点接收到客户端发送的资源请求时,负载均衡节点通过解析资源请求,将资源请求转发给对应的服务节点,以保证较高的资源命中率。The load balancing method provided by the embodiment of the present application can be applied in a network system that stores, schedules and distributes resources through CDN services. For example, in a network system that provides CDN services, resources are usually stored in a service cluster composed of hundreds or thousands of service nodes, and the service nodes provide external services through load balancing nodes. When the load balancing node receives the resource request sent by the client, the load balancing node parses the resource request and forwards the resource request to the corresponding service node to ensure a high resource hit rate.
基于此,本申请实施例提供了一种负载均衡方法,负载均衡节点在接收到客户端的资源请求时,能够一次性定位到准确的服务节点,从而避免产生大量跨设备东西向流量,降低交换机和服务节点压力,进一步地,负载均衡节点向该服务节点发送资源请求和连接协议信息,其中,该连接协议信息包括所采用的网络协议、客户端的地址信息和负载均衡节点的地址信息。通过这种方式,服务节点能够基于该连接协议信息,伪装成该负载均衡节点的响应报文,发送给客户端,该响应报文绕过了负载均衡节点,实现资源请求与响应报文分离流转,形成应用层DR模式的高效转发,提高了CDN服务的效率。Based on this, the embodiment of the present application provides a load balancing method. When a load balancing node receives a resource request from a client, it can locate an accurate service node at one time, thereby avoiding a large amount of cross-device east-west traffic and reducing the cost of switches and Service node pressure, further, the load balancing node sends a resource request and connection protocol information to the service node, wherein the connection protocol information includes the adopted network protocol, address information of the client and address information of the load balancing node. In this way, based on the connection protocol information, the service node can pretend to be the response message of the load balancing node and send it to the client. The response message bypasses the load balancing node and realizes the separation and flow of resource requests and response messages. , form the efficient forwarding of the DR mode of the application layer, and improve the efficiency of CDN services.
下面对本申请提供的技术方案的实施环境进行介绍。The implementation environment of the technical solution provided by this application is introduced below.
图1是本申请实施例提供的一种负载均衡方法的实施环境示意图。如图1所示,该实施环境包括客户端101、负载均衡节点102和服务节点103,客户端101、负载均衡节点102和服务节点103之间通过有线网络或无线网络进行直接或间接地连接。FIG. 1 is a schematic diagram of an implementation environment of a load balancing method provided by an embodiment of the present application. As shown in FIG. 1 , the implementation environment includes a client 101, a load balancing node 102 and a service node 103, and the client 101, the load balancing node 102 and the service node 103 are directly or indirectly connected through a wired network or a wireless network.
客户端101用于根据用户的资源需求,向负载均衡节点102发送相应的资源请求。该客户端101可以是用户侧的终端,也可以是服务器。其中,终端也被称为智能终端或移动智能终端,是指一类具备丰富人机交互方式、拥有接入互联网能力、通常搭载各种操作系统、具有较强处理能力的设备。在一些实施例中,移动智能终端的类型包括但不限于智能手机、平板电脑、台式计算机、车载终端、掌上游戏主机等,但并不局限于此。服务器可以是一个或多个计算设备所组成的服务器集群。需要说明的是,客户端101可以泛指多个客户端中的一个,本申请实施例仅以客户端101来举例说明。The client 101 is configured to send a corresponding resource request to the load balancing node 102 according to the user's resource requirement. The client 101 may be a user-side terminal or a server. Among them, a terminal is also called a smart terminal or a mobile smart terminal, which refers to a type of device that has rich human-computer interaction methods, has the ability to access the Internet, is usually equipped with various operating systems, and has strong processing capabilities. In some embodiments, the types of mobile smart terminals include, but are not limited to, smart phones, tablet computers, desktop computers, vehicle-mounted terminals, handheld game consoles, etc., but are not limited thereto. A server may be a server cluster composed of one or more computing devices. It should be noted that the client 101 may generally refer to one of multiple clients, and this embodiment of the present application only uses the client 101 as an example for illustration.
负载均衡节点102用于实现负载均衡功能,能够根据客户端101的资源请求,将该资源请求分发给相应的服务节点103。在一些实施例中,该负载均衡节点102通过一个服务器或者由多个服务器组成的服务器集群来实现负载均衡功能。在一些实施例中,该负载均衡节点102通过虚拟机或容器引擎(docker)来实现负载均衡功能,本申请实施例对此不作限定。在一些实施例中,负载均衡节点102的数量为多个,不同的负载均衡节点属于不同的数据中心,例如,负载均衡节点102包括第一负载均衡节点1021和第二负载均衡节点1022等等,其中,第一负载均衡节点1021属于第一数据中心,第二负载均衡节点1022属于第二数据中心,本申请实施例对于负载均衡节点的数量不作限定。The load balancing node 102 is used to realize the load balancing function, and can distribute the resource request to the corresponding service node 103 according to the resource request of the client 101 . In some embodiments, the load balancing node 102 implements the load balancing function through a server or a server cluster composed of multiple servers. In some embodiments, the load balancing node 102 implements the load balancing function through a virtual machine or a container engine (docker), which is not limited in this embodiment of the present application. In some embodiments, there are multiple load balancing nodes 102, and different load balancing nodes belong to different data centers. For example, the load balancing nodes 102 include a first load balancing node 1021 and a second load balancing node 1022, etc., Wherein, the first load balancing node 1021 belongs to the first data center, and the second load balancing node 1022 belongs to the second data center, and the embodiment of the present application does not limit the number of load balancing nodes.
服务节点103用于提供资源存储功能,能够根据接收到的资源请求,将与该资源请求对应的资源反馈给客户端101。其中,该服务节点103是指能够提供CDN服务的服务节点。在一些实施例中,该服务节点103为独立的物理服务器,或者是多个物理服务器构成的服务器集群或者分布式文件系统,还能够是提供云服务、云数据库、云计算、云函数、云存储、网络服务、云通信、中间件服务、域名服务、安全服务、大数据和人工智能平台等基础云计算服务的云服务器。在一些实施例中,在负载均衡节点102的数量为多个的情况下,服务节点103可以分属不同的数据中心,例如,第一负载均衡节点1021属于第一数据中心,该第一数据中心包括多个服务节点1031;第二负载均衡节点1022属于第二数据中心,该第二数据中心包括多个服务节点1032。需要说明的是,图中所示仅为示意性地,服务节点103的数量可 以更多或更少,本申请实施例对此不作限定。The service node 103 is used to provide a resource storage function, and can feed back resources corresponding to the resource request to the client 101 according to the received resource request. Wherein, the service node 103 refers to a service node capable of providing CDN services. In some embodiments, the service node 103 is an independent physical server, or a server cluster or a distributed file system composed of multiple physical servers, and can also provide cloud services, cloud databases, cloud computing, cloud functions, cloud storage Cloud servers for basic cloud computing services such as network services, cloud communications, middleware services, domain name services, security services, big data and artificial intelligence platforms. In some embodiments, when there are multiple load balancing nodes 102, the service nodes 103 may belong to different data centers, for example, the first load balancing node 1021 belongs to the first data center, and the first data center It includes a plurality of service nodes 1031 ; the second load balancing node 1022 belongs to a second data center, and the second data center includes a plurality of service nodes 1032 . It should be noted that what is shown in the figure is only illustrative, and the number of service nodes 103 may be more or less, which is not limited in this embodiment of the present application.
在一些实施例中,上述的无线网络或有线网络使用标准通信技术和/或协议。网络通常为因特网、但也能够是任何网络,包括但不限于局域网(local area network,LAN)、城域网(metropolitan area network,MAN)、广域网(wide area network,WAN)、移动、有线或者无线网络、专用网络或者虚拟专用网络的任何组合。在一些实现方式中,使用包括超级文本标记语言(hyper text markup language,HTML)、可扩展标记语言(extensible markup language,XML)等的技术和/或格式来代表通过网络交换的数据。此外还能够使用诸如安全套接字层(secure socket layer,SSL)、传输层安全(transport layer security,TLS)、虚拟专用网络(virtual private network,VPN)、网际协议安全(internet protocol security,IPsec)等常规加密技术来加密所有或者一些链路。在另一些实施例中,还能够使用定制和/或专用数据通信技术取代或者补充上述数据通信技术。In some embodiments, the wireless or wired network described above uses standard communication technologies and/or protocols. The network is usually the Internet, but can be any network, including but not limited to local area network (LAN), metropolitan area network (MAN), wide area network (WAN), mobile, wired or wireless Any combination of network, private network, or virtual private network. In some implementations, data exchanged over the network is represented using technologies and/or formats including hyper text markup language (HTML), extensible markup language (XML), and the like. In addition, it is also possible to use methods such as secure socket layer (secure socket layer, SSL), transport layer security (transport layer security, TLS), virtual private network (virtual private network, VPN), Internet protocol security (internet protocol security, IPsec) and other conventional encryption techniques to encrypt all or some links. In other embodiments, custom and/or dedicated data communication techniques can also be used instead of or in addition to the data communication techniques described above.
下面对上述实施环境中负载均衡节点和服务节点的硬件结构进行介绍。The hardware structure of the load balancing node and the service node in the above implementation environment is introduced below.
本申请实施例提供了一种网络设备,能够配置为上述实施环境中的负载均衡节点和服务节点。示意性地,图2是本申请实施例提供的一种网络设备的结构示意图。如图2所示,该网络设备200包括存储器201、处理器202、通信接口203以及总线204。其中,存储器201、处理器202、通信接口203通过总线204实现彼此之间的通信连接。The embodiment of the present application provides a network device, which can be configured as a load balancing node and a service node in the above implementation environment. Schematically, FIG. 2 is a schematic structural diagram of a network device provided by an embodiment of the present application. As shown in FIG. 2 , the network device 200 includes a memory 201 , a processor 202 , a communication interface 203 and a bus 204 . Wherein, the memory 201 , the processor 202 , and the communication interface 203 are connected to each other through the bus 204 .
存储器201可以是只读存储器(read-only memory,ROM)或可存储静态信息和指令的其它类型的静态存储设备,随机存取存储器(random access memory,RAM)或者可存储信息和指令的其它类型的动态存储设备,也可以是电可擦可编程只读存储器(electrically erasable programmable read-only memory,EEPROM)、只读光盘(compact disc read-only memory,CD-ROM)或其它光盘存储、光碟存储(包括压缩光碟、激光碟、光碟、数字通用光碟、蓝光光碟等)、磁盘存储介质或者其它磁存储设备、或者能够用于携带或存储具有指令或数据结构形式的期望的程序代码并能够由计算机存取的任何其它介质,但不限于此。存储器201可以存储至少一段程序代码,当存储器201中存储的程序代码被处理器202执行时,处理器202和通信接口203用于执行下述方法实施例中负载均衡节点或服务节点所执行的负载均衡方法。The memory 201 may be a read-only memory (read-only memory, ROM) or other types of static storage devices that can store static information and instructions, a random access memory (random access memory, RAM) or other types that can store information and instructions It can also be an electrically erasable programmable read-only memory (EEPROM), compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compact discs, laser discs, optical discs, digital versatile discs, Blu-ray discs, etc.), magnetic disk storage media or other magnetic storage devices, or can be used to carry or store desired program code in the form of instructions or data structures and can be programmed by a computer Any other medium accessed, but not limited to. The memory 201 can store at least one piece of program code. When the program code stored in the memory 201 is executed by the processor 202, the processor 202 and the communication interface 203 are used to execute the load balancing node or service node in the following method embodiments. balanced approach.
处理器202可以是网络处理器(network processor,NP)、中央处理器(central processing unit,CPU)、特定应用集成电路(application-specific integrated circuit,ASIC)或用于控制本申请方案程序执行的集成电路。该处理器202可以是一个单核(single-CPU)处理器,也可以是一个多核(multi-CPU)处理器。该处理器202的数量可以是一个,也可以是多个。这些处理器中的每一个例如是一个单核处理器,又如是一个多核处理器。这里的处理器可选地指一个或多个设备、电路、和/或用于处理数据(如计算机程序指令)的处理核。通信接口203使用例如收发器一类的收发模块,来实现网络设备200与其他设备或通信网络之间的通信。例如,可以通过通信接口203获取数据。The processor 202 may be a network processor (network processor, NP), a central processing unit (central processing unit, CPU), a specific application integrated circuit (application-specific integrated circuit, ASIC), or an integrated circuit for controlling the execution of the program program of this application. circuit. The processor 202 may be a single-core (single-CPU) processor, or a multi-core (multi-CPU) processor. The number of the processor 202 may be one or more. Each of these processors is, for example, a single-core processor, or a multi-core processor. A processor herein alternatively refers to one or more devices, circuits, and/or processing cores for processing data such as computer program instructions. The communication interface 203 uses a transceiver module such as a transceiver to implement communication between the network device 200 and other devices or communication networks. For example, data can be acquired through the communication interface 203 .
其中,存储器201和处理器202可以分离设置,也可以集成在一起。Wherein, the memory 201 and the processor 202 may be provided separately, or may be integrated together.
总线204可包括在网络设备200各个部件(例如,存储器201、处理器202、通信接口203)之间传送信息的通路。The bus 204 may include a path for transferring information between various components of the network device 200 (eg, memory 201 , processor 202 , communication interface 203 ).
在一些实施例中,处理器202通过读取存储器201中保存的程序代码实现下述实施例中 的方法,或者,处理器202通过内部存储的程序代码实现下述实施例中的方法。在处理器202通过读取存储器201中保存的程序代码实现下述实施例中的方法的情况下,存储器201中保存实现本申请实施例提供的负载均衡方法的程序代码。In some embodiments, the processor 202 implements the methods in the following embodiments by reading the program code stored in the memory 201, or, the processor 202 implements the methods in the following embodiments through the program code stored internally. In the case that the processor 202 implements the methods in the following embodiments by reading the program code stored in the memory 201, the memory 201 stores the program code for implementing the load balancing method provided in the embodiment of the present application.
处理器202实现上述功能的更多细节请参考下面各个方法实施例中的描述,在这里不再重复。For more details on how the processor 202 implements the above functions, please refer to the descriptions in the various method embodiments below, which will not be repeated here.
本申请实施例还提供了一种包括程序代码的计算机可读存储介质,例如包括程序代码的存储器201,上述程序代码可由网络设备200的处理器202执行以完成负载均衡方法。在一些实施例中,计算机可读存储介质是只读内存(read-only memory,ROM)、随机存取存储器(random access memory,RAM)、只读光盘(compact-disc read-only memory,CD-ROM)、磁带、软盘和光数据存储设备等。The embodiment of the present application also provides a computer-readable storage medium including program codes, such as the memory 201 including program codes. The above program codes can be executed by the processor 202 of the network device 200 to complete the load balancing method. In some embodiments, the computer-readable storage medium is a read-only memory (read-only memory, ROM), a random access memory (random access memory, RAM), a compact-disc read-only memory (CD- ROM), magnetic tape, floppy disk, and optical data storage devices, etc.
在介绍了本申请的应用场景和实施环境的基础上,下面结合几个实施例,对本申请所提供的负载均衡方法进行说明。On the basis of introducing the application scenario and implementation environment of the present application, the load balancing method provided by the present application will be described below in conjunction with several embodiments.
图3是本申请实施例提供的一种负载均衡方法的流程图。如图3所示,以客户端、第一负载均衡节点以及第一服务节点之间的交互为例来进行说明,该负载均衡方法包括如下步骤301至步骤305。FIG. 3 is a flowchart of a load balancing method provided by an embodiment of the present application. As shown in FIG. 3 , the interaction among the client, the first load balancing node and the first service node is taken as an example for illustration. The load balancing method includes the following steps 301 to 305 .
301、客户端向第一负载均衡节点发送资源请求,该资源请求用于获取目标资源。301. The client sends a resource request to the first load balancing node, where the resource request is used to obtain a target resource.
在本申请实施例中,第一负载均衡节点是指提供CDN服务的网络系统中任一个负载均衡节点。客户端根据用户发起的针对目标资源的请求行为,与第一负载均衡节点建立连接,通过该连接,向第一负载均衡节点发送资源请求,该资源请求用于获取该目标资源。示意性地,该目标资源为图片、音频、视频以及文本等等,本申请实施例对于目标资源的类型不作限定。In this embodiment of the present application, the first load balancing node refers to any load balancing node in the network system that provides CDN services. The client establishes a connection with the first load balancing node according to the request behavior initiated by the user for the target resource, and sends a resource request to the first load balancing node through the connection, and the resource request is used to obtain the target resource. Schematically, the target resource is a picture, audio, video, text, etc., and the embodiment of the present application does not limit the type of the target resource.
在一些实施例中,客户端使用传输控制协议(transmission control protocol,TCP)/用户数据报协议(user datagram protocol,UDP)以及上层网络协议,与第一负载均衡节点建立连接。在一些实施例中,该连接为传输隧道,能够支撑数据的高效传输。需要说明的是,在一些实施例中,客户端能够根据实际需求选择不同的网络协议来和第一负载节点建立连接,示意性地,该网络协议包括:HTTP、HTTP1.1、HTTP2.0、HTTP3.0、超文本传输安全协议(hyper text transfer protocol over SecureSocket layer,HTTPS)、高速UDP互联网连接协议(quick UDP internet connection,QUIC)以及基于TCP的全双工通信协议(web socket)等等,本申请实施例对此不作限定。In some embodiments, the client uses a transmission control protocol (transmission control protocol, TCP)/user datagram protocol (user datagram protocol, UDP) and an upper layer network protocol to establish a connection with the first load balancing node. In some embodiments, the connection is a transmission tunnel, which can support efficient transmission of data. It should be noted that, in some embodiments, the client can select different network protocols to establish a connection with the first load node according to actual needs. Schematically, the network protocols include: HTTP, HTTP1.1, HTTP2.0, HTTP3.0, hyper text transfer protocol over SecureSocket layer (HTTPS), high-speed UDP Internet connection protocol (quick UDP internet connection, QUIC) and TCP-based full-duplex communication protocol (web socket), etc., This embodiment of the present application does not limit it.
302、第一负载均衡节点响应于该客户端的资源请求,确定第一服务节点。302. The first load balancing node determines a first service node in response to the resource request of the client.
在本申请实施例中,该第一服务节点用于提供目标资源,第一负载均衡节点接收客户端发送的资源请求,响应于该资源请求,从多个服务节点中确定第一服务节点。该多个服务节点与该第一负载均衡节点属于同一数据中心,示意性地,如图2所示,第一负载均衡节点1021属于第一数据中心,该第一数据中心包括多个服务节点1031。In this embodiment of the present application, the first service node is used to provide target resources, the first load balancing node receives the resource request sent by the client, and determines the first service node from multiple service nodes in response to the resource request. The plurality of service nodes and the first load balancing node belong to the same data center. Schematically, as shown in FIG. 2 , the first load balancing node 1021 belongs to the first data center, and the first data center includes a plurality of service nodes 1031 .
在一些实施例中,本步骤302包括下述两个步骤:In some embodiments, this step 302 includes the following two steps:
步骤一、第一负载均衡节点响应于该资源请求,解析该资源请求,得到该资源请求的应用层特征。Step 1, the first load balancing node responds to the resource request, analyzes the resource request, and obtains the application layer characteristics of the resource request.
其中,第一负载均衡节点解析该资源请求中的目标字段,得到该资源请求的应用层特征。在一些实施例中,该资源请求的应用层特征包括该资源请求的URL标识,该URL标识能够 唯一标识该资源请求所请求的目标资源。在一些实施例中,该资源请求的应用层特征还包括该资源请求对应的资源类型,该资源类型用于表示该资源请求所请求的目标资源的类型。在另一些实施例中,该资源请求的应用层特征还包括其他信息,本申请实施例对此不作限定。另外,在一些实施例中,该目标字段的位置可以根据实际需求进行设置,本申请实施例对此不作限定。例如,以客户端的资源请求为HTTP协议下的资源请求为例,该资源请求用于请求http://a.com/x,该资源请求的目标字段为a.com/x,第一负载均衡节点解析该资源请求,得到该资源请求的应用层特征为a.com/x,也即是该资源请求的URL标识。Wherein, the first load balancing node parses the target field in the resource request to obtain the application layer characteristics of the resource request. In some embodiments, the application layer feature of the resource request includes the URL identifier of the resource request, and the URL identifier can uniquely identify the target resource requested by the resource request. In some embodiments, the application layer feature of the resource request further includes a resource type corresponding to the resource request, and the resource type is used to indicate the type of the target resource requested by the resource request. In some other embodiments, the application layer feature of the resource request further includes other information, which is not limited in this embodiment of the present application. In addition, in some embodiments, the position of the target field can be set according to actual needs, which is not limited in this embodiment of the present application. For example, assuming that the resource request of the client is a resource request under the HTTP protocol, the resource request is used to request http://a.com/x, the target field of the resource request is a.com/x, and the first load balancing The node parses the resource request, and obtains that the application layer characteristic of the resource request is a.com/x, which is the URL identifier of the resource request.
步骤二、第一负载均衡节点基于该应用层特征,确定与该应用层特征对应的第一服务节点。Step 2: The first load balancing node determines the first service node corresponding to the application layer feature based on the application layer feature.
其中,第一负载均衡节点调用目标算法,基于该应用层特征,确定与该应用层特征对应的第一服务节点。在一些实施例中,该目标算法为一致性哈希算法。示意性地,第一负载均衡节点使用哈希函数,对该应用层特征进行处理,得到与该应用特征对应的哈希值,然后根据多个服务节点的数量,使用取模函数,将该哈希值对该数量取模,从而从多个服务节点中确定第一服务节点。例如,多个服务节点包括服务节点A、服务节点B和服务节点C,分别通过编号0、1、2来表示,第一负载均衡节点调用一致性哈希算法,对应用层特征a.com/x进行处理,得到哈希值5,使用取模函数对服务节点的数量3取模后,得到2,对应服务节点C,则将该服务节点C确定为第一服务节点。由于网络系统中各个服务节点用于存储对应一定哈希值的资源,因此,第一负载均衡节点确定第一服务节点的过程也可以理解为,第一负载均衡节点基于该应用层特征,计算该应用层特征对应的哈希值,进而确定该目标资源应该存储的位置。当然,上述目标算法能够根据实际需求进行设置,例如,加权轮询算法、加权随机算法以及最小连接数算法等等,本申请实施例对此不作限定。Wherein, the first load balancing node invokes the target algorithm, and based on the application layer feature, determines the first service node corresponding to the application layer feature. In some embodiments, the target algorithm is a consistent hashing algorithm. Schematically, the first load balancing node uses a hash function to process the application layer feature to obtain a hash value corresponding to the application feature, and then uses a modulo function according to the number of multiple service nodes to obtain the hash value The value is modulo the number, so as to determine the first service node from the plurality of service nodes. For example, a plurality of service nodes include service node A, service node B, and service node C, which are respectively represented by numbers 0, 1, and 2. The first load balancing node invokes a consistent hash algorithm, and the application layer feature a.com/ x is processed to obtain a hash value of 5, and the modulo function is used to take the modulus of the number of service nodes 3 to obtain 2, which corresponds to service node C, and then the service node C is determined as the first service node. Since each service node in the network system is used to store resources corresponding to a certain hash value, the process of determining the first service node by the first load balancing node can also be understood as that the first load balancing node calculates the hash value based on the characteristics of the application layer. The hash value corresponding to the application layer feature determines where the target resource should be stored. Certainly, the above-mentioned target algorithm can be set according to actual requirements, for example, weighted round-robin algorithm, weighted random algorithm, minimum connection number algorithm, etc., which are not limited in this embodiment of the present application.
通过上述步骤一和步骤二,第一负载均衡节点能够根据资源请求的应用层特征,一次性定位到准确的第一服务节点,从而避免产生大量跨设备东西向流量,有效降低了交换机和服务节点的压力。而且,通过实时感知资源请求中的应用层特征,从而根据应用层特征进行请求调度,扩展了调度的灵活性。Through the above steps 1 and 2, the first load balancing node can locate the accurate first service node at one time according to the application layer characteristics of resource requests, thereby avoiding a large amount of cross-device east-west traffic and effectively reducing the number of switches and service nodes. pressure. Moreover, by sensing the application layer characteristics in the resource request in real time, request scheduling is performed according to the application layer characteristics, which expands the flexibility of scheduling.
303、第一负载均衡节点向该第一服务节点发送该资源请求、该第一负载均衡节点与该客户端之间的连接协议信息,该连接协议信息包括所采用的网络协议、该客户端的地址信息和该第一负载均衡节点的地址信息。303. The first load balancing node sends the resource request, the connection protocol information between the first load balancing node and the client to the first service node, and the connection protocol information includes the adopted network protocol and the address of the client information and address information of the first load balancing node.
在本申请实施例中,第一负载均衡节点在确定第一服务节点后,向该第一服务节点发送客户端的资源请求和连接协议信息。该连接协议信息用于服务节点向该客户端发送该资源请求的响应报文,以将该目标资源传输给该客户端,该响应报文的源地址信息为该第一负载均衡节点的地址信息。换言之,网络系统中的任一服务节点能够基于该连接协议信息,与客户端之间实现数据传输,即,该连接协议信息包括了客户端与服务节点之间实现数据传输的必要信息。在一些实施例中,该客户端的地址信息包括该客户端的端口号和网际互连协议(internet protocol,IP)地址;该第一负载均衡节点的地址信息包括该第一负载均衡节点的端口号和IP地址。In the embodiment of the present application, after determining the first service node, the first load balancing node sends the client's resource request and connection protocol information to the first service node. The connection protocol information is used by the service node to send a response message of the resource request to the client to transmit the target resource to the client, and the source address information of the response message is the address information of the first load balancing node . In other words, any service node in the network system can implement data transmission with the client based on the connection protocol information, that is, the connection protocol information includes necessary information for data transmission between the client and the service node. In some embodiments, the address information of the client includes a port number and an Internet protocol (internet protocol, IP) address of the client; the address information of the first load balancing node includes the port number and the address of the first load balancing node IP address.
在一些实施例中,第一负载均衡节点向第一服务节点发送该资源请求,向第一服务节点发送目标报文,该目标报文携带该连接协议信息,该目标报文所采用的网络协议和第一负载均衡节点与服务节点之间建立连接所采用的网络协议为同一网络协议。即,第一负载均衡节 点以单独数据包的形式将连接协议信息传输给第一服务节点。例如,以第一负载均衡节点与服务节点之间建立连接所采用的网络协议为HTTP为例,第一负载均衡节点在向第一服务节点发送该资源请求的情况下,同步采用HTTP向第一服务节点发送该目标报文。In some embodiments, the first load balancing node sends the resource request to the first service node, and sends a target message to the first service node, the target message carries the connection protocol information, and the network protocol adopted by the target message The network protocol used to establish the connection between the first load balancing node and the service node is the same network protocol. That is, the first load balancing node transmits the connection protocol information to the first service node in the form of a separate data packet. For example, taking HTTP as an example for establishing a connection between the first load balancing node and the service node, when the first load balancing node sends the resource request to the first service node, it uses HTTP to send the resource request to the first The service node sends the target message.
在一些实施例中,第一负载均衡节点与客户端之间建立连接所采用的网络协议和第一负载均衡节点与服务节点之间建立连接所采用的网络协议为同一网络协议。该连接协议信息可以是第一负载均衡节点在和客户端建立连接的时候得到的,也可以是第一负载均衡节点在接收到客户端的资源请求的情况下,对该资源请求进行解析得到的,本申请实施例对此不作限定。In some embodiments, the network protocol used to establish the connection between the first load balancing node and the client is the same network protocol as the network protocol used to establish the connection between the first load balancing node and the service node. The connection protocol information may be obtained when the first load balancing node establishes a connection with the client, or it may be obtained by analyzing the resource request when the first load balancing node receives the resource request from the client. This embodiment of the present application does not limit it.
在一些实施例中,该连接协议信息还包括第一负载均衡节点与客户端之间的连接状态(如已建立连接)、连接保持时间、基于TCP协议的序列号、第一负载均衡节点和客户端的设备标识信息等等,本申请实施例对此不作限定。In some embodiments, the connection protocol information also includes the connection status (such as established connection) between the first load balancing node and the client, the connection holding time, the sequence number based on the TCP protocol, the first load balancing node and the client The device identification information of the terminal, etc., are not limited in this embodiment of the present application.
另外,第一负载均衡节点与客户端之间建立连接所采用的网络协议和第一负载均衡节点与服务节点之间建立连接所采用的网络协议还可以为不同的网络协议,关于这种情况下的连接协议信息会在后续图6所示实施例中进行介绍,在此不再赘述。In addition, the network protocol used to establish the connection between the first load balancing node and the client and the network protocol used to establish the connection between the first load balancing node and the service node can also be different network protocols. In this case The connection protocol information will be introduced in the subsequent embodiment shown in FIG. 6 , and will not be repeated here.
304、第一服务节点接收该资源请求和该连接协议信息。304. The first service node receives the resource request and the connection protocol information.
305、第一服务节点响应于该资源请求,基于该连接协议信息,向该客户端发送该资源请求的响应报文,以将该目标资源传输给客户端。305. In response to the resource request, based on the connection protocol information, the first service node sends a response packet of the resource request to the client, so as to transmit the target resource to the client.
在本申请实施例中,第一服务节点响应于该资源请求,基于该连接协议信息,以该第一负载均衡节点的地址信息为源地址信息,以该客户端的地址信息为目的地址信息,向客户端发送该资源请求的响应报文(也即构造应用层DR模式的响应报文),该响应报文携带该目标资源。通过这种方式,第一服务节点的响应报文无需再次经过第一负载均衡节点,能够直接返回给客户端,从而实现了资源请求与响应报文分离流转,形成应用层DR模式的高效转发,提高了CDN服务效率。In this embodiment of the present application, in response to the resource request, based on the connection protocol information, the first service node uses the address information of the first load balancing node as the source address information, and uses the address information of the client as the destination address information to send The client sends a response message to the resource request (that is, to construct a response message in the DR mode of the application layer), and the response message carries the target resource. In this way, the response message of the first service node can be directly returned to the client without going through the first load balancing node again, thereby realizing the separation and flow of resource requests and response messages, forming efficient forwarding of the DR mode of the application layer, Improved CDN service efficiency.
示意性地,下面参考图4,对上述步骤301至步骤305进行示意性说明。图4是本申请实施例提供的一种负载均衡方法的示意图。如图4所示,以客户端采用HTTP,通过第一负载均衡节点向服务节点请求目标资源为例。客户端与第一负载均衡节点建立连接,并采用HTTPS,通过交换机向第一负载均衡节点发送资源请求,该资源请求用于请求目标资源http://a.com/x。第一负载均衡节点响应于该资源请求,解析该资源请求,得到该资源请求的URL标识a.com/x,也即是提取该资源请求中的应用层特征,从而根据该URL标识,确定第一服务节点,从而避免产生大量跨设备东西向流量,降低了交换机和服务节点的压力,进一步地,第一负载均衡节点向该第一服务节点发送该资源请求和连接协议信息,该第一服务节点接收到该资源请求和连接协议信息后,基于该连接协议信息,以第一负载均衡节点的地址信息为源地址信息,以客户端的地址信息为目的地址信息,生成与该资源请求对应的响应报文,该响应报文携带该目标资源,并将该响应报文通过交换机直接发送给客户端,实现了资源请求与响应报文分离流转,形成应用层DR模式的高效转发,提高了CDN服务效率。而且,在这一过程中,通过实时感知客户端的资源请求中的应用层特征,从而根据应用层特征进行请求调度,扩展了调度的灵活性。Schematically, the above step 301 to step 305 will be schematically described below with reference to FIG. 4 . FIG. 4 is a schematic diagram of a load balancing method provided by an embodiment of the present application. As shown in FIG. 4 , the client uses HTTP to request target resources from the service node through the first load balancing node as an example. The client establishes a connection with the first load balancing node, and uses HTTPS to send a resource request to the first load balancing node through the switch, and the resource request is used to request the target resource http://a.com/x. The first load balancing node responds to the resource request, parses the resource request, and obtains the URL identifier a.com/x of the resource request, that is, extracts the application layer feature in the resource request, and determines the first resource request based on the URL identifier. A service node, thereby avoiding the generation of a large amount of cross-device east-west traffic, reducing the pressure on switches and service nodes. Further, the first load balancing node sends the resource request and connection protocol information to the first service node, and the first service node After the node receives the resource request and the connection protocol information, based on the connection protocol information, the address information of the first load balancing node is used as the source address information, and the address information of the client is used as the destination address information to generate a response corresponding to the resource request message, the response message carries the target resource, and the response message is sent directly to the client through the switch, which realizes the separation and transfer of resource request and response message, forms the efficient forwarding of the DR mode of the application layer, and improves the CDN service efficiency. Moreover, in this process, by real-time perception of the application layer characteristics in the resource request of the client, request scheduling is performed according to the application layer characteristics, which expands the flexibility of scheduling.
示意性地,下面参考图5对相关技术提供的负载均衡方法和本申请提供的负载均衡方法的过程进行简要介绍。图5是一种相关技术提供的负载均衡方法和本申请实施例提供的负载 均衡方法的示意图。Schematically, the process of the load balancing method provided by the related art and the load balancing method provided by the present application will be briefly introduced below with reference to FIG. 5 . Fig. 5 is a schematic diagram of a load balancing method provided by a related technology and a load balancing method provided by an embodiment of the present application.
如图5中(a)图所示,相关技术提供的负载均衡方法包括如下步骤:As shown in Figure 5 (a), the load balancing method provided by the related technology includes the following steps:
(1)客户端通过交换机,以四层负载均衡器的地址为目的地址,以客户端的地址为源地址,向四层负载均衡器发送针对目标资源的资源请求;(1) The client sends a resource request for the target resource to the Layer 4 load balancer through the switch, with the address of the Layer 4 load balancer as the destination address and the address of the client as the source address;
(2)四层负载均衡器基于接收到的该资源请求进行负载均衡,以四层负载均衡器的地址为目的地址,以客户端的地址为源地址,将资源请求透传给七层负载均衡器;(2) The four-layer load balancer performs load balancing based on the received resource request, takes the address of the four-layer load balancer as the destination address, and takes the client's address as the source address, and transparently transmits the resource request to the seven-layer load balancer ;
(3)七层负载均衡器基于接收到的资源请求,与客户端建立连接,基于该资源请求中的应用层特征进行负载均衡,以服务节点的地址为目的地址,以七层负载均衡器的地址为源地址,将该资源请求发送给服务节点;(3) The seven-layer load balancer establishes a connection with the client based on the received resource request, and performs load balancing based on the application layer characteristics in the resource request, with the address of the service node as the destination address and the seven-layer load balancer's The address is the source address, and the resource request is sent to the service node;
(4)服务节点基于接收到的资源请求,以七层负载均衡器的地址为目的地址,以服务节点的地址为源地址,向七层负载均衡器发送目标资源;(4) Based on the received resource request, the service node sends the target resource to the layer-7 load balancer with the address of the layer-7 load balancer as the destination address and the address of the service node as the source address;
(5)七层负载均衡器基于接收到的目标资源,以客户端的地址为目的地址,以四层负载均衡器的地址为源地址,生成该资源请求的响应报文,绕过四层负载均衡器,通过交换机传输给客户端。(5) Based on the received target resource, the seven-layer load balancer uses the address of the client as the destination address and the address of the four-layer load balancer as the source address to generate a response message for the resource request, bypassing the four-layer load balancing device and transmit it to the client through the switch.
可见,在相关技术中,资源请求需要依次经过四层负载均衡器和七层负载均衡器,最终到达相应的服务节点,导致请求时延较高。而且,一旦该服务节点不存在该资源请求对应的资源,该服务节点会从其他服务节点中获取目标资源,从而产生大量跨设备东西向流量,导致交换机和服务节点的压力较大。另外,由于相关技术中七层负载均衡器需要解析完整的资源请求,耗时较高,因此,相关技术往往需要部署成千上万七层负载均衡器来保证CDN服务的效率,导致负载均衡的成本大大增加。It can be seen that in related technologies, resource requests need to pass through the four-layer load balancer and the seven-layer load balancer in sequence, and finally reach the corresponding service node, resulting in a high request delay. Moreover, once the service node does not have the resource corresponding to the resource request, the service node will obtain the target resource from other service nodes, thereby generating a large amount of cross-device east-west traffic, resulting in greater pressure on switches and service nodes. In addition, because the seven-layer load balancer in related technologies needs to parse complete resource requests, which takes a long time, therefore, related technologies often need to deploy tens of thousands of seven-layer load balancers to ensure the efficiency of CDN services, resulting in load balancing problems. The cost is greatly increased.
如图5中(b)图所示,本申请实施例提供的负载均衡方法包括如下步骤:As shown in Figure 5 (b), the load balancing method provided by the embodiment of the present application includes the following steps:
(1)客户端通过交换机,以负载均衡节点的地址为目的地址,以客户端的地址为源地址,向负载均衡节点发送针对目标资源的资源请求;(1) The client sends a resource request for the target resource to the load balancing node with the address of the load balancing node as the destination address and the address of the client as the source address through the switch;
(2)负载均衡节点基于接收到的资源请求,与客户端建立连接,基于该资源请求中的应用层特征进行负载均衡,以服务节点的地址为目的地址,以负载均衡节点的地址为源地址,将该资源请求和连接协议信息发送给服务节点;(2) The load balancing node establishes a connection with the client based on the received resource request, and performs load balancing based on the application layer characteristics in the resource request, with the address of the service node as the destination address and the address of the load balancing node as the source address , sending the resource request and connection protocol information to the service node;
(3)服务节点基于接收到的资源请求和连接协议信息,以该负载均衡节点的地址为源地址信息,以该客户端的地址为目的地址,生成该资源请求的响应报文,将该响应报文绕过负载均衡节点,通过交换机传输给客户端。(3) Based on the received resource request and connection protocol information, the service node uses the address of the load balancing node as the source address information and the address of the client as the destination address to generate a response message for the resource request, and sends the response message The file bypasses the load balancing node and is transmitted to the client through the switch.
可见,在本申请实施例提供的负载均衡方法中,负载均衡节点在接收到客户端的资源请求时,能够一次性定位到准确的服务节点,从而避免产生大量跨设备东西向流量,降低交换机和服务节点的压力。进一步地,负载均衡节点向该服务节点发送资源请求和连接协议信息,其中,该连接协议信息包括所采用的网络协议、客户端的地址信息和负载均衡节点的地址信息。通过这种方式,服务节点能够基于该连接协议信息,伪装成该负载均衡节点的响应报文,发送给客户端,该响应报文绕过了负载均衡节点,实现了资源请求与响应报文分离流转,形成应用层DR模式的高效转发,提高了CDN服务的效率。而且,由于本申请实施例提供的负载均衡方法中,负载均衡节点不需要解析完整的资源请求,耗时较短,因此在保证CDN服务效率的基础上,在网络系统中无需配置过多负载均衡节点,从而有效降低了负载均衡的成本。It can be seen that in the load balancing method provided by the embodiment of the present application, when the load balancing node receives the resource request from the client, it can locate the accurate service node at one time, thereby avoiding the generation of a large amount of cross-device east-west traffic and reducing the cost of switches and services. Node pressure. Further, the load balancing node sends a resource request and connection protocol information to the service node, wherein the connection protocol information includes the adopted network protocol, address information of the client and address information of the load balancing node. In this way, based on the connection protocol information, the service node can pretend to be the response message of the load balancing node and send it to the client. The response message bypasses the load balancing node and realizes the separation of resource requests and response messages. Transfer, form the efficient forwarding of DR mode at the application layer, and improve the efficiency of CDN services. Moreover, in the load balancing method provided by the embodiment of the present application, the load balancing node does not need to parse the complete resource request, which takes a short time. Therefore, on the basis of ensuring the CDN service efficiency, there is no need to configure too many load balancing nodes in the network system. nodes, thus effectively reducing the cost of load balancing.
上述图3和图4所示的负载均衡方法介绍了本申请实施例提供的负载均衡方案的一种基础的实施方式。其中,客户端与第一负载均衡之间所采用的网络协议和第一负载均衡节点与服务节点之间所使用的网络协议为同一网络协议。在一些实施例中,第一负载均衡节点与该客户端之间建立连接所采用的网络协议为第一网络协议,该第一负载均衡节点与服务节点之间建立连接所采用的网络协议为第二网络协议,第一网络协议和第二网络协议不同。下面基于图6所示的实施例,对这种情况下的负载均衡方法进行介绍。The above load balancing methods shown in FIG. 3 and FIG. 4 introduce a basic implementation manner of the load balancing solution provided by the embodiment of the present application. Wherein, the network protocol used between the client and the first load balancing node and the network protocol used between the first load balancing node and the service node are the same network protocol. In some embodiments, the network protocol used to establish the connection between the first load balancing node and the client is the first network protocol, and the network protocol used to establish the connection between the first load balancing node and the service node is the first network protocol. Two network protocols, the first network protocol and the second network protocol are different. Based on the embodiment shown in FIG. 6 , the load balancing method in this case will be introduced below.
图6是本申请实施例提供的一种负载均衡方法的流程图。如图6所示,以客户端、第一负载均衡节点以及第一服务节点之间的交互为例来进行说明,该负载均衡方法包括如下步骤601至步骤606。FIG. 6 is a flowchart of a load balancing method provided by an embodiment of the present application. As shown in FIG. 6 , the interaction among the client, the first load balancing node and the first service node is taken as an example for illustration. The load balancing method includes the following steps 601 to 606 .
601、客户端向第一负载均衡节点发送资源请求,该资源请求用于获取目标资源。601. The client sends a resource request to the first load balancing node, where the resource request is used to obtain a target resource.
在本申请实施例中,本步骤601的具体实施方式与上述步骤301同理,故在此不再赘述。In the embodiment of the present application, the specific implementation manner of this step 601 is the same as that of the above-mentioned step 301, so details are not repeated here.
602、第一负载均衡节点基于第二网络协议,对该资源请求进行协议转换,得到协议转换后的该资源请求。602. The first load balancing node performs protocol conversion on the resource request based on the second network protocol, and obtains the resource request after the protocol conversion.
在本申请实施例中,该第二网络协议表示该第一负载均衡节点和服务节点之间建立连接所采用的网络协议。第一负载均衡节点在接收到该资源请求的情况下,基于该资源请求所采用的第一网络协议和该第二网络协议,确定该资源请求不是基于第二网络协议生成的,对该资源请求进行协议转换,使得协议转换后的资源请求所使用的协议为第二网络协议。例如,客户端的资源请求所采用的第一网络协议为HTTPS,该资源请求包括https://a.com/x,第二网络协议为HTTP,第一负载均衡节点基于HTTP,对该资源请求进行协议转换,得到协议转换后的资源请求为http://a.com/x。需要说明的是,此处举例仅为示意性地,本申请实施例对于第一网络协议和第二网络协议的类型不作限定。In this embodiment of the present application, the second network protocol indicates a network protocol used to establish a connection between the first load balancing node and the service node. When the first load balancing node receives the resource request, based on the first network protocol and the second network protocol adopted by the resource request, it determines that the resource request is not generated based on the second network protocol, and the resource request Perform protocol conversion, so that the protocol used by the resource request after protocol conversion is the second network protocol. For example, the first network protocol used by the client's resource request is HTTPS, the resource request includes https://a.com/x, the second network protocol is HTTP, and the first load balancing node is based on HTTP. Protocol conversion, the resource request obtained after the protocol conversion is http://a.com/x. It should be noted that the example here is only for illustration, and the embodiment of the present application does not limit the types of the first network protocol and the second network protocol.
603、第一负载均衡节点基于该资源请求,确定第一服务节点。603. The first load balancing node determines the first service node based on the resource request.
在本申请实施例中,该第一服务节点用于提供目标资源,第一负载均衡节点基于资源请求确定第一服务节点的过程与上述步骤302同理,故在此不再赘述。In this embodiment of the present application, the first service node is used to provide target resources, and the process for the first load balancing node to determine the first service node based on the resource request is the same as the above step 302, so it will not be repeated here.
需要说明的是,在一些实施例中,第一负载均衡节点在执行上述步骤603的过程中,基于协议转换后的资源请求确定第一服务节点。在另一些实施例中,第一负载均衡节点先执行上述步骤603来确定第一服务节点,再执行上述步骤602来得到协议转换后的资源请求。即,本申请实施例对于第一负载均衡节点进行协议转换的时机以及确定第一服务节点所依赖的资源请求的协议类型不作限定。It should be noted that, in some embodiments, the first load balancing node determines the first service node based on the protocol-converted resource request during the process of performing the above step 603 . In some other embodiments, the first load balancing node first performs the above step 603 to determine the first service node, and then performs the above step 602 to obtain the resource request after the protocol conversion. That is, the embodiment of the present application does not limit the timing of protocol conversion by the first load balancing node and the determination of the protocol type of the resource request on which the first service node depends.
604、第一负载均衡节点向该第一服务节点发送协议转换后的资源请求、该第一负载均衡节点与该客户端之间的连接协议信息,该连接协议信息包括所采用的网络协议、该客户端的地址信息和该第一负载均衡节点的地址信息。604. The first load balancing node sends the protocol-converted resource request and connection protocol information between the first load balancing node and the client to the first service node, where the connection protocol information includes the adopted network protocol, the The address information of the client and the address information of the first load balancing node.
在本申请实施例中,本步骤604中第一负载均衡节点向该第一服务节点发送该资源请求和连接协议信息的过程与上述步骤303同理,故在此不再赘述。In this embodiment of the present application, the process of the first load balancing node sending the resource request and the connection protocol information to the first service node in step 604 is the same as that of step 303 above, so it will not be repeated here.
需要说明的是,由于第一网络协议与第二网络协议不同,其对应报文存在差异字段,因此,第一负载均衡节点能够根据资源请求中与第二网络协议对应报文的差异字段,得到采用第一网络协议与客户端之间实现数据传输的必要信息,从而无需解析完整的资源请求,降低了请求时延。示意性地,在这种情况下,该连接协议信息还包括该第一网络协议和第二网络协议的报文头中的差异字段所携带的信息。即,第一负载均衡节点响应于该资源请求,解析 该资源请求中与该第二网络协议对应报文头中的差异字段,得到相应的信息。下面以不同类型的网络协议为例,对这一过程进行举例说明:It should be noted that since the first network protocol is different from the second network protocol, there are difference fields in the corresponding packets, therefore, the first load balancing node can obtain The necessary information for data transmission between the first network protocol and the client is adopted, so that there is no need to parse a complete resource request, and the request delay is reduced. Schematically, in this case, the connection protocol information also includes the information carried in the difference fields in the packet headers of the first network protocol and the second network protocol. That is, in response to the resource request, the first load balancing node parses the difference field in the packet header corresponding to the second network protocol in the resource request to obtain corresponding information. The following takes different types of network protocols as examples to illustrate this process:
(1)第一网络协议为HTTPS,第二网络协议为HTTP。(1) The first network protocol is HTTPS, and the second network protocol is HTTP.
其中,HTTPS是在HTTP的基础上对数据进行加密传输的一种协议,这两种网络协议对应报文的差异字段包括密钥信息所在字段等。示意性地,第一负载均衡节点响应于该资源请求,解析该资源请求中密钥信息所在字段,得到该第一负载均衡节点和该客户端之间建立连接所需的密钥信息。即,在这种情况下,上述连接协议信息还包括第一负载均衡节点和该客户端之间建立连接所需的密钥信息,如公钥、私钥以及数字证书等。Among them, HTTPS is a protocol for encrypting and transmitting data on the basis of HTTP. The difference fields of the corresponding messages of the two network protocols include the field where the key information is located. Schematically, in response to the resource request, the first load balancing node parses the field where the key information is located in the resource request, and obtains the key information required for establishing a connection between the first load balancing node and the client. That is, in this case, the above connection protocol information also includes key information required to establish a connection between the first load balancing node and the client, such as a public key, a private key, and a digital certificate.
(2)第一网络协议为web socket,第二网络协议为HTTP。(2) The first network protocol is web socket, and the second network protocol is HTTP.
其中,web socket是在一种以长连接的形式实现全双工通信的一种协议。web socket和HTTP对应报文的差异字段包括密钥信息所在字段和请求类型所在字段等。例如,在web socket对应报文的头部会有一个upgrade:web socket(升级:web socket)的字段,用于标识该资源请求为web socket类型的请求,在web socket对应报文的头部还会有一个Sec-WebSocket-Key的字段,是一种base64编码的密文,也即是密钥信息。示意性地,第一负载均衡节点响应于该资源请求,解析该资源请求中密钥信息和请求类型所在字段,得到该第一负载均衡节点和该客户端之间建立连接所需的密钥信息和该资源请求的请求类型。即,在这种情况下,上述连接协议信息还包括该第一负载均衡节点和该客户端之间建立连接所需的密钥信息和该资源请求的请求类型,该请求类型用于标识该资源请求为web socket类型的请求。Among them, web socket is a protocol that realizes full-duplex communication in the form of long connection. The difference fields between websocket and HTTP corresponding messages include the field where the key information is located and the field where the request type is located. For example, there will be an upgrade: web socket (upgrade: web socket) field in the header of the message corresponding to web socket, which is used to identify that the resource request is a web socket type request. There will be a Sec-WebSocket-Key field, which is a base64-encoded ciphertext, which is the key information. Schematically, in response to the resource request, the first load balancing node parses the key information and the field of the request type in the resource request, and obtains the key information required for establishing a connection between the first load balancing node and the client and the request type of the resource request. That is, in this case, the above connection protocol information also includes key information required to establish a connection between the first load balancing node and the client and the request type of the resource request, and the request type is used to identify the resource The request is a web socket type request.
(3)第一网络协议为HTTP1.1,第二网络协议为HTTP。(3) The first network protocol is HTTP1.1, and the second network protocol is HTTP.
其中,HTTP1.1是在HTTP基础上支持以长连接的形式实现通信的一种协议。这两种网络协议对应报文的差异字段包括数据范围所在字段等等。例如,在HTTP1.1对应报文的头部会有range(范围)字段,用于以字节为单位标识数据范围。示意性地,第一负载均衡节点响应于该资源请求,解析该资源请求中数据范围所在字段,得到该第一负载均衡节点和该客户端之间建立连接所需的数据范围信息。即,在这种情况下,上述连接协议信息还包括该第一负载均衡节点和该客户端之间建立连接所需的数据范围信息。Among them, HTTP1.1 is a protocol that supports communication in the form of long connections on the basis of HTTP. The difference fields of the packets corresponding to the two network protocols include the field where the data range is located and the like. For example, there will be a range (range) field in the header of the HTTP1.1 corresponding message, which is used to identify the data range in bytes. Schematically, in response to the resource request, the first load balancing node parses the data range field in the resource request to obtain data range information required for establishing a connection between the first load balancing node and the client. That is, in this case, the above connection protocol information also includes data range information required to establish a connection between the first load balancing node and the client.
在一些实施例中,第一负载均衡节点存储有不同网络协议对应的差异字段信息,第一负载均衡节点能够根据接收到的资源请求的网络协议类型,确定相应的差异字段信息,从而解析该资源请求的报文头中对应的差异字段,得到相应的信息,提高负载均衡效率。例如,以该第一网络协议为HTTPS,该第二网络协议为HTTP为例,第一负载均衡节点存储有HTTPS和HTTP对应的差异字段信息,如密钥信息所在字段,在第一负载均衡节点接收到资源请求的情况下,能够基于该差异字段信息,解析该资源请求中密钥信息所在字段,得到相应的密钥信息,等等,本申请实施例对此不作限定。In some embodiments, the first load balancing node stores difference field information corresponding to different network protocols, and the first load balancing node can determine the corresponding difference field information according to the network protocol type of the resource request received, thereby parsing the resource The corresponding difference field in the request header can get the corresponding information and improve the efficiency of load balancing. For example, taking the first network protocol as HTTPS and the second network protocol as HTTP as an example, the first load balancing node stores the difference field information corresponding to HTTPS and HTTP, such as the field where the key information is located, in the first load balancing node When a resource request is received, based on the difference field information, the field where the key information is located in the resource request can be parsed to obtain corresponding key information, etc., which is not limited in this embodiment of the present application.
需要说明的是,上述几种仅为举例说明,在实际应用中,不同网络协议对应报文的差异字段还可以包括更多内容,上述第一网络协议与第二网络协议也可以采用其他形式,对此不作限定。另外,在一些实施例中,第一负载均衡节点在与客户端采用第一网络协议建立连接的情况下,基于所建立的连接得到该连接协议信息,本申请实施例对此不作限定。It should be noted that the above-mentioned types are only examples. In practical applications, the difference fields of packets corresponding to different network protocols may also include more content. The above-mentioned first network protocol and second network protocol may also adopt other forms. There is no limit to this. In addition, in some embodiments, when establishing a connection with the client using the first network protocol, the first load balancing node obtains the connection protocol information based on the established connection, which is not limited in this embodiment of the present application.
605、第一服务节点接收该协议转换后的资源请求和该连接协议信息。605. The first service node receives the protocol-converted resource request and the connection protocol information.
606、第一服务节点响应于该协议转换后的资源请求,基于该连接协议信息,向该客户端 发送该资源请求的响应报文,以将目标资源传输给客户端。606. In response to the protocol-converted resource request, the first service node sends a response message of the resource request to the client based on the connection protocol information, so as to transmit the target resource to the client.
在本申请实施例中,本步骤606的具体实施方式与上述步骤303同理,需要说明的是,在本步骤606中,第一服务节点生成的响应报文所采用的网络协议为第一网络协议,与第一负载均衡节点和客户端之间建立连接所采用的网络协议相同,从而实现了在客户端与第一负载均衡之间所采用的网络协议和第一负载均衡节点与服务节点之间所采用的网络协议不同的情况下,第一服务节点的响应报文依然可以直接返回给客户端,而无需再次经过第一负载均衡节点,实现了资源请求与响应报文分离流转,形成应用层DR模式的高效转发,提高了CDN服务效率。In this embodiment of the application, the specific implementation of this step 606 is the same as the above step 303. It should be noted that in this step 606, the network protocol used by the response message generated by the first service node is the first network The protocol is the same as the network protocol used to establish the connection between the first load balancing node and the client, thereby realizing the network protocol adopted between the client and the first load balancing node and the connection between the first load balancing node and the service node In the case of different network protocols adopted between the two, the response message of the first service node can still be returned directly to the client without going through the first load balancing node again, realizing the separation and flow of resource requests and response messages, forming an application Efficient forwarding of layer DR mode improves CDN service efficiency.
示意性地,下面参考图7,对上述步骤601至步骤606进行示意性说明。图7是本申请实施例提供的一种负载均衡方法的示意图。如图7所示,以客户端采用第一网络协议HTTPS,通过第一负载均衡节点向服务节点请求目标资源为例。客户端与第一负载均衡节点建立连接,并采用第一网络协议HTTPS,通过交换机向第一负载均衡节点发送资源请求,该资源请求用于请求目标资源https://a.com/x。第一负载均衡节点响应于该资源请求,确定该资源请求所采用的协议不是第二网络协议HTTP,对该资源请求进行协议转换,得到协议转换后的资源请求,该协议转换后的资源请求用于请求http://a.com/x。从而,第一负载均衡节点向该第一服务节点发送协议转换后的资源请求和连接协议信息,该第一服务节点接收到该资源请求和连接协议信息后,基于该连接协议信息,以第一负载均衡节点的地址信息为源地址信息,以客户端的地址信息为目的地址信息,生成与该资源请求对应的响应报文,该响应报文携带该目标资源,并将该响应报文通过交换机直接发送给客户端,从而实现了在客户端与第一负载均衡之间所采用的网络协议和第一负载均衡节点与服务节点之间所采用的网络协议不同的情况下,第一服务节点的响应报文依然能够直接返回给客户端,而无需再次经过第一负载均衡节点,实现了资源请求与响应报文分离流转,形成应用层DR模式的高效转发,提高了CDN服务效率。Schematically, the above steps 601 to 606 are schematically described below with reference to FIG. 7 . FIG. 7 is a schematic diagram of a load balancing method provided by an embodiment of the present application. As shown in FIG. 7 , it is taken as an example that the client uses the first network protocol HTTPS to request the target resource from the service node through the first load balancing node. The client establishes a connection with the first load balancing node, and uses the first network protocol HTTPS to send a resource request to the first load balancing node through the switch, and the resource request is used to request the target resource https://a.com/x. In response to the resource request, the first load balancing node determines that the protocol adopted by the resource request is not the second network protocol HTTP, performs protocol conversion on the resource request, and obtains a resource request after protocol conversion. The resource request after protocol conversion uses to request http://a.com/x. Therefore, the first load balancing node sends the protocol-converted resource request and connection protocol information to the first service node, and after receiving the resource request and connection protocol information, the first service node uses the first connection protocol information based on the connection protocol information. The address information of the load balancing node is the source address information, and the address information of the client is used as the destination address information to generate a response message corresponding to the resource request. The response message carries the target resource, and the response message is directly transmitted through the switch. sent to the client, so that when the network protocol adopted between the client and the first load balancer is different from the network protocol adopted between the first load balancer node and the service node, the response of the first service node The message can still be directly returned to the client without going through the first load balancing node again, which realizes the separation and flow of resource request and response messages, forms the efficient forwarding of the DR mode at the application layer, and improves the efficiency of CDN services.
综上,负载均衡节点在接收到客户端的资源请求时,能够在该资源请求所采用的网络协议和负载均衡节点与服务节点之间所采用的网络协议不同的情况下,一次性定位到准确的服务节点,从而避免产生大量跨设备东西向流量,降低交换机和服务节点的压力,进一步地,负载均衡节点向该服务节点发送资源请求和连接协议信息,其中,该连接协议信息包括所采用的网络协议、客户端的地址信息和负载均衡节点的地址信息。通过这种方式,服务节点能够基于该连接协议信息,伪装成该负载均衡节点的响应报文,发送给客户端,该响应报文绕过了负载均衡节点,实现资源请求与响应报文分离流转,形成应用层DR模式的高效转发,提高了CDN服务的效率。To sum up, when a load balancing node receives a resource request from a client, it can locate an accurate resource at one time when the network protocol used by the resource request is different from the network protocol used between the load balancing node and the service node. Service nodes, so as to avoid a large amount of cross-device east-west traffic and reduce the pressure on switches and service nodes. Further, the load balancing node sends resource requests and connection protocol information to the service node, where the connection protocol information includes the adopted network Protocol, client address information and load balancing node address information. In this way, based on the connection protocol information, the service node can pretend to be the response message of the load balancing node and send it to the client. The response message bypasses the load balancing node and realizes the separation and flow of resource requests and response messages. , form the efficient forwarding of the DR mode of the application layer, and improve the efficiency of CDN services.
上述图3至图7所示的负载均衡方法介绍了本申请实施例提供的负载均衡方案的几种实施方式。其中,负载均衡节点能够一次性定位到准确的存储有目标资源的服务节点,并由该服务节点向客户端提供目标资源。下面基于图8所示的实施例,在负载均衡节点所确定的服务节点不存在目标资源的情况下,对本申请实施例提供的负载均衡方法进行介绍。The above load balancing methods shown in FIG. 3 to FIG. 7 introduce several implementation manners of the load balancing solution provided by the embodiment of the present application. Wherein, the load balancing node can locate the accurate service node storing the target resource at one time, and the service node provides the target resource to the client. Based on the embodiment shown in FIG. 8 , the load balancing method provided by the embodiment of the present application will be introduced below in the case that the service node determined by the load balancing node does not have the target resource.
图8是本申请实施例提供的一种负载均衡方法的流程图。如图8所示,以客户端、第一负载均衡节点、第一服务节点以及第二服务节点之间的交互为例来进行说明,该负载均衡方法包括如下步骤801至步骤807。FIG. 8 is a flowchart of a load balancing method provided by an embodiment of the present application. As shown in FIG. 8 , the interaction among the client, the first load balancing node, the first service node and the second service node is taken as an example for illustration. The load balancing method includes the following steps 801 to 807 .
801、客户端向第一负载均衡节点发送资源请求,该资源请求用于获取目标资源。801. The client sends a resource request to the first load balancing node, where the resource request is used to obtain a target resource.
在本申请实施例中,本步骤801的具体实施方式与上述步骤301同理,故在此不再赘述。In the embodiment of the present application, the specific implementation manner of this step 801 is the same as that of the above-mentioned step 301, so it will not be repeated here.
802、第一负载均衡节点响应于该客户端的资源请求,确定第二服务节点。802. The first load balancing node determines a second service node in response to the client's resource request.
在本申请实施例中,本步骤802的具体实施方式与上述步骤302同理,即,第一负载均衡节点响应于该资源请求,从多个服务节点中确定该第二服务节点。In this embodiment of the present application, the specific implementation manner of step 802 is the same as that of step 302 above, that is, the first load balancing node determines the second service node from multiple service nodes in response to the resource request.
803、第一负载均衡节点向该第二服务节点发送该资源请求、该第一负载均衡节点与该客户端之间的连接协议信息,该连接协议信息包括所采用的网络协议、该客户端的地址信息和该第一负载均衡节点的地址信息。803. The first load balancing node sends the resource request, the connection protocol information between the first load balancing node and the client to the second service node, and the connection protocol information includes the adopted network protocol and the address of the client information and address information of the first load balancing node.
在本申请实施例中,本步骤803的具体实施方式与上述步骤303同理,故在此不再赘述。In the embodiment of the present application, the specific implementation manner of this step 803 is the same as that of the above-mentioned step 303, so it will not be repeated here.
804、第二服务节点接收该资源请求和该连接协议信息。804. The second service node receives the resource request and the connection protocol information.
805、第二服务节点响应于该资源请求,在该第二服务节点不存在该目标资源的情况下,确定第一服务节点。805. In response to the resource request, the second service node determines the first service node when the target resource does not exist on the second service node.
在本申请实施例中,该第一服务节点用于提供目标资源,第二服务节点在接收到该资源请求后,在该第二服务节点不存在该目标资源的情况下,基于该目标资源,从多个服务节点中重新确定存储有该目标资源的第一服务节点,该多个服务节点与该第一负载均衡节点属于同一数据中心。In this embodiment of the application, the first service node is used to provide the target resource. After the second service node receives the resource request, if the target resource does not exist in the second service node, based on the target resource, The first service node storing the target resource is re-determined from multiple service nodes, where the multiple service nodes and the first load balancing node belong to the same data center.
在一些实施例中,该多个服务节点能够根据目标规则,及时更新自身存储的资源。其中,该目标规则能够根据实际需求进行设置,对此不作限定。例如,服务节点存储有某一资源,在该资源长时间未被访问的情况下,服务节点删除该资源;又例如,服务节点存储有某一资源,在该资源的存储时长已超过预设时长的情况下,服务节点删除该资源,等等,本申请实施例对此不作限定。基于这种情况,第一负载节点在确定第二服务节点,并向该第二服务节点发送资源请求和连接协议信息时,第二服务节点有可能已经删除了原先存储的该目标资源,因此,第二服务节点需要重新确定存储有该目标资源的服务节点。In some embodiments, the multiple service nodes can update the resources stored by themselves in time according to the target rules. Wherein, the target rule can be set according to actual requirements, which is not limited. For example, the service node stores a certain resource, and if the resource has not been accessed for a long time, the service node deletes the resource; another example, the service node stores a certain resource, and the storage time of the resource exceeds the preset time In the case of , the service node deletes the resource, etc., which is not limited in this embodiment of the present application. Based on this situation, when the first load node determines the second service node and sends the resource request and connection protocol information to the second service node, the second service node may have deleted the original stored target resource. Therefore, The second service node needs to re-determine the service node storing the target resource.
在一些实施例中,第二服务节点调用目标算法,基于该资源请求,确定与该资源请求对应的第一服务节点。这一过程与上述步骤302中第一负载均衡节点确定第一服务节点的过程同理,故在此不再赘述。通过这种方式,多个服务节点中的每个服务节点能够在自身服务节点不存在目标资源的情况下,快速定位到存储有该目标资源的服务节点,提高CDN服务效率。当然,在一些实施例中,第二服务节点还能够将与自身相邻的服务节点确定为第一服务节点,等等,即,本申请实施例对于第二服务节点确定第一服务节点的具体方式不作限定。In some embodiments, the second service node invokes a target algorithm to determine the first service node corresponding to the resource request based on the resource request. This process is the same as the process of determining the first service node by the first load balancing node in step 302 above, so it will not be repeated here. In this way, each of the multiple service nodes can quickly locate the service node storing the target resource when the target resource does not exist in its own service node, thereby improving CDN service efficiency. Of course, in some embodiments, the second service node can also determine the service node adjacent to itself as the first service node, and so on, that is, the embodiment of the present application determines the specific The method is not limited.
806、第二服务节点向第一服务节点发送该资源请求和该连接协议信息。806. The second service node sends the resource request and the connection protocol information to the first service node.
807、第一服务节点响应于该资源请求,基于该连接协议信息,向该客户端发送该资源请求的响应报文,以将该目标资源传输给客户端。807. In response to the resource request, based on the connection protocol information, the first service node sends a response packet of the resource request to the client, so as to transmit the target resource to the client.
在本申请实施例中,本步骤807的具体实施方式与上述步骤305同理。通过这种方式,在第一负载节点所确定的服务节点不存在目标资源的情况下,由该服务节点自行确定能够提供该目标资源的第一服务节点,并向该第一服务节点发送资源请求和连接协议信息,使得第一服务节点的响应报文能够直接返回给客户端,而无需再次经过第一负载均衡节点,从而在客户端无感知的情况下,实现资源请求与响应报文分离流转,形成应用层DR模式的高效转发,提高了CDN服务效率。In the embodiment of the present application, the specific implementation manner of this step 807 is the same as that of the above-mentioned step 305 . In this way, if the service node determined by the first load node does not have the target resource, the service node will determine the first service node that can provide the target resource by itself, and send a resource request to the first service node and connection protocol information, so that the response message of the first service node can be directly returned to the client without going through the first load balancing node again, so that the resource request and response message can be separated and transferred without the client's perception , form the efficient forwarding of the DR mode of the application layer, and improve the service efficiency of the CDN.
需要说明的是,在一些实施例中,第一服务节点在不存在该目标资源的情况下,继续从 多个服务节点中确定其他服务节点,并向其他服务节点发送资源请求和连接协议信息,由其他服务节点向客户端提供该目标资源。It should be noted that, in some embodiments, when the target resource does not exist, the first service node continues to determine other service nodes from multiple service nodes, and sends resource requests and connection protocol information to other service nodes, The target resource is provided to the client by other service nodes.
示意性地,下面参考图9,对上述步骤801至步骤807进行示意性说明。图9是本申请实施例提供的一种负载均衡方法的示意图。如图9所示,以客户端通过第一负载均衡节点向服务节点请求目标资源为例。客户端与第一负载均衡节点建立连接,向该第一负载均衡节点发送资源请求,第一负载均衡节点响应于该资源请求,确定第二服务节点,向该第二服务节点发送资源请求和连接协议信息,该第二服务节点在不存在目标资源的情况下,确定第一服务节点,向该第一服务节点发送资源请求和连接协议信息,第一服务节点接收到该资源请求和连接协议信息后,基于该连接协议信息,以第一负载均衡节点的地址信息为源地址信息,以客户端的地址信息为目的地址信息,生成与该资源请求对应的响应报文,该响应报文携带该目标资源,并将该响应报文通过交换机直接发送给客户端,从而在第一负载均衡节点所确定的服务节点不存在目标资源且客户端无感知的情况下,实现资源请求与响应报文分离流转,形成应用层DR模式的高效转发,提高了CDN服务效率。Schematically, the above steps 801 to 807 are schematically described below with reference to FIG. 9 . FIG. 9 is a schematic diagram of a load balancing method provided by an embodiment of the present application. As shown in FIG. 9 , it is taken as an example that a client requests a target resource from a service node through a first load balancing node. The client establishes a connection with the first load balancing node, sends a resource request to the first load balancing node, and the first load balancing node determines the second service node in response to the resource request, and sends the resource request and connection to the second service node Protocol information, the second service node determines the first service node when there is no target resource, sends a resource request and connection protocol information to the first service node, and the first service node receives the resource request and connection protocol information Then, based on the connection protocol information, the address information of the first load balancing node is used as the source address information, and the address information of the client is used as the destination address information to generate a response message corresponding to the resource request, and the response message carries the target Resource, and the response message is sent directly to the client through the switch, so that when the service node determined by the first load balancing node does not have the target resource and the client has no perception, the resource request and response message are separated and flowed , form the efficient forwarding of the DR mode of the application layer, and improve the service efficiency of the CDN.
另外,在上述图3至图7所示的负载均衡方法中,向客户端提供目标资源的第一服务节点所接收到的资源请求和连接协议信息是由第一负载均衡节点发送的,而在上述图8和图9所示的负载均衡方法中,向客户端提供目标资源的第一服务节点所接收到的资源请求和连接协议信息是由另一服务节点发送的,即,通过这种方式,第一负载均衡节点与客户端之间的连接协议信息能够实现跨设备转移,使得设备间能够互联互通,相互调度,形成分布式协议调度能力,有效提升了CDN服务的效率。In addition, in the above load balancing methods shown in FIGS. 3 to 7 , the resource request and connection protocol information received by the first service node that provides the target resource to the client are sent by the first load balancing node, and the In the above load balancing method shown in Figure 8 and Figure 9, the resource request and connection protocol information received by the first service node that provides the target resource to the client is sent by another service node, that is, in this way , the connection protocol information between the first load balancing node and the client can be transferred across devices, so that the devices can be interconnected and mutually scheduled, forming a distributed protocol scheduling capability, and effectively improving the efficiency of CDN services.
上述图3至图9所示的负载均衡方法介绍了本申请实施例提供的负载均衡方案的几种实施方式。其中,负载均衡节点与服务节点均属于同一数据中心。下面基于图10所示的实施例,在负载均衡方法的实施环境包括多个数据中心的情况下,对本申请实施例提供的负载均衡方法进行介绍。The above load balancing methods shown in FIG. 3 to FIG. 9 introduce several implementation manners of the load balancing solution provided by the embodiment of the present application. Among them, the load balancing node and the service node belong to the same data center. Based on the embodiment shown in FIG. 10 , the load balancing method provided by the embodiment of the present application will be introduced below when the implementation environment of the load balancing method includes multiple data centers.
图10是本申请实施例提供的一种负载均衡方法的流程图。如图10所示,以客户端、第一负载均衡节点、第二负载均衡节点以及第三服务节点之间的交互为例来进行说明,该负载均衡方法包括如下步骤1001至步骤1007。FIG. 10 is a flowchart of a load balancing method provided by an embodiment of the present application. As shown in FIG. 10 , taking the interaction among the client, the first load balancing node, the second load balancing node and the third service node as an example for illustration, the load balancing method includes the following steps 1001 to 1007 .
1001、客户端向第一负载均衡节点发送资源请求,该资源请求用于获取目标资源。1001. A client sends a resource request to a first load balancing node, where the resource request is used to obtain a target resource.
在本申请实施例中,本步骤1001的具体实施方式与上述步骤301同理,故在此不再赘述。In the embodiment of the present application, the specific implementation manner of this step 1001 is the same as that of the above step 301, so it will not be repeated here.
1002、第一负载均衡节点响应于该客户端的资源请求,在第一负载均衡节点所在数据中心不存在目标资源的情况下,向第二负载均衡节点发送该资源请求、该第一负载均衡节点与该客户端之间的连接协议信息,该连接协议信息包括所采用的网络协议、该客户端的地址信息和该第一负载均衡节点的地址信息。1002. In response to the client's resource request, the first load balancing node sends the resource request, the first load balancing node and The connection protocol information between the clients, the connection protocol information includes the adopted network protocol, the address information of the client and the address information of the first load balancing node.
在本申请实施例中,第一负载均衡节点与第二负载均衡节点属于不同数据中心。每个数据中心都对应多个服务节点。示意性地,如图2所示,第一负载均衡节点1021属于第一数据中心,该第一数据中心包括多个服务节点1031;第二负载均衡节点1022属于第二数据中心,该第二数据中心包括多个服务节点1032。示意性地,第一负载均衡节点在接收到该资源请求后,在该第一负载均衡节点所在数据中心不存在该目标资源的情况下,基于该目标资源,确定第二负载均衡节点,并向该第二负载均衡节点发送该资源请求和连接协议信息。In the embodiment of the present application, the first load balancing node and the second load balancing node belong to different data centers. Each data center corresponds to multiple service nodes. Schematically, as shown in FIG. 2, the first load balancing node 1021 belongs to a first data center, and the first data center includes a plurality of service nodes 1031; the second load balancing node 1022 belongs to a second data center, and the second data center The center includes multiple service nodes 1032 . Schematically, after the first load balancing node receives the resource request, if the target resource does not exist in the data center where the first load balancing node is located, it determines the second load balancing node based on the target resource, and sends The second load balancing node sends the resource request and connection protocol information.
通过这种方式,第一负载均衡节点能够在所在数据中心不存在目标资源的情况下,及时将资源请求和连接协议信息转移给其他数据中心的负载均衡节点,从而在客户端无感知的情况下,实现了资源请求与响应报文分离流转,形成应用层DR模式的高效转发,提高了CDN服务效率。In this way, the first load balancing node can transfer resource requests and connection protocol information to load balancing nodes in other data centers in a timely manner when the target resource does not exist in the data center where it is located, so that when the client does not perceive , realizing the separation and transfer of resource requests and response messages, forming efficient forwarding in the DR mode of the application layer, and improving the efficiency of CDN services.
在一些实施例中,第一负载均衡节点存储有多个数据中心的资源存储情况,多个数据中心的资源存储情况用于指示各个数据中心所存储的资源和各个数据中心的网络地址。第一负载均衡节点在该第一负载均衡节点所在数据中心不存在目标资源的情况下,基于该第一负载均衡节点存储的多个数据中心的资源存储情况,确定第二负载均衡节点。通过这种方式,每个负载均衡节点能够在自身所在数据中心不存在目标资源的情况下,快速定位到存储有该目标资源的数据中心,提高CDN服务效率。当然,在一些实施例中,第一负载均衡节点还能够将相邻数据中心的负载均衡节点确定为第二负载均衡节点,等等,即,本申请实施例对于第一负载均衡节点确定第二负载均衡节点的具体方式不作限定。In some embodiments, the first load balancing node stores resource storage conditions of multiple data centers, and the resource storage conditions of multiple data centers are used to indicate the resources stored in each data center and the network address of each data center. When the first load balancing node does not have the target resource in the data center where the first load balancing node is located, the first load balancing node determines the second load balancing node based on resource storage conditions of multiple data centers stored by the first load balancing node. In this way, each load balancing node can quickly locate the data center that stores the target resource when the target resource does not exist in its own data center, improving CDN service efficiency. Of course, in some embodiments, the first load balancing node can also determine the load balancing node of the adjacent data center as the second load balancing node, and so on, that is, the embodiment of the present application determines the second load balancing node for the first load balancing node The specific manner of the load balancing node is not limited.
1003、第二负载均衡节点接收该资源请求和该连接协议信息。1003. The second load balancing node receives the resource request and the connection protocol information.
1004、第二负载均衡节点响应于该资源请求,确定第三服务节点,该第三服务节点用于提供目标资源。1004. The second load balancing node determines a third service node in response to the resource request, and the third service node is used to provide the target resource.
在本申请实施例中,本步骤1004的具体实施方式与上述步骤302同理。需要说明的是,该第三服务节点与该第二服务节点属于同一数据中心,也即是,该第三服务节点与第一负载均衡节点属于不同数据中心。In the embodiment of the present application, the specific implementation manner of this step 1004 is the same as that of the above-mentioned step 302 . It should be noted that the third service node and the second service node belong to the same data center, that is, the third service node and the first load balancing node belong to different data centers.
1005、第二负载均衡节点向该第三服务节点发送该资源请求和连接协议信息。1005. The second load balancing node sends the resource request and connection protocol information to the third service node.
1006、第三服务节点接收该资源请求和该连接协议信息。1006. The third service node receives the resource request and the connection protocol information.
1007、第三服务节点响应于该资源请求,基于该连接协议信息,向该客户端发送该资源请求的响应报文,以将该目标资源传输给客户端。1007. In response to the resource request, based on the connection protocol information, the third service node sends a response message of the resource request to the client, so as to transmit the target resource to the client.
在本申请实施例中,本步骤1007的具体实施方式与上述步骤305同理。通过这种方式,在第一负载节点所在数据中心不存在目标资源的情况下,由该第一负载均衡自行确定能够提供该目标资源的其他数据中心,并向该数据中心对应的第二负载均衡节点发送资源请求和连接协议信息,使得该第二负载均衡节点能够从自身所在的数据中心中,确定第三服务节点,该第三服务节点的响应报文能够直接返回给客户端,而无需再次经过第一负载均衡节点和第二负载均衡节点,从而在客户端无感知的情况下,实现了资源请求与响应报文分离流转,形成应用层DR模式的高效转发,提高了CDN服务效率。In the embodiment of this application, the specific implementation manner of this step 1007 is the same as that of the above-mentioned step 305 . In this way, when the target resource does not exist in the data center where the first load node is located, the first load balancer can determine other data centers that can provide the target resource by itself, and send the data to the second load balancer corresponding to the data center. The node sends the resource request and connection protocol information, so that the second load balancing node can determine the third service node from its own data center, and the response message of the third service node can be directly returned to the client without having to Through the first load balancing node and the second load balancing node, resource requests and response messages are separated and transferred without the client being aware, forming efficient forwarding in the DR mode of the application layer, and improving CDN service efficiency.
需要说明的是,在一些实施例中,第二负载均衡节点在该第二负载均衡节点所在数据中心不存在目标资源的情况下,继续确定其他数据中心,并向其他数据中心对应的负载均衡节点发送资源请求和连接协议信息,由其他数据中心的服务节点向客户端提供该目标资源。It should be noted that, in some embodiments, when the second load balancing node does not have the target resource in the data center where the second load balancing node is located, continue to determine other data centers, and report to the corresponding load balancing nodes of other data centers Send the resource request and connection protocol information, and the service nodes in other data centers will provide the target resource to the client.
示意性地,下面参考图11,对上述步骤1001至步骤1007进行示意性说明。图11是本申请实施例提供的一种负载均衡方法的示意图。如图11所示,以客户端通过第一负载均衡节点向服务节点请求目标资源为例。客户端与第一负载均衡节点建立连接,向该第一负载均衡节点发送资源请求,第一负载均衡节点响应于该资源请求,在该第一负载均衡节点所在数据中心不存在目标资源的情况下,向第二负载均衡节点发送资源请求和连接协议信息,该第二负载均衡节点在接收到该资源请求和连接协议信息后,响应于该资源请求,从自身所在数据中心的多个服务节点中确定第三服务节点,向该第三服务节点发送资源请求和连接协议信息, 由该第三服务节点基于该连接协议信息,以第一负载均衡节点的地址信息为源地址信息,以客户端的地址信息为目的地址信息,生成与该资源请求对应的响应报文,该响应报文携带该目标资源,并将该响应报文通过交换机直接发送给客户端,从而在第一负载均衡节点所在数据中心不存在目标资源的情况下,实现资源请求与响应报文分离流转,在客户端无感知的情况下,形成应用层DR模式的高效转发,提高了CDN服务效率。Schematically, the above steps 1001 to 1007 are schematically described below with reference to FIG. 11 . FIG. 11 is a schematic diagram of a load balancing method provided by an embodiment of the present application. As shown in FIG. 11 , it is taken as an example that a client requests a target resource from a service node through a first load balancing node. The client establishes a connection with the first load balancing node, sends a resource request to the first load balancing node, and the first load balancing node responds to the resource request, and if the data center where the first load balancing node is located does not have the target resource , send the resource request and connection protocol information to the second load balancing node. After receiving the resource request and connection protocol information, the second load balancing node responds to the resource request and selects Determine the third service node, send the resource request and connection protocol information to the third service node, based on the connection protocol information, the third service node uses the address information of the first load balancing node as the source address information, and uses the address information of the client The information is the destination address information, and a response message corresponding to the resource request is generated, the response message carries the target resource, and the response message is directly sent to the client through the switch, so that the data center where the first load balancing node is located When there is no target resource, the resource request and response packets are separated and transferred, and the efficient forwarding of the DR mode at the application layer is formed without the client being aware of it, which improves the efficiency of CDN services.
另外,在上述图10和图11所示的负载均衡方法中,向客户端提供目标资源的第三服务节点所接收到的资源请求和连接协议信息是由第一负载均衡节点发送给第二负载均衡节点后,由该第二负载均衡节点发送,即,通过这种方式,第一负载均衡节点与客户端之间的连接协议信息能够实现跨数据中心转移,使得数据中心间能够互联互通,相互调度,形成分布式协议调度能力,有效提升了CDN服务的效率。In addition, in the above load balancing method shown in Figure 10 and Figure 11, the resource request and connection protocol information received by the third service node that provides the target resource to the client is sent by the first load balancing node to the second load balancing node. After the balancing node, it will be sent by the second load balancing node, that is, in this way, the connection protocol information between the first load balancing node and the client can be transferred across data centers, so that the data centers can be interconnected and communicate with each other. Scheduling, forming a distributed protocol scheduling capability, effectively improving the efficiency of CDN services.
而且,相关技术中,以302调度为例,当调度中心发现客户端所请求的资源有更合适的CDN节点来提供服务时,需要通过HTTP 302状态码,让客户端向更合适的CDN节点发起资源请求,导致客户端需要建立2次以上连接,资源请求时延成倍增加,而本申请实施例提供的负载均衡方法中,当负载均衡节点发现客户端所请求的资源有更合适的数据中心来提供服务时,无需通过HTTP 302状态码让客户端重新发起资源请求,而是可以直接将资源请求和连接协议信息转移给其他数据中心对应的负载均衡节点,实现了在客户端无感知的情况下,资源请求与响应报文分离流转,形成应用层DR模式的高效转发,相比302调度,能够在提高CDN服务效率的同时,有效减少资源请求的时延。Moreover, in related technologies, taking 302 scheduling as an example, when the scheduling center finds that the resource requested by the client has a more suitable CDN node to provide services, it needs to pass the HTTP 302 status code to let the client initiate a request to a more suitable CDN node. The resource request requires the client to establish more than 2 connections, and the resource request delay is doubled. In the load balancing method provided by the embodiment of this application, when the load balancing node finds that the resource requested by the client has a more suitable data center When providing services, the client does not need to re-initiate the resource request through the HTTP 302 status code, but can directly transfer the resource request and connection protocol information to the corresponding load balancing nodes of other data centers, realizing the situation that the client has no perception In this case, resource requests and response messages are separated and flowed to form efficient forwarding in the DR mode of the application layer. Compared with 302 scheduling, it can effectively reduce the delay of resource requests while improving CDN service efficiency.
图12是本申请实施例提供的一种负载均衡装置的结构示意图。图12所示的负载均衡装置1200例如实现上述图3至图11所示的负载均衡方法中第一负载均衡节点的功能。如图12所示,负载均衡装置1200包括服务节点确定模块1201和连接协议信息转移模块1202。FIG. 12 is a schematic structural diagram of a load balancing device provided by an embodiment of the present application. The load balancing device 1200 shown in FIG. 12 implements, for example, the function of the first load balancing node in the load balancing methods shown in FIGS. 3 to 11 above. As shown in FIG. 12 , the load balancing device 1200 includes a service node determination module 1201 and a connection protocol information transfer module 1202 .
服务节点确定模块1201,用于响应于客户端的资源请求,确定第一服务节点,该资源请求用于获取目标资源;A service node determining module 1201, configured to determine a first service node in response to a resource request from a client, where the resource request is used to obtain a target resource;
连接协议信息转移模块1202,用于向该第一服务节点发送该资源请求、该第一负载均衡节点与该客户端之间的连接协议信息,该连接协议信息包括所采用的网络协议、该客户端的地址信息和该第一负载均衡节点的地址信息,该连接协议信息用于服务节点向该客户端发送该资源请求的响应报文,以将该目标资源传输给该客户端,该响应报文的源地址信息为该第一负载均衡节点的地址信息。A connection protocol information transfer module 1202, configured to send the resource request, connection protocol information between the first load balancing node and the client to the first service node, the connection protocol information includes the adopted network protocol, the client The address information of the terminal and the address information of the first load balancing node, the connection protocol information is used for the service node to send the response message of the resource request to the client, so as to transmit the target resource to the client, the response message The source address information of is the address information of the first load balancing node.
在一些实施例中,该连接协议信息转移模块1202,用于:In some embodiments, the connection protocol information transfer module 1202 is configured to:
向该第一服务节点发送该资源请求;sending the resource request to the first service node;
向该第一服务节点发送目标报文,该目标报文携带该连接协议信息,该目标报文所采用的网络协议和该第一负载均衡节点与服务节点之间建立连接所采用的网络协议为同一网络协议。Send a target message to the first service node, the target message carries the connection protocol information, the network protocol used by the target message and the network protocol used to establish a connection between the first load balancing node and the service node are: the same network protocol.
在一些实施例中,该第一负载均衡节点与该客户端之间建立连接所采用的网络协议为第一网络协议,该第一负载均衡节点与服务节点之间建立连接所采用的网络协议为第二网络协议,第一网络协议和第二网络协议不同,该连接协议信息还包括该第一网络协议和第二网络协议的报文头中的差异字段所携带的信息。In some embodiments, the network protocol used to establish the connection between the first load balancing node and the client is the first network protocol, and the network protocol used to establish the connection between the first load balancing node and the service node is For the second network protocol, the first network protocol is different from the second network protocol, and the connection protocol information also includes the information carried in the difference field in the packet headers of the first network protocol and the second network protocol.
在一些实施例中,该第一网络协议为超文本传输安全协议HTTPS,该第二网络协议为超 文本传输协议HTTP,该连接协议信息还包括该第一负载均衡节点和该客户端之间建立连接所需的密钥信息。In some embodiments, the first network protocol is HTTPS, the second network protocol is HTTP, and the connection protocol information also includes the connection protocol established between the first load balancing node and the client. Key information required to connect.
在一些实施例中,该第一网络协议为基于传输控制协议TCP的全双工通信协议web socket,该第二网络协议为超文本传输协议HTTP,该连接协议信息还包括该第一负载均衡节点和该客户端之间建立连接所需的密钥信息和该资源请求的请求类型,该请求类型用于标识该资源请求为web socket类型的请求。In some embodiments, the first network protocol is a full-duplex communication protocol websocket based on transmission control protocol TCP, the second network protocol is hypertext transfer protocol HTTP, and the connection protocol information also includes the first load balancing node The key information required to establish a connection with the client and the request type of the resource request, which is used to identify the resource request as a web socket type request.
在一些实施例中,该第一网络协议为超文本传输协议HTTP1.1,该第二网络协议为超文本传输协议HTTP,该连接协议信息还包括该第一负载均衡节点和该客户端之间建立连接所需的数据范围信息。In some embodiments, the first network protocol is Hypertext Transfer Protocol HTTP1.1, the second network protocol is Hypertext Transfer Protocol HTTP, and the connection protocol information also includes the connection between the first load balancing node and the client Data range information required to establish a connection.
在一些实施例中,该装置还包括协议转换模块,用于在该资源请求不是基于目标协议生成的情况下,基于该目标协议,对该资源请求进行协议转换,得到协议转换后的该资源请求,该目标协议表示该第一负载均衡节点和服务节点之间所使用的协议;In some embodiments, the device further includes a protocol conversion module, configured to perform protocol conversion on the resource request based on the target protocol when the resource request is not generated based on the target protocol, to obtain the resource request after protocol conversion , the target protocol represents the protocol used between the first load balancing node and the service node;
该连接协议信息转移模块1202,用于:The connection protocol information transfer module 1202 is used for:
向该第一服务节点发送协议转换后的该资源请求和该连接协议信息。Send the protocol-converted resource request and the connection protocol information to the first service node.
在一些实施例中,该第一服务节点与该第一负载均衡节点属于同一数据中心。In some embodiments, the first service node and the first load balancing node belong to the same data center.
在一些实施例中,该连接协议信息转移模块1202,还用于:In some embodiments, the connection protocol information transfer module 1202 is also used to:
响应于该资源请求,在该第一负载均衡节点所在数据中心不存在该目标资源的情况下,向第二负载均衡节点发送该资源请求和该连接协议信息,该第二负载均衡节点与该第一负载均衡节点属于不同数据中心。In response to the resource request, if the target resource does not exist in the data center where the first load balancing node is located, send the resource request and the connection protocol information to the second load balancing node, and the second load balancing node and the second load balancing node A load balancing node belongs to different data centers.
需要说明的是:上述实施例提供的负载均衡装置在进行负载均衡时,仅以上述各功能模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能模块完成,即将装置的内部结构划分成不同的功能模块,以完成以上描述的全部或者部分功能。另外,上述实施例提供的负载均衡装置与负载均衡方法实施例属于同一构思,其具体实现过程详见方法实施例,这里不再赘述。It should be noted that when the load balancing device provided in the above embodiment performs load balancing, the division of the above-mentioned functional modules is used as an example for illustration. In practical applications, the above-mentioned function distribution can be completed by different functional modules according to needs. That is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the load balancing device and the load balancing method embodiments provided in the above embodiments belong to the same idea, and the specific implementation process thereof is detailed in the method embodiments, and will not be repeated here.
图13是本申请实施例提供的一种数据处理装置的结构示意图。图13所示的数据处理装置1300例如实现上述图3至图11所示的负载均衡方法中服务节点的功能。如图13所示,数据处理装置1300包括信息接收模块1301和响应报文发送模块1302。Fig. 13 is a schematic structural diagram of a data processing device provided by an embodiment of the present application. The data processing apparatus 1300 shown in FIG. 13 implements, for example, the function of a service node in the load balancing method shown in FIGS. 3 to 11 above. As shown in FIG. 13 , the data processing device 1300 includes an information receiving module 1301 and a response packet sending module 1302 .
信息接收模块1301,用于接收客户端的资源请求、第一负载均衡节点与该客户端之间的连接协议信息,该连接协议信息包括所采用的网络协议、该客户端的地址信息和该第一负载均衡节点的地址信息,该资源请求用于获取目标资源;The information receiving module 1301 is configured to receive the resource request of the client, the connection protocol information between the first load balancing node and the client, the connection protocol information includes the adopted network protocol, the address information of the client and the first load The address information of the balance node, the resource request is used to obtain the target resource;
响应报文发送模块1302,用于响应于该资源请求,基于该连接协议信息,向该客户端发送该资源请求的响应报文,以将该目标资源传输给该客户端,该响应报文的源地址信息为该第一负载均衡节点的地址信息。Response message sending module 1302, configured to respond to the resource request, based on the connection protocol information, send a response message of the resource request to the client, so as to transmit the target resource to the client, the response message The source address information is address information of the first load balancing node.
在一些实施例中,该响应报文发送模块1302用于响应于该资源请求,基于该连接协议信息,以该第一负载均衡节点的地址信息为源地址信息,以该客户端的地址信息为目的地址信息,向该客户端发送该资源请求的响应报文。In some embodiments, the response message sending module 1302 is configured to respond to the resource request, based on the connection protocol information, use the address information of the first load balancing node as the source address information, and use the client address information as the destination address information, and send the response message of the resource request to the client.
在一些实施例中,该服务节点与该第一负载均衡节点属于同一数据中心。In some embodiments, the service node and the first load balancing node belong to the same data center.
在一些实施例中,该资源请求和该连接协议信息由该第一负载均衡节点发送。In some embodiments, the resource request and the connection protocol information are sent by the first load balancing node.
在一些实施例中,该资源请求和该连接协议信息由该数据中心的另一服务节点发送。In some embodiments, the resource request and the connection agreement information are sent by another service node of the data center.
在一些实施例中,该服务节点与该第一负载均衡节点属于不同数据中心。In some embodiments, the service node and the first load balancing node belong to different data centers.
在一些实施例中,该资源请求和该连接协议信息由该第一负载均衡节点发送给第二负载均衡节点后,由该第二负载均衡节点发送,该第二负载均衡节点与该服务节点属于同一数据中心,该第二负载均衡节点和该第一负载均衡节点属于不同数据中心。In some embodiments, after the resource request and the connection protocol information are sent by the first load balancing node to the second load balancing node, they are sent by the second load balancing node, and the second load balancing node and the service node belong to In the same data center, the second load balancing node and the first load balancing node belong to different data centers.
需要说明的是:上述实施例提供的数据处理装置在进行数据处理时,仅以上述各功能模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能模块完成,即将装置的内部结构划分成不同的功能模块,以完成以上描述的全部或者部分功能。另外,上述实施例提供的数据处理装置与负载均衡方法实施例属于同一构思,其具体实现过程详见方法实施例,这里不再赘述。It should be noted that: when the data processing device provided in the above-mentioned embodiments performs data processing, the division of the above-mentioned functional modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional modules according to needs. That is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the data processing device provided by the above embodiment and the embodiment of the load balancing method belong to the same idea, and the specific implementation process thereof is detailed in the method embodiment, and will not be repeated here.
本申请中术语“第一”“第二”等字样用于对作用和功能基本相同的相同项或相似项进行区分,应理解,“第一”、“第二”、“第n”之间不具有逻辑或时序上的依赖关系,也不对数量和执行顺序进行限定。还应理解,尽管以下描述使用术语第一、第二等来描述各种元素,但这些元素不应受术语的限制。这些术语只是用于将一元素与另一元素区别分开。例如,在不脱离各种所述示例的范围的情况下,第一服务节点可以被称为第二服务节点,并且类似地,第二服务节点可以被称为第一服务节点。第一服务节点和第二服务节点都可以是服务节点,并且在某些情况下,可以是单独且不同的服务节点。In this application, the terms "first" and "second" are used to distinguish the same or similar items with basically the same function and function. It should be understood that "first", "second" and "nth" There are no logical or timing dependencies, nor are there restrictions on quantity or order of execution. It should also be understood that although the following description uses the terms first, second, etc. to describe various elements, these elements should not be limited by the terms. These terms are only used to distinguish one element from another. For example, a first service node could be termed a second service node, and, similarly, a second service node could be termed a first service node, without departing from the scope of the various described examples. Both the first service node and the second service node may be service nodes, and in some cases may be separate and distinct service nodes.
本申请中术语“至少一个”的含义是指一个或多个,本申请中术语“多个”的含义是指两个或两个以上,例如,多个服务节点是指两个或两个以上的服务节点。The meaning of the term "at least one" in this application refers to one or more, and the meaning of the term "multiple" in this application refers to two or more, for example, a plurality of service nodes refers to two or more service node.
以上描述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到各种等效的修改或替换,这些修改或替换都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以权利要求的保护范围为准。The above description is only the specific implementation of the application, but the scope of protection of the application is not limited thereto. Any person familiar with the technical field can easily think of various equivalent modifications within the technical scope disclosed in the application. Or replacement, these modifications or replacements should be covered within the protection scope of this application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
在上述实施例中,可以全部或部分地通过软件、硬件、固件或者其任意组合来实现。当使用软件实现时,可以全部或部分地以程序产品的形式实现。该程序产品包括一个或多个程序指令。在计算设备上加载和执行该程序指令时,全部或部分地产生按照本申请实施例中的流程或功能。In the above embodiments, all or part of them may be implemented by software, hardware, firmware or any combination thereof. When implemented using software, it may be implemented in whole or in part in the form of a program product. The program product includes one or more program instructions. When the program instructions are loaded and executed on the computing device, all or part of the processes or functions according to the embodiments of the present application will be generated.
本领域普通技术人员可以理解实现上述实施例的全部或部分步骤可以通过硬件来完成,也可以通过程序来指令相关的硬件完成,该程序可以存储于一种计算机可读存储介质中,上述提到的存储介质可以是只读存储器,磁盘或光盘等。Those of ordinary skill in the art can understand that all or part of the steps for implementing the above-mentioned embodiments can be completed by hardware, and can also be completed by instructing related hardware through a program. The program can be stored in a computer-readable storage medium. The above-mentioned The storage medium can be read-only memory, magnetic disk or optical disk and so on.
以上所述,以上实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的范围。As mentioned above, the above embodiments are only used to illustrate the technical solutions of the present application, and are not intended to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: it can still understand the foregoing The technical solutions described in each embodiment are modified, or some of the technical features are replaced equivalently; and these modifications or replacements do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the various embodiments of the application.

Claims (24)

  1. 一种负载均衡方法,其特征在于,由第一负载均衡节点执行,所述方法包括:A load balancing method, characterized in that it is performed by a first load balancing node, the method comprising:
    响应于客户端的资源请求,确定第一服务节点,所述资源请求用于获取目标资源;determining a first service node in response to a resource request from a client, where the resource request is used to obtain a target resource;
    向所述第一服务节点发送所述资源请求、所述第一负载均衡节点与所述客户端之间的连接协议信息,所述连接协议信息包括所采用的网络协议、所述客户端的地址信息和所述第一负载均衡节点的地址信息,所述连接协议信息用于服务节点向所述客户端发送所述资源请求的响应报文,以将所述目标资源传输给所述客户端,所述响应报文的源地址信息为所述第一负载均衡节点的地址信息。Send the resource request, the connection protocol information between the first load balancing node and the client to the first service node, the connection protocol information includes the adopted network protocol, and the address information of the client and the address information of the first load balancing node, the connection protocol information is used for the service node to send the response message of the resource request to the client, so as to transmit the target resource to the client, so The source address information of the response message is the address information of the first load balancing node.
  2. 根据权利要求1所述的方法,其特征在于,所述向所述第一服务节点发送所述资源请求、所述第一负载均衡节点与所述客户端之间的连接协议信息,包括:The method according to claim 1, wherein the sending the resource request and the connection protocol information between the first load balancing node and the client to the first service node comprises:
    向所述第一服务节点发送所述资源请求;sending the resource request to the first serving node;
    向所述第一服务节点发送目标报文,所述目标报文携带所述连接协议信息,所述目标报文所采用的网络协议和所述第一负载均衡节点与服务节点之间建立连接所采用的网络协议为同一网络协议。Sending a target message to the first service node, the target message carrying the connection protocol information, the network protocol used by the target message and the information required for establishing a connection between the first load balancing node and the service node. The network protocol adopted is the same network protocol.
  3. 根据权利要求1或2所述的方法,其特征在于,所述第一负载均衡节点与所述客户端之间建立连接所采用的网络协议为第一网络协议,所述第一负载均衡节点与服务节点之间建立连接所采用的网络协议为第二网络协议,第一网络协议和第二网络协议不同,所述连接协议信息还包括所述第一网络协议和所述第二网络协议的报文头中的差异字段所携带的信息。The method according to claim 1 or 2, wherein the network protocol used to establish the connection between the first load balancing node and the client is the first network protocol, and the first load balancing node and the client The network protocol used to establish the connection between the service nodes is the second network protocol, the first network protocol is different from the second network protocol, and the connection protocol information also includes reports of the first network protocol and the second network protocol. The information carried in the difference field in the header.
  4. 根据权利要求3所述的方法,其特征在于,所述第一网络协议为超文本传输安全协议HTTPS,所述第二网络协议为超文本传输协议HTTP,所述连接协议信息还包括所述第一负载均衡节点和所述客户端之间建立连接所需的密钥信息。The method according to claim 3, wherein the first network protocol is Hypertext Transfer Security Protocol HTTPS, the second network protocol is Hypertext Transfer Protocol HTTP, and the connection protocol information also includes the first Key information required to establish a connection between a load balancing node and the client.
  5. 根据权利要求3所述的方法,其特征在于,所述第一网络协议为基于传输控制协议TCP的全双工通信协议web socket,所述第二网络协议为超文本传输协议HTTP,所述连接协议信息还包括所述第一负载均衡节点和所述客户端之间建立连接所需的密钥信息和所述资源请求的请求类型,所述请求类型用于标识所述资源请求为web socket类型的请求。The method according to claim 3, wherein the first network protocol is a full-duplex communication protocol websocket based on the transmission control protocol TCP, the second network protocol is a hypertext transfer protocol HTTP, and the connection The protocol information also includes key information required to establish a connection between the first load balancing node and the client and the request type of the resource request, and the request type is used to identify that the resource request is a web socket type request.
  6. 根据权利要求3所述的方法,其特征在于,所述第一网络协议为超文本传输协议HTTP1.1,所述第二网络协议为超文本传输协议HTTP,所述连接协议信息还包括所述第一负载均衡节点和所述客户端之间建立连接所需的数据范围信息。The method according to claim 3, wherein the first network protocol is Hypertext Transfer Protocol HTTP1.1, the second network protocol is Hypertext Transfer Protocol HTTP, and the connection protocol information also includes the Data range information required for establishing a connection between the first load balancing node and the client.
  7. 根据权利要求3至6任一项所述的方法,其特征在于,所述方法还包括:The method according to any one of claims 3 to 6, wherein the method further comprises:
    基于所述第二网络协议,对所述资源请求进行协议转换,得到协议转换后的所述资源请求;performing protocol conversion on the resource request based on the second network protocol, to obtain the resource request after protocol conversion;
    所述向所述第一服务节点发送所述资源请求、所述第一负载均衡节点与所述客户端之间的连接协议信息,包括:The sending the resource request and the connection protocol information between the first load balancing node and the client to the first service node includes:
    向所述第一服务节点发送协议转换后的所述资源请求和所述连接协议信息。Sending the protocol-converted resource request and the connection protocol information to the first service node.
  8. 根据权利要求1至7任一项所述的方法,其特征在于,所述第一服务节点与所述第一负载均衡节点属于同一数据中心。The method according to any one of claims 1 to 7, wherein the first service node and the first load balancing node belong to the same data center.
  9. 根据权利要求1至7任一项所述的方法,其特征在于,所述方法还包括:The method according to any one of claims 1 to 7, further comprising:
    响应于所述资源请求,在所述第一负载均衡节点所在数据中心不存在所述目标资源的情况下,向第二负载均衡节点发送所述资源请求和所述连接协议信息,所述第二负载均衡节点与所述第一负载均衡节点属于不同数据中心。In response to the resource request, if the target resource does not exist in the data center where the first load balancing node is located, sending the resource request and the connection protocol information to a second load balancing node, and the second load balancing node The load balancing node and the first load balancing node belong to different data centers.
  10. 一种负载均衡方法,其特征在于,由服务节点执行,所述方法包括:A load balancing method, characterized in that it is performed by a service node, the method comprising:
    接收客户端的资源请求、第一负载均衡节点与所述客户端之间的连接协议信息,所述连接协议信息包括所采用的网络协议、所述客户端的地址信息和所述第一负载均衡节点的地址信息,所述资源请求用于获取目标资源;receiving the resource request of the client, the connection protocol information between the first load balancing node and the client, the connection protocol information including the adopted network protocol, the address information of the client and the address information of the first load balancing node address information, the resource request is used to obtain the target resource;
    响应于所述资源请求,基于所述连接协议信息,向所述客户端发送所述资源请求的响应报文,以将所述目标资源传输给所述客户端,所述响应报文的源地址信息为所述第一负载均衡节点的地址信息。In response to the resource request, based on the connection protocol information, send a response message of the resource request to the client, so as to transmit the target resource to the client, and the source address of the response message The information is address information of the first load balancing node.
  11. 根据权利要求10所述的方法,其特征在于,所述响应于所述资源请求,基于所述连接协议信息,向所述客户端发送所述资源请求的响应报文,包括:The method according to claim 10, wherein in response to the resource request, sending a response message of the resource request to the client based on the connection protocol information includes:
    响应于所述资源请求,基于所述连接协议信息,以所述第一负载均衡节点的地址信息为源地址信息,以所述客户端的地址信息为目的地址信息,向所述客户端发送所述资源请求的响应报文。In response to the resource request, based on the connection protocol information, using the address information of the first load balancing node as source address information and using the address information of the client as destination address information, sending the Response message for resource request.
  12. 根据权利要求10或11所述的方法,其特征在于,所述服务节点与所述第一负载均衡节点属于同一数据中心。The method according to claim 10 or 11, wherein the service node and the first load balancing node belong to the same data center.
  13. 根据权利要求12所述的方法,其特征在于,所述资源请求和所述连接协议信息由所述第一负载均衡节点发送。The method according to claim 12, wherein the resource request and the connection protocol information are sent by the first load balancing node.
  14. 根据权利要求12所述的方法,其特征在于,所述资源请求和所述连接协议信息由所述数据中心的另一服务节点发送。The method according to claim 12, wherein the resource request and the connection protocol information are sent by another service node of the data center.
  15. 根据权利要求10或11所述的方法,其特征在于,所述服务节点与所述第一负载均衡节点属于不同数据中心。The method according to claim 10 or 11, wherein the service node and the first load balancing node belong to different data centers.
  16. 根据权利要求15所述的方法,其特征在于,所述资源请求和所述连接协议信息由所 述第一负载均衡节点发送给第二负载均衡节点后,由所述第二负载均衡节点发送,所述第二负载均衡节点与所述服务节点属于同一数据中心,所述第二负载均衡节点和所述第一负载均衡节点属于不同数据中心。The method according to claim 15, wherein the resource request and the connection protocol information are sent by the second load balancing node after being sent by the first load balancing node to the second load balancing node, The second load balancing node and the service node belong to the same data center, and the second load balancing node and the first load balancing node belong to different data centers.
  17. 一种负载均衡装置,其特征在于,所述装置包括:A load balancing device, characterized in that the device comprises:
    服务节点确定模块,用于响应于客户端的资源请求,确定第一服务节点,所述资源请求用于获取目标资源;A service node determination module, configured to determine a first service node in response to a resource request from a client, where the resource request is used to obtain a target resource;
    连接协议信息转移模块,用于向所述第一服务节点发送所述资源请求、所述第一负载均衡节点与所述客户端之间的连接协议信息,所述连接协议信息包括所采用的网络协议、所述客户端的地址信息和所述第一负载均衡节点的地址信息,所述连接协议信息用于服务节点向所述客户端发送所述资源请求的响应报文,以将所述目标资源传输给所述客户端,所述响应报文的源地址信息为所述第一负载均衡节点的地址信息。A connection protocol information transfer module, configured to send the resource request, connection protocol information between the first load balancing node and the client to the first service node, and the connection protocol information includes the adopted network Protocol, the address information of the client and the address information of the first load balancing node, the connection protocol information is used for the service node to send the response message of the resource request to the client, so that the target resource For transmission to the client, the source address information of the response message is the address information of the first load balancing node.
  18. 根据权利要求17所述的装置,其特征在于,所述连接协议信息转移模块,用于:The device according to claim 17, wherein the connection protocol information transfer module is configured to:
    向所述第一服务节点发送所述资源请求;sending the resource request to the first serving node;
    向所述第一服务节点发送目标报文,所述目标报文携带所述连接协议信息,所述目标报文所采用的网络协议和所述第一负载均衡节点与服务节点之间建立连接所采用的网络协议为同一网络协议。Sending a target message to the first service node, the target message carrying the connection protocol information, the network protocol used by the target message and the information required for establishing a connection between the first load balancing node and the service node. The network protocol adopted is the same network protocol.
  19. 一种数据处理装置,其特征在于,所述装置包括:A data processing device, characterized in that the device comprises:
    信息接收模块,用于接收客户端的资源请求、第一负载均衡节点与所述客户端之间的连接协议信息,所述连接协议信息包括所采用的网络协议、所述客户端的地址信息和所述第一负载均衡节点的地址信息,所述资源请求用于获取目标资源;An information receiving module, configured to receive a resource request from a client, connection protocol information between the first load balancing node and the client, the connection protocol information includes the adopted network protocol, the address information of the client, and the address information of the first load balancing node, and the resource request is used to obtain the target resource;
    响应报文发送模块,用于响应于所述资源请求,基于所述连接协议信息,向所述客户端发送所述资源请求的响应报文,以将所述目标资源传输给所述客户端,所述响应报文的源地址信息为所述第一负载均衡节点的地址信息。a response message sending module, configured to send a response message of the resource request to the client based on the connection protocol information in response to the resource request, so as to transmit the target resource to the client, The source address information of the response message is the address information of the first load balancing node.
  20. 根据权利要求19所述的装置,其特征在于,所述响应报文发送模块,用于:The device according to claim 19, wherein the response message sending module is configured to:
    响应于所述资源请求,基于所述连接协议信息,以所述第一负载均衡节点的地址信息为源地址信息,以所述客户端的地址信息为目的地址信息,向所述客户端发送所述资源请求的响应报文。In response to the resource request, based on the connection protocol information, using the address information of the first load balancing node as source address information and using the address information of the client as destination address information, sending the Response message for resource request.
  21. 一种负载均衡节点,其特征在于,所述负载均衡节点包括处理器和存储器,所述存储器用于存储至少一段程序代码,所述至少一段程序代码由所述处理器加载并执行如权利要求1至权利要求9中任一项所述的负载均衡方法。A load balancing node, characterized in that the load balancing node includes a processor and a memory, the memory is used to store at least one piece of program code, and the at least one piece of program code is loaded and executed by the processor according to claim 1 To the load balancing method described in any one of claim 9.
  22. 一种服务节点,其特征在于,所述服务节点包括处理器和存储器,所述存储器用于存储至少一段程序代码,所述至少一段程序代码由所述处理器加载并执行如权利要求10至权利要求16中任一项所述的负载均衡方法。A service node, characterized in that the service node includes a processor and a memory, the memory is used to store at least one piece of program code, and the at least one piece of program code is loaded and executed by the processor. The load balancing method described in any one of claim 16.
  23. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质用于存储至少一段程序代码,所述至少一段程序代码用于执行如权利要求1至权利要求9中任一项所述的负载均衡方法,或执行如权利要求10至权利要求16中任一项所述的负载均衡方法。A computer-readable storage medium, characterized in that the computer-readable storage medium is used to store at least one piece of program code, and the at least one piece of program code is used to execute any one of claims 1 to 9. load balancing method, or execute the load balancing method according to any one of claim 10 to claim 16.
  24. 一种计算机程序产品,其特征在于,所述计算机程序产品包括计算机程序代码,当所述计算机程序代码被网络设备执行时,所述网络设备执行如权利要求1至权利要求9中任一项所述的负载均衡方法,或执行如权利要求10至权利要求16中任一项所述的负载均衡方法。A computer program product, characterized in that the computer program product includes computer program code, and when the computer program code is executed by a network device, the network device executes any one of claims 1 to 9 The above load balancing method, or execute the load balancing method according to any one of claims 10 to 16.
PCT/CN2022/116443 2022-02-10 2022-09-01 Load balancing method and apparatus, node, and storage medium WO2023151264A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202210124714.8 2022-02-10
CN202210124714.8A CN116633934A (en) 2022-02-10 2022-02-10 Load balancing method, device, node and storage medium

Publications (1)

Publication Number Publication Date
WO2023151264A1 true WO2023151264A1 (en) 2023-08-17

Family

ID=87563523

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/116443 WO2023151264A1 (en) 2022-02-10 2022-09-01 Load balancing method and apparatus, node, and storage medium

Country Status (2)

Country Link
CN (1) CN116633934A (en)
WO (1) WO2023151264A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117376662A (en) * 2023-12-08 2024-01-09 杭州领信数科信息技术有限公司 Cluster type video safety boundary exchange method and device

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116975158B (en) * 2023-09-25 2024-01-26 腾讯科技(深圳)有限公司 Request processing method, apparatus, computer device and storage medium
CN117240787B (en) * 2023-11-14 2024-03-01 鹏城实验室 Switch load balancing method and device, electronic equipment and readable storage medium

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6249801B1 (en) * 1998-07-15 2001-06-19 Radware Ltd. Load balancing
US20030195919A1 (en) * 2002-03-26 2003-10-16 Tatsuya Watanuki Packet distributing system and method for distributing access packets to a plurality of server apparatuses
CN102752188A (en) * 2011-04-21 2012-10-24 北京邮电大学 Transmission control protocol connection migratory method and system
CN103220354A (en) * 2013-04-18 2013-07-24 广东宜通世纪科技股份有限公司 Method for achieving load balancing of server cluster
CN106302225A (en) * 2016-10-18 2017-01-04 上海优刻得信息科技有限公司 A kind of method and apparatus of server load balancing
CN106686085A (en) * 2016-12-29 2017-05-17 华为技术有限公司 Load balancing method, apparatus and system
CN113067824A (en) * 2021-03-22 2021-07-02 平安科技(深圳)有限公司 Data scheduling method, system, virtual host and computer readable storage medium

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6249801B1 (en) * 1998-07-15 2001-06-19 Radware Ltd. Load balancing
US20030195919A1 (en) * 2002-03-26 2003-10-16 Tatsuya Watanuki Packet distributing system and method for distributing access packets to a plurality of server apparatuses
CN102752188A (en) * 2011-04-21 2012-10-24 北京邮电大学 Transmission control protocol connection migratory method and system
CN103220354A (en) * 2013-04-18 2013-07-24 广东宜通世纪科技股份有限公司 Method for achieving load balancing of server cluster
CN106302225A (en) * 2016-10-18 2017-01-04 上海优刻得信息科技有限公司 A kind of method and apparatus of server load balancing
CN106686085A (en) * 2016-12-29 2017-05-17 华为技术有限公司 Load balancing method, apparatus and system
CN113067824A (en) * 2021-03-22 2021-07-02 平安科技(深圳)有限公司 Data scheduling method, system, virtual host and computer readable storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117376662A (en) * 2023-12-08 2024-01-09 杭州领信数科信息技术有限公司 Cluster type video safety boundary exchange method and device
CN117376662B (en) * 2023-12-08 2024-02-09 杭州领信数科信息技术有限公司 Cluster type video safety boundary exchange method and device

Also Published As

Publication number Publication date
CN116633934A (en) 2023-08-22

Similar Documents

Publication Publication Date Title
KR102514250B1 (en) Method, Apparatus and System for Selecting a Mobile Edge Computing Node
US11122027B2 (en) End-to-end M2M service layer sessions
CN110198363B (en) Method, device and system for selecting mobile edge computing node
US10694005B2 (en) Hardware-based packet forwarding for the transport layer
WO2023151264A1 (en) Load balancing method and apparatus, node, and storage medium
US7774492B2 (en) System, method and computer program product to maximize server throughput while avoiding server overload by controlling the rate of establishing server-side net work connections
US9058213B2 (en) Cloud-based mainframe integration system and method
EP3142306B1 (en) Openflow communication method, system, controller, and service gateway
EP3735768B1 (en) Improving qoe for video and web services using cross-layer information
EP3800867B1 (en) Load balancing method and device
CN112751898B (en) Load balancing method, device, medium and equipment
CN110875799A (en) Transmission control method and device
EP3588906B1 (en) Multi-path management with http/2
CN112631788A (en) Data transmission method and data transmission server
WO2016180188A1 (en) Distributed link establishment method, apparatus and system
CN112968965B (en) Metadata service method, server and storage medium for NFV network node
JP7076558B2 (en) GTP tunnel for anchorless backhaul support
EP4224750A1 (en) Method and apparatus for sending computing routing information, device, and storage medium
US11979457B2 (en) Managing network services using multipath protocols
WO2021068937A1 (en) Service binding method and apparatus
US20080298366A1 (en) Agnostic Network Architecture
US11570257B1 (en) Communication protocol, and a method thereof for accelerating artificial intelligence processing tasks
WO2023056873A1 (en) Data request method, communication apparatus, and communication system
WO2021254001A1 (en) Session establishment method, apparatus and system and computer storage medium
Duchêne Helping the Internet scale by leveraging path diversity

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22925623

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE