Streaming media server determination method and device, server, platform and medium
By calculating the stream load and preset constraints of the streaming media server, the most suitable server is selected for data stream access, which solves the problem of load imbalance on the streaming media server and achieves load balancing and performance optimization of each server.
Patent Information
- Application Number
- CN202411161885.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-22
- Publication Date
- 2024-10-11
- Estimated Expiration
- 2044-08-22
AI Technical Summary
There is a problem of load imbalance when selecting existing streaming media servers, which makes it impossible to ensure that the server selected each time has sufficient margin and load balance.
By obtaining the performance data of each streaming media server, calculating its streaming load, and selecting the lowest server that meets the constraint conditions as the target streaming media server based on the streaming load and preset constraints, it is ensured that the performance of the server accessed by the data stream is sufficient.
The load balancing of the streaming media server is realized, ensuring that the use of each server is related to its actual load, and solving the problem of load imbalance in the existing technology.
Smart Images

Figure CN118764487A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of cloud computing, and in particular to a method, device, server, platform and medium for determining a streaming media server. Background Art
[0002] With the development of Internet technology, online transmission of streaming media has become the main direction of the development of audio and video media. The streaming media server connects the sender and the receiver to stream media data, meeting the needs of media transmission scenarios with high real-time requirements. How to choose a suitable streaming media server has become the focus of attention in media data streaming transmission.
[0003] In the prior art, the selection of streaming media servers is mainly achieved through classification and comparison of transmission protocols. Specifically, according to the transmission protocol used by the media data stream service, a streaming media server that supports the transmission protocol is searched, and the media data stream service is allocated to the corresponding streaming media server for execution. For example, the cluster includes servers A1 and A2, where the transmission protocol used by the media data stream service is protocol 1, server A1 supports protocol 1, and server A2 supports protocol 2, then server A1 is determined as the target streaming media server for the media data stream service.
[0004] However, existing streaming media servers have the problem of load imbalance. Summary of the invention
[0005] The embodiments of the present application provide a method, device, server, platform and medium for determining a streaming media server, so as to achieve the effect of load balancing of the streaming media server.
[0006] In a first aspect, an embodiment of the present application provides a method for determining a streaming media server, including:
[0007] Obtaining a data stream access request sent by a business server;
[0008] Calculate the streaming load of each streaming server based on the performance data of each streaming server;
[0009] Determine the streaming media server that meets the preset constraint conditions and has the lowest streaming load as the target streaming media server;
[0010] The identifier of the target streaming media server is returned to the business server.
[0011] In a possible implementation manner, before calculating the stream load of each streaming media server according to the performance data of each streaming media server, the following steps are included:
[0012] Obtain performance data periodically reported by each streaming server;
[0013] The performance data includes: processor information, network bandwidth information, the number of information flows currently carried, the protocol type of each information flow, and the traffic bandwidth of each information flow.
[0014] In a possible implementation, calculating the stream load of each streaming media server according to the performance data of each streaming media server includes:
[0015] For each streaming media server, based on the protocol type of each information flow, determine the preset protocol weight corresponding to each information flow;
[0016] Based on the traffic bandwidth of each information flow, determine the preset traffic weight corresponding to each information flow;
[0017] The flow load of the streaming media server is calculated based on the number of information flows, the preset flow weight of each information flow, and the preset protocol weight.
[0018] In a possible implementation, determining a streaming media server that satisfies a preset constraint and has the lowest stream load as a target streaming media server includes:
[0019] For each streaming media server, based on the processor information, determine the number of processor cores of the streaming media server;
[0020] Determine the total available bandwidth of the streaming media server based on the network bandwidth information;
[0021] Determine the preset constraints corresponding to the streaming media server based on the number of processor cores, the total available bandwidth, the number of information flows, and the traffic bandwidth of each information flow;
[0022] Determine a streaming media server that meets corresponding preset constraints as an intermediate streaming media server;
[0023] The intermediate streaming media server with the lowest stream load is determined as the target streaming media server.
[0024] In a second aspect, an embodiment of the present application provides a device for determining a streaming media server, including:
[0025] An acquisition module, used to acquire a data stream access request sent by a business server;
[0026] A first processing module, used for calculating the stream load of each streaming media server according to the performance data of each streaming media server;
[0027] A determination module, used for determining a streaming media server that meets preset constraints and has the lowest streaming load as a target streaming media server;
[0028] The second processing module is used to return the identifier of the target streaming media server to the service server.
[0029] In a possible implementation manner, the first processing module is further configured to:
[0030] Obtain performance data periodically reported by each streaming server;
[0031] The performance data includes: processor information, network bandwidth information, the number of information flows currently carried, the protocol type of each information flow, and the traffic bandwidth of each information flow.
[0032] In a possible implementation manner, the first processing module is further configured to:
[0033] For each streaming media server, based on the protocol type of each information flow, determine the preset protocol weight corresponding to each information flow;
[0034] Based on the traffic bandwidth of each information flow, determine the preset traffic weight corresponding to each information flow;
[0035] The flow load of the streaming media server is calculated based on the number of information flows, the preset flow weight of each information flow, and the preset protocol weight.
[0036] In a possible implementation manner, the determination module is further configured to:
[0037] For each streaming media server, based on the processor information, determine the number of processor cores of the streaming media server;
[0038] Determine the total available bandwidth of the streaming media server based on the network bandwidth information;
[0039] Determine the preset constraints corresponding to the streaming media server based on the number of processor cores, the total available bandwidth, the number of information flows, and the traffic bandwidth of each information flow;
[0040] Determine a streaming media server that meets corresponding preset constraints as an intermediate streaming media server;
[0041] The intermediate streaming media server with the lowest stream load is determined as the target streaming media server.
[0042] In a third aspect, an embodiment of the present application provides a scheduling server, including: a memory, a processor;
[0043] Memory stores computer-executable instructions;
[0044] The processor executes the computer-executable instructions stored in the memory, so that the processor executes the above first aspect and / or various possible implementations of the first aspect.
[0045] In a fourth aspect, an embodiment of the present application provides a cloud computing platform, including a business server, a scheduling server, and a plurality of streaming media servers;
[0046] The scheduling server is used to execute the first aspect and / or various possible implementation methods of the first aspect as described above;
[0047] The business server is used to send the data stream to be processed to the target streaming media server corresponding to the identifier of the target scheduling server based on the identifier of the target scheduling server returned by the scheduling server;
[0048] The target streaming media server is used to perform at least one of the following processes on the data stream to be processed: playback processing, recording processing and analysis processing.
[0049] In a possible implementation manner, each streaming media server supports multiple streaming media transmission protocols, and different streaming media servers support the same streaming media transmission protocols.
[0050] In a fifth aspect, an embodiment of the present application provides a computer-readable storage medium, in which computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, they are used to implement the first aspect above and / or various possible implementations of the first aspect.
[0051] In a sixth aspect, an embodiment of the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the above first aspect and / or various possible implementation methods of the first aspect.
[0052] The method, device, server, platform and medium for determining a streaming media server provided in the embodiment of the present application obtain the data stream access request sent by the business server, and calculate the stream load of each streaming media according to the performance data of each current streaming media server, so as to select and allocate the streaming media server based on the stream load. Compared with the prior art, the present application selects the streaming media server by using the stream load of the streaming media server and the preset constraint conditions, so as to determine the lowest and most suitable access server for the streaming media server operation data stream. It is ensured that the performance of the streaming media server accessed by the data stream is sufficient, thereby ensuring the load balancing of the streaming media server. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0054] Figure 1 A schematic diagram of a scenario for the media data stream processing service provided by this application;
[0055] Figure 2This is an application scenario diagram of a method for determining a streaming media server applicable to an embodiment of the present application;
[0056] Figure 3 The process of the method for determining the streaming media server provided in the embodiment of the present application Figure 1 ;
[0057] Figure 4 A system architecture diagram for reporting performance data of a streaming media server provided in an embodiment of the present application;
[0058] Figure 5 A flowchart of a method for reporting performance data of a streaming media server provided in an embodiment of the present application;
[0059] Figure 6 A method for determining a streaming media server provided in this application Figure 2 ;
[0060] Figure 7 A schematic diagram of the structure of a device for determining a streaming media server provided in this application;
[0061] Figure 8 A flow chart of a data stream processing method based on a streaming media server provided in an embodiment of the present application;
[0062] Fig. 9 A structural diagram of a data stream processing device based on a streaming media server provided in an embodiment of the present application;
[0063] Fig.10 The hardware structure diagram of the scheduling server provided for this application.
[0064] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION
[0065] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.
[0066] First, the terms involved in this application are explained:
[0067] Video Surveillance Networking Transmission Protocol (GB28181): It is the mainstream protocol standard in video surveillance scenarios. The media stream transmission protocol in the GB28181 protocol adopts the Real-time Transport Protocol (RTP) or the Secure Real-time Transport Protocol (SRTP). The media stream is encapsulated in the MPEG-2 Program Stream (MPEG2-PS). The underlying transmission protocol needs to support both the User Datagram Protocol (UDP) and the Transmission Control Protocol (TCP) transmission. The GB28181 protocol relies on the Session Initiation Protocol (SIP) signaling to establish a streaming media transmission channel and only supports push streaming mode.
[0068] Real Time Stream Protocol (RTSP): It is commonly used in video conferencing, security monitoring and other scenarios, and is the mainstream protocol standard for multiple business scenarios. The media stream transmission protocol in the RTSP protocol also uses RTP / RTCP transmission. The media stream is encapsulated in original audio and video frames. The underlying transmission protocol needs to support both UDP and TCP transmission, and RTSP needs to support both push and pull modes.
[0069] Real Time Messaging Protocol (RTMP): It is commonly seen in scenarios such as live broadcast and on-demand video, and is common in scenarios where the device actively pushes the stream. The RTMP protocol uses a block message transmission method, and the media stream is encapsulated in the message format corresponding to RTMP. In the underlying transmission protocol, RTMP is built on top of the TCP protocol, and only needs to support the TCP protocol. RTMP supports both push and pull modes.
[0070] HTTP Live Streaming (HLS): It is a streaming media transmission protocol based on the Hypertext Transfer Protocol (HTTP). It is widely used in the field of video on demand and live broadcasting due to the good native support of browsers. The HLS protocol provides media list files through the HTTP protocol and supports media file downloads to achieve streaming effects. Its transport layer protocol can be completed only through the standard HTTP protocol, and the media stream is encapsulated in the transport stream (MPEG-2 Transport Stream, MPEG2-TS). Since HLS is based on the HTTP protocol, and the HTTP protocol is based on the TCP protocol, the HLS underlying transmission protocol only supports the TCP protocol and only supports the pull stream mode.
[0071] Web Realtime Communication (WEB REALTIME Communication, WEBRTC) protocol: is an application programming interface (Application Programming Interface, API) that supports web browsers for real-time voice or video conversations. WebRTC uses SRTP to encrypt RTP data, message authentication and integrity, and replay attack protection. It is a security framework that provides confidentiality by encrypting the RTP payload and supporting original authentication. The security features of WebRTC are an important part of its reliability, and its foundation is all around RTP. The underlying RTP data packets of WEB rely on UDP for transmission, and the underlying transmission protocol only supports UDP. At the same time, WEBRTC streaming transmission relies on signaling to establish a connection, so it only supports push streaming mode.
[0072] Figure 1 This is a schematic diagram of the media data stream processing service scenario provided by this application. Figure 1 As shown, the specific application scenario includes: a service server 101, at least one streaming media cluster 102, multiple source streaming clients 104 and multiple consuming clients 105. The streaming media cluster 102 includes at least one streaming media server 103.
[0073] The processing of media data streams means that the service server 101 is connected to multiple streaming media clusters 102 and the communication connection is ensured to be normal; the service server 101 determines the target streaming media server for processing the media data stream from multiple streaming media clusters 102 that are connected normally based on the media data stream processing service that needs to be processed currently. Among them, each streaming media cluster 102 includes multiple streaming media servers 103. After determining the target streaming media server, the service server 101 controls the source stream client 104, the target streaming media server and the consumer client 105 corresponding to the media data stream processing service to perform the distribution and / or playback processing of the media data stream.
[0074] In the prior art, the target streaming media server is selected by determining the target streaming media server according to the classification of the transmission protocol. Specifically, the streaming media server corresponding to the transmission protocol type is determined according to the transmission protocol type supported by the streaming media server and the transmission protocol type used by the media data stream. For example, the streaming media servers corresponding to transmission protocol one include: B1 and B2, and the streaming media servers corresponding to transmission protocol two include: B3 and B4. When the protocol corresponding to the media data stream is transmission protocol two, polling selection will be performed in the streaming media servers B3 and B4, and the target streaming media server will be determined.
[0075] However, in the actual selection of streaming media servers, in the method of selecting according to the protocol, essentially only the number of times the streaming media server is used is considered. For example, there are four streaming media servers that support the transmission protocol used by the media data stream, namely: server C1, server C2, server C3 and server C4. Service 1 selects server C1 according to the polling method, service 2 selects server C2 according to the polling method, and so on, to determine the server selected by the subsequent service. Due to the differences in the media stream processing speed and server load remaining of different streaming media servers in actual applications, as well as the difference in the data volume of the media data stream itself, it is impossible to guarantee that a streaming media server with sufficient margin can be selected every time, nor can it guarantee the load balance between servers supporting different transmission protocols and servers of the same protocol. Therefore, it can be known that there is a problem of unbalanced load on streaming media servers in the prior art.
[0076] In view of the above technical problems, the present application proposes the following technical concept: the method of selecting a streaming media server by polling in the combination corresponding to the classification according to the transmission protocol in the prior art is mainly aimed at realizing the scheduling and use of streaming media server resources in the cluster. In actual applications, due to the difference in performance data between different streaming media servers, there is a load imbalance in the streaming media servers in the cluster. Therefore, the flow load of each streaming media server at the media stream data processing level can be calculated according to the most recent performance data of each streaming media server when the business server sends a data stream access request; according to the flow load of each streaming media server and the preset constraints corresponding to each streaming media server, the streaming media server operation target streaming media server with the lowest flow load and meeting the preset constraints is selected. The preset constraints are used to ensure whether the remaining load space of the streaming media server and the remaining network bandwidth can meet the access of the data stream. Then, the identifier of the target streaming media server is returned to the business server. In this way, the most suitable target streaming media server can be determined according to the flow load of each streaming media server when processing the media data stream, thereby ensuring the load balance between each streaming media server.
[0077] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.
[0078] Figure 2 FIG. 2 is an application scenario diagram of a method for determining a streaming media server applicable to an embodiment of the present application. Figure 2 As shown, the application scenario includes: a service server 201, a scheduling processor 202, at least one streaming cluster 203, multiple source streaming clients 205, and multiple consuming clients 206. Each streaming cluster 203 includes at least one streaming server 204.
[0079] When determining the streaming media server, the streaming media server 204 periodically reports the current performance data of each streaming media server 204 to the scheduling server 202 through the streaming media cluster 203; the scheduling server 202 receives the data stream request from the business server 201, and calculates the stream load of each streaming media server 204 according to the latest performance data. The scheduling server 202 obtains the streaming media server 204 that meets the preset constraints according to the stream load of each streaming media server 204 and the preset constraints, and determines the target streaming media server that meets the data stream request according to the selection rule of the lowest stream load. The scheduling server 202 returns the identifier of the target streaming media server to the business server 201, and the business server 201 sends the service corresponding to the data stream request to the target streaming media server. The target streaming media server connects the source stream client 205 and the consumer client 206 corresponding to the service, and transmits the data stream of the source stream client 205 to the consumer client 206 through streaming media processing.
[0080] based on Figure 2 In the application scenario shown, an embodiment of the present application also provides a method for determining a streaming media server. Figure 3 The process of the method for determining the streaming media server provided in the embodiment of the present application Figure 1 .like Figure 3 As shown, the method includes:
[0081] S301: Obtain a data stream access request sent by a service server.
[0082] In this step, the implementation method of obtaining the data stream access request sent by the service server may be:
[0083] The data stream access request sent by the service server is obtained by responding to the external request. Exemplarily, the response request may be: the service server carries a target access address in the data stream access request, and the device or apparatus corresponding to the target access address responds to the request sent by the service server, thereby obtaining the corresponding data stream access request.
[0084] S302: Calculate the stream load of each streaming media server according to the performance data of each streaming media server.
[0085] Optionally, before calculating the stream load of each streaming media server, it is also necessary to obtain performance data periodically reported by each streaming media server;
[0086] The performance data includes: processor information, network bandwidth information, the number of information flows currently carried, the protocol type of each information flow, and the traffic bandwidth of each information flow.
[0087] The performance data used in this step is the performance data periodically reported by the streaming media server. The performance data is the latest performance data reported by the streaming media server when obtaining a data stream access request. For how to implement the reporting of performance data, Figure 4 as well as Figure 5 Further explanation is given in the following embodiments shown in the drawings, and redundant description is omitted here.
[0088] Optionally, in a possible implementation, a specific implementation of calculating the flow load may be:
[0089] a1. For each streaming media server, based on the protocol type of each information flow, determine the preset protocol weight corresponding to each information flow.
[0090] In this step, the protocol types of information flows include: GB28181, RTSP, RTMP, HLS, WEBRTC. The preset protocol weight corresponding to each information flow is related to the way each protocol type encapsulates the information flow, the underlying transmission mechanism corresponding to each protocol type, and the complexity of each information flow in the transmission and interaction between servers.
[0091] Exemplarily, the preset protocol weights for each of the above protocol types obtained based on a large amount of data training can be: protocol type: GB28181, preset protocol weight: 1.5; protocol type: RTSP, preset protocol weight: 1.2; protocol type: RTMP, preset protocol weight: 1; protocol type: HLS, preset protocol weight: 0.8; protocol type: WEBRTC, preset protocol weight: 2.
[0092] It should be noted that the protocol type of the information flow and the preset protocol weight in this application are only described for exemplary purposes and are not limiting.
[0093] a2. Based on the traffic bandwidth of each information flow, determine the preset traffic weight corresponding to each information flow.
[0094] In this step, the traffic bandwidth of each information flow is the network bandwidth occupied by the information flow when it is processed in the streaming media server. The preset traffic weight is determined by evaluating the performance of the streaming media server and conducting a comprehensive analysis based on the performance of the streaming media server under high load and the stability of the streaming media server.
[0095] Exemplarily, the preset traffic weight corresponding to each information flow in this step can be set as:
[0096] Traffic bandwidth range: less than 2Mbps, preset traffic weight: 1; traffic bandwidth range: greater than or equal to 2Mbps and less than or equal to 4Mbps, preset traffic weight: 1.5; traffic bandwidth range: greater than 4Mbps, preset traffic weight: 2.
[0097] It should be noted that the preset traffic weight of the information flow in this application is only described as an example and is not restrictive.
[0098] a3. Calculate the stream load of the streaming media server based on the number of information flows, the preset traffic weight of each information flow, and the preset protocol weight.
[0099] In this step, the network bandwidth information is the total available bandwidth of the streaming media server. The flow load calculation of the streaming media server is related to the current network information of the streaming media server and the information flow it carries. The specific calculation method is based on the following formula:
[0100]
[0101] Among them, L represents the stream load of the streaming media server; w represents the preset protocol weight corresponding to each information flow; β represents the preset traffic weight corresponding to each information flow; P represents the number of information flows corresponding to each protocol type; n represents the existence of n protocol types.
[0102] S303: Determine a streaming media server that meets preset constraints and has the lowest streaming load as a target streaming media server.
[0103] Optionally, in a possible implementation manner, a specific implementation method for determining the target streaming media server includes:
[0104] b1. For each streaming media server, determine the number of processor cores of the streaming media server based on the processor information.
[0105] In this step, the number of processor cores can be determined by: obtaining the number of processor cores in the streaming media by querying the command line; or obtaining the number of processor cores by reading the device configuration information of the streaming media server. If the streaming media processor runs in a virtualized environment, the number of processor cores in the streaming media server can be queried by connecting to the virtualization management configuration platform.
[0106] b2. Determine the total available bandwidth of the streaming media server based on the network bandwidth information.
[0107] In this step, the network bandwidth information includes the network type used by the current streaming media server and the total available bandwidth.
[0108] b3. Determine the preset constraints corresponding to the streaming media server based on the number of processor cores, the total available bandwidth, the number of information flows, and the traffic bandwidth of each information flow.
[0109] In this step, the preset constraint conditions are that the stream load needs to be less than the upper limit of the load supported by the streaming media server, and the comprehensive flow bandwidth must be lower than the total available bandwidth of the streaming media server.
[0110] The specific calculation formula is as follows:
[0111]
[0112]
[0113] Among them, L represents the flow load of the streaming media server; C represents the number of processor cores in the streaming media server; 200 represents the preset load limit of each processor core; b represents the traffic bandwidth of each information flow; P represents the number of information flows corresponding to each protocol type; n represents the existence of n protocol types; B represents the total available bandwidth of the streaming media server.
[0114] Formula (2) is used to limit the total bandwidth of information flows to be lower than the total available bandwidth of the streaming media server. Formula (3) is used to limit the flow load of the streaming media server to be lower than the upper limit of the load of the streaming media server.
[0115] b4. Determine the streaming media server that meets the corresponding preset constraint conditions as the intermediate streaming media server.
[0116] In this step, in another possible implementation, if there is no streaming media server that meets the preset constraint condition, it indicates that there is no available streaming media server in the current streaming media cluster, and scheduling failure information can be sent to the service server.
[0117] b5. Determine the intermediate streaming media server with the lowest stream load as the target streaming media server.
[0118] In this step, if the number of intermediate streaming media servers is one, the intermediate streaming media server is determined as the target streaming media server. If there are multiple intermediate streaming media servers, the intermediate streaming media servers are sorted based on their stream loads, and the intermediate streaming media server with the lowest stream load is determined as the target streaming media server.
[0119] S304: Return the identifier of the target streaming media server to the service server.
[0120] In this step, the identifier of the target streaming media server includes at least any one of the following: the address of the target streaming media server, the access interface of the target streaming media server, the name or code of the target streaming media server.
[0121] The method of returning the information to the service server may be: sending a data packet to the service server through a wired link or a wireless link and / or sending a data connection request to the service server.
[0122] In this embodiment, the flow load of each streaming media server is calculated by obtaining the data flow access request of the service server and according to the latest performance data reported by each streaming media server after obtaining the data flow access request. The streaming media servers are screened according to the preset constraints, and the target streaming media server with the lowest flow load is determined among the streaming media servers that meet the preset constraints. The identifier of the determined target streaming media server is sent to the service server to determine the streaming media server. Thus, the use of each streaming media server is related to the flow load of the streaming media server itself, and the actual load of each streaming media server is taken into consideration, so as to achieve load balancing of the streaming media servers, and solve the problem of unbalanced load of the streaming media servers existing in the prior art.
[0123] Figure 4 The system architecture diagram for reporting performance data of a streaming media server provided in the embodiment of the present application is used to further explain the performance data reporting in the above step S302. Figure 4 As shown, in a possible implementation, the architecture includes: a scheduling server 401 and multiple streaming media servers 402.
[0124] The implementation method includes: the streaming media server periodically reports performance data to the scheduling server through a heartbeat mechanism; the performance data reporting form is to send a data transmission request to the scheduling server based on the HTTP protocol, and send the performance data to the scheduling server. Among them, the heartbeat mechanism refers to a method for ensuring whether the communication between the various components of the system exists, and monitoring the status of the communication between the various components. In this step, the heartbeat mechanism is used to ensure whether the communication between the scheduling server and the streaming media server exists, and maintain the heartbeat of the streaming media server in the scheduling server through periodic data reporting.
[0125] based on Figure 4 As shown in the architecture diagram, the embodiment of the present application also provides a method for reporting performance data of a streaming media server. Figure 5 The present invention provides a flow chart of a method for reporting streaming media server performance data. Figure 5 As shown, the method includes:
[0126] c1. The heartbeat reporting program based on the streaming media server periodically triggers the heartbeat reporting task.
[0127] In this step, the cycle of triggering the heartbeat reporting task is set according to the actual streaming media server application scenario. Exemplarily, the cycle of the heartbeat reporting task is set to 10 seconds, then every ten seconds, the streaming media server will trigger the reporting task based on the heartbeat reporting program.
[0128] c2. Collect data based on the heartbeat reporting program of the streaming media server.
[0129] In this step, the data collected by the heartbeat reporting program includes: server information and information about information flows carried in the server. The server information includes: processor information, network bandwidth information, load information, and memory information; the information about information flows includes: the identifier of each information flow, the protocol type of each information flow, and the traffic bandwidth of each information flow.
[0130] Exemplarily, the information of the information flow collected by the heartbeat reporting program may be:
[0131] GB28181 flow information: the GB28181 flow identifier carried by the current server, corresponding to the flow bandwidth;
[0132] RTSP stream information: RTSP identifier carried by the current server, corresponding traffic bandwidth;
[0133] RTMP stream information: the RTMP stream identifier carried by the current server, corresponding to the traffic bandwidth;
[0134] HLS stream information: the HLS stream identifier carried by the current server, corresponding to the traffic bandwidth;
[0135] WEBRTC flow information: WEBRTC flow identifier carried by the current server, corresponding to the traffic bandwidth.
[0136] c3. The collected data is summarized based on the heartbeat reporting program and determined as performance data.
[0137] In this step, the collected data is summarized, and the information flow of each protocol type is counted to obtain the number of information flows in the streaming media server. Summarization can also include: normalizing the format of the collected data, completing the collected data, and removing duplicates.
[0138] c4. Report the performance data to the scheduling server based on HTTP.
[0139] In this step, the performance data is added to the body of the HTTP request, and the performance data is reported by accessing the scheduling server.
[0140] Optionally, in a possible implementation, the performance data reporting week will start the next cycle according to the reporting period, and when the reporting period is reached, the current performance data will be newly acquired and reported.
[0141] c5. After receiving the performance data, the scheduling server corrects and stores the performance data.
[0142] In this step, the correction of performance data includes but is not limited to: data format normalization, data cleaning, data deduplication, and filling of missing data values.
[0143] In this embodiment, the communication connection between the streaming media server and the scheduling server is maintained through the heartbeat mechanism, and periodic performance data reporting is implemented based on the heartbeat mechanism, thereby achieving efficient and fast performance data upload, and ensuring the stability of communication between the scheduling server and the streaming media server while uploading data.
[0144] Based on the above embodiments, Figure 6 A further implementation example is described for determining the streaming media server. Figure 6 A method for determining a streaming media server provided in this application Figure 2 .like Figure 6 As shown, the method includes:
[0145] d1. The business server adds a data stream access request.
[0146] d2. The scheduling server receives the data stream access request from the business server.
[0147] d3. The scheduling server calculates the current streaming load of each streaming media server.
[0148] d4. The dispatch center returns the identifier of the target streaming media server that meets the preset constraint conditions and has the minimum streaming load to the service server.
[0149] d5. The target streaming media server accepts the data stream access and processes the services corresponding to the data stream.
[0150] In this step, the streaming media server processes the data stream including at least one of the following: disassembly of the transmission protocol corresponding to the data stream, data stream recording, and data stream playback processing. For specific data stream corresponding service processing methods, refer to the following Figure 8 The embodiment shown.
[0151] Figure 7 A structural diagram of a device for determining a streaming media server provided in this application, such as Figure 7 As shown, the determination device of the streaming media server provided in this embodiment includes:
[0152] An acquisition module 701 is used to acquire a data stream access request sent by a service server;
[0153] The first processing module 702 is used to calculate the stream load of each streaming media server according to the performance data of each streaming media server;
[0154] A determination module 703 is used to determine a streaming media server that meets preset constraints and has the lowest streaming load as a target streaming media server;
[0155] The second processing module 704 is used to return the identifier of the target streaming media server to the service server.
[0156] In a possible implementation, the first processing module 702 is further configured to:
[0157] Obtain performance data periodically reported by each streaming server;
[0158] The performance data includes: processor information, network bandwidth information, the number of information flows currently carried, the protocol type of each information flow, and the traffic bandwidth of each information flow.
[0159] In a possible implementation, the first processing module 702 is further configured to:
[0160] For each streaming media server, based on the protocol type of each information flow, determine the preset protocol weight corresponding to each information flow;
[0161] Based on the traffic bandwidth of each information flow, determine the preset traffic weight corresponding to each information flow;
[0162] The flow load of the streaming media server is calculated based on the number of information flows, the preset flow weight of each information flow, and the preset protocol weight.
[0163] In a possible implementation, the determining module 703 is further configured to:
[0164] For each streaming media server, the number of processor cores of the streaming media server is determined based on the processor information; the total available bandwidth of the streaming media server is determined based on the network bandwidth information;
[0165] Determine the preset constraints corresponding to the streaming media server based on the number of processor cores, the total available bandwidth, the number of information flows, and the traffic bandwidth of each information flow;
[0166] Determine a streaming media server that meets corresponding preset constraints as an intermediate streaming media server;
[0167] The intermediate streaming media server with the lowest stream load is determined as the target streaming media server.
[0168] The device for determining a streaming media server provided in this embodiment can execute the method provided in the above method embodiment, and its implementation principle and technical effect are similar, which will not be described in detail in this embodiment.
[0169] Figure 8 A flow chart of a data stream processing method based on a streaming media server provided in an embodiment of the present application. Figure 6 Based on the embodiment shown, how to implement data stream processing based on the streaming media server in step d5 is further explained. Figure 8 As shown, the method includes: e1, the source stream client sends the data stream to be processed to the streaming media server based on a preset transmission protocol; e2, the streaming media server receives the data stream to be processed, performs protocol parsing on the data stream to be processed based on the transmission protocol of the data stream to be processed, and at the same time, the streaming media server transcodes or repackages the data stream to be processed, and converts the data to be processed into a target data stream of a target transmission protocol; e3, the streaming media server pushes the target data stream to the consumer client based on the target transmission protocol.
[0170] Based on the above embodiments, the present application provides a cloud computing platform. The cloud computing platform is used to implement the streaming media server determination method of any one of the above embodiments. The cloud computing platform includes: a business server, a scheduling server, and multiple streaming media servers;
[0171] The scheduling server is used to execute Figures 3 to 6 The method described in any one of the embodiments shown;
[0172] The business server is used to send the data stream to be processed to the target streaming media server corresponding to the identifier of the target scheduling server based on the identifier of the target scheduling server returned by the scheduling server;
[0173] The target streaming media server is used to perform at least one of the following processes on the data stream to be processed: playback processing, recording processing and analysis processing.
[0174] Optionally, each streaming media server supports multiple streaming media transmission protocols, and different streaming media servers support the same streaming media transmission protocols.
[0175] In one possible implementation, a specific implementation method for a streaming media server to support multiple transmission protocols is: setting corresponding transmission protocol conversion modules for multiple transmission protocols, converting the data streams of multiple transmission protocols into data streams in a preset standard format, and playing, recording, and analyzing the data streams based on the data streams in the preset standard format.
[0176] Fig. 9The following is a schematic diagram of the structure of a data stream processing device based on a streaming media server provided in an embodiment of the present application. Fig. 9 As shown, the device includes: a GB28181 protocol module 901, an RTSP protocol module 902, an RTMP protocol module 903, an HLS protocol module 904, a WEBRTC protocol module 905, a preset standard format data stream processing module 906, a data stream playback module 907, a data stream recording module 908, and a data stream analysis module 909.
[0177] The GB28181 protocol module 901 is used to transcode and encapsulate a data stream whose transmission protocol is GB28181, and determine it as a data stream in a preset standard format;
[0178] RTSP protocol module 902, used for transcoding and encapsulating the data stream whose transmission protocol is RTSP, and determining it as a data stream in a preset standard format;
[0179] The RTMP protocol module 903 is used to transcode and encapsulate the data stream whose transmission protocol is RTMP, and determine it as a data stream in a preset standard format;
[0180] The HLS protocol module 904 is used to transcode and encapsulate the data stream whose transmission protocol is HLS, and determine it as a data stream in a preset standard format;
[0181] WEBRTC protocol module 905, used to transcode and encapsulate the data stream whose transmission protocol is WEBRTC, and determine it as a data stream in a preset standard format;
[0182] A preset standard format data stream processing module 906 is used to determine a subsequent processing method of the data stream;
[0183] The data stream playing module 907 is used to play the data stream;
[0184] The data stream recording module 908 is used to record the data stream;
[0185] The data flow analysis module 909 is used to analyze and process the data flow.
[0186] Fig.10 The hardware structure diagram of the scheduling server provided in this application. Fig.10 As shown, the scheduling server provided in this embodiment includes: at least one processor 1001 and a memory 1002. Optionally, the scheduling server also includes a communication component 1003. The processor 1001, the memory 1002 and the communication component 1003 are connected via a bus 1004.
[0187] In a specific implementation process, at least one processor 1001 executes the computer-executable instructions stored in the memory 1002, so that at least one processor 1001 executes the above method.
[0188] The specific implementation process of the processor 1001 can be found in the above Figure 3-6 The implementation principle and technical effect of the method embodiment shown are similar, and this embodiment will not be repeated here.
[0189] In the above embodiments, it should be understood that the processor can be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), etc. A general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in the invention can be directly implemented as a hardware processor, or can be implemented by a combination of hardware and software modules in the processor.
[0190] The memory may include a high-speed memory (Random Access Memory, RAM), and may also include a non-volatile memory (NVM), such as at least one disk storage.
[0191] The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, the bus in the drawings of this application is not limited to only one bus or one type of bus.
[0192] The present application also provides a computer program product, including a computer program, which implements the above method when executed by a processor.
[0193] The present application also provides a computer-readable storage medium, in which computer-executable instructions are stored. When a processor executes the computer-executable instructions, the above method is implemented.
[0194] The above-mentioned readable storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk. The readable storage medium can be any available medium that can be accessed by a general or special-purpose computer.
[0195] An exemplary readable storage medium is coupled to a processor so that the processor can read information from the readable storage medium and write information to the readable storage medium. Of course, the readable storage medium can also be a component of the processor. The processor and the readable storage medium can be located in an application specific integrated circuit (Application Specific Integrated Circuits, referred to as: ASIC). Of course, the processor and the readable storage medium can also exist in the device as discrete components.
[0196] The division of units is only a logical function division, and there may be other divisions in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interface, device or unit, which can be electrical, mechanical or other forms.
[0197] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0198] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0199] If the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods of each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.
[0200] Those skilled in the art can understand that all or part of the steps of implementing the above-mentioned method embodiments can be completed by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, the steps of the above-mentioned method embodiments are executed; and the aforementioned storage medium includes: ROM, RAM, disk or optical disk and other media that can store program codes.
[0201] Finally, it should be noted that those skilled in the art will readily conceive of other embodiments of the present invention after considering the specification and practicing the invention disclosed herein. The present invention is intended to cover any variations, uses or adaptations of the present invention, which follow the general principles of the present invention and include common knowledge or customary technical means in the art not disclosed by the present invention, are not limited to the precise structure described above and shown in the drawings, and may be modified and changed in various ways without departing from the scope thereof. The scope of the present invention is limited only by the appended claims.
Claims
1. A method for determining a streaming media server, characterized in that: include: Obtaining a data stream access request sent by a business server; Calculate the streaming load of each streaming server based on the performance data of each streaming server; Determine the streaming media server that meets the preset constraint condition and has the lowest stream load as the target streaming media server; The identifier of the target streaming media server is returned to the service server.
2. The method according to claim 1, characterized in that Before calculating the stream load of each streaming media server according to the performance data of each streaming media server, the method includes: Obtain performance data periodically reported by each streaming server; The performance data includes: processor information, network bandwidth information, the number of currently carried information flows, the protocol type of each information flow, and the traffic bandwidth of each information flow.
3. The method according to claim 2, characterized in that The step of calculating the stream load of each streaming media server according to the performance data of each streaming media server includes: For each streaming media server, based on the protocol type of each information flow, determine the preset protocol weight corresponding to each information flow; Based on the traffic bandwidth of each information flow, determine the preset traffic weight corresponding to each information flow; The stream load of the streaming media server is calculated based on the number of information flows, the preset traffic weight of each information flow, and the preset protocol weight.
4. The method according to claim 2 or 3, characterized in that: The step of determining the streaming media server that satisfies the preset constraint condition and has the lowest stream load as the target streaming media server includes: For each streaming media server, determining the number of processor cores of the streaming media server based on the processor information; Determining the total available bandwidth of the streaming media server based on the network bandwidth information; Determining a preset constraint condition corresponding to the streaming media server based on the number of cores of the processor, the total available bandwidth, the number of information flows, and the traffic bandwidth of each information flow; Determine a streaming media server that meets corresponding preset constraints as an intermediate streaming media server; The intermediate streaming media server with the lowest stream load is determined as the target streaming media server.
5. A device for determining a streaming media server, characterized in that: include: An acquisition module, used to acquire a data stream access request sent by a business server; A first processing module, used for calculating the stream load of each streaming media server according to the performance data of each streaming media server; A determination module, used for determining a streaming media server that meets preset constraints and has the lowest stream load as a target streaming media server; The second processing module is used to return the identifier of the target streaming media server to the business server.
6. A scheduling server, characterized in that: include: Memory, processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory, so that the processor performs the method according to any one of claims 1 to 4.
7. A cloud computing platform, characterized in that: Including business servers, scheduling servers and multiple streaming media servers; Wherein, the scheduling server is used to execute the method according to any one of claims 1 to 4; The business server is used for sending the data stream to be processed to the target streaming media server corresponding to the identifier of the target scheduling server based on the identifier of the target scheduling server returned by the scheduling server; The target streaming media server is used to perform at least one of the following processing on the data stream to be processed: playback processing, recording processing and analysis processing.
8. The cloud computing platform according to claim 7, characterized in that: Each streaming media server supports multiple streaming media transmission protocols, and different streaming media servers support the same streaming media transmission protocols.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, which are used to implement the method according to any one of claims 1 to 4 when executed by a processor.
10. A computer program product, characterized in that The invention comprises a computer program, which implements the method according to any one of claims 1 to 4 when being executed by a processor.
Citation Information
Patent Citations
Audio and video stream load balancing method and device
CN111193788A
Media stream transmission method, media server and communication system
CN116233481A
Streaming media load balancing method and device, electronic equipment and storage medium
CN118075244A
System and methods of cooperatively load-balancing clustered servers
US20050027862A1
Load balancing method and apparatus, device, computer storage medium and program
WO2023050901A1
