Search

CN-122002062-A - Transcoding task allocation method, device and readable storage medium

CN122002062ACN 122002062 ACN122002062 ACN 122002062ACN-122002062-A

Abstract

The embodiment of the application provides a transcoding task allocation method, equipment and a readable storage medium, wherein after receiving a transcoding task from a terminal, electronic equipment selects an absolute idle card randomly preferentially and allocates the transcoding task when the absolute idle card of an encoding module is idle is sufficient, and selects a relative idle card and allocates the transcoding task when the absolute idle card of the encoding module is idle is insufficient, so that the aim of improving load balance is fulfilled while randomly selecting a hardware transcoding card is fulfilled. In addition, in the field of AI analysis, after the edge AI gateway receives the AI request from the terminal equipment, randomness and load balancing are considered when the service node is selected, so that the phenomenon that a plurality of AI requests are accumulated to the same service node, which results in poor real-time performance and service node performance bottleneck, is avoided.

Inventors

  • XU DONGXU
  • HUANG XUEHUI
  • ZHUANG XIAOCHUAN
  • ZENG ZHIQUAN

Assignees

  • 厦门网宿有限公司

Dates

Publication Date
20260508
Application Date
20260212

Claims (10)

  1. 1. The transcoding task allocation method is characterized by being applied to electronic equipment, wherein a plurality of hardware transcoding cards are carried on the electronic equipment, and the method comprises the following steps: receiving a transcoding task from a terminal device; Determining at least three idle hardware transcoding cards in the plurality of hardware transcoding cards to obtain a first set; Under the condition that at least a preset number of absolute idle cards exist in the first set, randomly selecting one absolute idle card from the at least preset number of absolute idle cards, distributing the transcoding task to the selected absolute idle cards, wherein the load of a coding module of each absolute idle card is smaller than a preset first load; Determining a second set containing relatively free cards under the condition that the number of absolute free cards in the first set is smaller than the preset number and at least the preset number of hardware transcoding cards exist in the first set, wherein the load of a coding module of each relatively free card is smaller than the load of a relatively busy card, and the average load of each relatively free card is smaller than a second load, and the relatively busy card is the rest hardware transcoding cards except the relatively free card in the plurality of hardware transcoding cards, and the second load is larger than the first load; And randomly selecting a relatively idle card from the second set, and distributing the transcoding task to the selected relatively idle card.
  2. 2. The method of claim 1, wherein the determining the second set comprising relatively free cards if the number of absolute free cards in the first set is less than the preset number, and if at least a preset number of hardware transcoding cards are present in the first set, comprises: Sequencing all hardware transcoding cards in the first set according to the order from low to high of the load of the coding module to obtain a first queue; Determining a first number according to the load of the coding modules of the hardware transcoding cards of the preset number, which are ranked forward in the first queue, wherein the first number is greater than or equal to the preset number and is smaller than or equal to the number of the hardware transcoding cards in the first set; and determining a second set according to the load of the first number of hardware transcoding cards ordered in the first queue and the first number.
  3. 3. The method of claim 2, wherein the determining the second set based on the first number of load of the first number of hardware transcoding cards ordered earlier in the first queue and the first number comprises: Taking the first number of hardware transcoding cards ordered earlier in the first queue as the relative idle cards to obtain a second set under the condition that the average load of the first number of hardware transcoding cards ordered earlier in the first queue is smaller than a second load and the first number is smaller than the number of hardware transcoding cards in the first set; And determining that the second set and the first set are the same set under the condition that the average load of the first number of hardware transcoding cards ordered earlier in the first queue is smaller than the second load and the first number is equal to the number of hardware transcoding cards in the first set.
  4. 4. A method according to claim 3, further comprising: randomly selecting one hardware transcoding card from the first set and distributing the transcoding task to the selected hardware transcoding card under the condition that the average load of the first number of hardware transcoding cards which are ranked at the front in the first queue is larger than or equal to the second load and the first number is smaller than the number of the hardware transcoding cards in the first set; And determining absolute idle cards from the hardware transcoding cards which do not belong to the first set in the plurality of hardware transcoding cards under the condition that the average load of the first number of hardware transcoding cards which are ranked at the front in the first queue is larger than or equal to the second load and the first number of hardware transcoding cards is equal to the number of hardware transcoding cards in the first set, obtaining a third set, merging the first set and the third set to obtain a merged set, randomly selecting one hardware transcoding card from the merged set, and distributing the transcoding task to the selected hardware transcoding card.
  5. 5. The method of any one of claims 1-4, further comprising: Determining an absolute idle card from the hardware transcoding cards which do not belong to the first set in the plurality of hardware transcoding cards under the condition that the number of the absolute idle cards in the first set is smaller than the preset number and the number of the hardware transcoding cards in the first set is smaller than the preset number, so as to obtain a third set, and merging the first set and the third set to obtain a merged set; and under the condition that the total number of the hardware transcoding cards in the combined set is greater than or equal to the preset number, randomly selecting one hardware transcoding card from the combined set, and distributing the transcoding task to the selected hardware transcoding card.
  6. 6. The method as recited in claim 5, further comprising: under the condition that the total number of the hardware transcoding cards in the merging set is smaller than the preset number, ordering a plurality of hardware transcoding cards carried by the electronic equipment according to the order from low to high of the load of the hard coding module to obtain a second queue; Determining a second number according to the load of the hard coding modules of the hardware transcoding cards with the preset number, which are ranked at the front in the second queue; and randomly selecting one hardware transcoding card from the second number of hardware transcoding cards ordered in the second queue and distributing the transcoding task to the selected hardware transcoding card under the condition that the average load of the second number of hardware transcoding cards ordered in the second queue is smaller than the second load.
  7. 7. The method as recited in claim 6, further comprising: When the average load of the first number of hardware transcoding cards in the second queue is greater than or equal to a second load, determining, for each hardware transcoding card of a plurality of hardware transcoding cards carried on the electronic device, a total score of the hardware transcoding cards according to scores of modules of the hardware transcoding cards, where the scores are used to indicate whether the corresponding module is available; determining available hardware transcoding cards from the plurality of hardware transcoding cards according to the total score of each hardware transcoding card, and obtaining a fourth set; And randomly selecting a hardware transcoding card from the fourth set, and distributing the transcoding task to the selected hardware transcoding card.
  8. 8. The method according to any one of claims 2 to 4, wherein the determining the first number according to the load of the hard-coded modules of the preset number of hardware transcoding cards ordered earlier in the first queue includes: Determining that the first number is the number of the hardware transcoding cards in the first set when the difference between the loads of the first hardware transcoding card and the last hardware transcoding card in the preset number is smaller than a preset difference; And under the condition that the difference value of the loads of the first hardware transcoding card and the last hardware transcoding card in the preset number of hardware transcoding cards is larger than or equal to a preset difference value and the difference value of the loads of the first hardware transcoding card and the middle hardware transcoding card is smaller than the preset difference value, determining the first number according to the preset number and the number of the hardware transcoding cards in the first set.
  9. 9. An electronic device comprising a processor, a memory and a computer program stored on the memory and executable on the processor, wherein execution of the computer program by the processor causes the electronic device to implement the method of any one of claims 1 to 8.
  10. 10. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the method according to any one of claims 1 to 8.

Description

Transcoding task allocation method, device and readable storage medium Technical Field The embodiment of the application relates to the technical field of video transcoding and AI analysis, in particular to a method and equipment for distributing transcoding tasks and a readable storage medium. Background The cloud video transcoding refers to a process of outputting a target video after processing such as decoding, parameter adjustment, recoding and the like on a source video uploaded to a cloud based on cloud computing resources in order to adapt to different playing scenes, network environments and the like, wherein code rates, resolutions or formats of the target video and the source video are different. In the traditional scheme, a plurality of hardware transcoding cards are mounted on a single server, and video transcoding is realized by using the hardware transcoding cards. After receiving the transcoding task, the server randomly selects one hardware transcoding card from the plurality of hardware transcoding cards, and distributes the transcoding task to the randomly selected hardware transcoding card. However, in the random card selection scheme, the load of the randomly selected hardware transcoding card may be relatively high, resulting in load imbalance. In addition, when the edge artificial intelligence (ARTIFICIAL INTELLIGENCE, AI) randomly distributes AI requests to service nodes providing AI reasoning services, it is highly likely that AI requests will be distributed to service nodes with higher loads. Disclosure of Invention The embodiment of the application provides a transcoding task allocation method, equipment and a readable storage medium, wherein when transcoding tasks are allocated each time, when an absolute idle card of an encoding module is idle enough, the absolute idle card is selected randomly preferentially, and the transcoding tasks are allocated, when the absolute idle card of the encoding module is idle insufficiently, a relative idle card is selected, and the transcoding tasks are allocated, so that the aim of randomly selecting a hardware transcoding card and simultaneously improving load balance is fulfilled. In a first aspect, an embodiment of the present application provides a method for distributing a transcoding task, which is applied to an electronic device, where a plurality of hardware transcoding cards are carried on the electronic device, and the method includes: receiving a transcoding task from a terminal device; Determining at least three idle hardware transcoding cards in the plurality of hardware transcoding cards to obtain a first set; Under the condition that at least a preset number of absolute idle cards exist in the first set, randomly selecting one absolute idle card from the at least preset number of absolute idle cards, distributing the transcoding task to the selected absolute idle cards, wherein the load of a coding module of each absolute idle card is smaller than a preset first load; Determining a second set containing relatively free cards under the condition that the number of absolute free cards in the first set is smaller than the preset number and at least the preset number of hardware transcoding cards exist in the first set, wherein the load of a coding module of each relatively free card is smaller than the load of a relatively busy card, and the average load of each relatively free card is smaller than a second load, and the relatively busy card is the rest hardware transcoding cards except the relatively free card in the plurality of hardware transcoding cards, and the second load is larger than the first load; And randomly selecting a relatively idle card from the second set, and distributing the transcoding task to the selected relatively idle card. In a second aspect, an embodiment of the present application provides a transcoding task allocation apparatus, where the transcoding task allocation apparatus is integrated on an electronic device, and a plurality of hardware transcoding cards are mounted on the electronic device, and the transcoding task allocation apparatus includes: the receiving and transmitting module is used for receiving a transcoding task from the terminal equipment; the processing module is used for determining the hardware transcoding cards with at least three idle modules from the plurality of hardware transcoding cards to obtain a first set; The absolute idle module is used for randomly selecting one absolute idle card from at least the preset number of absolute idle cards under the condition that the first set contains the at least the preset number of absolute idle cards, distributing the transcoding task to the selected absolute idle cards, and enabling the load of the coding module of each absolute idle card to be smaller than a preset first load; A relative idle module, configured to determine, when the number of absolute idle cards in the first set is less than the preset number and at least a preset num