Gateway resource scheduling method and computer program product
By determining the priority of terminal devices and scheduling data processing queues based on SIM card information in the cloud gateway, the problem of low utilization of cloud gateway devices is solved, and the immediacy and load balancing of data processing are achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHINA MOBILE INTERNET CO LTD
- Filing Date
- 2024-08-09
- Publication Date
- 2026-04-28
AI Technical Summary
Cloud gateway devices cannot simultaneously achieve the ideal operating state of high utilization and high service quality, resulting in low utilization.
The terminal device is authenticated based on the SIM card information of the user identification module to determine its priority. The data processing queue is scheduled based on a preset objective function, divided into multiple sub-queues with a priority order, and finally the data forwarding task is sent to the corresponding CPU core for execution.
It achieves a balance in data processing efficiency among different users, ensuring the immediacy and load balancing of data processing, and fully leveraging the gateway's performance.
Smart Images

Figure CN118972969B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of gateway scheduling technology, and in particular to a gateway resource scheduling method and computer program product. Background Technology
[0002] With the rapid development of the internet, gateway devices play a crucial role in data transmission. With the emergence of a large number of mobile device users and their access to cloud services, cloud gateways, as the entry and exit points for traffic in large data centers, play a decisive role in the reliability and transmission speed of network transmission. Although gateway devices are constantly evolving and iterating, a significant contradiction remains between the utilization rate of cloud gateway devices and the quality of service for users; gateway devices cannot simultaneously achieve the ideal operating state of high utilization and high service quality. Summary of the Invention
[0003] This application provides a gateway resource scheduling method and computer program product to solve the problem of low utilization of cloud gateways in related technologies.
[0004] In a first aspect, embodiments of this application provide a gateway resource scheduling method applied to a cloud gateway, the cloud gateway including multiple central processing unit (CPU) cores, the method comprising:
[0005] The terminal devices are authenticated based on the SIM card information of the user identification module to determine the priority of each terminal device;
[0006] When data forwarding tasks are received from different terminal devices, the data forwarding tasks are scheduled based on the priority of the different terminal devices to obtain a data processing queue.
[0007] Based on a preset objective function, the data processing queue is divided into multiple sub-queues with a sequential order. The preset objective function is used to divide the data processing queue into an optimal resource allocation sequence.
[0008] The data forwarding tasks in the multiple sequential sub-queues are distributed to the corresponding CPU cores for execution.
[0009] Secondly, embodiments of this application provide a computer program product, the computer program product including a computer program stored on a non-transitory computer-readable storage medium, the computer program including program instructions, which, when executed by a computer, implement the steps of the method described in the first aspect.
[0010] In this embodiment, the cloud gateway first authenticates the terminal devices based on the SIM card information of the user identification module to determine the priority of each terminal device. Then, upon receiving data forwarding tasks from different terminal devices, it schedules the data forwarding tasks based on the priorities of the different terminal devices to obtain a data processing queue. Next, based on a preset objective function, the data processing queue is divided into multiple sub-queues with a specific order. The preset objective function is used to divide the data processing queue into an optimal resource allocation sequence. Finally, the data forwarding tasks in the multiple sub-queues with a specific order are distributed to the corresponding CPU cores for execution. This embodiment of the application schedules the data forwarding tasks of different terminal devices, which can effectively balance the data processing efficiency among different users. Furthermore, based on the queued data forwarding tasks, gateway resource scheduling is performed to fully utilize the gateway's performance, ensuring both the immediacy of data processing and load balancing. Attached Figure Description
[0011] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments of this application and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:
[0012] Figure 1 This is a flowchart of the gateway resource scheduling method provided in the embodiments of this application;
[0013] Figure 2 This is a schematic diagram of the gateway resource scheduling device provided in the embodiments of this application;
[0014] Figure 3 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application. Detailed Implementation
[0015] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0016] The terms "first," "second," etc., used in the specification and claims of this application are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such use of data can be interchanged where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein. Furthermore, in the specification and claims, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship.
[0017] The following is in conjunction with the appendix Figures 1 to 3 This application provides a detailed description of a gateway resource scheduling method and computer program product through specific embodiments and application scenarios.
[0018] like Figure 1 The diagram shown is a flowchart of a gateway resource scheduling method provided in an embodiment of this application. Figure 1 As shown, the gateway resource scheduling method is applied to a cloud gateway, which includes multiple central processing units (CPUs). The gateway resource scheduling method may include the contents shown in S101 to S104.
[0019] In S101, terminal devices are authenticated based on Subscriber Identity Module (SIM) card information to determine the priority of each terminal device.
[0020] It's worth noting that users can register using a SIM card to obtain login verification credentials and user priority. User priority refers to the priority associated with different SIM cards; the higher the priority, the higher the priority should be for data forwarding tasks within a predetermined timeframe.
[0021] In S102, when data forwarding tasks are received from different terminal devices, the data forwarding tasks are scheduled based on the priority of the different terminal devices to obtain a data processing queue.
[0022] In other words, data forwarding tasks generated by different SIM devices can be scheduled based on device priority to ensure that high-priority data forwarding tasks can be sent out in a timely manner.
[0023] In this context, the SIM device is the device equipped with a SIM card, and the priority of the data forwarding task corresponds to the priority of the SIM card. By setting priorities, the efficiency of data communication between different types of users can be guaranteed.
[0024] In one example, scheduling data forwarding tasks based on the priorities of different terminal devices can include: when a data forwarding task arrives at the cloud gateway, the priority of each data forwarding task is the same as the priority of its SIM card. Every CPU clock cycle, the priority of the data forwarding task is incremented by one. The higher the priority, the earlier it is in the data processing queue.
[0025] It's worth noting that when priorities are the same, tasks are arranged in chronological order. This initial sorting of data forwarding tasks ensures that higher-priority tasks execute faster, while also processing data forwarding tasks for other users, thus balancing efficiency and user experience across different users. The scheduling in this example is performed in real-time; that is, the order of data forwarding tasks in the data processing queue changes in real time.
[0026] In S103, based on a preset objective function, the data processing queue is divided into multiple sub-queues with a sequential order.
[0027] The preset objective function is used to divide the data processing queue into an optimal resource allocation sequence.
[0028] In this embodiment, the data processing queue after the first scheduling can be scheduled a second time according to the target function of the pre-set device, that is, gateway resource scheduling, so as to fully utilize the gateway performance.
[0029] In S104, data forwarding tasks from multiple sub-queues with a sequential order are distributed to the corresponding CPU cores for execution.
[0030] In this embodiment, the cloud gateway first authenticates the terminal devices based on the SIM card information of the user identification module to determine the priority of each terminal device. Then, upon receiving data forwarding tasks from different terminal devices, it schedules the data forwarding tasks based on the priorities of the different terminal devices to obtain a data processing queue. Next, based on a preset objective function, the data processing queue is divided into multiple sub-queues with a specific order. The preset objective function is used to divide the data processing queue into an optimal resource allocation sequence. Finally, the data forwarding tasks in the multiple sub-queues with a specific order are distributed to the corresponding CPU cores for execution. This embodiment of the application schedules the data forwarding tasks of different terminal devices, which can effectively balance the data processing efficiency among different users. Furthermore, based on the queued data forwarding tasks, gateway resource scheduling is performed to fully utilize the gateway's performance, ensuring both the immediacy of data processing and load balancing.
[0031] In one possible implementation of this application, based on a preset target model, the data processing queue is divided into multiple sub-queues with a sequential order. This may include: encoding the data forwarding tasks in the data processing queue to obtain multiple initial resource allocation sequences; determining the objective function corresponding to each initial resource allocation sequence based on the CPU load balancing index and the execution time span of the data processing tasks; and updating each initial resource allocation sequence based on the objective function to obtain a resource allocation sequence, wherein the resource allocation sequence includes multiple sub-queues with a sequential order.
[0032] In this embodiment, data forwarding tasks in the data processing queue can be encoded based on the number of CPU cores in the cloud gateway to obtain an initial resource allocation sequence. Then, based on the CPU load balancing metrics and the execution time span of the data processing tasks, an objective function is determined. Finally, each initial resource allocation sequence is updated according to the objective function to determine the order of task execution. In other words, after one scheduling, the sequence can be updated based on the capabilities of the CPU cores in the cloud gateway to better schedule gateway resources and thus improve gateway utilization.
[0033] In one possible implementation of this application, the data forwarding tasks in the data processing queue are encoded to obtain multiple initial resource allocation sequences. This may include: determining a range of unit values equal to the number of CPU cores in the cloud gateway, wherein all unit value ranges constitute an overall value range; allocating a value to each data forwarding task within the overall value range to obtain an initial resource allocation sequence; and obtaining multiple initial resource allocation sequences after multiple allocations.
[0034] In other words, we can first determine the number of CPU cores in the cloud gateway, and then determine the range of unit values that are the same as the number of CPU cores in the cloud gateway. For example, when the number of CPU cores in the cloud gateway is 10, then we can determine the range from 0 to 10 (which includes ten unit value ranges, namely (0,1], (1,2], (2,3], (3,4], (4,5], (5,6], (6,7], (7,8], (8,9], (9,10]). Therefore, each CPU core of each cloud gateway can correspond to one unit value range.
[0035] It is worth noting that the number of CPU cores mentioned above is just an example. Since a cloud gateway may consist of one or more gateway devices, its number of CPU cores is not limited to 10 and can be more, depending on the actual application. This embodiment does not impose any limitations.
[0036] A value is generated for each data forwarding task within the overall scope, thus obtaining the initial resource allocation sequence. For example, when the number of CPU cores is 10, a value is generated for each data forwarding task between (0, 10) to obtain the initial resource allocation sequence.
[0037] To improve the scheduling efficiency of gateway CPU resources, multiple initial resource allocation sequences can be used, and a multi-void search method can be adopted to obtain the optimal resource scheduling scheme. Therefore, multiple initial resource allocation sequences are randomly generated according to the above method.
[0038] In one possible implementation of this application, determining the objective function corresponding to each initial resource allocation sequence based on CPU load balancing metrics and the execution time span of the data processing task may include: determining CPU core load balancing metrics based on CPU core physical parameters, including CPU speed, CPU utilization, memory size, used memory size, and hard disk usage size; determining the total execution time required for each CPU core to execute the task based on the execution time of the initial resource allocation sequence on each CPU core; determining the execution time span of the data processing task based on the total execution time, where the execution time span is the difference between the maximum and minimum execution times; and determining the objective function based on the CPU core load balancing metrics and the execution time span.
[0039] In this embodiment, when allocating data forwarding tasks according to the resource allocation sequence, the physical parameters of each CPU core, such as its speed, utilization, memory size, remaining memory size, and remaining hard disk size, can be predicted. Memory and hard disk sizes can be pre-allocated for each CPU core, allowing scheduling only within a preset size range. The CPU core's utilization, remaining memory size, and remaining hard disk size can be obtained similarly based on the speed required for executing data forwarding tasks of different sizes.
[0040] In one example, based on the CPU speed, CPU utilization, memory size, memory usage, and hard disk usage corresponding to the CPU core, the CPU core load can be obtained as follows:
[0041] VL = w1y c +w2y cp +w3y m +w4y mp +w5y d
[0042] w1+w2+w3+w4+w5=1
[0043] Where w1 represents the first impact factor, w2 represents the second impact factor, w3 represents the third impact factor, w4 represents the fourth impact factor, w5 represents the fifth impact factor, and y c Indicates CPU speed, y cp Indicates CPU utilization, y m Indicates memory size, y mp Indicates the amount of memory used, y d This indicates the size of the hard drive in use.
[0044] Based on the load across all CPU cores, the average load value AL is obtained. Then, based on the average load value AL and the load value VL for each CPU core, the load balancing metric BL is obtained as follows:
[0045]
[0046] Among them, VL v Let VL represent the load corresponding to the v-th CPU core, where v = 1, 2, ..., V, and V represents the total number of CPU cores.
[0047] Determine the execution time of the resource allocation sequence on each CPU core (i.e., the amount of data divided by the unit size). Based on this execution time, determine the total execution time required for each CPU core to execute the task. Then, find the maximum and minimum execution times within all total execution times. Thus, the execution time span RT can be determined as follows:
[0048] RT = T max -T min
[0049] Among them, T max T represents the maximum execution time. min This indicates the minimum execution time.
[0050] Therefore, the objective function can be determined as:
[0051] F = BL ε +RT λ ;
[0052] It is worth noting that the smaller the objective function, the better. Here, ε represents the influence factor of the load balancing index, λ represents the influence factor of the execution time span, and both ε and λ are between (0,1), with λ being less than ε.
[0053] In this embodiment, the objective function corresponding to each initial resource allocation sequence can be obtained. The objective function value represents the quality of the resource allocation sequence, so as to determine the resource allocation sequence with the optimal objective function value, thereby realizing task scheduling.
[0054] In one possible implementation of this application, updating each initial resource allocation sequence based on an objective function to obtain a resource allocation sequence may include: determining the initial resource allocation sequence with the largest objective function value as the optimal resource allocation sequence; updating other initial resource allocation sequences based on the optimal resource allocation sequence to obtain an updated resource allocation sequence; for each updated resource allocation sequence, determining whether the optimal resource allocation sequence has mutated based on random numbers within a preset range, and obtaining the objective function of all updated resource allocation sequences; determining the mutation probability and crossover probability of each resource allocation sequence based on the objective function of all updated resource allocation sequences; updating the resource allocation sequence again based on the mutation probability and crossover probability to obtain an updated resource allocation sequence; and determining the resource allocation sequence with the smallest objective function when the number of updates is greater than or equal to a preset number.
[0055] In this embodiment, based on the objective function, the resource allocation sequence with the largest objective function value is determined as the optimal resource allocation sequence. Other resource allocation sequences are then updated according to the optimal sequence to obtain updated resource allocation sequences. For each updated resource allocation sequence, a random number is used to determine whether the optimal resource allocation sequence has mutated, and the objective function of all updated resource allocation sequences is obtained. The mutation probability and crossover probability of each resource allocation sequence are determined based on its corresponding objective function value. The resource allocation sequences are then updated a second time based on these probabilities to obtain a second-updated resource allocation sequence. After multiple updates, the number of updates is determined. If the number of updates is greater than or equal to a preset number, the resource allocation sequence with the smallest objective function is determined. The mutation in this embodiment allows for fine-tuning of the optimal resource allocation sequence. As the number of iterations increases, it constrains the search space, changes the search direction of the resource allocation sequence, and allows it to enter other regions for searching, improving the overall search capability, reducing the possibility of getting trapped in local optima, and ultimately accelerating the convergence speed.
[0056] Each time the value of the resource allocation sequence changes, it is necessary to determine whether each element in the resource allocation sequence is within a preset range. If not, it is pulled back to the upper or lower limit.
[0057] In one possible implementation of this application, updating other initial resource allocation sequences based on the optimal resource allocation sequence to obtain an updated resource allocation sequence may include: obtaining the average distance and maximum distance between other initial resource allocation sequences and the optimal resource allocation sequence; determining a rate control coefficient for updating the initial resource allocation sequences based on the average distance, maximum distance, and a logarithmic function, wherein the logarithmic function is used to control the update amount; determining the update amount for each initial resource allocation sequence based on the rate control coefficient; and updating the corresponding initial resource allocation sequence based on the update amount for each initial resource allocation sequence to obtain an updated resource allocation sequence.
[0058] The average distance between other initial resource allocation sequences and the optimal resource allocation sequence is:
[0059]
[0060] in, Indicates the average distance. Let represent the j-th element of the i-th resource allocation sequence during the t-th optimization process, where i = 1, 2, ..., I, I represents the total number of resource allocation sequences, and j = 1, 2, ..., J, J represents the total number of CPU cores. Let j represent the j-th element of the optimal resource allocation sequence during the t-th optimization process.
[0061] The maximum distance between other initial resource allocation sequences and the optimal resource allocation sequence is:
[0062]
[0063] Where, d max Indicates the maximum distance.
[0064] Based on the average distance, maximum distance, and logarithmic function, the rate control coefficients used to update the initial resource allocation sequence can be determined, and may include:
[0065] Based on the maximum distance d max and average distance The speed control factor used to update the resource allocation sequence is:
[0066]
[0067] Where ω0 represents the preset control coefficient, ω t This represents the speed control coefficient.
[0068] In this application, the distance between resource allocation sequences is used as the basis, and the ln function is used to control the update amount, which further limits the search speed and optimizes the ability of global and local search, which is conducive to finding resource allocation sequences better.
[0069] Based on the speed control coefficient, the update amount for each resource allocation sequence is obtained as follows:
[0070]
[0071] step i =step min +(step max -step min )β
[0072] Where, ΔX t Let ΔX represent the update amount in the t-th optimization. t-1 This represents the update amount in the (t-1)th optimization. This represents the i-th resource allocation sequence in the (t-1)-th optimization. Let step represent the optimal resource allocation sequence in the t-th optimization. i Let step represent the step size control coefficient corresponding to the i-th resource allocation sequence. max The step represents the maximum step size control factor. min represents the minimum step size control coefficient, and β represents a random number that follows a uniform distribution in [0,1].
[0073] In this embodiment, based on the objective function, the resource allocation sequence with the largest objective function value is determined as the optimal resource allocation sequence, and other resource allocation sequences are updated according to the optimal resource allocation sequence to obtain the updated resource allocation sequence.
[0074] In one possible implementation of this application, for each updated resource allocation sequence, determining whether the optimal resource allocation sequence has been mutated based on a random number within a preset range may include: generating a first random number within a preset range for each updated resource allocation sequence; if the first random number is greater than or equal to a first threshold, performing mutation processing on the optimal resource allocation sequence to obtain a new resource allocation sequence; if the first random number is less than the first threshold, not performing mutation processing on the optimal resource allocation sequence.
[0075] The preset range can be any range of the pre-installed device, and can be determined according to the actual application. This embodiment does not limit it.
[0076] In one example, for each resource allocation sequence, a random number rand1 is generated between [0,1], and it is determined whether the random number rand1 is greater than a first threshold r. i If so, the optimal resource allocation sequence is mutated to obtain a new resource allocation sequence for global search; otherwise, the optimal resource allocation sequence is not mutated.
[0077] The optimal resource allocation sequence is mutated as follows:
[0078]
[0079]
[0080] Where σ represents the coefficient of variation, X max Let X represent a sequence with the same dimensions as the resource allocation sequence, where each element in each dimension is an upper bound value. min Let represent a sequence with the same dimensions as the resource allocation sequence, where each element in each dimension is a lower bound value. α represents an intermediate parameter, and e represents the natural constant. denoted as a random number in [-2.5α, 2.5α], g represents the upper limit of α, t represents the current number of optimizations, iter represents the maximum number of optimizations, and ξ represents the adjustment coefficient, which is a constant greater than 1.
[0081] The mutation method provided in this application has good mutation performance and fine-tuning capability. As the number of iterations increases, it can constrain the search space, change the search direction of the resource allocation sequence, and thus enter other regions for searching, thereby improving the overall search capability, reducing the possibility of getting trapped in local optima, and ultimately accelerating the convergence speed.
[0082] In one possible implementation of this application, the gateway resource scheduling method may further include: generating a second random number within a preset range for each updated resource allocation sequence; replacing the optimal resource allocation sequence with the new resource allocation sequence if the second random number is less than a second threshold and the objective function of the new resource allocation sequence decreases; and updating the first threshold and the second threshold if the second random number is greater than or equal to the second threshold or the objective function of the new resource allocation sequence does not decrease.
[0083] In this embodiment, for each resource allocation sequence, a random number rand2 is generated between [0,1], and it is determined whether the random number rand2 is less than the second threshold A. i Furthermore, it checks whether the objective function value of the new resource allocation sequence decreases. If so, it replaces the optimal resource allocation sequence with the new one; otherwise, it applies a threshold A. i and threshold r i Update.
[0084] It is worth noting that the first threshold r i and the second threshold A i All are initialized during the first optimization process, and a first threshold r is initialized for each resource allocation sequence. i and the second threshold A i .
[0085] Threshold Ai and threshold r i The update is as follows:
[0086]
[0087] in, This represents the first threshold in the t-th optimization process, and δ represents a constant between (0,1). Indicates the updated This represents the initial threshold. This represents the updated threshold r. i γ is a constant greater than 0.
[0088] In one possible implementation of this application, the resource allocation sequence is updated again based on the mutation probability and the crossover probability to obtain an updated resource allocation sequence. This may include: determining whether the resource allocation sequence needs to be mutated based on the mutation probability; if the resource allocation sequence needs to be mutated, randomly changing at least one element in the resource allocation sequence within the sequence value range to obtain a mutated resource allocation sequence; randomly pairing all resource allocation sequences in pairs to obtain multiple paired resource allocation sequences; determining whether the elements in the paired resource allocation sequences need to be crossed based on the crossover probability; if the elements in the paired resource allocation sequences need to be crossed, performing a corresponding crossover on at least one element in the paired resource allocation sequences to obtain a crossover resource allocation sequence; arranging the original resource allocation sequence, the mutated resource allocation sequence, and the crossover resource allocation sequence in ascending order of the objective function to obtain the updated resource allocation sequence.
[0089] In this embodiment, the objective function values corresponding to all resource allocation sequences can be re-obtained, and the mutation probability and crossover probability of each resource allocation sequence can be determined based on the objective function value corresponding to each resource allocation sequence. The resource allocation sequences can then be updated a second time based on the mutation probability and crossover probability to obtain the updated resource allocation sequences.
[0090] The mutation probability and crossover probability are:
[0091]
[0092] Where F' represents the intermediate parameter, P1 represents the cross coefficient, P2 represents the coefficient of variation, and F' max This represents the maximum value among the intermediate parameters corresponding to all resource allocation sequences. F' represents the average of the intermediate parameters corresponding to all resource allocation sequences. minF'(X1), F'(X2)) represents the minimum value among the intermediate parameters corresponding to all resource allocation sequences, and max(F'(X1), F'(X2)) represents the maximum second parameter corresponding to the resource allocation sequences X1 and X2 to be crossed. i ) represents the second parameter of the resource allocation sequence to be mutated, t represents the current number of optimizations, and iter represents the maximum number of optimizations.
[0093] Based on the coefficient of variation P2, a roulette wheel method is used to determine whether the resource allocation sequence needs to be mutated. If so, one or more elements in the resource allocation sequence are randomly changed within their value range (the specific number of elements can be preset) to obtain the mutated resource allocation sequence; otherwise, the resource allocation sequence is not mutated.
[0094] Furthermore, all resource allocation sequences are randomly paired in pairs, and based on the crossover coefficient P1, a roulette wheel method is used to determine whether the two paired task allocation sequences need to be crossed. If so, one or more elements of the two resource allocation sequences are crossed in the same position (the specific number of elements can be preset) to obtain two crossed resource allocation sequences; otherwise, the resource allocation sequences are not mutated.
[0095] The more elements that mutate or cross over, the greater the difference between the resulting sequence and the original sequence, ensuring the diversity of the search and making it easier to obtain the best resource scheduling scheme.
[0096] The original resource allocation sequence, the mutated resource allocation sequence, and the cross resource allocation sequence are arranged in order of the objective function value from smallest to largest, and values are taken from front to back, retaining a preset number of resource allocation sequences.
[0097] In this embodiment, by mutating and crossing the resource allocation sequence, it is possible to escape local optima and increase the diversity of the sequence, thereby not only improving the optimization effect but also accelerating the convergence speed, thus finding the optimal resource allocation sequence.
[0098] In this embodiment, by scheduling the queue once, the data processing efficiency between member users and ordinary users can be effectively balanced. Based on the scheduled queue, gateway resource scheduling is performed to fully utilize gateway performance, ensuring both the immediacy of data processing and load balancing. Furthermore, this application designs an algorithm that primarily uses local search and secondarily uses global search, combined with a genetic algorithm, to achieve superior global search performance. This allows the algorithm to obtain the optimal resource allocation sequence, thus achieving the gateway resource allocation scheme.
[0099] like Figure 2The diagram shown is a schematic representation of a gateway resource scheduling device provided in an embodiment of this application. Figure 2 As shown, the gateway resource scheduling device is applied to a cloud gateway, which includes multiple central processing unit (CPU) cores. The gateway resource scheduling device may include: a first determining module 201, a first scheduling module 202, a second scheduling module 203, and an execution module 204.
[0100] The system comprises: a first determining module 201, used to authenticate terminal devices based on SIM card information from the user identification module and determine the priority of each terminal device; a first scheduling module 202, used to schedule data forwarding tasks based on the priority of different terminal devices when receiving data forwarding tasks from different terminal devices, thereby obtaining a data processing queue; a second scheduling module 203, used to divide the data processing queue into multiple sub-queues with a pre-defined objective function, wherein the pre-defined objective function is used to divide the data processing queue into an optimal resource allocation sequence; and an execution module 204, used to distribute the data forwarding tasks in the multiple sub-queues with a pre-defined objective function to the corresponding CPU cores for execution.
[0101] In this embodiment, the first determining module 201 first authenticates the terminal devices based on the SIM card information of the user identification module to determine the priority of each terminal device. Then, the first scheduling module 202, upon receiving data forwarding tasks from different terminal devices, schedules the data forwarding tasks based on the priorities of the different terminal devices to obtain a data processing queue. The second scheduling module 203 then divides the data processing queue into multiple sub-queues with a predetermined order based on a preset objective function. The preset objective function is used to divide the data processing queue into an optimal resource allocation sequence. Finally, the execution module 204 distributes the data forwarding tasks in the multiple sub-queues with a predetermined order to the corresponding CPU cores for execution. This embodiment of the application schedules the data forwarding tasks of different terminal devices, which can effectively balance the data processing efficiency among different users. Furthermore, based on the queued data forwarding tasks, gateway resource scheduling is performed to fully utilize the gateway performance, ensuring both the immediacy of data processing and load balancing.
[0102] In one possible implementation of this application, the second scheduling module 203 is used to encode the data forwarding tasks in the data processing queue to obtain multiple initial resource allocation sequences; determine the objective function corresponding to each initial resource allocation sequence based on the CPU load balancing index and the execution time span of the data processing tasks; update each initial resource allocation sequence based on the objective function to obtain a resource allocation sequence, wherein the resource allocation sequence includes multiple sub-queues with a sequential order.
[0103] In one possible implementation of this application, the second scheduling module 203 is used to determine a range of unit values equal to the number of CPU cores in the cloud gateway, wherein all unit value ranges constitute an overall value range; within the overall value range, a value is assigned to each data forwarding task to obtain an initial resource allocation sequence; after multiple allocations, multiple initial resource allocation sequences are obtained.
[0104] In one possible implementation of this application, the second scheduling module 203 is used to determine the load balancing index of the CPU cores based on the physical parameters of the CPU cores, including CPU speed, CPU utilization, memory size, memory usage, and hard disk usage; determine the total execution time required for each CPU core to execute a task based on the execution time of the initial resource allocation sequence on each CPU core; determine the execution time span of the data processing task based on the total execution time, the execution time span being the difference between the maximum and minimum execution time; and determine the objective function based on the load balancing index of the CPU cores and the execution time span.
[0105] In one possible implementation of this application, the second scheduling module 203 is configured to: determine the initial resource allocation sequence with the largest objective function value as the optimal resource allocation sequence based on the objective function; update other initial resource allocation sequences based on the optimal resource allocation sequence to obtain updated resource allocation sequences; for each updated resource allocation sequence, determine whether the optimal resource allocation sequence has mutated based on random numbers within a preset range, and obtain the objective function of all updated resource allocation sequences; determine the mutation probability and crossover probability of each resource allocation sequence based on the objective function of all updated resource allocation sequences; update the resource allocation sequence again based on the mutation probability and crossover probability to obtain updated updated resource allocation sequences; and determine the resource allocation sequence with the smallest objective function if the number of updates is greater than or equal to a preset number.
[0106] In one possible implementation of this application, the second scheduling module 203 is used to obtain the average distance and maximum distance between other initial resource allocation sequences and the optimal resource allocation sequence; determine the speed control coefficient for updating the initial resource allocation sequence based on the average distance, maximum distance and logarithmic function, wherein the logarithmic function is used to control the update amount; determine the update amount of each initial resource allocation sequence based on the speed control coefficient; and update the corresponding initial resource allocation sequence based on the update amount of each initial resource allocation sequence to obtain the updated resource allocation sequence.
[0107] In one possible implementation of this application, the second scheduling module 203 is configured to generate a first random number within a preset range for each updated resource allocation sequence; if the first random number is greater than or equal to a first threshold, perform mutation processing on the optimal resource allocation sequence to obtain a new resource allocation sequence; if the first random number is less than the first threshold, do not perform mutation processing on the optimal resource allocation sequence.
[0108] In one possible implementation of this application, the second scheduling module 203 is configured to generate a second random number within a preset range for each updated resource allocation sequence; if the second random number is less than a second threshold and the objective function of the new resource allocation sequence decreases, the optimal resource allocation sequence is replaced with the new resource allocation sequence; if the second random number is greater than or equal to the second threshold, or the objective function of the new resource allocation sequence does not decrease, the first threshold and the second threshold are updated.
[0109] In one possible implementation of this application, the second scheduling module 203 is used to determine whether the resource allocation sequence needs to be mutated based on the mutation probability; if the resource allocation sequence needs to be mutated, at least one element in the resource allocation sequence is randomly changed within the sequence value range to obtain a mutated resource allocation sequence; all resource allocation sequences are randomly paired in pairs to obtain multiple paired resource allocation sequences; based on the crossover probability, it is determined whether the elements in the paired resource allocation sequences need to be crossed; if the elements in the paired resource allocation sequences need to be crossed, at least one corresponding element in the paired resource allocation sequences is crossed in the same position to obtain a cross resource allocation sequence; the original resource allocation sequence, the mutated resource allocation sequence, and the cross resource allocation sequence are arranged in ascending order of the objective function to obtain the updated resource allocation sequence.
[0110] The gateway resource scheduling device in this application already has the functionality of... Figure 1 The method embodiments shown are described in detail. Therefore, for any parts not covered in detail in this embodiment, please refer to the relevant descriptions in the foregoing embodiments, which will not be repeated here.
[0111] like Figure 3 As shown, this application embodiment also provides an electronic device 300, including a processor 301, a memory 302, and a program or instructions stored in the memory 302 and executable on the processor 301. When the program or instructions are executed by the processor 301, they implement the various processes of the above-described gateway resource scheduling processing method embodiment and achieve the same technical effect. To avoid repetition, they will not be described again here.
[0112] Optionally, embodiments of this application also provide a computer-readable storage medium storing a computer program. When executed by a processor, this computer program implements the various processes of the above-described gateway resource scheduling method embodiments and achieves the same technical effects. To avoid repetition, it will not be described again here. The computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0113] Optionally, this application embodiment also provides a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium. The computer program includes program instructions, which, when executed by a computer, implement the various processes of the above-described gateway resource scheduling method embodiment and achieve the same technical effect. To avoid repetition, they will not be described again here.
[0114] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.
[0115] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0116] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of this application.
Claims
1. A gateway resource scheduling method, characterized in that, Applied to a cloud gateway, the cloud gateway including multiple central processing unit (CPU) cores, the method includes: The terminal devices are authenticated based on the SIM card information of the user identification module to determine the priority of each terminal device; When data forwarding tasks are received from different terminal devices, the data forwarding tasks are scheduled based on the priority of the different terminal devices to obtain a data processing queue. Based on a preset objective function, the data processing queue is divided into multiple sub-queues with a sequential order. The preset objective function is used to divide the data processing queue into an optimal resource allocation sequence. The data forwarding tasks in the multiple sequential sub-queues are distributed to the corresponding CPU cores for execution; The data processing queue is divided into multiple sub-queues with a specific order based on a preset objective function, including: The data forwarding tasks in the data processing queue are encoded to obtain multiple initial resource allocation sequences; Based on the CPU's load balancing metrics and the execution time span of the data processing tasks, determine the objective function corresponding to each initial resource allocation sequence; The objective function is: ; in, Indicates the factors affecting load balancing metrics. Indicating the influencing factors of the execution time span, as well as All are between (0,1), and Less than ; Based on the objective function, each initial resource allocation sequence is updated to obtain a resource allocation sequence, which includes multiple sub-queues with a sequential order.
2. The method according to claim 1, characterized in that, The data forwarding tasks in the data processing queue are encoded to obtain multiple initial resource allocation sequences, including: Based on the number of CPU cores in the cloud gateway, a range of unit values equal to the number of CPU cores is determined, wherein all unit value ranges constitute the overall value range. Within the overall numerical range, a value is assigned to each data forwarding task to obtain the initial resource allocation sequence; After multiple allocations, several initial resource allocation sequences are obtained.
3. The method according to claim 1, characterized in that, The objective function for each initial resource allocation sequence is determined based on the CPU's load balancing metrics and the execution time span of the data processing tasks, including: Based on the physical parameters of the CPU core, the load balancing metrics of the CPU core are determined. The physical parameters include CPU speed, CPU utilization, memory size, memory usage, and hard disk usage. Based on the execution time of the initial resource allocation sequence on each CPU core, determine the total execution time required for each CPU core to execute the task. Based on the total execution time, the execution time span of the data processing task is determined, where the execution time span is the difference between the maximum execution time and the minimum execution time. The objective function is determined based on the CPU core's load balancing metrics and the execution time span.
4. The method according to claim 1, characterized in that, The step of updating each initial resource allocation sequence based on the objective function to obtain a resource allocation sequence includes: Based on the objective function, the initial resource allocation sequence with the largest objective function value is determined as the optimal resource allocation sequence; Based on the optimal resource allocation sequence, other initial resource allocation sequences are updated to obtain the updated resource allocation sequence. For each updated resource allocation sequence, based on random numbers within a preset range, determine whether the optimal resource allocation sequence has mutated, and obtain the objective function for all updated resource allocation sequences; Based on the objective function of all the updated resource allocation sequences, determine the mutation probability and crossover probability of each resource allocation sequence; Based on the mutation probability and the crossover probability, the resource allocation sequence is updated again to obtain the updated resource allocation sequence. If the number of updates is greater than or equal to the preset number, determine the resource allocation sequence that minimizes the objective function.
5. The method according to claim 4, characterized in that, The step of updating other initial resource allocation sequences based on the optimal resource allocation sequence to obtain the updated resource allocation sequence includes: Obtain the average distance and maximum distance between the other initial resource allocation sequences and the optimal resource allocation sequence; Based on the average distance, the maximum distance, and the logarithmic function, a rate control coefficient for updating the initial resource allocation sequence is determined, wherein the logarithmic function is used to control the update amount; Based on the speed control coefficient, determine the update amount for each initial resource allocation sequence; Based on the update amount of each initial resource allocation sequence, the corresponding initial resource allocation sequence is updated to obtain the updated resource allocation sequence.
6. The method according to claim 4, characterized in that, The step of determining whether the optimal resource allocation sequence has mutated for each updated resource allocation sequence based on random numbers within a preset range includes: For each updated resource allocation sequence, generate a first random number within a preset range; If the first random number is greater than or equal to the first threshold, the optimal resource allocation sequence is mutated to obtain a new resource allocation sequence. If the first random number is less than the first threshold, the optimal resource allocation sequence is not mutated.
7. The method according to claim 6, characterized in that, The method further includes: For each updated resource allocation sequence, a second random number is generated within the preset range; If the second random number is less than the second threshold and the objective function of the new resource allocation sequence decreases, the new resource allocation sequence replaces the optimal resource allocation sequence. If the second random number is greater than or equal to the second threshold, or if the objective function of the new resource allocation sequence does not decrease, update the first threshold and the second threshold.
8. The method according to claim 4, characterized in that, The step of updating the resource allocation sequence again based on the mutation probability and the crossover probability to obtain the updated resource allocation sequence includes: Based on the mutation probability, determine whether the resource allocation sequence needs to be mutated; When the resource allocation sequence needs to be mutated, at least one element in the resource allocation sequence is randomly changed within the range of sequence values to obtain a mutated resource allocation sequence. All resource allocation sequences are randomly paired in pairs to obtain multiple paired resource allocation sequences; Based on the crossover probability, determine whether elements in the paired resource allocation sequence need to be crossed; When elements in the paired resource allocation sequence need to be crossed, at least one corresponding element in the paired resource allocation sequence is crossed in the same position to obtain a crossed resource allocation sequence. The original resource allocation sequence, the mutated resource allocation sequence, and the crossover resource allocation sequence are arranged in ascending order of the objective function to obtain the updated resource allocation sequence.
9. A gateway resource scheduling device, characterized in that, Applied to a cloud gateway, the cloud gateway including multiple central processing unit (CPU) cores, the device includes: The first determining module is used to authenticate terminal devices based on the SIM card information of the user identification module and determine the priority of each terminal device. The first scheduling module is used to schedule the data forwarding tasks based on the priority of different terminal devices when receiving data forwarding tasks from different terminal devices, so as to obtain a data processing queue. The second scheduling module is used to divide the data processing queue into multiple sub-queues with a sequential order based on a preset objective function. The preset objective function is used to divide the data processing queue into an optimal resource allocation sequence. The execution module is used to distribute the data forwarding tasks in the multiple sub-queues with a sequential order to the corresponding CPU cores for execution; The second scheduling module is used to encode the data forwarding tasks in the data processing queue to obtain multiple initial resource allocation sequences; based on the CPU load balancing index and the execution time span of the data processing tasks, it determines the objective function corresponding to each initial resource allocation sequence; based on the objective function, it updates each initial resource allocation sequence to obtain a resource allocation sequence, which includes multiple sub-queues with a sequential order. The objective function is: ; in, Indicates the factors affecting load balancing metrics. Indicating the influencing factors of the execution time span, as well as All are between (0,1), and Less than .
10. An electronic device, characterized in that, It includes a processor, a memory, a program or instructions stored in the memory and executable on the processor, wherein the program or instructions, when executed by the processor, implement the steps of the method as described in any one of claims 1 to 8.
11. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the method as described in any one of claims 1 to 8.
12. A computer program product, characterized in that, The computer program product includes a computer program stored on a non-transitory computer-readable storage medium, the computer program including program instructions that, when executed by a computer, implement the steps of the method as described in any one of claims 1 to 8.
Citation Information
Patent Citations
Cloud computing resource load balancing scheduling method based on improved genetic algorithm and application
CN112380016A
Communication method and device
CN112491516A