Streaming media load balancing method and device, equipment and storage medium

By obtaining client attribute information and formulating an average allocation strategy, the resource balancing problem of the streaming media system is solved when the number of devices exceeds the limit, achieving high concurrency and high availability of streaming media services, and improving the efficiency of video streaming services.

CN118764489APending Publication Date: 2024-10-11HAOYUN TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410760510.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-13
Publication Date
2024-10-11

AI Technical Summary

Technical Problem

In the existing technology, the streaming media system cannot maintain resource balance when the number of devices exceeds the limit, resulting in slow request response and system instability, making it difficult to achieve high availability.

Method used

By obtaining the attribute information of all clients accessing the streaming media service, calculating the number of clients and the number of streaming media service nodes under each attribute information, formulating an average distribution strategy, and evenly allocating clients to streaming media service nodes to ensure that each The number of requests processed by the node is within an acceptable range to avoid single point overload.

Benefits of technology

It achieves high concurrency and high availability of streaming media services, dynamically allocates resources, improves the efficiency of video streaming services, and avoids the problem of device connection limit and sudden increase in server pressure.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118764489A_ABST
    Figure CN118764489A_ABST
Patent Text Reader

Abstract

The invention discloses a streaming media load balancing method, device and equipment and a storage medium, and the method comprises the steps: obtaining all user sides accessing a streaming media service, traversing the information of all user sides, and obtaining the attribute information corresponding to each user side; according to the attribute information of each user side, obtaining the access number of the user sides corresponding to the same attribute information and the number of streaming media service nodes; obtaining an average distribution strategy according to the access number and the number of streaming media service nodes; and traversing the access conditions of all the user sides, and if the streaming media service node accessed by the current user side does not conform to the average distribution strategy, accessing the user side to the streaming media service node needing to be accessed by the user side according to the average distribution strategy. The technical problems that in the prior art, resource balance cannot be kept, the system cannot operate stably, and high availability is difficult to achieve are solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of streaming media load information technology, and in particular to a method, device, equipment and storage medium for streaming media load balancing. Background Art

[0002] Currently, for video surveillance applications, the main responsibility of streaming media services is to connect to users' video devices and perform various operations on the devices on behalf of users.

[0003] In the prior art, the bridge for streaming media to communicate with devices is to call the SDKs provided by different device manufacturers. Through practice, it has been found that the device connection instances of SDKs of different manufacturers on a service process are limited, and the number of connections varies from manufacturer to manufacturer. Under the single-point deployment solution of streaming media, the system can still run if the number of devices in the entire system does not reach the limit. Once the number of devices exceeds the limit, the request cannot be sent due to the limitation on the number of accesses to the same SDK, and some devices cannot be operated. At the same time, with the increase in the volume of streaming media business and the continuous growth in the number of docking requests, streaming media has to process a large number of requests, and the pressure on the server increases sharply, resulting in slow response to subsequent requests. Once a single-point deployed streaming media fails, it is easy to cause a single-point server failure, and the entire streaming media cannot be used, which easily leads to the system being unable to run after a certain node crashes, which in turn makes it impossible to maintain resource balance, the system cannot run stably, and it is difficult to have high availability. Summary of the invention

[0004] The present invention provides a method for streaming media load balancing to solve the technical problems in the prior art that resources cannot be balanced, the system cannot run stably, and it is difficult to have high availability.

[0005] In order to solve the above technical problems, an embodiment of the present invention provides a method for streaming media load balancing, including:

[0006] Obtain all client terminals that access the streaming media service, and traverse the information of all client terminals to obtain the attribute information corresponding to each client terminal;

[0007] According to the attribute information of each user terminal, the access quantity and the number of streaming media service nodes corresponding to the user terminals with the same attribute information are obtained; wherein the streaming media service includes a plurality of streaming media service nodes;

[0008] According to the access quantity and the number of streaming media service nodes, an average distribution strategy is obtained; wherein the average distribution strategy includes: according to the attribute information corresponding to each user terminal, each user terminal is evenly distributed to the streaming media service node to be accessed;

[0009] The access conditions of all the user terminals are traversed. If the streaming media service node accessed by the current user terminal does not conform to the average distribution strategy, the user terminal is connected to the streaming media service node that it needs to access according to the average distribution strategy.

[0010] As a preferred solution, before acquiring all the user terminals accessing the streaming media service, the method further includes:

[0011] In response to a signaling request sent by any user terminal, proxy the signaling request and determine the load balancing service node corresponding to the proxy signaling request;

[0012] Through the load balancing service node, a decision is made on the streaming media service node access for the user terminal, and the proxied signaling request is sent to the streaming media service node corresponding to the user terminal, so that the streaming media service node establishes a streaming connection with the user terminal according to the proxied signaling request;

[0013] Until all the user terminals that have sent signaling requests establish streaming connections with their corresponding streaming media service nodes.

[0014] As a preferred solution, the proxying of the signaling request and determining the load balancing service node corresponding to the proxy signaling request specifically includes:

[0015] According to the signaling request, determine the proxy service corresponding to the user terminal; wherein the proxy service includes nginx proxy service and rtsp proxy service;

[0016] The signaling request is proxied through the determined user-side proxy service, so that according to the proxied signaling request, the load balancing service node corresponding to the signaling request is determined in the load balancing service cluster, and the proxied signaling request is sent to the load balancing service module in the corresponding load balancing service node; wherein, the load balancing service cluster includes a plurality of load balancing service nodes, and each load balancing service node includes a plurality of load balancing service modules.

[0017] As a preferred solution, the method of determining the load balancing service node corresponding to the signaling request in the load balancing service cluster according to the proxied signaling request, and sending the proxied signaling request to the load balancing service module in the corresponding load balancing service node specifically includes:

[0018] According to the attribute information of the user end corresponding to the signaling request after the proxy, determine the corresponding load balancing service node in the load balancing service cluster; wherein all the user ends under each same attribute information are evenly distributed to the load balancing service nodes in the load balancing service cluster;

[0019] According to the protocol information of the proxied signaling request, the proxied signaling request is sent to the load balancing service module in the corresponding load balancing service node; wherein the protocol information includes http protocol information, websocket protocol information and rtsp protocol information.

[0020] As a preferred solution, the decision of accessing a streaming media service node for the user terminal is made through the load balancing service node, and the proxied signaling request is sent to the streaming media service node corresponding to the user terminal, so that the streaming media service node establishes a streaming connection with the user terminal according to the proxied signaling request, specifically including:

[0021] Based on the protocol information of the signaling request after the proxy, the decision of the streaming media service node access is made for the user terminal through the load balancing service module in the corresponding load balancing service node, and the streaming media service node corresponding to the user terminal is obtained;

[0022] The proxied signaling request is sent to the streaming service node, so that the streaming service node feeds back response information according to the proxied signaling request, and returns the stream address to the user terminal through the corresponding streaming service node and proxy service, thereby establishing a stream connection between the user terminal and the streaming service node.

[0023] As a preferred solution, the method of obtaining the access quantity and the number of streaming media service nodes of the user terminals corresponding to the same attribute information according to the attribute information of each user terminal, and obtaining the average distribution strategy according to the access quantity and the number of streaming media service nodes, specifically includes:

[0024] According to the attribute information of each user terminal, the current access number of all user terminals with the same attribute information is obtained, thereby obtaining the current access number of all user terminals under each attribute information;

[0025] According to the working status of each streaming media service node in the streaming media service, the number of streaming media service nodes available for streaming media business processing is obtained as the number of streaming media service nodes;

[0026] According to the current access quantity of all users under each attribute information and the number of streaming service nodes, the number of all users under any attribute information evenly allocated to each streaming service node is calculated, so that all users have a corresponding streaming service node to access.

[0027] As a preferred solution, after the user terminal is connected to the streaming media service node that it needs to access according to the average distribution strategy, the method further includes:

[0028] According to all the user terminal information written into the database, the user terminal information currently connected to the streaming media service node is compared to obtain the unconnected user terminal;

[0029] According to the attribute information of the non-connected user terminal, a streaming media service node is allocated and accessed to the non-connected user terminal.

[0030] Accordingly, the present invention also provides a streaming media load balancing device, comprising: an attribute information module, a quantity module, a distribution strategy module and an access module;

[0031] The attribute information module is used to obtain all the user terminals accessing the streaming media service, and traverse the information of all the user terminals to obtain the attribute information corresponding to each user terminal;

[0032] The quantity module is used to obtain the access quantity of the user terminals and the quantity of the streaming media service nodes corresponding to the same attribute information according to the attribute information of each user terminal; wherein the streaming media service includes a plurality of streaming media service nodes;

[0033] The allocation strategy module is used to obtain an average allocation strategy according to the access quantity and the number of streaming media service nodes; wherein the average allocation strategy includes each user terminal being evenly allocated to the streaming media service node to be accessed according to its corresponding attribute information;

[0034] The access module is used to traverse the access status of all user terminals. If the streaming media service node accessed by the current user terminal does not comply with the average distribution strategy, the user terminal is connected to the streaming media service node it needs to access according to the average distribution strategy.

[0035] Correspondingly, the present invention also provides a terminal device, including a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, and when the processor executes the computer program, the method for streaming media load balancing as described in any one of the above items is implemented.

[0036] Correspondingly, the present invention also provides a computer-readable storage medium, which includes a stored computer program, wherein when the computer program is running, the device where the computer-readable storage medium is located is controlled to execute any one of the methods for streaming media load balancing described above.

[0037] Compared with the prior art, the embodiments of the present invention have the following beneficial effects:

[0038] The technical solution of the present invention obtains all user terminals accessing the streaming media service and the attribute information corresponding to each user terminal, and then can determine the access quantity and the number of streaming media service nodes of all user terminals under the same attribute information, so as to accurately and evenly allocate each user terminal under the same attribute information to the corresponding streaming media service node, and construct an average allocation strategy to avoid too many user terminals under the same attribute information occupying the same streaming media service node, resulting in the service access quantity exceeding the limit and the inability to maintain resource balance, while also avoiding reducing the high availability of the streaming media service; thus, through the average allocation strategy, the access status of all current user terminals after traversal is combined, and the user terminal is accessed to the corresponding streaming media service node with the average allocation strategy, thereby ensuring high concurrency and high availability of the streaming media service, realizing dynamic allocation of resources, and improving the efficiency of the video streaming service. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] Figure 1 : A flow chart of a method for streaming media load balancing provided by an embodiment of the present invention;

[0040] Figure 2 : An overall system architecture diagram of streaming media load balancing provided by an embodiment of the present invention;

[0041] Figure 3 : A flowchart of the http request load balancing process provided by an embodiment of the present invention;

[0042] Figure 4 : A flowchart of the websocket request load balancing process provided by an embodiment of the present invention;

[0043] Figure 5 : The rtsp request load balancing workflow diagram provided by the embodiment of the present invention;

[0044] Figure 6 : A structural diagram of a streaming media load balancing device provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0045] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0046] Embodiment 1

[0047] Please refer to Figure 1, a method for streaming media load balancing provided by an embodiment of the present invention includes the following steps S101-S105:

[0048] Step S101: Establishing a streaming connection between a user terminal and a streaming media service node.

[0049] In this example, see Figure 2 , which is the overall system architecture diagram of the streaming media load balancing provided by the present invention, including the user end, proxy service, load balancing service cluster, streaming media service, Red is remote dictionary service, database, Kaf la stream processing platform, and consu l registration center; wherein the proxy service includes ngi The nx proxy service and the rtsp proxy service are the access entrances of the entire user-side cluster, which can guide the user-side request path to the appropriate load balancing service node; the streaming media service includes several streaming media service nodes, which are used to process the user's business requests and perform streaming media business processing; the load balancing service cluster includes multiple load balancing service nodes, and the load balancing service cluster is used to receive the request signaling of the user-side business, so as to determine the optimal streaming media service node to perform business processing on its request signaling, and each load balancing service node includes a signaling load balancing module and a media load balancing module, the signaling load balancing module is used to process the signaling request sent by the user side, and the media load balancing module includes a web media load balancing module and an rtsp media load balancing module, the web media load balancing module is mainly used to process the stream request sent by the user side, so as to return the stream address after processing the stream request; the rtsp media load balancing module is mainly used to process the request of the rtsp protocol, and its function is similar to that of the web media load balancing module. At the same time, it can also extract device streams to the streaming media service through the rtsp protocol. If there are multiple instances in the entire cluster, they are mapped to the outside through virtual IP.

[0050] In this embodiment, the consu l registration center is used for registration, service discovery and health check of each node in the proxy service, load balancing service cluster and streaming media service; the kaf la stream processing platform is used to receive alarm events of each node in the streaming media service; the Redis remote dictionary service and database are the data layer nodes of the entire system. The database is mainly used to save user-side information and related business data. The Redis remote dictionary service is mainly used to cache global load information and for load balancing decisions.

[0051] As a preferred solution of this embodiment, before acquiring all the user terminals accessing the streaming media service, steps S201-S203 are also included:

[0052] Step S201: In response to a signaling request sent by any user terminal, the signaling request is proxied, and a load balancing service node corresponding to the proxied signaling request is determined.

[0053] As a preferred solution of this embodiment, the proxying of the signaling request and determining the load balancing service node corresponding to the proxy signaling request specifically includes:

[0054] According to the signaling request, the proxy service corresponding to the user end is determined; wherein the proxy service includes an nginx proxy service and an rtsp proxy service; the signaling request is proxied through the determined proxy service of the user end, so that according to the proxied signaling request, the load balancing service node corresponding to the signaling request is determined in the load balancing service cluster, and the proxied signaling request is sent to the load balancing service module in the corresponding load balancing service node; wherein the load balancing service cluster includes a plurality of load balancing service nodes, and each load balancing service node includes a plurality of load balancing service modules.

[0055] In this embodiment, when the user terminal accesses the proxy service, there are two types of gateways, including the NGI NX gateway and the RTSP gateway. The NGI NX network is associated with the NGI NX proxy service, which is used to process the request signaling of the HTTP protocol sent by the user terminal. The request signaling of the HTTP protocol includes signaling requests and non-signaling requests. The cluster has only one instance; since the NGINX gateway does not support the proxy of RTSP requests, the RTSP network is associated with the RTSP proxy service, which is used to process the requests sent by the RTSP user terminal. The user terminal obtains the device stream from the streaming media through the RTSP protocol. There are multiple instances in the entire cluster, which are mapped to the outside through the virtual IP.

[0056] As a preferred solution of this embodiment, the method of determining the load balancing service node corresponding to the signaling request in the load balancing service cluster according to the proxied signaling request, and sending the proxied signaling request to the load balancing service module in the corresponding load balancing service node specifically includes:

[0057] According to the attribute information of the user terminal corresponding to the proxied signaling request, the corresponding load balancing service node is determined in the load balancing service cluster; wherein all the user terminals under each same attribute information are evenly distributed to the load balancing service nodes in the load balancing service cluster; according to the protocol information of the proxied signaling request, the proxied signaling request is sent to the load balancing service module in the corresponding load balancing service node; wherein the protocol information includes http protocol information, websocket protocol information and rtsp protocol information.

[0058] In this embodiment, the load balancing service node corresponding to the signaling request is determined in the load balancing service cluster through the proxied signaling request, so that the load balancing service node processes the user terminal. When determining the load balancing service node corresponding to the user terminal, the number of all user terminals with the same attribute information can be used, and then all user terminals with the attribute information are evenly distributed to each load balancing service node. For example, if the number of all user terminals with the same attribute information is 3 (including user terminal 1, user terminal 2 and user terminal 3), and the number of all load balancing service nodes is 3 (including load balancing service node 1, load balancing service node 2 and load balancing service node 3), each user terminal with the same attribute information is evenly distributed to each load balancing service node, that is, load balancing service node 1 corresponds to user terminal 1, and load balancing service node 2 corresponds to user terminal 1. For user terminal 2, load balancing service node 3 corresponds to user terminal 3; if the number of all user terminals with the same attribute information is 2 (including user terminal 1 and user terminal 2), and the number of all load balancing service nodes is 3 (including load balancing service node 1, load balancing service node 2 and load balancing service node 3), then load balancing service node 1 corresponds to user terminal 1, and load balancing service node 2 corresponds to user terminal 2; if the number of all user terminals with the same attribute information is 3 (including user terminal 1, user terminal 2 and user terminal 3), and the number of all load balancing service nodes is 2 (including load balancing service node 1 and load balancing service node 2), then load balancing service node 1 corresponds to user terminal 1 and user terminal 3, and load balancing service node 2 corresponds to user terminal 2, or, load balancing service node 1 corresponds to user terminal 1, and load balancing service node 2 corresponds to user terminal 2 and user terminal 3, and the principle is similar.

[0059] It can be understood that by determining the load balancing service nodes and user terminals, it is ensured that when the number of load balancing service nodes is greater than the number of user terminals, each user terminal with the same attribute information can be called by a load balancing service node using the SDK of its corresponding attribute information. It can also be ensured that when the number of load balancing service nodes is less than the number of user terminals, each load balancing service node can process the minimum number of user terminals with the same attribute information, so as to avoid a single load balancing service node processing too many SDKs with the same attribute information, resulting in the triggering limit of the SDK access number making it impossible to send requests, and also avoid the problem of sudden increase in node pressure under a large number of requests and slow request response.

[0060] In this embodiment, the corresponding load balancing module in the load balancing service node is selected by judging the type of the request signaling (whether it is a stream request, a request of the rtsp protocol, etc.) based on the information of the request signaling.

[0061] In this embodiment, according to the protocol information of the proxied signaling request, the proxied signaling request can be sent to the load balancing service module in the corresponding load balancing service node for processing, thereby accessing the streaming media service node.

[0062] Step S202: The load balancing service node makes a decision on the streaming service node access for the user terminal, and sends the proxied signaling request to the streaming service node corresponding to the user terminal, so that the streaming service node establishes a streaming connection with the user terminal according to the proxied signaling request.

[0063] As a preferred solution of this embodiment, the decision of accessing a streaming media service node for the user terminal is made through the load balancing service node, and the proxied signaling request is sent to the streaming media service node corresponding to the user terminal, so that the streaming media service node establishes a streaming connection with the user terminal according to the proxied signaling request, specifically including:

[0064] Based on the protocol information of the proxied signaling request, a decision is made on the streaming media service node access for the user terminal through the load balancing service module in the corresponding load balancing service node, and the streaming media service node corresponding to the user terminal is obtained; the proxied signaling request is sent to the streaming media service node, so that the streaming media service node feeds back response information according to the proxied signaling request, and returns the stream address to the user terminal through the corresponding streaming media service node and proxy service, thereby establishing a stream connection between the user terminal and the streaming media service node.

[0065] In this embodiment, the protocol information of the signaling request after the proxy includes http protocol information, websocket protocol information and rtsp protocol information. The http protocol information is used to provide the user-side signaling interaction and other non-signaling interactions, the websocket protocol information is used to provide the user-side real-time stream and playback stream preview and fetching, and the rtsp protocol information is used to provide the real-time stream preview and fetching in the rtsp information.

[0066] In this embodiment, for the request load balancing of http protocol information, please refer to Figure 3, a request is initiated by the user end, and the request reaches the NGI NX gateway service. Then the NGI NX gateway service routes the request to a load balancing service through its own load balancing algorithm, including but not limited to the round robin algorithm. The load balancing service node receives the request and processes it through the algorithm in the internal load balancing module to determine whether the request is a signaling request. If it is a signaling request, it queries Red IS to obtain load information, finds the streaming media service node connected to the device associated with the request, and sends the request to the streaming media service on behalf of the server. If it is not a signaling request, a streaming media service is randomly selected to proxy the request. In this way, the streaming media service receives the proxy request sent by the load balancing service, processes it and responds to the result.

[0067] In this embodiment, for websocket flow load balancing, please refer to Figure 4 The client sends an HTTP request, which carries the device ID, channel, and stream type of the stream. Since it is an HTTP request, it follows the load balancing workflow of HTTP requests. It first enters the NGI NX gateway and is routed to the load balancing service. The load balancing service makes a decision and queries the streaming media load information of Redis. It gives priority to the streaming media service node that has distributed the on-demand stream. Otherwise, it is the same as the election of the HTTP request. It finds the streaming media service node connected to the device and returns the decided stream address. The stream address directly points to the real address of the streaming media. The client receives the response and uses the obtained stream address to directly initiate a stream connection to the specified streaming media. The streaming media performs connection processing and uploads it.

[0068] In this embodiment, for rtsp stream load balancing, please refer to Figure 5 ,rtsp stream is similar to websocket stream, but its interaction is different from websocket. The user sends an rtsp request to the rtsp proxy service. The rtsp proxy service obtains the registered load balancing service list through consu l, randomly selects a load balancing service node, and sends an http request to the load balancing service node. The request is used to decide on the on-demand service of the stream. The decision algorithm is the same as the websocket stream decision algorithm. It responds to the streaming media address after the election. After the rtsp proxy service obtains the response result, it splices the on-demand address string and sets the redirection information in the rtsp response content. The rtsp user receives the redirection response and automatically makes a redirection request according to the response content. The streaming media service receives the rtsp request sent by the user and processes it.

[0069] Step S203: until all the user terminals that have sent signaling requests have established streaming connections with their corresponding streaming media service nodes.

[0070] In this embodiment, when all the users that have sent signaling requests have established streaming connections with their corresponding streaming service nodes, the initial connection between the user terminals and the streaming service nodes has been completed, and dynamic load balancing monitoring can be performed on the user terminals and streaming media.

[0071] Step S102: Acquire all the clients accessing the streaming media service, and traverse the information of all the clients to obtain the attribute information corresponding to each client.

[0072] In this embodiment, the information of all access device user terminals in the entire streaming media service can be obtained through redis, wherein the user terminal information includes the streaming media node information and device information currently accessed by it, and the device information may include attribute information. Preferably, the attribute information may be the manufacturer information of the device corresponding to the user terminal.

[0073] Step S103: according to the attribute information of each user terminal, the access quantity of the user terminals corresponding to the same attribute information and the quantity of the streaming media service nodes are obtained; wherein the streaming media service includes a plurality of streaming media service nodes.

[0074] In this embodiment, the device information of all connected user terminals is traversed to obtain the number of user terminals connected to each manufacturer n and the number of all streaming nodes m in the current streaming service that are in working state. The number of all streaming nodes m in the current streaming service that are in working state can be obtained by statistically analyzing the streaming node information currently connected to each user terminal.

[0075] Step S104: obtaining an average distribution strategy according to the access quantity and the number of streaming media service nodes; wherein the average distribution strategy includes: according to the attribute information corresponding to each user terminal, evenly distributing each user terminal to the streaming media service node that needs to be accessed.

[0076] As a preferred solution of this embodiment, the method of obtaining the access quantity and the number of streaming media service nodes of the user terminals corresponding to the same attribute information according to the attribute information of each user terminal, and obtaining the average distribution strategy according to the access quantity and the number of streaming media service nodes, specifically includes:

[0077] According to the attribute information of each user terminal, the current access number of all user terminals with the same attribute information is obtained, thereby obtaining the current access number of all user terminals under each attribute information; according to the working status of each streaming service node in the streaming service, the number of streaming service nodes that can be used for streaming business processing is obtained as the number of streaming service nodes; according to the current access number of all user terminals under each attribute information and the number of streaming service nodes, the number of all user terminals under any attribute information averagely allocated to each streaming service node is calculated, so that all user terminals have a corresponding streaming service node to access them.

[0078] In this embodiment, based on the number n of user-side access corresponding to each manufacturer and the number m of all streaming nodes in working state in the current streaming service, the result of evenly distributing the corresponding user-side devices of each manufacturer to the streaming service nodes can be obtained, that is, an even distribution strategy is obtained.

[0079] In this embodiment, the user terminal access status of each streaming media service node is traversed. If the number of user terminal accesses corresponding to the same manufacturer does not correspond to the averagely distributed number, under this condition, that is, the number of accesses to a node is less than the expected number, there must be another node with more accesses than the expected number, and the designated device can be found for connection allocation.

[0080] For example, if the number of all the user terminals with the same attribute information is 3 (including user terminal 1, user terminal 2 and user terminal 3), and the number of all the streaming service nodes is 3 (including streaming service node 1, streaming service node 2 and streaming service node 3), then each user terminal with the same attribute information is evenly distributed to each streaming service node, that is, streaming service node 1 corresponds to user terminal 1, streaming service node 2 corresponds to user terminal 2, and streaming service node 3 corresponds to user terminal 3; if the number of all the user terminals with the same attribute information is 2 (including user terminal 1 and user terminal 2), the number of all the streaming service nodes is is 3 (including streaming service node 1, streaming service node 2 and streaming service node 3), then streaming service node 1 corresponds to user terminal 1, and streaming service node 2 corresponds to user terminal 2; if the number of all user terminals with the same attribute information is 3 (including user terminal 1, user terminal 2 and user terminal 3), and the number of all streaming service nodes is 2 (including streaming service node 1 and streaming service node 2), then streaming service node 1 corresponds to user terminal 1 and user terminal 3, and streaming service node 2 corresponds to user terminal 2, or, streaming service node 1 corresponds to user terminal 1, and streaming service node 2 corresponds to user terminal 2 and user terminal 3, and the principle is the same. It should be noted that the load balancing node that processes the user terminal request does not necessarily need to correspond one-to-one with the streaming service node. It only needs to ensure that when processing the request of the user terminal, there is a corresponding load balancing node and streaming service node.

[0081] It can be understood that by determining the streaming service nodes and user terminals, it is ensured that when the number of streaming service nodes is greater than the number of user terminals, each user terminal with the same attribute information can be called by a streaming service node using the SDK with its corresponding attribute information. It can also be ensured that when the number of streaming service nodes is less than the number of user terminals, each streaming service node can process the minimum number of user terminals with the same attribute information, so as to avoid a single streaming service node processing too many SDKs with the same attribute information, resulting in the triggering limit on the number of SDK accesses making it impossible to send requests, and to avoid the problem of a sudden increase in node pressure under a large number of requests and slow request response.

[0082] Step S105: traverse the access status of all user terminals, and if the streaming media service node currently accessed by a user terminal does not comply with the average allocation strategy, access the user terminal to the streaming media service node it needs to access according to the average allocation strategy.

[0083] As a preferred solution of this embodiment, after the user terminal is connected to the streaming media service node that it needs to access according to the average distribution strategy, the method further includes:

[0084] According to all the user terminal information written into the database, the user terminal information currently accessing the streaming media service node is compared to obtain the non-accessed user terminal; according to the attribute information of the non-accessed user terminal, the streaming media service node is allocated and accessed to the non-accessed user terminal.

[0085] In this embodiment, all user terminal device information is obtained from the database, the device information in the database is compared with the connected device information, the currently unconnected devices are found, and access allocation is performed, thereby ensuring that the user terminals access the streaming media service nodes evenly distributed.

[0086] It can be understood that the load balancing service cluster and streaming media service of this embodiment have high availability and high concurrency capabilities, and deploy multiple service nodes of the same type. When a node crashes, the system can still run stably. For frequent business request processing, load balancing can distribute them relatively evenly to each streaming media node for processing. At the same time, it also solves different attribute information, such as the number of device access restrictions of different manufacturers' SDKs, and through dynamic resource allocation, maintains a regular polling task responsible for checking the access status of the device, automatically adjusting the device access, and maintaining resource balance. At the same time, it has good scalability and can easily add or delete service nodes without changing other configurations of the cluster. The number of service instances can be flexibly changed when the system load demand changes.

[0087] Implementing the above embodiments has the following effects:

[0088] The technical solution of the present invention obtains all user terminals accessing the streaming media service and the attribute information corresponding to each user terminal, and then can determine the access quantity and the number of streaming media service nodes of all user terminals under the same attribute information, so as to accurately and evenly allocate each user terminal under the same attribute information to the corresponding streaming media service node, and construct an average allocation strategy to avoid too many user terminals under the same attribute information occupying the same streaming media service node, resulting in the service access quantity exceeding the limit and the inability to maintain resource balance, while also avoiding reducing the high availability of the streaming media service; thus, through the average allocation strategy, the access status of all current user terminals after traversal is combined, and the user terminal is accessed to the corresponding streaming media service node with the average allocation strategy, thereby ensuring high concurrency and high availability of the streaming media service, realizing dynamic allocation of resources, and improving the efficiency of the video streaming service.

[0089] Embodiment 2

[0090] See also Figure 6 , which is a streaming media load balancing device provided by the present invention, comprising: an attribute information module 201, a quantity module 202, an allocation strategy module 203 and an access module 204;

[0091] The attribute information module 201 is used to obtain all the user terminals accessing the streaming media service, and traverse the information of all the user terminals to obtain the attribute information corresponding to each user terminal;

[0092] The quantity module 202 is used to obtain the access quantity of the user terminals and the quantity of the streaming media service nodes corresponding to the same attribute information according to the attribute information of each user terminal; wherein the streaming media service includes a plurality of streaming media service nodes;

[0093] The allocation strategy module 203 is used to obtain an average allocation strategy according to the access quantity and the number of streaming media service nodes; wherein the average allocation strategy includes: according to the attribute information corresponding to each user terminal, each user terminal is evenly allocated to the streaming media service node to be accessed;

[0094] The access module 204 is used to traverse the access status of all user terminals. If the streaming media service node accessed by the current user terminal does not comply with the average allocation strategy, the user terminal is accessed to the streaming media service node it needs to access according to the average allocation strategy.

[0095] As a preferred solution, before acquiring all the user terminals accessing the streaming media service, the method further includes:

[0096] In response to a signaling request sent by any user terminal, proxy the signaling request and determine the load balancing service node corresponding to the proxy signaling request;

[0097] Through the load balancing service node, a decision is made on the streaming media service node access for the user terminal, and the proxied signaling request is sent to the streaming media service node corresponding to the user terminal, so that the streaming media service node establishes a streaming connection with the user terminal according to the proxied signaling request;

[0098] Until all the user terminals that have sent signaling requests establish streaming connections with their corresponding streaming media service nodes.

[0099] As a preferred solution, the proxying of the signaling request and determining the load balancing service node corresponding to the proxy signaling request specifically includes:

[0100] According to the signaling request, determine the proxy service corresponding to the user terminal; wherein the proxy service includes nginx proxy service and rtsp proxy service;

[0101] The signaling request is proxied through the determined user-side proxy service, so that according to the proxied signaling request, the load balancing service node corresponding to the signaling request is determined in the load balancing service cluster, and the proxied signaling request is sent to the load balancing service module in the corresponding load balancing service node; wherein, the load balancing service cluster includes a plurality of load balancing service nodes, and each load balancing service node includes a plurality of load balancing service modules.

[0102] As a preferred solution, the method of determining the load balancing service node corresponding to the signaling request in the load balancing service cluster according to the proxied signaling request, and sending the proxied signaling request to the load balancing service module in the corresponding load balancing service node specifically includes:

[0103] According to the attribute information of the user end corresponding to the signaling request after the proxy, determine the corresponding load balancing service node in the load balancing service cluster; wherein all the user ends under each same attribute information are evenly distributed to the load balancing service nodes in the load balancing service cluster;

[0104] According to the protocol information of the proxied signaling request, the proxied signaling request is sent to the load balancing service module in the corresponding load balancing service node; wherein the protocol information includes http protocol information, websocket protocol information and rtsp protocol information.

[0105] As a preferred solution, the decision of accessing a streaming media service node for the user terminal is made through the load balancing service node, and the proxied signaling request is sent to the streaming media service node corresponding to the user terminal, so that the streaming media service node establishes a streaming connection with the user terminal according to the proxied signaling request, specifically including:

[0106] Based on the protocol information of the signaling request after the proxy, the decision of the streaming media service node access is made for the user terminal through the load balancing service module in the corresponding load balancing service node, and the streaming media service node corresponding to the user terminal is obtained;

[0107] The proxied signaling request is sent to the streaming service node, so that the streaming service node feeds back response information according to the proxied signaling request, and returns the stream address to the user terminal through the corresponding streaming service node and proxy service, thereby establishing a stream connection between the user terminal and the streaming service node.

[0108] As a preferred solution, the method of obtaining the access quantity and the number of streaming media service nodes of the user terminals corresponding to the same attribute information according to the attribute information of each user terminal, and obtaining the average distribution strategy according to the access quantity and the number of streaming media service nodes, specifically includes:

[0109] According to the attribute information of each user terminal, the current access number of all user terminals with the same attribute information is obtained, thereby obtaining the current access number of all user terminals under each attribute information;

[0110] According to the working status of each streaming media service node in the streaming media service, the number of streaming media service nodes available for streaming media business processing is obtained as the number of streaming media service nodes;

[0111] According to the current access quantity of all users under each attribute information and the number of streaming service nodes, the number of all users under any attribute information evenly allocated to each streaming service node is calculated, so that all users have a corresponding streaming service node to access.

[0112] As a preferred solution, after the user terminal is connected to the streaming media service node that it needs to access according to the average distribution strategy, the method further includes:

[0113] According to all the user terminal information written into the database, the user terminal information currently connected to the streaming media service node is compared to obtain the unconnected user terminal;

[0114] According to the attribute information of the non-connected user terminal, a streaming media service node is allocated and accessed to the non-connected user terminal.

[0115] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the device described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.

[0116] Implementing the above embodiments has the following effects:

[0117] The technical solution of the present invention obtains all user terminals accessing the streaming media service and the attribute information corresponding to each user terminal, and then can determine the access quantity and the number of streaming media service nodes of all user terminals under the same attribute information, so as to accurately and evenly allocate each user terminal under the same attribute information to the corresponding streaming media service node, and construct an average allocation strategy to avoid too many user terminals under the same attribute information occupying the same streaming media service node, resulting in the service access quantity exceeding the limit and the inability to maintain resource balance, while also avoiding reducing the high availability of the streaming media service; thus, through the average allocation strategy, the access status of all current user terminals after traversal is combined, and the user terminal is accessed to the corresponding streaming media service node with the average allocation strategy, thereby ensuring high concurrency and high availability of the streaming media service, realizing dynamic allocation of resources, and improving the efficiency of the video streaming service.

[0118] Embodiment 3

[0119] Correspondingly, the present invention also provides a terminal device, comprising: a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein when the processor executes the computer program, the method for streaming media load balancing as described in any one of the above embodiments is implemented.

[0120] The terminal device of this embodiment includes: a processor, a memory, and a computer program and a computer instruction stored in the memory and executable on the processor. When the processor executes the computer program, each step in the above-mentioned embodiment 1 is implemented, for example: Figure 1 Alternatively, the processor implements the functions of each module / unit in the above device embodiment, such as the access module 204, when executing the computer program.

[0121] Exemplarily, the computer program can be divided into one or more modules / units, and the one or more modules / units are stored in the memory and executed by the processor to complete the present invention. The one or more modules / units can be a series of computer program instruction segments that can complete specific functions, and the instruction segments are used to describe the execution process of the computer program in the terminal device. For example, the access module 204 is used to traverse the access status of all user terminals. If the streaming media service node accessed by the current user terminal does not comply with the average distribution strategy, the user terminal is connected to the streaming media service node that it needs to access according to the average distribution strategy.

[0122] The terminal device may be a computing device such as a desktop computer, a notebook, a PDA, and a cloud server. The terminal device may include, but is not limited to, a processor and a memory. Those skilled in the art will appreciate that the schematic diagram is merely an example of a terminal device and does not constitute a limitation on the terminal device. The terminal device may include more or fewer components than shown in the diagram, or may combine certain components, or different components. For example, the terminal device may also include an input / output device, a network access device, a bus, etc.

[0123] The processor may be a central processing unit (CPU), other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor, etc. The processor is the control center of the terminal device, and various interfaces and lines are used to connect various parts of the entire terminal device.

[0124] The memory can be used to store the computer program and / or module, and the processor realizes various functions of the terminal device by running or executing the computer program and / or module stored in the memory, and calling the data stored in the memory. The memory can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, at least one application required for a function, etc.; the data storage area can store data created according to the use of the mobile terminal, etc. In addition, the memory can include a high-speed random access memory, and can also include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart memory card (Smart Med ia Card, SMC), a secure digital (SecureDi gita l, SD) card, a flash card (F l ash Card), at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.

[0125] Wherein, if the module / unit integrated in the terminal device 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 such an understanding, the present invention implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Wherein, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, U disk, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM, Read-On l yMemory), random access memory (RAM, Random Access Memory), electric carrier signal, telecommunication signal and software distribution medium. It should be noted that the content contained in the computer-readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electric carrier signals and telecommunication signals.

[0126] Embodiment 4

[0127] Correspondingly, the present invention also provides a computer-readable storage medium, which includes a stored computer program, wherein when the computer program is running, the device where the computer-readable storage medium is located is controlled to execute the method for streaming media load balancing as described in any one of the above embodiments.

[0128] The specific embodiments described above further illustrate the purpose, technical solutions and beneficial effects of the present invention. It should be understood that the above description is only a specific embodiment of the present invention and is not intended to limit the scope of protection of the present invention. It is particularly pointed out that for those skilled in the art, any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention should be included in the scope of protection of the present invention.

Claims

1. A method for streaming media load balancing, characterized in that: include: Obtain all client terminals that access the streaming media service, and traverse the information of all client terminals to obtain the attribute information corresponding to each client terminal; According to the attribute information of each user terminal, the access quantity and the number of streaming media service nodes corresponding to the user terminals with the same attribute information are obtained; wherein the streaming media service includes a plurality of streaming media service nodes; According to the access quantity and the number of streaming media service nodes, an average distribution strategy is obtained; wherein the average distribution strategy includes: according to the attribute information corresponding to each user terminal, each user terminal is evenly distributed to the streaming media service node to be accessed; The access conditions of all the user terminals are traversed. If the streaming media service node accessed by the current user terminal does not conform to the average allocation strategy, the user terminal is accessed to the streaming media service node that it needs to access according to the average allocation strategy.

2. A method for streaming media load balancing as claimed in claim 1, characterized in that: Before acquiring all the user terminals accessing the streaming media service, the method further includes: In response to a signaling request sent by any user terminal, proxy the signaling request and determine the load balancing service node corresponding to the proxy signaling request; Through the load balancing service node, a decision is made on the streaming media service node access for the user terminal, and the proxied signaling request is sent to the streaming media service node corresponding to the user terminal, so that the streaming media service node establishes a streaming connection with the user terminal according to the proxied signaling request; Until all the user terminals that have sent signaling requests establish streaming connections with their corresponding streaming media service nodes.

3. A method for streaming media load balancing as claimed in claim 2, characterized in that: The proxying of the signaling request and determining the load balancing service node corresponding to the proxy signaling request specifically includes: According to the signaling request, determine the proxy service corresponding to the user terminal; wherein the proxy service includes nginx proxy service and rtsp proxy service; The signaling request is proxied through the determined user-side proxy service, so that according to the proxied signaling request, the load balancing service node corresponding to the signaling request is determined in the load balancing service cluster, and the proxied signaling request is sent to the load balancing service module in the corresponding load balancing service node; wherein, the load balancing service cluster includes a plurality of load balancing service nodes, and each load balancing service node includes a plurality of load balancing service modules.

4. A method for streaming media load balancing as claimed in claim 3, characterized in that: The method of determining, according to the proxied signaling request, a load balancing service node corresponding to the signaling request in the load balancing service cluster, and sending the proxied signaling request to a load balancing service module in the corresponding load balancing service node specifically includes: According to the attribute information of the user end corresponding to the signaling request after the proxy, determine the corresponding load balancing service node in the load balancing service cluster; wherein all the user ends under each same attribute information are evenly distributed to the load balancing service nodes in the load balancing service cluster; According to the protocol information of the proxied signaling request, the proxied signaling request is sent to the load balancing service module in the corresponding load balancing service node; wherein the protocol information includes http protocol information, websocket protocol information and rtsp protocol information.

5. A method for streaming media load balancing as claimed in claim 4, characterized in that: The step of making a decision on the streaming media service node access for the user terminal through the load balancing service node, and sending the proxied signaling request to the streaming media service node corresponding to the user terminal, so that the streaming media service node establishes a streaming connection with the user terminal according to the proxied signaling request, specifically includes: Based on the protocol information of the signaling request after the proxy, the decision of the streaming media service node access is made for the user terminal through the load balancing service module in the corresponding load balancing service node, and the streaming media service node corresponding to the user terminal is obtained; The proxied signaling request is sent to the streaming service node, so that the streaming service node feeds back response information according to the proxied signaling request, and returns the stream address to the user terminal through the corresponding streaming service node and proxy service, thereby establishing a stream connection between the user terminal and the streaming service node.

6. A method for streaming media load balancing as claimed in claim 1, characterized in that: The method of obtaining the access quantity and the number of streaming media service nodes of the user terminals corresponding to the same attribute information according to the attribute information of each user terminal, and obtaining the average distribution strategy according to the access quantity and the number of streaming media service nodes, specifically includes: According to the attribute information of each user terminal, the current access number of all user terminals with the same attribute information is obtained, thereby obtaining the current access number of all user terminals under each attribute information; According to the working status of each streaming media service node in the streaming media service, the number of streaming media service nodes available for streaming media business processing is obtained as the number of streaming media service nodes; According to the current access quantity of all users under each attribute information and the number of streaming service nodes, the number of all users under any attribute information evenly allocated to each streaming service node is calculated, so that all users have a corresponding streaming service node to access.

7. A method for streaming media load balancing according to any one of claims 1 to 6, characterized in that: After the user terminal is connected to the streaming media service node that the user terminal needs to access according to the average distribution strategy, the method further includes: According to all the user terminal information written into the database, the user terminal information currently connected to the streaming media service node is compared to obtain the unconnected user terminal; According to the attribute information of the non-connected user terminal, a streaming media service node is allocated and accessed to the non-connected user terminal.

8. A streaming media load balancing device, characterized in that: include: Attribute information module, quantity module, allocation strategy module and access module; The attribute information module is used to obtain all the user terminals accessing the streaming media service, and traverse the information of all the user terminals to obtain the attribute information corresponding to each user terminal; The quantity module is used to obtain the access quantity of the user terminals and the quantity of the streaming media service nodes corresponding to the same attribute information according to the attribute information of each user terminal; wherein the streaming media service includes a plurality of streaming media service nodes; The allocation strategy module is used to obtain an average allocation strategy according to the access quantity and the number of streaming media service nodes; wherein the average allocation strategy includes each user terminal being evenly allocated to the streaming media service node to be accessed according to its corresponding attribute information; The access module is used to traverse the access status of all user terminals. If the streaming media service node accessed by the current user terminal does not comply with the average distribution strategy, the user terminal is connected to the streaming media service node it needs to access according to the average distribution strategy.

9. A terminal device, characterized in that: The method comprises a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein when the processor executes the computer program, the method for streaming media load balancing as described in any one of claims 1 to 7 is implemented.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored computer program, wherein when the computer program is executed, the device where the computer-readable storage medium is located is controlled to execute the method for streaming media load balancing according to any one of claims 1 to 7.