Source return path scheduling method and device
By analyzing the audience terminal information and obtaining the bandwidth of the computer room, the dynamic decision-making hash ring is constructed, which solves the problems of high resource consumption and uneven scheduling in the existing CDN live broadcast back-to-source path scheduling, and achieves uniformity of flow distribution and cost optimization.
Patent Information
- Application Number
- CN202410720485.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-04
- Publication Date
- 2024-09-27
AI Technical Summary
When the existing CDN live broadcast back-to-source path scheduling method updates the hash ring in real time, it results in high CPU and memory consumption, frequent changes in the computer room, increased costs, and may cause bandwidth overflow, and does not sense changes in the remaining bandwidth in real time, resulting in unbalanced scheduling. , increasing the possibility of bandwidth overflow in large computer rooms.
By analyzing the region and operator information of the audience terminal, we can obtain the remaining bandwidth of the available computer room and the heat level of the target stream, dynamically decide whether to build a new hash ring, and build or reconstruct the hash ring based on the heat level of different streams and the bandwidth of the computer room. Scheduling and distribution flows to appropriate computer rooms.
Cost and quality are optimized, computing costs are reduced, flow distribution tree bifurcation is avoided, flow distribution is uniform, and the risk of bandwidth overflow is reduced.
Smart Images

Figure CN118714359A
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of live broadcast technology, and in particular, to a method, apparatus, computer equipment, computer-readable storage medium, and computer program product for scheduling a back-to-source path. Background Art
[0002] With the rapid popularization of Internet technology, online live broadcasting is being accepted and loved by more and more people. Online live broadcasting generally involves: live broadcasting platform, anchor terminal and audience terminal, among which the anchor terminal can provide multimedia content (such as video content) to the audience terminal through the live broadcasting platform, and can also receive multimedia content (such as commentary content) provided by the audience terminal through the live broadcasting platform, thereby achieving the effect of live broadcast and interactive. Since online live broadcasting has strong liveness and interactivity, it is favored by more and more audiences and anchors.
[0003] In the live broadcast architecture, CDN live broadcast downstream is mainly responsible for the distribution of streaming media audio and video streams, distributing the live stream of the upstream push stream node (anchor terminal) into a tree structure to meet the requests of large-scale users. In this distribution process, pulling the stream from the viewer terminal to the anchor terminal or the source station is back to the source. Generally, when CDN receives a playback request from the viewer terminal user for back to the source, it will build a hash ring for machine room selection scheduling, and determine the number of hash rings to be built by the total bandwidth.
[0004] However, according to the above hash ring construction method, if the hash ring is constantly updated in real time according to the remaining bandwidth of the computer room, it will lead to large CPU and memory consumption. At the same time, it will cause the computer room hit by the flow to change constantly, resulting in more forks in the flow distribution tree and increased costs. If the remaining bandwidth changes are not perceived in real time, it will lead to an imbalance in the scheduling of large and small computer rooms, and the flow will be concentrated in the large computer room, which will also increase the possibility of bandwidth overflow in the large computer room.
[0005] It should be noted that the above content is not necessarily prior art, nor is it intended to limit the scope of patent protection of this application. Summary of the invention
[0006] The embodiments of the present application provide a back-to-source path scheduling method, apparatus, computer equipment, computer-readable storage medium, and computer program product to solve or alleviate one or more of the technical problems raised above.
[0007] An aspect of an embodiment of the present application provides a method for scheduling a back-to-source path, the method comprising:
[0008] In response to a play request from a viewer terminal for a target stream, parsing the play request to obtain region and operator information of the viewer terminal;
[0009] Acquire an available computer room in the content distribution network according to the region and operator information, and acquire the remaining bandwidth of the available computer room;
[0010] Obtaining the real-time number of viewers of the target stream to determine the popularity level of the target stream;
[0011] Based on the heat level of the target flow, determine whether to construct a new hash ring or use an already constructed hash ring according to the remaining bandwidth of the available computer room;
[0012] The target stream is distributed to the machine room used by the viewer terminal according to the determined hash ring scheduling.
[0013] Optionally, acquiring an available computer room in a content distribution network according to the region and operator information includes:
[0014] A first computer room list covered by the operator in the region is obtained, where the computer rooms in the first computer room list are the available computer rooms.
[0015] Optionally, after obtaining the available computer room, the method further includes:
[0016] Obtain a list of second computer rooms included in the current flow distribution tree of the target flow;
[0017] Comparing the first computer room list with the second computer room list;
[0018] In the case where the first computer room list and the second computer room list have no intersection, the step of obtaining the remaining bandwidth of the available computer rooms is performed.
[0019] Optionally, the method further comprises:
[0020] When the first computer room list and the second computer room list have an intersection, obtaining a third computer room list contained in the intersection;
[0021] Obtain the remaining bandwidth of the corresponding computer room in the third computer room list;
[0022] The target stream is dispatched and distributed to the computer room used by the viewer terminal from the third computer room list according to the remaining bandwidth.
[0023] Optionally, the determining, based on the heat level of the target flow, whether to construct a new hash ring according to the remaining bandwidth of the available computer room or to use an already constructed hash ring includes:
[0024] When the heat level of the target flow is cold flow and there is no constructed hash ring for the target flow and the available computer room, a new hash ring for the target flow and the available computer room is constructed according to the remaining bandwidth of the available computer room.
[0025] Optionally, the determining, based on the heat level of the target flow, whether to construct a new hash ring according to the remaining bandwidth of the available computer room or to use the constructed hash ring further includes:
[0026] When the heat level of the target flow is cold flow and there is a constructed hash ring for the target flow and the available computer room, it is determined to use the constructed hash ring.
[0027] Optionally, the determining, based on the heat level of the target flow, whether to construct a new hash ring according to the remaining bandwidth of the available computer room or to use an already constructed hash ring includes:
[0028] When the heat level of the target flow is non-cold flow, obtain the current first time, the second time when the hash ring was last constructed for the target flow and the available computer room, and the time threshold corresponding to the heat level;
[0029] determining a difference between the first time and the second time, and comparing the difference with the time threshold;
[0030] When the difference exceeds the time threshold, a new hash ring is constructed for the target flow and the available computer room according to the remaining bandwidth of the available computer room.
[0031] Optionally, the determining, based on the heat level of the target flow, whether to construct a new hash ring according to the remaining bandwidth of the available computer room or to use the constructed hash ring further includes:
[0032] When the difference does not exceed the time threshold, it is determined to use the hash ring constructed last time for the target flow and the available computer room.
[0033] Optionally, different heat levels correspond to different time thresholds, wherein the higher the heat level, the smaller the time threshold.
[0034] Another aspect of an embodiment of the present application provides a back-to-source path scheduling device, the device comprising:
[0035] A parsing module, configured to respond to a play request of a viewer terminal for a target stream and parse the play request to obtain region and operator information of the viewer terminal;
[0036] An acquisition module, used to acquire available computer rooms in the content distribution network according to the region and operator information, and to acquire remaining bandwidth of the available computer rooms;
[0037] A determination module, used for obtaining the real-time number of viewers of the target stream to determine the popularity level of the target stream;
[0038] A construction module, configured to determine, based on the heat level of the target flow, whether to construct a new hash ring according to the remaining bandwidth of the available computer room or to use the constructed hash ring;
[0039] The scheduling module is used to distribute the target stream to the machine room used by the viewer terminal according to the determined hash ring scheduling.
[0040] Another aspect of an embodiment of the present application provides a computer device, including:
[0041] at least one processor; and
[0042] a memory communicatively coupled to the at least one processor;
[0043] Wherein: the memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the method as described above.
[0044] Another aspect of an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer instructions, and when the computer instructions are executed by a processor, the method described above is implemented.
[0045] Another aspect of an embodiment of the present application provides a computer program product, including a computer program, which implements the method described above when executed by a processor.
[0046] The above technical solution adopted in the embodiment of the present application may have the following advantages:
[0047] Combine the real-time flow heat level and the remaining bandwidth of the computer room to dynamically decide whether to build a new hash ring. Based on the heat level of different flows, each flow has its own resource perspective, and only the hash ring is rebuilt according to the remaining bandwidth of the computer room for non-cold flows, so as to optimize the cost and quality. By scheduling different hot flows to different computer rooms, the distribution is more even, while reducing the corresponding computing cost and not causing more forks in the flow distribution tree. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] The accompanying drawings exemplarily illustrate the embodiments and constitute a part of the specification, and together with the text description of the specification, are used to explain the exemplary implementation of the embodiments. The embodiments shown are for illustrative purposes only and do not limit the scope of the claims. In all drawings, the same reference numerals refer to similar but not necessarily identical elements.
[0049] Figure 1 A schematic diagram of an operating environment of a back-to-source path scheduling method according to Embodiment 1 of the present application is shown;
[0050] Figure 2 The flowchart of the back-to-source path scheduling method according to the first embodiment of the present application is schematically shown;
[0051] Figure 3 A schematic diagram of region and operator information according to the back-to-source path scheduling method of the first embodiment of the present application is schematically shown;
[0052] Figure 4 A schematic diagram of a hash ring of the back-to-source path scheduling method according to the first embodiment of the present application is schematically shown;
[0053] Figure 5 A flowchart of an optional embodiment of the back-to-source path scheduling method according to the first embodiment of the present application is schematically shown;
[0054] Figure 6 A schematic diagram of a flow distribution tree of the back-to-source path scheduling method according to the first embodiment of the present application is schematically shown;
[0055] Figure 7 Schematically shows Figure 2 A detailed flow chart of step S206;
[0056] Figure 8 A schematic diagram schematically shows a mapping relationship between a heat level, a time threshold, and a judgment condition according to a back-to-source path scheduling method according to Embodiment 1 of the present application;
[0057] Fig. 9 A flowchart schematically shows an exemplary application of the back-to-source path scheduling method according to the first embodiment of the present application;
[0058] Fig.10 A block diagram of a back-to-source path scheduling device according to Embodiment 2 of the present application is schematically shown; and
[0059] Fig.11 The hardware architecture diagram of the computer device according to the third embodiment of the present application is schematically shown. DETAILED DESCRIPTION
[0060] In order to make the purpose, technical solutions and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present application.
[0061] It should be noted that the descriptions involving "first", "second", etc. in the embodiments of the present application are only for descriptive purposes and cannot be understood as indicating or implying their relative importance or implicitly indicating the number of technical features indicated. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In addition, the technical solutions between the various embodiments can be combined with each other, but they must be based on the ability of ordinary technicians in the field to implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such combination of technical solutions does not exist and is not within the scope of protection required by this application.
[0062] In the description of the present application, it should be understood that the numerical labels before the steps do not indicate the order in which the steps are executed, but are only used to facilitate the description of the present application and to distinguish each step, and therefore should not be understood as a limitation on the present application.
[0063] First, the following terms are explained:
[0064] CDN (Content Delivery Network): is a new type of content service system based on IP network. Through the strategic construction and deployment of widely distributed edge servers, supplemented by relevant load balancing and central platform scheduling strategies, it can enable visiting users to access the available edge servers nearby and obtain the required content, thereby improving cache hit rate and response speed. The general CDN architecture is a tree-like structure that relies on layering and port multiplexing to improve the load capacity of the entire system. The edge-side CDN node close to the user obtains real-time media streams or static files from the source station through layers of back-to-source according to the decision of the scheduling system, thereby providing services to users.
[0065] Push streaming: collects audio and video data from the push streaming node client, encodes it, and encapsulates it using a transmission protocol before transmitting it to the server. The server here is the source station in the CDN architecture.
[0066] Pulling stream: The process in which the playback node client pulls the live media stream to the local computer through the specified source address.
[0067] Back to source: refers to the process by which the playback node client obtains the audio and video information of the requested media stream from the CDN. When a client requests to access a resource, if the resource is not cached on the CDN node, the CDN node will go back to the source station to obtain the resource.
[0068] Stream distribution tree: refers to the mapping of a live stream on the CDN node, which is used to reflect which nodes on the entire network currently have the stream.
[0069] Dynamic back-to-source: refers to dynamically planning the full-link back-to-source path based on many factors such as the real-time flow distribution tree, operator matching, node status (bandwidth, network jitter, memory, CPU, etc.), and flow status (heat, protocol). The selection of the back-to-source path affects the overall cost and quality.
[0070] Hash Ring: It is a data sharding solution that maps nodes and data to a ring structure through a hash function. It is used to achieve data balance and fault tolerance in systems such as distributed caching, load balancing, and distributed databases.
[0071] Consistent Hash (Chash): In distributed systems, data distribution is a key issue because data usually needs to be stored on multiple nodes to improve performance, scalability, and fault tolerance. The core of the data distribution problem is how to reasonably distribute data to different nodes so that the system can efficiently process data requests. The consistent hashing algorithm is an important tool for solving data distribution problems. It can effectively reduce the impact of a large number of failures caused by the increase or decrease of nodes in a distributed system, thereby improving the performance and availability of distributed systems. Its application in self-built downlink backhaul is mainly used to control the bifurcation of the flow distribution tree.
[0072] Bandwidth overflow: refers to the situation where the bandwidth actually used by the scheduled computer room exceeds the maximum tolerance of the computer room, causing network packet loss and resulting in viewing lag.
[0073] Secondly, in order to facilitate those skilled in the art to understand the technical solutions provided in the embodiments of the present application, the relevant technologies are described below:
[0074] When the self-built CDN receives a playback request from a viewer terminal user, it will decide which data centers to use for coverage based on the current user's IP information, the region where the user is located, and the operator. It will also generate a hash ring in real time to select and schedule data centers based on the distribution of the currently requested stream in the CDN.
[0075] In general, the total bandwidth is used to determine the number of hash rings to be built. The essence of this method is to hope that the computer room with large bandwidth capacity will bear more traffic. However, if the hash ring is continuously updated in real time according to the remaining bandwidth of the computer room, it will first lead to greater CPU and memory consumption, that is, it will cause the response time to increase, the user's first opening time to become longer, and the quality to deteriorate. At the same time, more importantly, it will cause the computer room hit by the flow to change constantly, resulting in more bifurcations in the flow distribution tree, that is, the cost will increase. If the remaining bandwidth changes are not perceived in real time, it will lead to an imbalance in the scheduling of large and small computer rooms, and the flow will be concentrated in the large computer room, which will also increase the possibility of bandwidth overflow in the large computer room in disguise.
[0076] To this end, the embodiment of the present application provides a back-to-source path scheduling technical solution. In this technical solution, the real-time flow heat level and the remaining bandwidth of the computer room are combined to dynamically decide whether a new hash ring needs to be built to achieve cost and quality optimization. See below for details.
[0077] Finally, for ease of understanding, an exemplary operating environment is provided below.
[0078] Figure 1 The following schematically shows an environmental application diagram according to an embodiment of the present application.
[0079] The environment diagram may include a service platform 2, anchor terminals (4A, 4B, ..., 4M), and audience terminals (6A, 6B, ..., 6N). In a live broadcast scenario, the anchor terminals (4A, 4B, ..., 4M) log in to the service platform 2, and the service platform 2 pushes the live broadcast data to the audience terminals (6A, 6B, ..., 6N) in real time.
[0080] The service platform 2 can provide a live broadcast service, which can be a single server, a server cluster or a cloud computing service center. In the embodiment of the present application, the service platform 2 includes a CDN for receiving push streams from anchor terminals (4A, 4B, ..., 4M) and playback requests from audience terminals (6A, 6B, ..., 6N), and distributing live streams.
[0081] The anchor terminal (4A, 4B, ..., 4M) is used to generate live broadcast data in real time and perform streaming operations on the live broadcast data. The live broadcast data may include audio data or video data. The anchor terminal may be an electronic device such as a smart phone or a tablet computer. Of course, the anchor terminal may be a virtual computing instance in the service platform 2.
[0082] The audience terminal (6A, 6B, ..., 6N) can be configured to receive the live broadcast data of the anchor terminal in real time. The audience terminal (6A, 6B, ..., 6N) can be any type of computing device, such as a smart phone, a tablet device, a laptop computer, a smart TV, a car terminal, etc. The audience terminal (6A, 6B, ..., 6N) can have a built-in browser or a special program, and receive the live broadcast data through the browser or the special program to output content to the user. The content may include video, audio, comments, text data and / or the like.
[0083] The audience terminal (6A, 6B, ..., 6N) may include a player. The player outputs (e.g., displays, presents) content to the user. The content may include video, audio, comments, text data and / or the like. The audience terminal (6A, 6B, ..., 6N) may include an interface, which may include an input element (touch screen). For example, the input element may be configured to receive user instructions, which may enable the audience terminal (6A, 6B, ..., 6N) to perform various operations, such as sending a bullet screen, entering a comment, giving a gift, etc.
[0084] The anchor terminals (4A, 4B, ..., 4M), the audience terminals (6A, 6B, ..., 6N) and the service platform 2 may be connected via a network. The network may include various network devices, such as routers, switches, multiplexers, hubs, modems, bridges, repeaters, firewalls and / or proxy devices, etc. The network may include physical links, such as coaxial cable links, twisted pair cable links, optical fiber links, combinations thereof and / or the like. The network may include wireless links, such as cellular links, satellite links, Wi-Fi links and / or the like.
[0085] It should be noted that the number of the host terminals and the audience terminals in the figure is only for illustration and is not used to limit the scope of patent protection of this application. According to actual conditions, there can be any number of host terminals and audience terminals.
[0086] The following uses the service platform as the execution subject to introduce the technical solution of the present application through multiple embodiments. It should be noted that these embodiments can be implemented in a variety of different forms and should not be interpreted as being limited to the embodiments described here.
[0087] Embodiment 1
[0088] Figure 2 The flowchart of the back-to-source path scheduling method according to the first embodiment of the present application is schematically shown.
[0089] like Figure 2 As shown, the back-to-source path scheduling method may include steps S200 to S208, wherein:
[0090] Step S200: In response to a play request from a viewer terminal for a target stream, the play request is parsed to obtain region and operator information of the viewer terminal.
[0091] When a user of a viewer terminal needs to watch a live broadcast room, the viewer terminal will send a play request for the target stream corresponding to the live broadcast room to the service platform. The play request includes the IP address of the viewer terminal. After receiving the play request, the service platform parses the IP address to obtain the region and operator information corresponding to the viewer terminal. Figure 3The figure shows a schematic diagram of region and operator information.
[0092] Step S202: obtaining available computer rooms in the CDN according to the region and operator information, and obtaining remaining bandwidth of the available computer rooms.
[0093] Each operator has different computer rooms in different regions. According to the parsed region and operator information, all computer rooms that can be used to distribute the target stream to the viewer terminal can be obtained. Specifically, a first computer room list covered by the operator in the region is obtained, and the computer rooms in the first computer room list are the available computer rooms. In addition, in order to balance the load, the real-time remaining bandwidth of each computer room needs to be considered when distributing the target stream. Therefore, the remaining bandwidth of the available computer room needs to be obtained in real time for subsequent computer room scheduling.
[0094] Step S204: obtaining the real-time number of viewers of the target stream to determine the popularity level of the target stream.
[0095] In this embodiment, when performing computer room scheduling, it is necessary to consider not only the remaining bandwidth of the available computer room, but also the heat of the target flow. The heat can be reflected by the number of real-time viewers in each computer room. The more real-time viewers there are, the higher the heat level of the target flow. For example, when the number of real-time viewers of the target flow is less than 10, the corresponding heat level is cold flow; when the number of real-time viewers of the target flow is greater than or equal to 10 and less than 100, the corresponding heat level is warm flow; when the number of real-time viewers of the target flow is greater than or equal to 100 and less than 1000, the corresponding heat level is hot flow; when the number of real-time viewers of the target flow is greater than or equal to 100, the corresponding heat level is extremely hot flow.
[0096] Step S206: Based on the heat level of the target flow, determine whether to construct a new hash ring according to the remaining bandwidth of the available computer room or use the constructed hash ring.
[0097] The traditional method of determining the number of hash rings to be built by total bandwidth is essentially to hope that the computer room with large bandwidth capacity will bear more traffic. However, if the hash ring is constantly updated in real time according to the remaining bandwidth of the computer room, it will first lead to large CPU and memory consumption. More importantly, it will cause the computer room hit by the flow to change constantly, resulting in more bifurcations in the flow distribution tree, that is, increased costs. If the remaining bandwidth changes are not perceived in real time, it will lead to an imbalance in the scheduling of large and small computer rooms, and the flow will be concentrated in the large computer room, which will also increase the possibility of bandwidth overflow in the large computer room.
[0098] This embodiment not only considers the real-time remaining bandwidth of each computer room, but also combines the real-time heat level of each flow, and only rebuilds the hash ring based on the remaining bandwidth for non-cold flows. By distributing different hot flows to different computer rooms, the distribution is made more uniform, which also reduces the corresponding computing cost and does not cause an increase in tree forks.
[0099] Specifically, first determine whether the target flow is a cold flow. For cold flows, if there is a constructed hash ring, it is determined to use the constructed hash ring; if there is no constructed hash ring, a new hash ring will be constructed based on the remaining bandwidth. For non-cold flows, it is necessary to obtain the time threshold corresponding to the heat level of the target flow, and construct a new hash ring once according to the remaining bandwidth within each time threshold range. In other words, for cold flows, it will only be rebuilt when the corresponding hash ring does not exist, and it will not be updated in real time. For non-cold flows, the hash ring will be updated in real time according to the remaining bandwidth, and the higher the heat level of the target flow, the smaller the time threshold, that is, the more frequent the update.
[0100] In this embodiment, the hash ring is a consistent hash ring. The core idea of the consistent hash algorithm is to map data and nodes to a unified hash ring. Specifically, it includes the following key contents:
[0101] (1) Calculate a hash value for each node and data: Map each node and data to a hash ring and use the same hash function to convert their names or identifiers into hash values.
[0102] (2) Data location: When data needs to be accessed, the data’s hash value is calculated to determine its location on the hash ring. Then, the hash ring is searched clockwise until the nearest node is found, and the data is mapped to this node.
[0103] (3) Load balancing: The consistent hashing algorithm achieves relatively balanced data distribution by evenly distributing data on the hash ring. When a node joins or leaves, it only affects the data adjacent to the node, without affecting the entire data distribution.
[0104] (4) Fault tolerance: When a node fails, the consistent hashing algorithm will automatically redistribute the data of the failed node to other nodes to maintain data availability.
[0105] like Figure 4 , which is a schematic diagram of the hash ring. Figure 4 In the example, each node represents the name or ID of the computer room, and each key represents the name or ID of the flow. The larger the node bandwidth, the larger the range it is responsible for.
[0106] Step S208: Distribute the target stream to the machine room used by the viewer terminal according to the determined hash ring scheduling.
[0107] After determining to construct a new hash ring or use an already constructed hash ring in the previous step, the computer room scheduling can be performed according to the new hash ring or the already constructed hash ring, and the target stream corresponding to the playback request is distributed to the viewer terminal through one or more scheduled computer rooms. The specific method of performing computer room scheduling according to the hash ring in this embodiment can adopt the existing scheduling method, which will not be repeated here.
[0108] The back-to-source path scheduling method provided in this embodiment can dynamically decide whether to build a new hash ring based on the real-time flow heat level and the remaining bandwidth of the computer room. Based on the heat level of different flows, each flow has its own resource perspective to achieve cost and quality optimization.
[0109] Further reading Figure 5 , is a flowchart of an optional embodiment of the back-to-source path scheduling method proposed in Embodiment 1 of the present application. It can be understood that the flowchart is not used to limit the order of executing the steps. Some steps in the flowchart can also be added or deleted as needed.
[0110] In an optional embodiment, the method Figure 2 The steps of obtaining available data centers in the CDN according to the region and operator information and subsequent steps thereof include:
[0111] S300: Obtain a first computer room list covered by the operator in the region, where the computer rooms in the first computer room list are the available computer rooms.
[0112] S302: Obtain a second computer room list included in the current flow distribution tree of the target flow.
[0113] The stream distribution tree is used to represent the current distribution path of the target stream, including the machine room nodes that have been covered when distributing the target stream to the viewer terminal watching the target stream. Figure 6 FIG. 1 is a schematic diagram of a flow distribution tree. Figure 6 In the example, the stream distribution tree includes a root node (e.g., a source station), a secondary node, and edge nodes of various operators. If the target stream is not watched by any user in a certain area, the stream branch tree will not include the computer room node in the area. According to the stream distribution tree corresponding to the target stream, the second computer room list can be obtained, that is, the computer room list that has transmitted the target stream.
[0114] S304, compare whether the first computer room list and the second computer room list have an intersection. If the first computer room list and the second computer room list do not have an intersection, execute step S306. If the first computer room list and the second computer room list have an intersection, execute steps S308-S312.
[0115] S306: Obtain the remaining bandwidth of the available computer room.
[0116] If there is no intersection between the first machine room list and the second machine room list, it means that the path that has transmitted the target stream cannot be directly used to distribute the target stream to the viewer terminal. At this time, it is necessary to obtain the remaining bandwidth of all the available machine rooms and continue to execute Figure 2 The subsequent steps (S204-S208) in.
[0117] S308: Obtain a list of third computer rooms included in the intersection.
[0118] S310: Obtain the remaining bandwidth of the corresponding computer room in the third computer room list.
[0119] S312: Distribute the target stream to the computer room used by the viewer terminal from the third computer room list according to the remaining bandwidth.
[0120] If there is an intersection between the first computer room list and the second computer room list, it means that the path that has transmitted the target stream can be directly used to distribute the target stream to the viewer terminal. At this time, it is only necessary to obtain the third computer room list contained in the intersection and obtain the remaining bandwidth of the corresponding computer room in the third computer room list. Then, according to the remaining bandwidth of each computer room in the third computer room list, the target stream is scheduled to be distributed to the computer room used by the viewer terminal, for example, the computer room with the largest remaining bandwidth is selected for scheduling, without the need to schedule within the range of all the available computer rooms, and without the need to create or update the hash ring.
[0121] Further reading Figure 7 ,for Figure 2 A detailed flow chart of step S206 in FIG. It can be understood that the flow chart is not used to limit the order of executing the steps. Some steps in the flow chart can also be added or deleted as needed. In this embodiment, the step S206 specifically includes:
[0122] Step S2060, determining whether the heat level of the target flow is a cold flow. If it is a cold flow, executing step S2061; if it is a non-cold flow, executing step S2063.
[0123] According to the real-time number of viewers of the target stream and the preset division rules, the heat level of the target stream can be obtained. The heat level may include cold stream, warm stream, hot stream, extremely hot stream, etc. In this embodiment, different processing methods are used for hash ring construction and computer room scheduling for cold streams and non-cold streams (such as warm streams, hot streams, and extremely hot streams).
[0124] Step S2061, determining whether there is a constructed hash ring for the target flow and the available computer room. If there is a constructed hash ring, executing step S2062; if there is no constructed hash ring, executing step S2066.
[0125] Step S2062, determine to use the constructed hash ring.
[0126] In this embodiment, if the target flow is a cold flow, and there is a constructed hash ring for the target flow and the available computer room, the constructed hash ring can be directly used for computer room scheduling, and there is no need to update the hash ring for the cold flow in real time.
[0127] Step S2063, obtaining the current first time, the second time when the hash ring was last constructed for the target flow and the available computer room, and the time threshold corresponding to the heat level.
[0128] In this embodiment, a different time threshold is set for each heat level, and the higher the heat level, the smaller the time threshold. Figure 8 FIG. 1 is a schematic diagram of a mapping relationship among the heat level, time threshold and judgment condition. Figure 8 The time threshold for cold flow is 10 minutes, the time threshold for warm flow is 5 minutes, the time threshold for hot flow is 3 minutes, and the time threshold for extremely hot flow is 1 minute. The time threshold is used to control the update frequency of the hash ring corresponding to the flow of the heat level. Within each time threshold range, a new hash ring is constructed according to the remaining bandwidth. The higher the heat level of the flow, the more frequently the hash ring is updated.
[0129] Step S2064, determining the difference between the first time and the second time, and comparing the difference with the time threshold. If the difference does not exceed the time threshold, executing step S2065; if the difference exceeds the time threshold, executing step S2066.
[0130] Step S2065, determining to use the hash ring constructed last time for the target flow and the available computer room.
[0131] If the difference does not exceed the time threshold, there is no need to reconstruct the hash ring for the target flow and the available computer room, and the last constructed hash ring within the time threshold can be directly used.
[0132] Step S2066: construct a new hash ring for the target flow and the available computer room according to the remaining bandwidth of the available computer room.
[0133] If the target flow is not a cold flow, and the difference between the first time and the second time exceeds the time threshold, or the target flow is a cold flow, but there is no constructed hash ring for the target flow and the available computer room, then a new hash ring needs to be constructed for the target flow and the available computer room. The new hash ring can be constructed according to the existing construction method based on the remaining bandwidth of the available computer room, which will not be described in detail here.
[0134] In order to make this application easier to understand, the following Fig. 9 An exemplary application is provided.
[0135] In this exemplary application, the back-to-source path scheduling method includes:
[0136] Step S400: parse the user IP to obtain region and operator information.
[0137] Step S402: Obtain a list of computer rooms covered by the operator in the region and a flow distribution tree of the target flow.
[0138] Step S404, determine whether the computer room in the flow distribution tree has an intersection with the coverage computer room list. If there is an intersection, execute step S406; if there is no intersection, execute step S408.
[0139] Step S406: Select a computer room with more remaining bandwidth from the intersection for scheduling.
[0140] Step S408, determining whether the heat level of the target flow is a cold flow. If it is a cold flow, executing step S410; if not, executing step S414.
[0141] Step S410, determine whether there is a constructed hash ring for the target flow and the coverage room list. If yes, execute step S412; if no, execute step S418.
[0142] Step S412, obtaining the original constructed hash ring for computer room scheduling.
[0143] Step S414, determine whether the time from the current time to the last time the hash ring of the target flow was constructed exceeds the threshold corresponding to the heat level. If it exceeds the threshold, execute step S418; if it does not exceed the threshold, execute step S416.
[0144] Step S416: within the threshold range, obtain the hash ring constructed last time to perform computer room scheduling.
[0145] Step S418: Reconstruct a hash ring for the target flow and the coverage room list according to the real-time remaining bandwidth.
[0146] Step S420, returning the scheduling result.
[0147] Fig. 9 The specific implementation process of the above steps is in Figure 2-8 This is explained in the relevant description and will not be repeated here.
[0148] Embodiment 2
[0149] Fig.10 The block diagram of the back-to-source path scheduling device according to the second embodiment of the present application is schematically shown. The device can be divided into one or more program modules, one or more program modules are stored in a storage medium, and are executed by one or more processors to complete the embodiment of the present application. The program module referred to in the embodiment of the present application refers to a series of computer program instruction segments that can complete specific functions. The following description will specifically introduce the functions of each program module in this embodiment. Fig.10 As shown, the device 60 may include: a parsing module 600, an acquisition module 602, a determination module 604, a construction module 606, and a scheduling module 608, wherein:
[0150] The parsing module 600 is used to respond to a play request of a viewer terminal for a target stream and parse the play request to obtain the region and operator information of the viewer terminal.
[0151] The acquisition module 602 is used to acquire available computer rooms in the CDN according to the region and operator information, and acquire the remaining bandwidth of the available computer rooms.
[0152] Specifically, a first computer room list covered by the operator in the region is obtained, and the computer rooms in the first computer room list are the available computer rooms.
[0153] In an optional embodiment, after obtaining the available computer room, the method further includes:
[0154] Obtain a list of second computer rooms included in the current flow distribution tree of the target flow;
[0155] Comparing the first computer room list with the second computer room list;
[0156] When the first computer room list and the second computer room list have no intersection, obtaining the remaining bandwidth of the available computer rooms, and triggering subsequent modules to continue processing;
[0157] When the first computer room list and the second computer room list have an intersection, obtaining a third computer room list contained in the intersection;
[0158] Obtain the remaining bandwidth of the corresponding computer room in the third computer room list;
[0159] The target stream is directly dispatched and distributed from the third machine room list to the machine room used by the viewer terminal according to the remaining bandwidth.
[0160] The determination module 604 is used to obtain the real-time number of viewers of the target stream to determine the popularity level of the target stream.
[0161] In this embodiment, when scheduling the computer room, it is necessary to consider not only the remaining bandwidth of the available computer room, but also the heat level of the target flow, which can be reflected by the number of real-time viewers in each computer room. The more real-time viewers there are, the higher the heat level of the target flow. The heat level may include cold flow, warm flow, hot flow, extremely hot flow, etc.
[0162] The construction module 606 is used to determine whether to construct a new hash ring or use an existing hash ring according to the remaining bandwidth of the available computer room based on the heat level of the target flow.
[0163] Specifically, when the heat level of the target flow is cold flow and there is no constructed hash ring for the target flow and the available computer room, a new hash ring for the target flow and the available computer room is constructed according to the remaining bandwidth of the available computer room.
[0164] When the heat level of the target flow is cold flow and there is a constructed hash ring for the target flow and the available computer room, it is determined to use the constructed hash ring.
[0165] When the heat level of the target flow is non-cold flow, obtain the current first time, the second time when the hash ring was last constructed for the target flow and the available computer room, and the time threshold corresponding to the heat level;
[0166] determining a difference between the first time and the second time, and comparing the difference with the time threshold;
[0167] When the difference exceeds the time threshold, constructing a new hash ring for the target flow and the available computer room according to the remaining bandwidth of the available computer room;
[0168] When the difference does not exceed the time threshold, it is determined to use the hash ring constructed last time for the target flow and the available computer room.
[0169] In this embodiment, different heat levels correspond to different time thresholds, wherein the higher the heat level, the smaller the time threshold.
[0170] The scheduling module 608 is used to distribute the target stream to the machine room used by the viewer terminal according to the determined hash ring scheduling.
[0171] After determining to construct a new hash ring or use an already constructed hash ring, the computer room scheduling can be performed according to the new hash ring or the already constructed hash ring, and the target stream corresponding to the playback request is distributed to the viewer terminal through one or more scheduled computer rooms. The specific method of performing computer room scheduling according to the hash ring in this embodiment can adopt the existing scheduling method, which will not be repeated here.
[0172] The specific implementation process of the above-mentioned functions of each module can be found in the description of the above-mentioned embodiment 1, and will not be repeated here.
[0173] The back-to-source path scheduling system provided in this embodiment can dynamically decide whether a new hash ring needs to be built based on the real-time flow heat level and the remaining bandwidth of the computer room. Based on the heat levels of different flows, a resource perspective of each flow is formed, and only the hash ring is rebuilt according to the remaining bandwidth of the computer room for non-cold flows, so as to optimize the cost and quality. By scheduling different hot flows to different computer rooms, the distribution is made more uniform, while the corresponding computing cost is reduced, and the number of forks in the flow distribution tree will not increase.
[0174] Embodiment 3
[0175] Fig.11 The schematic diagram of the hardware architecture of a computer device 10000 suitable for implementing the back-to-source path scheduling method according to the third embodiment of the present application is schematically shown. In some embodiments, the computer device 10000 may be a terminal device such as a smart phone, a wearable device, a tablet computer, a personal computer, a vehicle-mounted terminal, a game console, a virtual device, a workbench, a digital assistant, a set-top box, a robot, etc. In other embodiments, the computer device 10000 may be a rack server, a blade server, a tower server, or a cabinet server (including an independent server, or a server cluster composed of multiple servers), etc. Fig.11 As shown, the computer device 10000 includes but is not limited to: a memory 10010, a processor 10020, and a network interface 10030 that can communicate with each other through a system bus. Among them:
[0176] The memory 10010 includes at least one type of computer-readable storage medium, and the readable storage medium includes a flash memory, a hard disk, a multimedia card, a card-type memory (such as an SD or DX memory), a random access memory (RAM), a static random access memory (SRAM), a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), a programmable read-only memory (PROM), a magnetic memory, a magnetic disk, an optical disk, etc. In some embodiments, the memory 10010 may be an internal storage module of the computer device 10000, such as a hard disk or a memory of the computer device 10000. In other embodiments, the memory 10010 may also be an external storage device of the computer device 10000, such as a plug-in hard disk equipped on the computer device 10000, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. Of course, the memory 10010 may also include both the internal storage module of the computer device 10000 and its external storage device. In this embodiment, the memory 10010 is generally used to store an operating system and various application software installed on the computer device 10000, such as program code of a back-to-source path scheduling method, etc. In addition, the memory 10010 can also be used to temporarily store various data that have been output or are to be output.
[0177] In some embodiments, the processor 10020 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other chips. The processor 10020 is generally used to control the overall operation of the computer device 10000, such as performing control and processing related to data interaction or communication with the computer device 10000. In this embodiment, the processor 10020 is used to run the program code stored in the memory 10010 or process data.
[0178] The network interface 10030 may include a wireless network interface or a wired network interface, and the network interface 10030 is generally used to establish a communication link between the computer device 10000 and other computer devices. For example, the network interface 10030 is used to connect the computer device 10000 to an external terminal through a network, and to establish a data transmission channel and a communication link between the computer device 10000 and the external terminal. The network may be a wireless or wired network such as an intranet, the Internet, the Global System of Mobile communication (GSM), Wideband Code Division Multiple Access (WCDMA), 4G network, 5G network, Bluetooth, Wi-Fi, etc.
[0179] It should be pointed out that Fig.11 Only a computer device having components 10010 - 10030 is shown, but it should be understood that implementation of all of the components shown is not a requirement, and more or fewer components may alternatively be implemented.
[0180] In this embodiment, the back-to-source path scheduling method stored in the memory 10010 may also be divided into one or more program modules and executed by one or more processors (such as the processor 10020) to complete the embodiment of the present application.
[0181] Embodiment 4
[0182] An embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored, wherein when the computer program is executed by a processor, the steps of the back-to-source path scheduling method in the embodiment are implemented.
[0183] In this embodiment, the computer-readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEP ROM), programmable read-only memory (PROM), magnetic memory, disk, optical disk, etc. In some embodiments, the computer-readable storage medium may be an internal storage unit of a computer device, such as a hard disk or memory of the computer device. In other embodiments, the computer-readable storage medium may also be an external storage device of a computer device, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the computer device. Of course, the computer-readable storage medium may also include both an internal storage unit of a computer device and an external storage device thereof. In this embodiment, the computer-readable storage medium is generally used to store an operating system and various application software installed on a computer device, such as the program code of the back-to-source path scheduling method in the embodiment. In addition, the computer-readable storage medium may also be used to temporarily store various types of data that have been output or are to be output.
[0184] Embodiment 5
[0185] An embodiment of the present application also provides a computer program product, including a computer program, which implements the method in the above embodiment when executed by a processor.
[0186] Obviously, those skilled in the art should understand that the modules or steps of the above-mentioned embodiments of the present application can be implemented by general-purpose computer devices, they can be concentrated on a single computer device, or distributed on a network composed of multiple computer devices, optionally, they can be implemented by executable program codes of computer devices, so that they can be stored in a storage device and executed by the computer device, and in some cases, the steps shown or described can be executed in a different order from that herein, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. In this way, the embodiments of the present application are not limited to any specific combination of hardware and software.
[0187] It should be noted that the above are only preferred embodiments of the present application, and the patent protection scope of the present application is not limited thereto. Any equivalent structure or equivalent process transformation made using the contents of the specification and drawings of the present application, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.
Claims
1. A method for scheduling a back-to-source path, characterized in that: The method comprises: In response to a play request from a viewer terminal for a target stream, parsing the play request to obtain region and operator information of the viewer terminal; Acquire an available computer room in the content distribution network according to the region and operator information, and acquire the remaining bandwidth of the available computer room; Obtaining the real-time number of viewers of the target stream to determine the popularity level of the target stream; Based on the heat level of the target flow, determine whether to construct a new hash ring or use an already constructed hash ring according to the remaining bandwidth of the available computer room; The target stream is distributed to the machine room used by the viewer terminal according to the determined hash ring scheduling.
2. The method according to claim 1, characterized in that: The acquiring of available computer rooms in the content distribution network according to the region and operator information includes: A first computer room list covered by the operator in the region is obtained, where the computer rooms in the first computer room list are the available computer rooms.
3. The method according to claim 2, characterized in that After obtaining the available computer room, the method further includes: Obtain a list of second computer rooms included in the current flow distribution tree of the target flow; Comparing the first computer room list with the second computer room list; In the case where the first computer room list and the second computer room list have no intersection, the step of obtaining the remaining bandwidth of the available computer rooms is performed.
4. The method according to claim 3, characterized in that The method further comprises: When the first computer room list and the second computer room list have an intersection, obtaining a third computer room list contained in the intersection; Obtain the remaining bandwidth of the corresponding computer room in the third computer room list; The target stream is dispatched and distributed to the computer room used by the viewer terminal from the third computer room list according to the remaining bandwidth.
5. The method according to claim 1, characterized in that The determining, based on the heat level of the target flow, to construct a new hash ring according to the remaining bandwidth of the available computer room or to use the constructed hash ring comprises: When the heat level of the target flow is cold flow and there is no constructed hash ring for the target flow and the available computer room, a new hash ring for the target flow and the available computer room is constructed according to the remaining bandwidth of the available computer room.
6. The method according to claim 1 or 5, characterized in that: The step of determining, based on the heat level of the target flow, to construct a new hash ring according to the remaining bandwidth of the available computer room or to use the constructed hash ring further includes: When the heat level of the target flow is cold flow and there is a constructed hash ring for the target flow and the available computer room, it is determined to use the constructed hash ring.
7. The method according to claim 1, characterized in that The determining, based on the heat level of the target flow, to construct a new hash ring according to the remaining bandwidth of the available computer room or to use the constructed hash ring comprises: When the heat level of the target flow is non-cold flow, obtain the current first time, the second time when the hash ring was last constructed for the target flow and the available computer room, and the time threshold corresponding to the heat level; determining a difference between the first time and the second time, and comparing the difference with the time threshold; When the difference exceeds the time threshold, a new hash ring is constructed for the target flow and the available computer room according to the remaining bandwidth of the available computer room.
8. The method according to claim 7, characterized in that The step of determining, based on the heat level of the target flow, to construct a new hash ring according to the remaining bandwidth of the available computer room or to use the constructed hash ring further includes: When the difference does not exceed the time threshold, it is determined to use the hash ring constructed last time for the target flow and the available computer room.
9. The method according to claim 7 or 8, characterized in that: Different heat levels correspond to different time thresholds, wherein the higher the heat level, the smaller the time threshold.
10. A back-to-source path scheduling device, characterized in that: The device comprises: A parsing module, configured to respond to a play request of a viewer terminal for a target stream and parse the play request to obtain region and operator information of the viewer terminal; An acquisition module, used to acquire available computer rooms in the content distribution network according to the region and operator information, and to acquire remaining bandwidth of the available computer rooms; A determination module, used for obtaining the real-time number of viewers of the target stream to determine the popularity level of the target stream; A construction module, configured to determine, based on the heat level of the target flow, whether to construct a new hash ring according to the remaining bandwidth of the available computer room or to use the constructed hash ring; The scheduling module is used to distribute the target stream to the machine room used by the viewer terminal according to the determined hash ring scheduling.
11. A computer device, characterized in that: include: at least one processor; and a memory communicatively connected to the at least one processor; wherein: The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 9.
12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and when the computer instructions are executed by a processor, the method according to any one of claims 1 to 9 is implemented.
13. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to claims 1 to 9 are implemented.
