Gateway resource scheduling method and computer program product
By determining the priority of terminal devices based on SIM card information in the cloud gateway and scheduling data forwarding task, the problem of low utilization rate of cloud gateway equipment is solved, realizing the immediacy of data processing and load balancing, and ensuring efficient resource utilization .
Patent Information
- Application Number
- CN202411091041.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-09
- Publication Date
- 2024-11-15
- Estimated Expiration
- 2044-08-09
AI Technical Summary
Cloud gateway devices cannot achieve high utilization and high service quality operation states at the same time, resulting in low utilization.
By authenticating the terminal device based on the SIM card information of the user identification module, determining its priority, and scheduling the data forwarding task based on the priority, dividing it into multiple subqueues with sequence, and processing the data using the preset objective function The queue is divided into the optimal resource allocation sequence, and finally the data forwarding task in the subqueue is sent to the corresponding CPU core for execution.
Effectively balance the data processing efficiency between different users, fully utilize the gateway performance, and ensure the immediacy of data processing and load balancing.
Smart Images

Figure CN118972969A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of gateway scheduling, and in particular to a gateway resource scheduling method and a computer program product. Background Art
[0002] With the rapid development of the Internet, gateway devices play an important role in data transmission. With the emergence of a large number of mobile device users, a large number of mobile devices access cloud services, and cloud gateways are the entrance and exit of large data center traffic, which plays a decisive role in the reliability and transmission of network transmission. Although gateway devices are also constantly developing and iterating, there is still a serious contradiction between the utilization rate of cloud gateway devices and the service quality of users. Gateway devices cannot achieve the ideal operating state of high utilization and high service quality at the same time. Summary of the invention
[0003] The embodiments of the present application provide a gateway resource scheduling method and a computer program product to solve the problem of low cloud gateway utilization in the related art.
[0004] In a first aspect, an embodiment of the present application provides a gateway resource scheduling method, which is applied to a cloud gateway, wherein the cloud gateway includes multiple central processing unit (CPU) cores, and the method includes:
[0005] Authenticate the terminal device based on the SIM card information of the subscriber identity module and determine the priority of each terminal device;
[0006] When receiving data forwarding tasks from different terminal devices, scheduling the data forwarding tasks based on the priorities 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 a plurality of sub-queues having a sequential order, wherein 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 plurality of sub-queues having a sequential order are sent to the corresponding CPU cores for execution.
[0009] In a second aspect, an embodiment of the present application provides a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium, and the computer program includes program instructions, which, when executed by a computer, implement the steps of the method described in the first aspect.
[0010] In the embodiment of the present application, first, the cloud gateway authenticates the terminal device based on the SIM card information of the user identification module, determines the priority of each terminal device, and then, when receiving data forwarding tasks from different terminal devices, schedules the data forwarding tasks based on the priorities of different terminal devices to obtain a data processing queue, and then divides the data processing queue into multiple sub-queues with a sequence based on a preset objective function. The preset objective function is used to divide the data processing queue into an optimal resource allocation sequence, and finally sends the data forwarding tasks in the multiple sub-queues with a sequence to the corresponding CPU core for execution. The embodiment of the present application schedules the data forwarding tasks of different terminal devices once, which can effectively balance the data processing efficiency between different users, and performs gateway resource scheduling based on the queue after scheduling, thereby fully exerting the gateway performance, ensuring both the immediacy of data processing and the load balancing. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0012] Figure 1 is a flow chart of a gateway resource scheduling method provided in an embodiment of the present application;
[0013] Figure 2 is a schematic diagram of a gateway resource scheduling device provided in an embodiment of the present application;
[0014] Figure 3 It is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0015] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0016] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described here. In addition, the "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally represents that the objects associated with each other are in an "or" relationship.
[0017] The following is combined with Figures 1 to 3 , a gateway resource scheduling method and a computer program product provided in an embodiment of the present application are described in detail through specific embodiments and application scenarios.
[0018] like Figure 1 As shown, it is a flow chart of a gateway resource scheduling method provided by an embodiment of the present application. Figure 1 As shown, the gateway resource scheduling method is applied to a cloud gateway, and the cloud gateway includes multiple central processing units (CPUs). The gateway resource scheduling method may include: the contents shown in S101 to S104.
[0019] In S101, the terminal device is authenticated based on the Subscriber Identity Module (SIM) card information, and the priority of each terminal device is determined.
[0020] It is worth noting that users can register through SIM cards to obtain login authentication credentials and user priority. Among them, user priority can refer to the priority corresponding to different SIM cards. The higher the priority, the data forwarding task should be executed first within the predetermined time range.
[0021] In S102, when data forwarding tasks from different terminal devices are received, the data forwarding tasks are scheduled based on the priorities of the different terminal devices to obtain a data processing queue.
[0022] That is to say, the data forwarding tasks generated by different SIM devices can be scheduled based on the priority of the devices to ensure that the data forwarding tasks with high priority can be sent out in time.
[0023] The SIM device is a device equipped with a SIM card, and the priority corresponding to the data forwarding task is the priority corresponding to the SIM card. By setting the priority, the data communication efficiency between different types of users can be guaranteed in priority.
[0024] In one instance, scheduling of data forwarding tasks based on the priorities of different terminal devices may include: when the data forwarding task arrives at the cloud gateway, the priority of each data forwarding task is the same as its SIM card priority, and the priority of the data forwarding task increases by one with each CPU clock cycle. The higher the priority, the higher its position in the data processing queue.
[0025] It is worth noting that when the priorities are the same, they are arranged in chronological order, so that the data forwarding tasks can be sorted in the first place, ensuring that the user tasks with high priority can be executed faster, while the data forwarding tasks of other users can also be processed, thereby balancing the efficiency and experience among different users. The scheduling in this example is carried out in real time, that is, the order of the 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 a plurality of 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 for the second time according to the objective function of the pre-device, that is, gateway resource scheduling, so as to fully exert the gateway performance.
[0029] In S104, the data forwarding tasks in the plurality of sub-queues having a sequential order are sent to the corresponding CPU cores for execution.
[0030] In the embodiment of the present application, first, the cloud gateway authenticates the terminal device based on the SIM card information of the user identification module, determines the priority of each terminal device, and then, when receiving data forwarding tasks from different terminal devices, schedules the data forwarding tasks based on the priorities of different terminal devices to obtain a data processing queue, and then divides the data processing queue into multiple sub-queues with a sequence based on a preset objective function. The preset objective function is used to divide the data processing queue into an optimal resource allocation sequence, and finally sends the data forwarding tasks in the multiple sub-queues with a sequence to the corresponding CPU core for execution. The embodiment of the present application schedules the data forwarding tasks of different terminal devices once, which can effectively balance the data processing efficiency between different users, and performs gateway resource scheduling based on the queue after scheduling, thereby fully exerting the gateway performance, ensuring both the immediacy of data processing and the load balancing.
[0031] In a possible implementation of the present application, based on a preset target model, a data processing queue is divided into multiple sub-queues with a sequence, which 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 task; based on the objective function, updating each initial resource allocation sequence to obtain a resource allocation sequence, and the resource allocation sequence includes multiple sub-queues with a sequence.
[0032] In this embodiment, the data forwarding tasks in the data processing queue can be encoded based on the number of CPU cores of the cloud gateway to obtain the initial resource allocation sequence, and then the objective function is determined according to the CPU load balancing index and the execution time span of the data processing task, and then 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 according to the capacity of the CPU core in the cloud gateway to better schedule the gateway resources, thereby improving the gateway utilization rate.
[0033] In a possible implementation of the present application, encoding the data forwarding tasks in the data processing queue to obtain multiple initial resource allocation sequences may include: based on the number of CPU cores in the cloud gateway, determining the same number of unit numerical ranges as the number of CPU cores, wherein all unit numerical ranges constitute an overall numerical range; within the overall numerical range, assigning a numerical value to each data forwarding task to obtain an initial resource allocation sequence; after multiple allocations, obtaining multiple initial resource allocation sequences.
[0034] That is to say, the number of CPU cores of the cloud gateway can be determined first, and the unit value range that is the same as the number of CPU cores of the cloud gateway can be determined. For example, when the number of CPU cores of the cloud gateway is 10, the range of 0-10 can be determined (including 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 a unit value range.
[0035] It is worth noting that the above-mentioned number of CPU cores is only an example. Since the cloud gateway may be composed of one gateway device or multiple gateway devices, the number of CPU cores is not limited to 10, and may be more, depending on the actual application, and is not limited in this embodiment.
[0036] A value is generated for each data forwarding task within the overall range, thereby obtaining an 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], thereby obtaining an initial resource allocation sequence.
[0037] In order to improve the scheduling efficiency of the gateway CPU resources, multiple initial resource allocation sequences can be used to obtain the optimal resource scheduling solution by using a multi-body search method. Therefore, according to the above method, multiple initial resource allocation sequences are randomly generated.
[0038] In a possible implementation of the present application, determining the objective function corresponding to each initial resource allocation sequence based on the CPU load balancing index and the execution time span of executing the data processing task may include: determining the load balancing index of the CPU core based on the physical parameters of the CPU core, the physical parameters including CPU rate, 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 for executing the data processing task based on the total execution time, the execution time span being the difference between the maximum execution time and the minimum execution time; determining the objective function based on the load balancing index and the execution time span of the CPU core.
[0039] In this embodiment, when allocating data forwarding tasks according to the resource allocation sequence, the physical parameters of the CPU core such as the rate, utilization, memory size, remaining memory size, and remaining hard disk size corresponding to each CPU core can be predicted; the memory and hard disk size can be pre-divided for each CPU core, and it is only allowed to be scheduled within the preset size range. Among them, the CPU core can be based on the rate required by the CPU core to execute data forwarding tasks of different sizes, and the utilization, remaining memory size, and remaining hard disk size can be obtained in the same way.
[0040] In one example, according to the CPU rate, CPU utilization, memory size, used memory size, and hard disk usage size corresponding to the CPU core, the load of the CPU core 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] Among them, 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, y c Indicates the CPU speed, y cp Indicates CPU utilization, y m Indicates the memory size, y mp Indicates the memory size used, y d Indicates the used hard disk size.
[0044] According to the load corresponding to all CPU cores, the load average AL is obtained, and according to the load average AL and the load VL corresponding to each CPU core, the load balancing index BL is obtained as follows:
[0045]
[0046] Among them, VL v Represents the load VL corresponding to the vth CPU core, 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 amount of units), and based on this execution time, determine the total execution time required for each CPU core to execute the task, and find the maximum execution time and the minimum execution time in all the total execution times, so that the execution time span RT can be determined as:
[0048] RT=T max -T min
[0049] Among them, T max represents the maximum execution time, T min 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 is, the better, where ε represents the influencing factor of the load balancing index, and λ represents the influencing factor of the execution time span. Both ε and λ are between (0,1), and λ is smaller than ε.
[0053] In this embodiment, the objective function corresponding to each initial resource allocation sequence can be obtained, and 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 a possible implementation of the present application, each initial resource allocation sequence is updated based on the objective function to obtain a resource allocation sequence, which may include: based on the objective function, determining the initial resource allocation sequence with the largest objective function value as the optimal resource allocation sequence; based on the optimal resource allocation sequence, updating other initial resource allocation sequences to obtain an updated resource allocation sequence; for each updated resource allocation sequence, determining whether the optimal resource allocation sequence mutates based on a random number within a preset range, and obtaining the objective function of all updated resource allocation sequences; according to the objective functions of all updated resource allocation sequences, determining the mutation probability and crossover probability of each resource allocation sequence; based on the mutation probability and crossover probability, updating the resource allocation sequence again to obtain an updated updated resource allocation sequence; when the number of updates is greater than or equal to the preset number of times, determining the resource allocation sequence with the smallest objective function.
[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, and other resource allocation sequences are updated according to the optimal resource allocation sequence to obtain the updated resource allocation sequence, and then for each updated resource allocation sequence, whether the optimal resource allocation sequence is mutated is determined based on a random number, and the objective function of all updated resource allocation sequences is obtained, and the mutation probability and crossover probability of each resource allocation sequence are determined according to the objective function value corresponding to each resource allocation sequence, and the resource allocation sequence is updated twice based on the mutation probability and crossover probability to obtain the resource allocation sequence after the second update, and after multiple updates, the number of updates is determined, and when the number of updates is greater than or equal to the preset number of times, the resource allocation sequence with the smallest objective function is determined. The mutation in this embodiment allows the optimal resource allocation sequence to be fine-tuned, and when the number of iterations increases, the search space can be constrained, the search direction of the resource allocation sequence can be changed, so as to enter other areas for search, thereby improving the overall search capability, reducing the possibility of falling into a local optimum, 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 limit or the lower limit.
[0057] In a possible implementation of the present application, based on the optimal resource allocation sequence, updating other initial resource allocation sequences to obtain updated resource allocation sequences may include: obtaining the average distance and the maximum distance between other initial resource allocation sequences and the optimal resource allocation sequence; determining a speed control coefficient for updating the initial resource allocation sequence based on the average distance, the maximum distance and the logarithmic function, wherein the logarithmic function is used to control the update amount; determining the update amount of each initial resource allocation sequence based on the speed control coefficient; and updating the corresponding initial resource allocation sequence based on the update amount of each initial resource allocation sequence to obtain an updated resource allocation sequence.
[0058] Among them, the average distance between other initial resource allocation sequences and the optimal resource allocation sequence is:
[0059]
[0060] in, represents the average distance, represents the jth element of the i-th resource allocation sequence in the t-th optimization process, i = 1, 2, ..., I, I represents the total number of resource allocation sequences, j = 1, 2, ..., J, J represents the total number of CPU cores, Represents the jth element of the optimal resource allocation sequence in the tth optimization process.
[0061] The maximum distance between other initial resource allocation sequences and the optimal resource allocation sequence is:
[0062]
[0063] Among them, d max Indicates the maximum distance.
[0064] Determining a speed control coefficient for updating an initial resource allocation sequence according to the average distance, the maximum distance, and the logarithmic function may include:
[0065] According to the maximum distance d max And the average distance The speed control coefficient used to update the resource allocation sequence is obtained as:
[0066]
[0067] Among them, ω0 represents the preset control coefficient, ω t Indicates the speed control coefficient.
[0068] In the present 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, optimizes the global search and local search capabilities, and is conducive to better searching for resource allocation sequences.
[0069] According to the speed control coefficient, the update amount of each resource allocation sequence is obtained as:
[0070]
[0071] step i =step min +(step max -step min )β
[0072] Where ΔX t represents the update amount in the tth optimization, ΔX t-1 represents the update amount in the t-1th optimization, represents the i-th resource allocation sequence in the t-1-th optimization, represents the optimal resource allocation sequence in the tth optimization, step i represents the step size control coefficient corresponding to the i-th resource allocation sequence, step max Indicates the maximum step length control coefficient, step min represents the minimum step size control coefficient, and β represents a random number that obeys the uniform distribution between [0,1].
[0073] In this embodiment, based on the objective function, a 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 an updated resource allocation sequence.
[0074] In a possible implementation of the present application, for each updated resource allocation sequence, determining whether the optimal resource allocation sequence has mutated based on a random number within a preset range may include: for each updated resource allocation sequence, generating a first random number within a preset range; when the first random number is greater than or equal to a first threshold, mutating the optimal resource allocation sequence to obtain a new resource allocation sequence; when the first random number is less than the first threshold, not mutating the optimal resource allocation sequence.
[0075] The preset range may be any range of the pre-set device, which may be based on actual application and is not limited in this embodiment.
[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, then 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] Among them, σ represents the coefficient of variation, X max represents a sequence with the same dimension as the resource allocation sequence, and the elements of each dimension are the upper limit of the element, X min represents a sequence with the same dimension as the resource allocation sequence, and the elements of each dimension are the lower limit values of the elements, α represents the intermediate parameter, e represents the natural constant, represents 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; ξ represents the adjustment coefficient, which is a constant greater than 1.
[0081] The mutation method provided in the present application has good mutation performance and fine-tuning capability. When the number of iterations increases, it can constrain the search space and change the search direction of the resource allocation sequence, thereby entering other areas for search, thereby improving the overall search capability, reducing the possibility of falling into local optimality, and ultimately accelerating the convergence speed.
[0082] In a possible implementation of the present application, the gateway resource scheduling method may further include: generating a second random number within a preset range for each updated resource allocation sequence; when the second random number is less than a second threshold and the objective function of the new resource allocation sequence is reduced, replacing the optimal resource allocation sequence with a new resource allocation sequence; when the second random number is greater than or equal to the second threshold, or the objective function of the new resource allocation sequence is not reduced, updating the first threshold and the second threshold.
[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 value A i , and whether the objective function value of the new resource allocation sequence is reduced, if so, the new resource allocation sequence is used to replace the optimal resource allocation sequence, otherwise the threshold A is used. i and the threshold r i Updates.
[0084] It is worth noting that the first threshold r i and the second threshold A i are initialized in the first optimization process, and each resource allocation sequence initializes a first threshold r i and the second threshold A i .
[0085] Threshold Ai and the threshold r i The update is:
[0086]
[0087] in, represents the first threshold in the t-th optimization process, δ represents a constant between (0,1), Indicates updated represents the first threshold of initialization, represents the updated threshold r i , γ is a constant greater than 0.
[0088] In a possible implementation of the present application, based on the mutation probability and the crossover probability, the resource allocation sequence is updated again to obtain an updated resource allocation sequence, which 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; based on the crossover probability, determining 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, performing co-location crossover on at least one corresponding element in the paired resource allocation sequence to obtain a crossed resource allocation sequence; arranging the original resource allocation sequence, the mutated resource allocation sequence, and the crossed resource allocation sequence in the order of the objective function from small to large to obtain an 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 according to the objective function value corresponding to each resource allocation sequence, and the resource allocation sequence can be updated for the second time based on the mutation probability and the crossover probability to obtain the resource allocation sequence after the second update.
[0090] Among them, the mutation probability and crossover probability are obtained as follows:
[0091]
[0092] Among them, F' represents the intermediate parameter, P1 represents the cross coefficient, P2 represents the coefficient of variation, and F' max represents the maximum value of the intermediate parameters corresponding to all resource allocation sequences, represents the average value of the intermediate parameters corresponding to all resource allocation sequences, F' minrepresents the minimum value of the intermediate parameters corresponding to all resource allocation sequences, max(F'(X1), F'(X2)) represents the maximum second parameter corresponding to the resource allocation sequence X1 to be crossed with the resource allocation sequence X2, and F'(X i ) represents the second parameter of the resource allocation sequence to be mutated, t represents the current optimization times, and iter represents the maximum optimization times.
[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 set in advance) to obtain a 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 in the two resource allocation sequences are cross-linked in the same position (the specific number of elements can be set in advance) to obtain two crossed resource allocation sequences. Otherwise, the resource allocation sequence is not mutated.
[0095] The more elements that are mutated or crossed, the greater the difference between the obtained sequence and the original sequence will be, which can ensure the diversity of the search and is more conducive to obtaining the best resource scheduling solution.
[0096] The original resource allocation sequence, the variant resource allocation sequence and the cross resource allocation sequence are arranged in the order of the objective function value from the smallest to the smallest, and the values are taken from the front to the back, and a preset number of resource allocation sequences are retained.
[0097] In this embodiment, by mutating and crossing the resource allocation sequence, it is possible to escape from the local optimum and increase the diversity of the sequence, thereby not only improving the optimization effect but also accelerating the convergence speed, thereby finding the optimal resource allocation sequence.
[0098] In the embodiment of the present application, by scheduling the queue once, the data processing efficiency between member users and ordinary users can be effectively balanced, and based on the queue after scheduling, gateway resource scheduling is performed, so as to fully exert the gateway performance, which not only ensures the immediacy of data processing, but also ensures load balancing. In addition, the present application designs an algorithm that mainly uses local search and supplements global search, and combines genetic algorithms to make the algorithm have better global search performance, so that the optimal resource allocation sequence can be obtained, thereby achieving the acquisition of the optimal resource allocation sequence and obtaining a gateway resource allocation plan.
[0099] like Figure 2As shown, it is a schematic diagram of a gateway resource scheduling device provided in an embodiment of the present application. Figure 2 As shown, the gateway resource scheduling device is applied to a cloud gateway, and the cloud gateway includes multiple central processing unit CPU cores. The gateway resource scheduling device may include: a first determination module 201, a first scheduling module 202, a second scheduling module 203 and an execution module 204.
[0100] Among them, the first determination module 201 is used to authenticate the terminal device based on the user identification module SIM card information and determine the priority of each terminal device; the first scheduling module 202 is used to schedule the data forwarding tasks based on the priorities of different terminal devices when receiving data forwarding tasks from different terminal devices, and obtain the data processing queue; the second scheduling module 203 is used to divide the data processing queue into multiple sub-queues with a sequence based on a preset objective function, and the preset objective function is used to divide the data processing queue into an optimal resource allocation sequence; the execution module 204 is used to send the data forwarding tasks in multiple sub-queues with a sequence to the corresponding CPU core for execution.
[0101] In the embodiment of the present application, first, the first determination module 201 authenticates the terminal device based on the SIM card information of the user identification module, and determines the priority of each terminal device. Then, the first scheduling module 202 schedules the data forwarding tasks based on the priorities of different terminal devices when receiving data forwarding tasks of different terminal devices, and obtains a data processing queue. The second scheduling module 203 divides the data processing queue into a plurality of sub-queues with a sequence 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 sends the data forwarding tasks in the plurality of sub-queues with a sequence to the corresponding CPU core for execution. The embodiment of the present application schedules the data forwarding tasks of different terminal devices once, which can effectively balance the data processing efficiency between different users, and performs gateway resource scheduling based on the queue after scheduling, so as to fully exert the gateway performance, which not only ensures the immediacy of data processing, but also ensures the load balancing.
[0102] In a possible implementation of the present 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 indicator and the execution time span of the data processing task; based on the objective function, update each initial resource allocation sequence to obtain a resource allocation sequence, and the resource allocation sequence includes multiple sub-queues with a sequence.
[0103] In a possible implementation of the present application, the second scheduling module 203 is used to determine, based on the number of CPU cores in the cloud gateway, a unit numerical range of the same number as the number of CPU cores, wherein all unit numerical ranges constitute an overall numerical range; within the overall numerical range, a numerical 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 a possible implementation of the present application, the second scheduling module 203 is used to determine the load balancing index of the CPU core based on the physical parameters of the CPU core, the physical parameters including CPU speed, CPU utilization, memory size, used memory size, and hard disk usage size; 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, determine the execution time span for executing the data processing task, the execution time span being the difference between the maximum execution time and the minimum execution time; determine the objective function based on the load balancing index and execution time span of the CPU core.
[0105] In a possible implementation of the present application, the second scheduling module 203 is used to determine, based on the objective function, an initial resource allocation sequence with the largest objective function value as the optimal resource allocation sequence; based on the optimal resource allocation sequence, update other initial resource allocation sequences to obtain an updated resource allocation sequence; for each updated resource allocation sequence, determine whether the optimal resource allocation sequence mutates based on a random number 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 functions of all updated resource allocation sequences; based on the mutation probability and crossover probability, update the resource allocation sequence again to obtain an updated updated resource allocation sequence; when the number of updates is greater than or equal to the preset number of times, determine the resource allocation sequence with the smallest objective function.
[0106] In a possible implementation of the present application, the second scheduling module 203 is used to obtain the average distance and the 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, the maximum distance and the 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 an updated resource allocation sequence.
[0107] In a possible implementation of the present application, the second scheduling module 203 is used to generate a first random number within a preset range for each updated resource allocation sequence; when the first random number is greater than or equal to a first threshold, the optimal resource allocation sequence is mutated to obtain a new resource allocation sequence; when the first random number is less than the first threshold, the optimal resource allocation sequence is not mutated.
[0108] In a possible implementation of the present application, the second scheduling module 203 is used to generate a second random number within a preset range for each updated resource allocation sequence; when the second random number is less than the second threshold and the objective function of the new resource allocation sequence is reduced, the new resource allocation sequence is used to replace the optimal resource allocation sequence; when the second random number is greater than or equal to the second threshold, or the objective function of the new resource allocation sequence is not reduced, the first threshold and the second threshold are updated.
[0109] In a possible implementation of the present 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 sequence need to be crossed; if the elements in the paired resource allocation sequence need to be crossed, at least one corresponding element in the paired resource allocation sequence is cross-linked in the same position to obtain a crossed resource allocation sequence; the original resource allocation sequence, the mutated resource allocation sequence, and the crossed resource allocation sequence are arranged in the order of the objective function from small to large to obtain an updated updated resource allocation sequence.
[0110] The function of the gateway resource scheduling device of this application is already in Figure 1 The method embodiment shown is described in detail, so for any details not provided in the description of this embodiment, please refer to the relevant descriptions in the aforementioned embodiments, which will not be repeated here.
[0111] like Figure 3 As shown, an embodiment of the present application also provides an electronic device 300, including a processor 301, a memory 302, and a program or instruction stored in the memory 302 and executable on the processor 301. When the program or instruction is executed by the processor 301, each process of the above-mentioned gateway resource scheduling processing method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0112] Optionally, the embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by the processor, each process of the above-mentioned gateway resource scheduling method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it is not repeated here. Among them, the computer-readable storage medium is such as a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk, etc.
[0113] Optionally, an embodiment of the present application also provides a computer program product, the computer program product includes a computer program stored on a non-transitory computer-readable storage medium, the computer program includes program instructions, and when the program instructions are executed by a computer, the various processes of the above-mentioned gateway resource scheduling method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, they are not repeated here.
[0114] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0115] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0116] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.
Claims
1. A gateway resource scheduling method, characterized in that: Applied to a cloud gateway, the cloud gateway includes a plurality of central processing unit (CPU) cores, and the method includes: Authenticate the terminal device based on the SIM card information of the subscriber identity module and determine the priority of each terminal device; When receiving data forwarding tasks from different terminal devices, scheduling the data forwarding tasks based on the priorities of the different terminal devices to obtain a data processing queue; Based on a preset objective function, the data processing queue is divided into a plurality of sub-queues having a sequential order, wherein the preset objective function is used to divide the data processing queue into an optimal resource allocation sequence; The data forwarding tasks in the plurality of sub-queues having a sequential order are sent to corresponding CPU cores for execution.
2. The method according to claim 1, characterized in that: Based on the preset target model, the data processing queue is divided into a plurality of sub-queues with a sequence, including: Encoding the data forwarding tasks in the data processing queue to obtain multiple initial resource allocation sequences; Determine the objective function corresponding to each of the initial resource allocation sequences based on the CPU load balancing index and the execution time span of the data processing task; Based on the objective function, each of the initial resource allocation sequences is updated to obtain a resource allocation sequence, wherein the resource allocation sequence includes a plurality of sub-queues in a sequential order.
3. The method according to claim 2, characterized in that The encoding of the data forwarding tasks in the data processing queue to obtain a plurality of initial resource allocation sequences includes: Based on the number of CPU cores in the cloud gateway, determining a number of unit value ranges equal to the number of CPU cores, wherein all unit value ranges constitute an overall value range; Within the overall value range, assigning a value to each data forwarding task to obtain an initial resource allocation sequence; After multiple allocations, multiple initial resource allocation sequences are obtained.
4. The method according to claim 2, characterized in that: The determining of the objective function corresponding to each of the initial resource allocation sequences based on the CPU load balancing index and the execution time span of the data processing task comprises: Determine the load balancing index of the CPU core based on the physical parameters of the CPU core, wherein the physical parameters include CPU speed, CPU utilization, memory size, used memory size, and hard disk usage size; Determining a 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; Determine, according to the total execution time, an execution time span for executing the data processing task, wherein the execution time span is a difference between a maximum execution time and a minimum execution time; An objective function is determined based on the load balancing index of the CPU core and the execution time span.
5. The method according to claim 2, characterized in that: The updating of each of the initial resource allocation sequences based on the objective function to obtain a resource allocation sequence comprises: Based on the objective function, determining an initial resource allocation sequence with a maximum objective function value as an optimal resource allocation sequence; Based on the optimal resource allocation sequence, updating other initial resource allocation sequences to obtain an updated resource allocation sequence; For each updated resource allocation sequence, based on a random number within a preset range, determining whether the optimal resource allocation sequence is mutated, and obtaining the objective function of all updated resource allocation sequences; Determining the mutation probability and crossover probability of each resource allocation sequence according to the objective functions of all updated resource allocation sequences; Based on the mutation probability and the crossover probability, the resource allocation sequence is updated again to obtain an updated resource allocation sequence; When the number of updates is greater than or equal to the preset number of updates, a resource allocation sequence with a minimum objective function is determined.
6. The method according to claim 5, characterized in that The updating of other initial resource allocation sequences based on the optimal resource allocation sequence to obtain an updated resource allocation sequence includes: Acquire an average distance and a maximum distance between the other initial resource allocation sequences and the optimal resource allocation sequence; Determining a speed control coefficient for updating an initial resource allocation sequence according to the average distance, the maximum distance, and a logarithmic function, wherein the logarithmic function is used to control an update amount; Determining an update amount of each initial resource allocation sequence according to the speed control coefficient; Based on the update amount of each initial resource allocation sequence, the corresponding initial resource allocation sequence is updated to obtain an updated resource allocation sequence.
7. The method according to claim 5, characterized in that The step of determining, for each updated resource allocation sequence, whether the optimal resource allocation sequence is mutated based on a random number within a preset range includes: For each updated resource allocation sequence, generating a first random number within a preset range; When 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; When the first random number is smaller than a first threshold, no mutation processing is performed on the optimal resource allocation sequence.
8. The method according to claim 7, characterized in that The method further comprises: For each updated resource allocation sequence, generating a second random number within the preset range; When the second random number is less than a second threshold and the objective function of the new resource allocation sequence decreases, replacing the optimal resource allocation sequence with the new resource allocation sequence; When the second random number is greater than or equal to the second threshold, or the objective function of the new resource allocation sequence is not reduced, the first threshold and the second threshold are updated.
9. The method according to claim 5, characterized in that The updating of the resource allocation sequence based on the mutation probability and the crossover probability to obtain an updated resource allocation sequence includes: Based on the mutation probability, determining whether the resource allocation sequence needs to be mutated; In the case where the resource allocation sequence needs to be mutated, at least one element in the resource allocation sequence is randomly changed within a 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, determining whether elements in the paired resource allocation sequence need to be crossed; When the elements in the paired resource allocation sequence need to be crossed, cross-linking at least one corresponding element in the paired resource allocation sequence to obtain a crossed resource allocation sequence; The original resource allocation sequence, the variant resource allocation sequence and the cross resource allocation sequence are arranged in order of the objective function from small to large, and an updated resource allocation sequence is obtained.
10. A computer program product, characterized in that The computer program product comprises a computer program stored on a non-transitory computer-readable storage medium, wherein the computer program comprises program instructions, and when the program instructions are executed by a computer, the steps of the method according to any one of claims 1 to 9 are implemented.
Citation Information
Patent Citations
Cloud computing resource load balancing scheduling method based on improved genetic algorithm and application
CN112380016A
Communication method and device
CN112491516A
Resource scheduling method, device and system of gateway management system and storage medium
CN117591266A
Hybrid multi-cloud resource scheduling method based on GPT technology and genetic optimization
CN118245205A
5G Internet of Things gateway data processing method and device and 5G Internet of Things gateway
CN118433916A
