Disclosure of Invention
The embodiment of the invention provides a CDN resource scheduling method and device, which can realize the optimization of the use efficiency of CDN resources under a main broadcasting scene through feedback.
According to an aspect of the present invention, a CDN resource scheduling method is provided, including:
s1: after a stream pushing instruction sent by a new user side entering a current channel is obtained, determining each available CDN according to the available stream pushing number and the available transcoding stream number of each CDN;
s2: determining a target CDN according to the available bandwidth ratio of each available CDN;
s3: and configuring the target CDN as a live broadcast and watching line, so that a main broadcasting end pushes flow through the target CDN, and the new user end pulls flow through the target CDN.
Preferably, the determining, according to the available number of push streams and the available number of transcoding streams of each CDN, each available CDN specifically is:
t1: obtaining the number of available plug streams and the number of available transcoding streams of each CDN;
t2: determining a current CDN, judging whether the current CDN meets the condition that the available push stream number is not less than a preset first numerical value and the available transcoding stream number is not less than a preset second numerical value, if so, determining the current CDN as the available CDN, and if not, rejecting the current CDN;
t3: and determining the next CDN as the current CDN, and re-executing T2 until the judgment of each CDN is finished, and determining each available CDN.
Preferably, the determining a target CDN according to the available bandwidth percentage of each available CDN specifically is:
s21: obtaining available bandwidth of each available CDN, and sequentially calculating the proportion of each available CDN bandwidth to the sum of the available bandwidth of all available CDNs to obtain the available bandwidth ratio of each available CDN;
s22: and randomly drawing according to a preset drawing strategy in each available CDN to determine a target CDN, wherein the preset drawing strategy is a corresponding relation between the drawn probability of each CDN and the available bandwidth ratio of each available CDN.
Preferably, the preset extraction policy is that the probability of each available CDN being extracted is equal to the available bandwidth ratio of each available CDN.
Preferably, configuring the target CDN as a live broadcast and viewing line, so that an anchor end performs push streaming through the target CDN, and after performing pull streaming through the target CDN, the new user end further includes:
s4: and acquiring quality information fed back by the new user side in real time, judging whether the quality information meets preset qualified conditions, if so, executing the step S4 again, and if not, rejecting the target CDN and executing the step S2 again.
Preferably, the CDN resource scheduling method provided by the present invention further includes:
s5: after a stream pulling instruction sent by a new user side entering a current channel is obtained, determining each available CDN according to the available stream pulling number of each CDN;
s6: determining a target CDN according to the number of access users of each available CDN;
s7: and configuring the target CDN as a live broadcast and watching line, so that the new user side can call back pull stream through the target CDN.
Preferably, the determining the target CDN according to the number of access users of each available CDN specifically is:
and acquiring the number of access users of each available CDN, and determining the available CDN corresponding to the maximum number of access users as a target CDN.
According to another aspect of the present invention, there is provided a CDN resource scheduling device, including:
the first determining module is used for determining each available CDN according to the available push stream number and the available transcoding stream number of each CDN after a push stream instruction sent by a new user side entering a current channel is obtained;
a second determining module, configured to determine a target CDN according to an available bandwidth proportion of each available CDN;
and the configuration module is used for configuring the target CDN into a line for live broadcasting and watching, so that a main broadcasting end pushes the stream through the target CDN, and the new user end pulls the stream through the target CDN.
According to another aspect of the present invention, there is provided an electronic device comprising a processor and a memory, the memory having stored thereon computer program instructions which, when executed by the processor, implement the CDN resource scheduling method as described above.
According to another aspect of the present invention, there is provided a computer readable storage medium having stored thereon computer program instructions which, when executed by a processor, implement the CDN resource scheduling method as described above.
According to the technical scheme, the embodiment of the invention has the following advantages:
the invention provides a CDN resource scheduling method and a device, wherein the method comprises the following steps: s1: after a stream pushing instruction sent by a new user side entering a current channel is obtained, determining each available CDN according to the available stream pushing number and the available transcoding stream number of each CDN; s2: determining a target CDN according to the available bandwidth ratio of each available CDN; s3: and configuring the target CDN as a live broadcast and watching line, so that the anchor end pushes the stream through the target CDN, and the new user end pulls the stream through the target CDN. The invention evaluates whether the CDN is available or not through the index parameters of each CDN, and further selects a line for live broadcast viewing according to the available bandwidth ratio of each available CDN so as to realize the push flow of a main broadcasting end and the pull flow of a user end.
Detailed Description
The embodiment of the invention provides a CDN resource scheduling method and device, which can realize the optimization of the use efficiency of CDN resources under a main broadcasting scene through feedback.
In order to make the objects, features and advantages of the present invention more obvious and understandable, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention, and it is obvious that the embodiments described below are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Referring to fig. 1, an embodiment of a CDN resource scheduling method provided in the present invention includes:
101. after a stream pushing instruction sent by a new user side entering a current channel is obtained, determining each available CDN according to the available stream pushing number and the available transcoding stream number of each CDN;
in this embodiment, if a new user side enters a current channel, after a stream pushing instruction sent by the user side is obtained (it should be noted that the stream pushing instruction may be a mode instruction for watching a live broadcast selected by a user, that is, a mode for pushing a stream through a main broadcast), each available CDN needs to be determined according to the number of available stream pushing and the number of available transcoded streams of each CDN, and it can be understood that each CDN refers to a CDN of each vendor, and upper and lower limits of parameters of each CDN itself are configured by each vendor. Since a plurality of CDNs are distributed in a live broadcast network, a plurality of live broadcast channels are live broadcast at the same time, a plurality of users are watching live broadcast in each channel, and a part of the number of push streams of the CDNs (for use by the anchor push stream, if the number of push streams of a certain CDN is 3, the CDN can be used by three anchor terminals to push streams, that is, it can be used as a live broadcast line of three channels, when the number of available push streams is 0, the CDN is unavailable) and the number of transcoding streams (as in the foregoing example, when an anchor terminal pushes streams through the CDN, a video stream with a low bit rate converted from a video stream is usually provided to a video center for a user to pull streams, and when the number of available transcoding streams is 0, the CDN is proved to be unavailable), each available CDN needs to be determined according to the number of available push streams and the number of available transcoding streams of each CDN.
102. Determining a target CDN according to the available bandwidth ratio of each available CDN;
after each available CDN is determined, because multiple available CDNs usually exist in a live broadcast network, in order to avoid the problem of low CDN resource utilization efficiency caused by random selection in the prior art, in the embodiment of the present invention, a target CDN is determined according to an available bandwidth proportion of each available CDN, it should be noted that the available bandwidth proportion of each available CDN is a ratio of an available bandwidth of each available CDN to a sum of available bandwidths of all available CDNs. The determination of the target CDN is equivalent to the final determination of a live broadcast and watching used line in an available CDN cluster, so that most live broadcast channels, user terminals and anchor terminals are concentrated in the same CDN as much as possible, and the problem of low use efficiency of some CDN resources caused by random CDN distribution can be avoided.
103. And configuring the target CDN as a live broadcast and watching line, so that the anchor end pushes the stream through the target CDN, and the new user end pulls the stream through the target CDN.
After the target CDN is determined, the target CDN is configured into a line for live broadcasting and watching, so that the anchor end pushes the stream through the target CDN, and the new user end pulls the stream through the target CDN. It can be understood that the pushing of the video stream by the anchor terminal through the target CDN is to push the video stream to the live center, and then the pulling of the new user terminal through the target CDN is performed in the video center to realize the viewing.
The invention evaluates whether the CDN is available or not through the index parameters of each CDN, and further selects a line for live broadcast viewing according to the available bandwidth ratio of each available CDN so as to realize the push flow of a main broadcasting end and the pull flow of a user end.
To describe the above embodiment of the CDN resource scheduling method more specifically, the following provides another embodiment of the CDN resource scheduling method, and referring to fig. 2, the another embodiment of the CDN resource scheduling method provided by the present invention includes:
201. acquiring a stream pushing instruction sent by a new user side entering a current channel;
in this embodiment, if a new user side enters the current channel, after the stream pushing instruction sent by the user side is obtained, it should be noted that the stream pushing instruction may be a mode instruction for watching live broadcast selected by the user, that is, a mode for performing stream pushing through the anchor broadcast. In addition, the user terminal to be used may also trigger another live broadcast watching mode, and the present invention will be described in detail in the following embodiments, which are not specifically described in this embodiment.
202. Obtaining the number of available plug streams and the number of available transcoding streams of each CDN;
determining each available CDN according to the available number of push streams and the available number of transcoding streams of each CDN, where each CDN refers to a CDN of each vendor, and upper and lower limits of a parameter of each CDN are configured by each vendor. Because a plurality of CDNs are distributed in a live broadcast network, a plurality of live broadcast channels are live broadcast at the same time, a plurality of users are watching live broadcast in each channel, and the number of push streams and the number of transcoding streams of some CDNs are used up, that is, the CDNs are unavailable, it is necessary to determine each available CDN according to the number of available push streams and the number of available transcoding streams of each CDN.
203. Determining a current CDN, judging whether the current CDN meets the condition that the available push stream number is not less than a preset first numerical value and the available transcoding stream number is not less than a preset second numerical value, if so, determining the current CDN as the available CDN, and if not, rejecting the current CDN;
generally, all CDNs may be determined one by one, CDNs in a CDN cluster may be sequenced, then a current CDN is determined, whether the CDN meets the condition that the number of available push streams is not less than a preset first value (which may be generally set to 1) and the number of available transcoding streams is not less than a preset second value (which may be generally set to 1) is determined, if yes, the current CDN is determined to be an available CDN, and if not, the current CDN is rejected, which is equivalent to regarding the current CDN as an unavailable CDN.
204. Determining the next CDN as the current CDN, and re-executing 202 until the judgment of each CDN is completed, and determining each available CDN;
after the current CDN is judged, the next CDN may be judged as above until the judgment of each CDN is completed, and then each available CDN may be finally determined.
205. Obtaining the available bandwidth of each available CDN, and calculating the proportion of each available CDN bandwidth to the sum of the available bandwidths of all available CDNs in sequence to obtain the available bandwidth ratio of each available CDN;
after each available CDN is determined, the available bandwidth of each available CDN needs to be acquired, and the ratio of each available CDN bandwidth to the sum of the available bandwidths of all available CDNs is sequentially calculated to obtain the available bandwidth ratio of each available CDN.
206. Randomly extracting and determining a target CDN in each available CDN according to a preset extraction strategy, wherein the preset extraction strategy is a corresponding relation between the extracted probability of each CDN and the available bandwidth ratio of each available CDN;
then, random drawing may be performed on each available CDN according to a preset drawing policy to determine a target CDN, where it should be noted that random drawing refers to drawing with a certain probability, that is, the preset drawing policy is that the probability that each available CDN is drawn is equal to the available bandwidth proportion of each available CDN, if three available CDNs are A, B and C respectively, and the corresponding available bandwidth proportions are 50%, 30%, and 20%, the probability that a is drawn as the target CDN is 50%, and similarly, B and C. Therefore, the CDN with a high available bandwidth ratio has a high probability of being preferentially allocated for use, and CDN resources can be reasonably used in a centralized manner.
207. Configuring the target CDN as a line for live broadcasting and watching, so that the anchor end pushes flow through the target CDN, and the new user end pulls flow through the target CDN;
after the target CDN is determined, the target CDN is configured into a line for live broadcasting and watching, so that the anchor end pushes the stream through the target CDN, and the new user end pulls the stream through the target CDN. It can be understood that the pushing of the video stream by the anchor terminal through the target CDN is to push the video stream to the live center, and then the pulling of the new user terminal through the target CDN is performed in the video center to realize the viewing.
208. And acquiring quality information fed back by the new user side in real time, judging whether the quality information meets preset qualified conditions, if so, executing the step 208 again, otherwise, rejecting the target CDN, and executing the step 206 again.
In the live broadcast process, quality information fed back by a new user side can be obtained in real time, it should be noted that the quality information is usually network quality information and may include information such as delay, stuck and the like, if the information meets preset qualified conditions (such as whether the delay is qualified or not), monitoring of the CDN is continuously performed, if the information does not meet the preset qualified conditions, the currently used target CDN is regarded as unqualified, the target CDN is rejected as an unavailable CDN, and a new target CDN is selected from the available CDNs again.
The invention provides a feedback-based CDN resource scheduling method, which determines an available CDN through various index parameters of the CDN and determines a target CDN according to the available bandwidth ratio so as to centralize a live broadcast channel, a main broadcast end and a user end in most of the available CDN to realize effective regulation and control of CDN resources.
Both the above two embodiments are detailed descriptions of selecting the first mode after the user enters the live channel, and another mode will be described below, referring to fig. 3, another embodiment of the CDN resource scheduling method provided by the present invention includes:
301. acquiring a pull stream instruction sent by a new user side entering a current channel;
in this embodiment, if a new user enters a current channel, after acquiring a pull stream instruction sent by the user, it should be noted that the pull stream instruction may be a mode instruction for watching live broadcast selected by the user, that is, the new user realizes a live broadcast watching mode by calling back the pull stream mode.
302. Determining each available CDN according to the available pull number of each CDN;
it should be noted that, in this mode, it is required to determine that the CDN has an available pull flow number, and generally, the available pull flow number is greater than 0, which indicates that a new user side can pull through the CDN. Therefore, if the number of available pulling flows of the CDN is greater than 0, the CDN is available.
303. Determining a target CDN according to the number of access users of each available CDN;
different from another mode, in this embodiment, an available CDN corresponding to the maximum number of access users is determined as the target CDN by obtaining the number of access users of each available CDN. It can be understood that, in a line where a current channel is docked (i.e., multiple CDNs), the number of users using each CDN is usually different, and in order to centrally regulate and control CDN resources, in the embodiment of the present invention, a target CDN used by a new user side is set as a CDN having the largest number of access users, so as to improve the use efficiency of CDN resources.
304. And configuring the target CDN as a live broadcast and watching line, so that the new user side can call back the pull stream through the target CDN.
After the target CDN is determined, the target CDN is configured to be a line for live broadcasting and watching, so that the new user side performs call back pull flow through the target CDN, where a process of call back pull flow is common general knowledge of those skilled in the art, and is not specifically described here.
The above is a detailed description of a CDN resource scheduling method provided by the present invention, and the following is a description of a structure and a connection relationship of a CDN resource scheduling device provided by the present invention, please refer to fig. 4, where an embodiment of a CDN resource scheduling device provided by the present invention includes:
a first determining module 401, configured to determine, after obtaining a stream pushing instruction sent by a new user terminal entering a current channel, each available CDN according to an available stream pushing number and an available transcoding stream number of each CDN;
a second determining module 402, configured to determine a target CDN according to an available bandwidth proportion of each available CDN;
a configuration module 403, configured to configure the target CDN as a live broadcast and viewing line, so that the anchor end performs push streaming through the target CDN, and the new user end performs pull streaming through the target CDN.
Further, the first determining module 401 includes:
the acquisition submodule is used for acquiring a stream pushing instruction sent by a new user side entering a current channel;
the determining submodule is used for determining each available CDN according to the available push stream number and the available transcoding stream number of each CDN;
the determination submodule includes:
the obtaining unit is used for obtaining the number of available push streams and the number of available transcoding streams of each CDN;
the judging unit is used for determining the current CDN, judging whether the current CDN meets the condition that the available push stream number is not less than a preset first numerical value and the available transcoding stream number is not less than a preset second numerical value, if so, determining the current CDN as the available CDN, and if not, rejecting the current CDN;
and the circulating unit is used for determining the next CDN as the current CDN, re-triggering the judging unit until the judgment of each CDN is completed, and determining each available CDN.
Still further, the second determining module 402 includes:
the calculation sub-module is used for acquiring the available bandwidth of each available CDN, and calculating the proportion of each available CDN bandwidth to the sum of the available bandwidths of all available CDNs in sequence to obtain the available bandwidth ratio of each available CDN;
and the extraction sub-module is used for randomly extracting and determining the target CDN in each available CDN according to a preset extraction strategy, wherein the preset extraction strategy is a corresponding relation between the extracted probability of each CDN and the available bandwidth ratio of each available CDN.
Further, the preset extraction policy is such that the probability of each available CDN being extracted is equal to the available bandwidth share of each available CDN.
Furthermore, the CDN resource scheduling device provided by the present invention further includes:
and the feedback module is configured to obtain quality information fed back by the new user side in real time, determine whether the quality information meets a preset qualified condition, re-trigger the feedback unit if the quality information meets the preset qualified condition, and reject the target CDN and re-trigger the second determining module 402 if the quality information does not meet the preset qualified condition.
Furthermore, the CDN resource scheduling device provided by the present invention further includes:
the third determining module is used for determining each available CDN according to the available pull number of each CDN after acquiring a pull instruction sent by a new user side entering a current channel;
the fourth determining module is used for determining the target CDN according to the number of access users of each available CDN;
and the callback module is used for configuring the target CDN into a line for live broadcasting and watching so that the new user side can carry out callback pull flow through the target CDN.
Furthermore, the fourth determining module is further configured to obtain the number of access users of each available CDN, and determine the available CDN corresponding to the maximum number of access users as the target CDN.
The invention also relates to an electronic device comprising a processor and a memory, on which computer program instructions are stored, which when executed by the processor implement the CDN resource scheduling method as described above.
The present invention also relates to a computer readable storage medium having stored thereon computer program instructions which, when executed by a processor, implement the CDN resource scheduling method as described above.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the several embodiments provided in the present application, it should be understood that the disclosed system, apparatus and method may be implemented in other manners. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one logical division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
The above-mentioned embodiments are only used for illustrating the technical solutions of the present invention, and not for limiting the same; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.