Load balancing method and device for SIP protocol
By obtaining SIP protocol messages in the load balancing device, matching session table entries, counting traffic counts, and using the minimum traffic scheduling algorithm to determine the target server, the problems of uneven traffic distribution and high equipment pressure in audio and video traffic scheduling are solved, and efficient load balancing is achieved.
Patent Information
- Application Number
- CN202411486454.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-23
- Publication Date
- 2025-02-25
AI Technical Summary
The prior art has problems of uneven traffic distribution and high pressure on load balancing equipment in audio and video traffic scheduling, especially in video surveillance systems, resulting in equipment overload and low load balancing efficiency.
The load balancing device obtains messages based on SIP protocol, matches session table entries, counts server traffic counts, uses the minimum traffic scheduling algorithm to determine the target server, establishes a new session table entries, and uses this table entries to perform traffic counting to achieve load balancing.
It realizes intelligent scheduling of audio and video traffic, reduces the pressure of load balancing equipment, ensures uniform distribution of traffic, avoids equipment overload, and improves load balancing efficiency.
Smart Images

Figure CN119520527A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer information processing, and in particular to a load balancing method and device for a SIP protocol. Background Art
[0002] With the rapid increase in network bandwidth, computer processing power and storage capacity, video information processing technology has gradually achieved full digitization and networking, and the advantages of video surveillance systems have become increasingly obvious. In this context, the SIP protocol, as a multimedia communication protocol, has been widely used, especially in the field of video transmission. However, with the widespread deployment of video surveillance systems, audio and video traffic has increased dramatically, which has brought tremendous pressure to load balancing devices. In order to alleviate this pressure, it is necessary to properly process the SIP INVITE / SDP message to ensure that the SIP control message is forwarded through the load balancing device, while the audio and video streams do not pass through the device, thereby optimizing the load distribution of the device.
[0003] Currently, the commonly used traffic scheduling methods mainly include polling algorithm and minimum flow scheduling algorithm, but these solutions have their own limitations:
[0004] Polling algorithm: During the load distribution process, the polling algorithm evenly distributes traffic. However, if a server fails and is reactivated, the traffic of the server cannot be balanced with other servers, resulting in long-term uneven traffic distribution.
[0005] Minimum flow scheduling algorithm: is an algorithm for allocating network traffic, especially suitable for load balancing scenarios. In audio and video traffic scheduling, its main goal is to allocate traffic to the server with the smallest current load to ensure efficient use of system resources and balanced traffic distribution. However, since audio and video streams do not pass through the load balancing device, the device cannot obtain the actual traffic statistics of each server, resulting in the algorithm cannot be effectively applied in this scenario.
[0006] Therefore, the limitations of existing technologies in audio and video traffic scheduling are highlighted, and a new method is urgently needed to effectively achieve uniform distribution of traffic and reduce the pressure on load balancing equipment.
[0007] The above information disclosed in the Background section is only for enhancement of understanding of the background of the present application and therefore it may contain information that does not constitute the prior art that is already known to a person of ordinary skill in the art. Summary of the invention
[0008] In view of this, the present application provides a load balancing method and device for the SIP protocol, which can intelligently schedule audio and video traffic, reduce the pressure on load balancing equipment, and ensure uniform distribution of traffic, avoid equipment overload, and improve load balancing efficiency.
[0009] Other features and advantages of the present application will become apparent from the following detailed description, or may be learned in part by the practice of the present application.
[0010] According to one aspect of the present application, a load balancing method for a SIP protocol is proposed, the method comprising: a load balancing device obtains a message based on the SIP protocol; matches a session table entry according to an identifier and five-tuple information of the message; when no session table entry is matched, counting the flow counts of each server; determining a target server according to the flow count and a minimum flow scheduling algorithm; establishing a new session table entry based on the target server; and performing flow counting according to the session table entry to perform load balancing.
[0011] In an exemplary embodiment of the present application, before the load balancing device obtains a message based on the SIP protocol, it also includes: the load balancing device obtains message data; matches a session table entry according to an identifier of the message data; when matching the session table entry, determining that the message data is a message based on the SIP protocol.
[0012] In an exemplary embodiment of the present application, it further includes: when a session table entry is matched, determining the type of the message; processing the message according to the type, and updating the aging time corresponding to the message.
[0013] In an exemplary embodiment of the present application, message processing is performed according to the type, and the aging time corresponding to the message is updated, including: the load balancing device processes the message according to the type; and updates the aging time in the session table entry corresponding to the message.
[0014] In an exemplary embodiment of the present application, the aging time in the session table entry corresponding to the message is updated, including: when the message is an INVITE message, setting the aging time in the session table entry according to a preset field in the message; when the message is a BYE message, setting the aging time in the session table entry to 0, and deleting the session table entry.
[0015] In an exemplary embodiment of the present application, determining the target server according to the traffic count and the minimum traffic scheduling algorithm includes: extracting a server corresponding to the minimum value in the traffic count as the target server.
[0016] In an exemplary embodiment of the present application, establishing a new session entry based on the target server includes: associating the identifier and five-tuple information of the message with the target server, and establishing the session entry.
[0017] In an exemplary embodiment of the present application, traffic counting is performed according to the session table entry for load balancing, including: the load balancing device does not modify the SDP protocol field in the message so that the audio message is not transmitted through the load balancing device; the load balancing device performs traffic counting of the server through the session table entry to perform load balancing.
[0018] In an exemplary embodiment of the present application, traffic counting is performed according to the session table entry to perform load balancing, and further includes: when the aging time in the session table entry is reached, deleting the session table entry and reducing the traffic count of the server corresponding to the session table entry.
[0019] According to one aspect of the present application, a load balancing device for a SIP protocol is provided, the device comprising: a message module, used for a load balancing device to obtain a message based on the SIP protocol; a matching module, used for matching a session table item according to an identifier and five-tuple information of the message; a statistical module, used for counting the flow counts of each server when no session table item is matched; an algorithm module, used for determining a target server according to the flow count and a minimum flow scheduling algorithm; a session module, used for establishing a new session table item based on the target server; and a flow module, used for counting the flow count according to the session table item to perform load balancing.
[0020] According to one aspect of the present application, an electronic device is proposed, which includes: one or more processors; a storage device for storing one or more programs; when the one or more programs are executed by the one or more processors, the one or more processors implement the method as described above.
[0021] According to one aspect of the present application, a computer-readable medium is provided, on which a computer program is stored. When the program is executed by a processor, the method described above is implemented.
[0022] According to the load balancing method and device for the SIP protocol of the present application, a message based on the SIP protocol is obtained through a load balancing device; a session table item is matched according to an identifier and five-tuple information of the message; when no session table item is matched, the flow count of each server is counted; a target server is determined according to the flow count and a minimum flow scheduling algorithm; a new session table item is established based on the target server; and a method of performing load balancing by performing flow counting according to the session table item can intelligently schedule audio and video flow, reduce the pressure of the load balancing device, ensure uniform distribution of flow, avoid device overload, and improve load balancing efficiency.
[0023] It should be understood that the foregoing general description and the following detailed description are exemplary only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] The above and other objects, features and advantages of the present application will become more apparent by describing in detail the exemplary embodiments thereof with reference to the accompanying drawings. The accompanying drawings described below are only some embodiments of the present application, and it is clear to a person skilled in the art that other accompanying drawings can be obtained from these accompanying drawings without creative effort.
[0025] Figure 1 The present invention is a flow chart showing a load balancing method for SIP protocol according to an exemplary embodiment.
[0026] Figure 2 The present invention is a flow chart showing a load balancing method for SIP protocol according to another exemplary embodiment.
[0027] Figure 3 It is a schematic diagram showing a load balancing method for SIP protocol according to another exemplary embodiment.
[0028] Figure 4 The present invention is a flow chart showing a load balancing method for SIP protocol according to another exemplary embodiment.
[0029] Figure 5 It is a block diagram showing a load balancing device for SIP protocol according to an exemplary embodiment.
[0030] Figure 6 It is a block diagram of an electronic device according to an exemplary embodiment.
[0031] Figure 7 It is a block diagram of a computer-readable medium according to an exemplary embodiment. DETAILED DESCRIPTION
[0032] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in many forms and should not be construed as limited to the embodiments set forth herein; rather, these embodiments are provided so that this application will be comprehensive and complete and will fully convey the concepts of the example embodiments to those skilled in the art. The same reference numerals in the figures represent the same or similar parts, and thus their repeated description will be omitted.
[0033] In addition, described feature, structure or characteristic can be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present application. However, those skilled in the art will appreciate that the technical scheme of the present application can be put into practice without one or more of the specific details, or other methods, components, devices, steps, etc. can be adopted. In other cases, known methods, devices, realizations or operations are not shown or described in detail to avoid blurring the various aspects of the application.
[0034] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities may be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.
[0035] The flowcharts shown in the accompanying drawings are only exemplary and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps can be decomposed, and some operations / steps can be combined or partially combined, so the actual execution order may change according to actual conditions.
[0036] It should be understood that although the terms first, second, third, etc. may be used herein to describe various components, these components should not be limited by these terms. These terms are used to distinguish one component from another component. Therefore, the first component discussed below can be referred to as the second component without departing from the teachings of the concepts of the present application. As used herein, the term "and / or" includes any one of the associated listed items and all combinations of one or more.
[0037] Those skilled in the art will appreciate that the drawings are merely schematic diagrams of example embodiments, and the modules or processes in the drawings are not necessarily necessary for implementing the present application, and therefore cannot be used to limit the scope of protection of the present application.
[0038] The technical abbreviations involved in this application are explained as follows:
[0039] SIP (Session Initiation Protocol) is a multimedia communication protocol developed by IETF (Internet Engineering Task Force). It is a text-based application layer control protocol used to create, modify, and release sessions of one or more participants. SIP is an IP voice session control protocol derived from the Internet, which is flexible, easy to implement, and easy to expand. SIP is currently used in the field of video surveillance.
[0040] SDP (Session Description Protocol) is a session description format. It is not a transport protocol. It only uses different appropriate transport protocols, including Session Announcement Protocol (SAP), Session Initiation Protocol (SIP), Real Time Streaming Protocol (RTSP), MIME extension protocol email, and Hypertext Transfer Protocol (HTTP). SDP is also a text-based protocol, which ensures that the protocol is highly scalable, giving it a wide range of applications. SDP does not support negotiation of session content or media encoding, so it is only used to describe media information in streaming media.
[0041] Figure 1 The flowchart of a load balancing method for SIP protocol according to an exemplary embodiment is shown. The load balancing method 10 for SIP protocol at least includes steps S102 to S112.
[0042] like Figure 1 As shown, in S102, the load balancing device obtains a message based on the SIP protocol.
[0043] In one embodiment, before the load balancing device obtains a message based on the SIP protocol, it also includes: the load balancing device obtains message data; matches the session table entry according to the identifier of the message data; when the session table entry is matched, it is determined that the message data is a message based on the SIP protocol. Before obtaining the SIP protocol message, the load balancing device first obtains a network traffic packet containing the message data. According to the identifier of the message (such as Call-ID), it matches the existing session table entry. If the match is successful, it is identified that the message is a SIP protocol message.
[0044] In S104, the session table entry is matched according to the identifier and the five-tuple information of the message. The load balancing device searches for matching records in the existing session table entry according to the identifier (such as Call-ID) of the message and the five-tuple information (source IP, destination IP, source port, destination port, protocol type). The five-tuple provides unique message source and destination information.
[0045] In S106, when no session entry is matched, the traffic counts of each server are counted. The device cannot find the session corresponding to this message. Therefore, the load balancing device needs to re-determine which server to process this new session.
[0046] At this time, the device will count the traffic count of each server, that is, the number of sessions or data traffic currently processed by each server. This provides a basis for subsequent server selection.
[0047] In one embodiment, when a session entry is matched, the type of the message is determined; the message is processed according to the type, and the aging time corresponding to the message is updated.
[0048] More specifically, the load balancing device processes the message according to the type; when the message is an INVITE message, the aging time in the session table entry is set according to a preset field in the message; when the message is a BYE message, the aging time in the session table entry is set to 0, and the session table entry is deleted.
[0049] If an existing session entry is matched, the device will process it differently based on the type of message (such as INVITE or BYE). For an INVITE message, the device will set the aging time of the session entry, while for a BYE message, the device will set the aging time to 0, delete the session entry, and end the session.
[0050] In S108, the target server is determined according to the traffic count and the minimum traffic scheduling algorithm. The server corresponding to the minimum value in the traffic count can be extracted as the target server. According to the traffic count counted in the previous step, the device uses the minimum traffic scheduling algorithm to select the server with the lightest current load as the target server.
[0051] The device extracts the smallest value in the traffic count and determines the server corresponding to the smallest value as the target server. This ensures that new sessions are assigned to the server with the smallest processing load.
[0052] In S110, a new session table entry is established based on the target server. For example, the identifier and five-tuple information of the message are associated with the target server, and the session table entry is established. After determining the target server, the load balancing device will create a corresponding session table entry for the new session.
[0053] The content of the session table entry includes the identifier (Call-ID) and five-tuple information of the message, and associates it with the target server. In this way, when subsequent messages arrive, the device can quickly identify and dispatch them to the correct server for processing.
[0054] In S112, traffic counting is performed according to the session table entry to perform load balancing.
[0055] After the new session table entry is created, the load balancing device will count the traffic based on the entry. This means that the device will track all message traffic of the session and distribute the traffic evenly to each server.
[0056] The load balancing device will continuously adjust according to the traffic count of each server to ensure that the load of each server is within a reasonable range and there will be no server overload or resource waste.
[0057] According to the load balancing method for the SIP protocol of the present application, a message based on the SIP protocol is obtained through a load balancing device; a session table item is matched according to an identifier and five-tuple information of the message; when no session table item is matched, the flow count of each server is counted; a target server is determined according to the flow count and a minimum flow scheduling algorithm; a new session table item is established based on the target server; and a method of performing load balancing by performing flow counting according to the session table item can intelligently schedule audio and video flow, reduce the pressure of the load balancing device, ensure uniform distribution of flow, avoid device overload, and improve load balancing efficiency.
[0058] It should be clearly understood that the present application describes how to form and use specific examples, but the principles of the present application are not limited to any details of these examples. On the contrary, based on the teaching of the content disclosed in the present application, these principles can be applied to many other embodiments.
[0059] Figure 2 The present invention is a flow chart showing a load balancing method for SIP protocol according to another exemplary embodiment. Figure 2 The process 20 shown is for Figure 1 A detailed description of S112 “performing traffic counting according to the session table entry to perform load balancing” in the process shown.
[0060] like Figure 2 As shown, in S202, the load balancing device does not modify the SDP protocol field in the message, so that the audio message is not transmitted through the load balancing device.
[0061] The format of the SDP protocol consists of a series of lines, each of which starts with a letter indicating the type of the line. The SDP protocol defines some standard line types, including v, o, s, c, t, m, etc. The following is an example of the SDP protocol format:
[0062] v=0
[0063] o=-123456 7890IN IP4 192.168.1.1
[0064] s=My Session
[0065] c=IN IP4 192.168.1.1
[0066] t=0 0
[0067] m=audio 5004RTP / AVP 0 8 18
[0068] Among them, v represents the protocol version, o represents the initiator of the session and the session ID, s represents the session name, c represents the connection information, t represents the start and end time of the session, and m represents the media information.
[0069] In traditional SIP seven-layer load balancing scheduling, in order to allow the response message to return to the load balancing device, the network layer IP and application layer IP of the request message will be modified when it passes through the device, so the subsequent media stream will also pass through the load balancing device. If the traffic is too large, it will cause pressure on the device.
[0070] like Figure 3 As shown in the timing diagram of the SIP message passing through the load balancing device, when the SIP negotiation message in this application passes through the device, the C field IP in the message is not modified, so that the media traffic does not pass through the load balancing device and is directly returned to the requester.
[0071] In S204, the load balancing device counts the traffic of the server through the session table entry to perform load balancing.
[0072] In S206, when the aging time in the session entry is reached, the session entry is deleted, and the flow count of the server corresponding to the session entry is reduced.
[0073] In a specific embodiment, a complete 200 OK message is as follows:
[0074] SIP / 2.0 200OK
[0075] Via:SIP / 2.0 / UDP 10.64.49.44:7100; rport=7100; branch=z9hG4bK2438925454
[0076] From:<sip:130909115229300920@10.64.49.44:7100> ;tag=1622357887
[0077] To:<sip:33010602001310019179@10.64.49.218:7100> ;tag=1871358434
[0078] Cal1-ID:3069339122
[0079] CSeg:20INVITE
[0080] Contact:<sip:130909113319427420@10.64.49.218:7100> Content-Type:Application / SDP
[0081] User-Agent:Hikvision
[0082] Content-Length:184
[0083] v=0
[0084] o=3301060200131001917900IN IP4 10.64.49.44
[0085] s=Playback
[0086] c=IN IP4 10.64.49.218t=13787928001378797137
[0087] m=video 5518RTP / AVP 96
[0088] a=rtpmap:96PS / 90000
[0089] a=sendonly
[0090] y=1060205518
[0091] The t=1378792800 1378797137 in the message indicates the start time and end time, which is the NTP time in seconds. When the end time is 0, it means there is no limit. You can use this time to set the SIP connection duration.
[0092] CSeq is used to identify the sequence numbers of different transactions in the same session. It consists of an integer used as a sequence number and the message type. The last string in CSeq can be used to determine whether it is an invite or bye status code.
[0093] When receiving a message, the load balancing device first extracts the Call-ID in the message to determine whether the message is a SIP message and enters the device's SIP-UDP processing flow. The device matches the existing session table entries based on the Call-ID and the five-tuple information. If no session table entry is hit, the device compares the traffic counts of each real server and selects the server with the smallest current count. Subsequently, the device creates a new session table entry based on the Call-ID and the five-tuple, and increases the traffic count of the corresponding server by 1.
[0094] If an existing session entry is matched, the device will further determine the type of the SIP message (such as INVITE or BYE), and perform corresponding processing according to different types of messages, while updating the aging time of the session entry.
[0095] Figure 4 The present invention is a flow chart showing a load balancing method for SIP protocol according to another exemplary embodiment. Figure 4 The process 40 shown is for Figure 1 Detailed description of the process shown.
[0096] like Figure 4 As shown, in S402, a message is received.
[0097] In S404, the session table entry is matched.
[0098] In S406, it is determined whether a table entry is hit.
[0099] In S408, the minimum traffic scheduling algorithm determines the target server.
[0100] In S410, a new session entry is created.
[0101] In S412, the target server traffic count is increased by 1. The traffic count indicates the number of connections of the current server. When the session entry node reaches the aging time and deletes the session entry, the traffic count of the corresponding server is decreased by 1.
[0102] In S414, the message type is identified. When a 200 OK (invite) message is received, the duration of the SIP session is recorded through the t field in the message, and if there is no limit, it is set as the default maximum duration of the SIP session table entry (which can be freely set).
[0103] When a 200 ok (bye) message is received, it indicates that the session has ended. The aging time of the session entry is set to 0, indicating immediate deletion.
[0104] In S416, the network layer IP and application layer IP of the message are modified according to the session entry.
[0105] In S418, the message is forwarded.
[0106] According to the load balancing method for the SIP protocol of the present application, the actual transmission address of the audio and video stream is controlled by the IP and port in the SDP protocol. These fields in the SDP determine the destination of the audio and video stream without passing through the load balancing device. When matching the session table entries, the Call-ID in the SIP protocol is used to distinguish different sessions. Each SIP session has a unique Call-ID to ensure that each service can be processed and scheduled independently.
[0107] According to the load balancing method for the SIP protocol of the present application, by identifying the SIP protocol message and the session duration field in the SDP, the device can flexibly set or change the aging time of the session table entry, thereby accurately controlling the duration of the session. By counting the flow count of the real service in each session, the load balancing device can perform scheduling according to the load of the server to ensure that the audio and video flow is evenly distributed among multiple servers, thereby achieving efficient load balancing.
[0108] Those skilled in the art will appreciate that all or part of the steps for implementing the above embodiments are implemented as a computer program executed by a CPU. When the computer program is executed by the CPU, the above functions defined by the above method provided in the present application are executed. The program may be stored in a computer-readable storage medium, which may be a read-only memory, a disk, or an optical disk, etc.
[0109] In addition, it should be noted that the above figures are only schematic illustrations of the processes included in the method according to the exemplary embodiments of the present application, and are not intended to be limiting. It is easy to understand that the processes shown in the above figures do not indicate or limit the time sequence of these processes. In addition, it is also easy to understand that these processes can be performed synchronously or asynchronously, for example, in multiple modules.
[0110] The following is an embodiment of the device of the present application, which can be used to execute the embodiment of the method of the present application. For details not disclosed in the embodiment of the device of the present application, please refer to the embodiment of the method of the present application.
[0111] Figure 5 FIG. 1 is a block diagram of a load balancing device for SIP protocol according to an exemplary embodiment. Figure 5 As shown, the load balancing device 50 for the SIP protocol includes: a message module 502 , a matching module 504 , a statistics module 506 , an algorithm module 508 , a session module 510 , and a traffic module 512 .
[0112] The message module 502 is used for the load balancing device to obtain messages based on the SIP protocol;
[0113] The matching module 504 is used to match the session table entry according to the identifier and the five-tuple information of the message;
[0114] The statistics module 506 is used to count the traffic counts of each server when no session entry is matched;
[0115] The algorithm module 508 is used to determine the target server according to the traffic count and the minimum traffic scheduling algorithm; the algorithm module 508 is also used to extract the server corresponding to the minimum value in the traffic count as the target server.
[0116] The session module 510 is used to establish a new session table entry based on the target server; the session module 510 is also used to associate the identifier and five-tuple information of the message with the target server and establish the session table entry.
[0117] The traffic module 512 is used to count traffic according to the session table entry to perform load balancing.
[0118] According to the load balancing device for SIP protocol of the present application, a message based on SIP protocol is obtained through a load balancing device; a session table item is matched according to an identifier and five-tuple information of the message; when a session table item is not matched, the flow count of each server is counted; a target server is determined according to the flow count and a minimum flow scheduling algorithm; a new session table item is established based on the target server; and a method of performing load balancing by performing flow counting according to the session table item can intelligently schedule audio and video flow, reduce the pressure of the load balancing device, ensure uniform distribution of flow, avoid device overload, and improve load balancing efficiency.
[0119] Figure 6 It is a block diagram of an electronic device according to an exemplary embodiment.
[0120] Refer to the following Figure 6 The electronic device 600 according to this embodiment of the present application is described. Figure 6 The electronic device 600 shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0121] like Figure 6 As shown, the electronic device 600 is in the form of a general computing device. The components of the electronic device 600 may include, but are not limited to: at least one processing unit 610, at least one storage unit 620, a bus 630 connecting different system components (including the storage unit 620 and the processing unit 610), a display unit 640, etc.
[0122] The storage unit stores a program code, which can be executed by the processing unit 610, so that the processing unit 610 performs the steps described in this specification according to various exemplary embodiments of the present application. For example, the processing unit 610 can perform the following steps: Figure 1 , Figure 2 , Figure 4 Follow the steps shown in .
[0123] The storage unit 620 may include a readable medium in the form of a volatile storage unit, such as a random access memory unit (RAM) 6201 and / or a cache memory unit 6202 , and may further include a read-only memory unit (ROM) 6203 .
[0124] The storage unit 620 may also include a program / utility 6204 having a set (at least one) of program modules 6205, such program modules 6205 including but not limited to: an operating system, one or more application programs, other program modules and program data, each of which or some combination may include the implementation of a network environment.
[0125] Bus 630 may represent one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.
[0126] The electronic device 600 may also communicate with one or more external devices 600' (e.g., keyboards, pointing devices, Bluetooth devices, etc.) to enable a user to communicate with the electronic device 600, and / or any device (e.g., routers, modems, etc.) that the electronic device 600 can communicate with one or more other computing devices. Such communication may be performed via an input / output (I / O) interface 650. In addition, the electronic device 600 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) via a network adapter 660. The network adapter 660 may communicate with other modules of the electronic device 600 via a bus 630. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 600, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0127] Through the above description of the implementation, it is easy for those skilled in the art to understand that the example implementation described here can be implemented by software, or by combining software with necessary hardware. Figure 7 As shown, the technical solution according to the implementation mode of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, and includes a number of instructions to enable a computing device (which can be a personal computer, a server, or a network device, etc.) to execute the above method according to the implementation mode of the present application.
[0128] The software product may be any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, a system, device or component of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination thereof. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof.
[0129] The computer readable storage medium may include a data signal propagated in a baseband or as part of a carrier wave, wherein a readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. The readable storage medium may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by an instruction execution system, an apparatus, or a device or used in combination with it. The program code contained on the readable storage medium may be transmitted with any appropriate medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination of the above.
[0130] Program code for performing the operations of the present application may be written in any combination of one or more programming languages, including object-oriented programming languages such as Java, C++, etc., and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., using an Internet service provider to connect through the Internet).
[0131] The computer-readable medium carries one or more programs. When the one or more programs are executed by a device, the computer-readable medium implements the following functions: the load balancing device obtains a message based on the SIP protocol; matches a session table item according to an identifier and five-tuple information of the message; when no session table item is matched, counts the flow count of each server; determines a target server according to the flow count and a minimum flow scheduling algorithm; establishes a new session table item based on the target server; and counts the flow according to the session table item to perform load balancing.
[0132] Those skilled in the art will appreciate that the above modules can be distributed in the device according to the description of the embodiment, or can be changed accordingly and only used in one or more devices different from the embodiment. The modules of the above embodiments can be combined into one module, or further divided into multiple sub-modules.
[0133] Through the description of the above embodiments, it is easy for those skilled in the art to understand that the example embodiments described here can be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to the embodiment of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, including several instructions to enable a computing device (which can be a personal computer, a server, a mobile terminal, or a network device, etc.) to execute the method according to the embodiment of the present application.
[0134] The exemplary embodiments of the present application are specifically shown and described above. It should be understood that the present application is not limited to the detailed structures, configurations or implementations described herein; on the contrary, the present application is intended to cover various modifications and equivalent configurations included in the spirit and scope of the appended claims.
Claims
1. A load balancing method for SIP protocol, characterized in that: include: The load balancing device obtains messages based on the SIP protocol; Matching a session table entry according to the identifier and quintuple information of the message; When no session entry is matched, the traffic count of each server is counted; Determine the target server according to the traffic count and the minimum traffic scheduling algorithm; Establishing a new session table entry based on the target server; Traffic counting is performed according to the session table entry to perform load balancing.
2. The method according to claim 1, characterized in that Before the load balancing device obtains the SIP protocol-based message, it also includes: The load balancing device obtains the message data; Matching a session table entry according to an identifier of the message data; When a session entry is matched, it is determined that the message data is a message based on the SIP protocol.
3. The method according to claim 1, characterized in that Also includes: When a session entry is matched, determining the type of the message; The message is processed according to the type, and the aging time corresponding to the message is updated.
4. The method according to claim 3, characterized in that Processing the message according to the type and updating the aging time corresponding to the message includes: The load balancing device processes the message according to the type; Update the aging time in the session table entry corresponding to the message.
5. The method according to claim 4, characterized in that Updating the aging time in the session table entry corresponding to the message includes: When the message is an INVITE message, setting an aging time in the session table entry according to a preset field in the message; When the message is a BYE message, the aging time in the session table entry is set to 0, and the session table entry is deleted.
6. The method according to claim 1, characterized in that Determining a target server according to the traffic count and the minimum traffic scheduling algorithm includes: A server corresponding to the minimum value in the traffic count is extracted as the target server.
7. The method according to claim 1, characterized in that Establishing a new session table entry based on the target server includes: The identifier and five-tuple information of the message are associated with the target server, and the session table entry is established.
8. The method according to claim 1, characterized in that Traffic counting is performed according to the session table entry to perform load balancing, including: The load balancing device does not modify the SDP protocol field in the message, so that the audio message is not transmitted through the load balancing device; The load balancing device counts the traffic of the server through the session table entry to perform load balancing.
9. The method according to claim 1, characterized in that Counting traffic according to the session table entry to perform load balancing also includes: When the aging time in the session table entry is reached, the session table entry is deleted, and the flow count of the server corresponding to the session table entry is reduced.
10. A load balancing device for SIP protocol, characterized in that: include: Message module, used for load balancing equipment to obtain messages based on the SIP protocol; A matching module, used for matching a session entry according to an identifier and five-tuple information of the message; The statistics module is used to count the traffic of each server when no session entry is matched; An algorithm module, used for determining a target server according to the traffic count and the minimum traffic scheduling algorithm; A session module, used for establishing a new session entry based on the target server; The flow module is used to count the flow according to the session table entry to perform load balancing.