LU503247B1 - Distributed task scheduling gateway scheduling method based on rate limiting - Google Patents

Distributed task scheduling gateway scheduling method based on rate limiting Download PDF

Info

Publication number
LU503247B1
LU503247B1 LU503247A LU503247A LU503247B1 LU 503247 B1 LU503247 B1 LU 503247B1 LU 503247 A LU503247 A LU 503247A LU 503247 A LU503247 A LU 503247A LU 503247 B1 LU503247 B1 LU 503247B1
Authority
LU
Luxembourg
Prior art keywords
task
scheduling
area
resource
scheduled
Prior art date
Application number
LU503247A
Other languages
German (de)
Inventor
Yunjie Zhu
Qingzhu Yuan
Original Assignee
Zhongbo Information Tech Research Institute Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhongbo Information Tech Research Institute Co Ltd filed Critical Zhongbo Information Tech Research Institute Co Ltd
Application granted granted Critical
Publication of LU503247B1 publication Critical patent/LU503247B1/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/4881Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • G06F9/5038Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals considering the execution order of a plurality of tasks, e.g. taking priority or time dependency constraints into consideration
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The present invention discloses a distributed task scheduling gateway scheduling method based on rate limiting, which comprises: constructing a distributed task scheduling gateway at a server, wherein the task scheduling gateway comprises a task interface module, a task scheduling module, a task execution module, a task scheduling internal area, and a task scheduling global area constructed at the server; performing scheduling preprocessing on a task by the task interface module, updating the preprocessed task to a task scheduling area, notifying the task scheduling module of scheduling task execution, and waiting for a task execution result; scheduling a ready-to-execute task and an executable task by the task scheduling module, and starting the task execution module to transmit a task serial number; and sending a task execution request to a task execution micro-service by the task execution module and storing the task execution result into the task scheduling internal area.

Description

DESCRIPTION
DISTRIBUTED TASK SCHEDULING GATEWAY SCHEDULING METHOD BASED
ON RATE LIMITING
TECHNICAL FIELD
The present invention belongs to the technical field of big data, and relates to a distributed task scheduling gateway scheduling method based on rate limiting.
BACKGROUND
The micro-servitization divides a single application into a plurality of small services with high cohesion and low coupling, and each service only needs to be responsible for single service logic, which improves system development efficiency and expansibility, and therefore the application of the micro-servitization is more and more extensive. However, the governance of micro-services also brings new challenges. Among them, the rate-limited use of shared resources is one of the issues that often need to be considered. In a highly concurrent system, task requests of a plurality of tenants are distributed to a task execution micro-service through load balancing, and resources are overloaded at a certain moment, making the resources unavailable.
Common rate limiting algorithms include a counter algorithm and a leaky bucket algorithm, however, the counter algorithm has the defect of a spurt phenomenon, and the leaky bucket algorithm cannot cope with short-time burst traffic.
The rate limiting is realized using a built-in rate limiting filter factory in Spring Cloud
Gateway, and the rate limiting of the resource is completed by configuring the total capacity of the token bucket, the average filling rate of the token bucket per second, and the name of the
Bean object of the resolver used for the rate limiting resource in a configuration file. The disadvantages of the rate limiting filter factory are that: the same rate limiting parameter is used by all resources, which is difficult to dynamically adjust the rate limiting parameter on the resource, and especially, the rate limiting on the resource group with a logical relationship cannot be realized.
SUMMARY
The present invention is intended to provide a distributed task scheduling gateway scheduling method based on rate limiting, which solves the technical problem of realizing task scheduling according to a time sequence, priority, a resource group and resource rate limiting by configuring scheduling parameters on a configuration library.
In order to achieve the above objective, the present invention adopts the following technical solutions.
A distributed task scheduling gateway scheduling method based on rate limiting comprises the following steps: step S100: creating a distributed task scheduling gateway cluster at a server by adopting a micro-service framework, constructing a task interface module, a task scheduling module, a task execution module and a task scheduling internal area in the task scheduling gateway, wherein the task scheduling internal area comprises a to-be-scheduled task area, a to-be-executed task area and a task execution result area, and constructing a task scheduling global area on a distributed shared memory database Redis of a server, wherein the task scheduling gateways share the task scheduling global area, and the task scheduling internal area and the task scheduling global area constitute a task scheduling area; step S101: after receiving a task submitted by a client, firstly performing scheduling preprocessing on the task by the task interface module to obtain a preprocessed task and updating the preprocessed task to the task scheduling internal area and the task scheduling global area; then notifying the task scheduling module by the task interface module of scheduling task execution; and finally waiting for a task execution result by the task interface module in the task scheduling internal area;
step S102: scheduling a ready-to-execute task in the task scheduling internal area and then scheduling an executable task in the task scheduling global area by the task scheduling module, starting the task execution module, and transmitting a task serial number to the task execution module by the task scheduling module; step S103: sending a task execution request to the task execution micro-service according to task execution service routing parameter in the task by the task execution module; storing a task execution result returned by the task execution micro-service into the task scheduling internal area and notifying the task interface module of obtaining the task execution result by the task execution module.
Preferably, when step S100 is executed, the task scheduling gateway is a micro-service cluster, and the task submitted by the client is distributed to the task scheduling gateway through load balancing to perform unified scheduling execution; the task scheduling gateway performs task scheduling by adopting time queuing, task priority and resource rate limiting, wherein the resource rate limiting mode comprises resource group rate limiting and resource rate limiting; the task scheduling in the resource rate limiting mode is the maximum number of tasks which are used concurrently based on the resource and the resource group in the task, and the resource is only used sequentially in a limited number of times in a single task.
Preferably, when step S100 is executed, the task scheduling internal area comprises the to-be-scheduled task area, the to-be-executed task area and the task execution result area, a data structure of the task scheduling internal area adopts a linked list structure, and operation threads on the task scheduling internal area are synchronized, the to-be-scheduled task area is a resource group object linked list, a node attribute of thereof comprises a resource group ID and a resource object linked list, a node attribute of the resource object linked list comprises a resource ID and a to-be-scheduled task object linked list, and a node attribute of the to-be-scheduled task object linked list comprises a task serial number, a task scheduling state, task priority, starting time for tasks waiting to be scheduled, a task execution timeout duration, a network element group ID, a network element ID, a network element group rate limiting threshold and a network element rate limiting threshold, a linked list node of the to-be-executed task area is a to-be-executed task object, and an attribute of the to-be-executed task object comprises a task serial number, task execution micro-service routing and service data; a linked list node of the task execution result area is a task execution result object, and an attribute of the task execution result object comprises a task serial number and result data.
Preferably, when step S100 is executed, a Redis List data structure is adopted in the task scheduling global area to store data, a key name is a resource group ID, a key value is a list of all tasks that use resources in the resource group, node data comprises a task serial number, task priority, a task scheduling state and a resource ID, the task scheduling state comprises to-be-scheduled and executing, a data storage duration is set to be equal to the task execution timeout duration, and Redis automatically clears data according to the set data storage duration; when the task scheduling global area is created, a Redis global lock pool is created, and a distributed global lock is set for each resource group; the task scheduling gateway obtains the global lock before operating the task scheduling global area and releases the global lock after the operation is completed.
Preferably, when step S102 is executed, the task scheduling module generates a task serial number and starting time for tasks waiting to be scheduled, wherein the task serial number is unique on the task scheduling gateway cluster; according to a tenant parameter in the task, a task scheduling configuration library is inquired, a tenant is authenticated, and priority of tasks is set; according to a task type and a resource identification parameter in the task, a task scheduling configuration library is inquired, and task execution micro-service routing, a task execution timeout threshold, a resource group and a resource rate limiting threshold are set.
Preferably, the method comprises: grouping all resources, wherein a searching speed of tasks on the task scheduling area is effectively improved after grouping;
dividing a plurality of resources which need to be subjected to total rate limiting into a resource group, wherein a rate limiting threshold of the resource group is less than the sum of the rate limiting thresholds of all the resources in the resource group; dividing a resource which does not need resource group rate limiting into a plurality of resource groups, wherein a rate limiting threshold of each resource group is equal to the sum of the rate limiting thresholds of all the resources in the group; wherein for example, one network management server manages 10 network elements, to operate network elements, a person must log in to the network management, each network element is limited to 5 persons operating simultaneously (that is, the resource rate limiting threshold is 5), and thus, 50 persons may operate 10 network elements simultaneously on the network management, that is, 50 persons log in the network management simultaneously; obviously, the performance of the network management server cannot bear, and at this time, 20 persons are restricted from logging in the network management simultaneously (that is, the resource group rate limiting threshold is 20). initializing and clearing the task scheduling area when the task scheduling gateway is started; after the task interface module preprocesses the task to obtain the preprocessed task, the task state being “to-be-scheduled”, searching for the to-be-scheduled task area according to the resource group ID and the resource ID, obtaining the to-be-scheduled task, and adding the to-be-scheduled task into a task list on the node object of the corresponding resource ID; in the task scheduling global area, obtaining and locking a global lock from the Redis global lock pool according to a resource group ID in the preprocessed task, obtaining a task list by taking the resource group ID as a Key, adding the to-be-scheduled task into the list, and releasing the global lock.
Preferably, when step S102 is executed, the task scheduling module scans each resource in the to-be-scheduled task area, obtains a task list waiting to be scheduled on the resource, and obtains a ready-to-execute task according to a duration for tasks waiting to be scheduled and task priority; the ready-to-execute task undergoes priority and rate-limited scheduling in the task scheduling global area, and if the scheduling is successful, the task execution module is started, a task serial number is transmitted, meanwhile, the state of the task successfully scheduled is updated to be “executing” in the task scheduling global area, and the task successfully scheduled is deleted in the to-be-scheduled task area.
Preferably, when step S102 is executed, the task scheduling module scans the task list waiting to be scheduled on the resource, obtains a task sequence with the highest task priority, then takes out a task with the longest waiting scheduling time from the sequence, and compares the waiting scheduling time with a task execution timeout threshold; if the waiting scheduling time is greater than the task execution timeout threshold, an execution timeout failure result is directly added into the task execution result area, and the task is deleted from the task scheduling area; otherwise, the task is taken as the ready-to-execute task.
Preferably, when step S102 and step S103 are executed, a resource group ID in the ready-to-execute task is taken as RedisKey to obtain a global task list on all gateways on the resource group in the task scheduling global area, and a scan list obtains the maximum value of the task priority identical to the resource ID in the ready-to-execute task and performs determination: if the maximum value of the task priority is greater than the priority of the ready-to-execute task, the task scheduling fails; otherwise, rate-limited scheduling is performed, according to the resource group ID and a resource ID in the ready-to-execute task, the number of tasks with the task state of “executing” in the global task list is counted to obtain a current flow of the resource group and a current flow of the resource and perform determination: if the current flow of the resource group and the current flow of the resource are less than a resource group rate limiting threshold and a resource rate limiting threshold in the ready-to-execute task, respectively, the ready-to-execute task is successfully scheduled, and the task state is modified to be “executing” in the global task list; otherwise, the ready-to-execute task scheduling fails; according to the task serial number successfully scheduled, the task successfully scheduled is deleted from the to-be-scheduled task area, the task execution module is started, and the task serial number is transmitted;
after the task execution module is started, according to the task serial number, a task that needs to be executed is obtained and deleted from the to-be-executed task area, and then according to a routing parameter of the task that needs to be executed, a task execution request 1s sent to the task execution micro-service, the returned task execution result is stored into the task result area, and the task interface module is notified of obtaining the task execution result.
Preferably, when step S103 is executed, after receiving the notification of the task execution result, the task interface module takes out the task execution result from the task execution result area, and returns the result to the client; the task interface module deletes a task with the returned task execution result on the Redis task scheduling global area and the task execution result area according to the resource group ID and the task serial number in the task execution results; 1f a waiting duration of the task interface module in the task execution result area exceeds the task execution timeout threshold, the task interface module directly returns execution failure to the client, and deletes the task in the task scheduling area.
Beneficial effects:
The distributed task scheduling gateway scheduling method based on rate limiting described in the present invention solves the technical problem of realizing task scheduling according to a time sequence, priority, a resource group and resource rate limiting by configuring scheduling parameters on a configuration library; compared with a task gateway of a Spring Cloud framework, the present invention provides a novel distributed task scheduling method, which realizes resource rate limiting with more complex logic and more flexible configuration, and ensures the reasonable use of resources.
BRIEF DESCRIPTION OF THE DRAWINGS
FIG. 1 1s a schematic diagram of the use of a distributed task scheduling gateway according to the present invention in a BOSS system of a telecom operator;
FIG. 2 is a schematic diagram of the software structure of a task scheduling gateway according to the present invention;
FIG. 3 is a general schematic flowchart of the task scheduling according to the present invention;
FIG. 4 1s a flowchart of the implementation of step S101 according to the present invention;
FIG. 5 is a flowchart of the implementation of step S102 according to the present invention;
FIG. 6 is a flowchart of the implementation of step S310 according to the present invention; and
FIG. 7 is a flowchart of the implementation of step S103 according to the present invention.
DETAILED DESCRIPTION
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of them. Based on the examples in the present invention, all other examples obtained by those of ordinary skill in the art without creative work shall fall within the protection scope of the present invention.
As shown in FIG. 1 to FIG. 4, a distributed task scheduling gateway scheduling method based on rate limiting comprises the following steps: step S100: creating a distributed task scheduling gateway cluster at a server by adopting a micro-service framework, constructing a task interface module, a task scheduling module, a task execution module and a task scheduling internal area in the task scheduling gateway, wherein the task scheduling internal area comprises a to-be-scheduled task area, a to-be-executed task area and a task execution result area, and constructing a task scheduling global area on a distributed shared memory database Redis of a server, wherein the task scheduling gateways share the task scheduling global area, and the task scheduling internal area and the task scheduling global area constitute a task scheduling area;
FIG. 1 shows an embodiment of the present invention applied to a BOSS system of a telecom operator, where a distributed task scheduling gateway is positioned in a BOSS system architecture, a user client of the BOSS system generates a large number of various tasks, such as a service provision task, a network element configuration task, a network element inspection task, and these tasks are significantly prioritized and a plurality of tasks may operate the same network element simultaneously, for example, task execution services A and B operate network element A simultaneously at a certain moment in the figure. By adopting the method described herein, all tasks are sent to the task scheduling gateway through load balancing and are executed after scheduling, so that not only the tasks are executed according to the task priority in order, but also the network element is not unstable or even unavailable due to overload through network element rate limiting.
The distributed task scheduling gateway is a micro-service constructed based on Spring
Boot, as shown in FIG. 2, the task scheduling gateway mainly comprises a task interface module, a task scheduling module, a task execution module and a task scheduling internal area, and task scheduling gateways share a Redis scheduling global area. With a controller realized by the annotation @RestController, the task interface module sends a task execution request by adopting a controller interface method realized by the annotation @RequestMapping and using an annotation @RequestBody interface client and returns a task execution result. The task scheduling module and the task execution module are constructed by adopting Java threads, when the task scheduling gateway is started, the task scheduling module thread is started, and when the task scheduling module schedules and executes a task, the task execution module thread is started.
The task scheduling area comprises a task scheduling internal area on the gateway and a task scheduling global area on the Redis,
wherein the task scheduling internal area comprises a to-be-scheduled task area, a to-be-executed task area and a task execution result area.
The linked list node of the to-be-scheduled task area is a network element group object; the attributes of the network element group object are as follows: a network element group ID and a network element object linked list; the node attributes of the network element object linked list are as follows: a network element ID and a to-be-scheduled task object linked list; the node attributes of the to-be-scheduled task object linked list are as follows: a task serial number, a task scheduling state, task priority, starting time for tasks waiting to be scheduled, a task execution timeout duration, a network element group ID, a network element ID, a network element group rate limiting threshold and a network element rate limiting threshold. The linked list node of the to-be-executed task area is a to-be-executed task object, and the attributes of the object are as follows: a task serial number, task execution micro-service routing and service data. The linked list node of the task execution result area is a task execution result object, and the attributes of the object are as follows: a task serial number and result data.
Step S101: after receiving a task submitted by a client, firstly performing scheduling preprocessing on the task by the task interface module to obtain a preprocessed task and updating the preprocessed task to the task scheduling internal area and the task scheduling global area; then notifying the task scheduling module by the task interface module of scheduling task execution; and finally waiting for a task execution result by the task interface module in the task scheduling internal area;
As shown in FIG. 4, when step S101 is executed, the specific steps are as follows.
Step S200: submitting task data by the client, the task data comprising: a tenant account and password, a task type, a network element group ID, a network element ID and service data.
Step S201: configuring the tenant account and password and a permission of the tenant for executing a task into the task scheduling configuration library, and then scheduling execution after the tenant authentication is passed, and otherwise, returning authentication failure.
Step S202: performing task preprocessing, which comprises: generating a task serial number and starting time for the task waiting to be scheduled; determining task priority according to the level of the tenants, such as group users and provincial users in the tenants; determining task execution micro-service routing and a task execution timeout duration according to the task type; and determining the network element group and the network element rate limiting threshold through the network element group ID and the network element ID.
Step S203: generating a global task scheduling object, wherein the object attributes are as follows: a task serial number, task priority, a task scheduling state and a network element ID, the task scheduling state being “to-be-scheduled”; adding the object into a linked list key value with the Redis Key as “a network element group ID”, and setting a storage duration as the task timeout duration.
Step S204: generating a task execution object, wherein the object attributes are as follows: a task serial number, task execution micro-service routing and service data, and adding the task execution object into the to-be-executed task area.
Step S205: generating a to-be-scheduled task object, wherein the object attributes are as follows: a task serial number, a task scheduling state, task priority, starting time for tasks waiting to be scheduled, a task execution timeout duration, a network element group ID, a network element ID, a network element group rate limiting threshold and a network element rate limiting threshold: searching for the network element group object according to the network element group ID in the to-be-scheduled task area, if no network element group object is searched, creating a network element group object (attributes: a network element group ID and an empty network element object linked list) and a network element object (attributes: a network element ID and an empty to-be-scheduled task object linked list), adding the to-be-scheduled task object into the to-be-scheduled task object linked list in the network element object, adding the network element object into the network element object linked list in the network element group object, and adding the network element group object into the to-be-scheduled task area;
otherwise, searching for the network element object linked list in the network element group object according to the network element ID, if no network element object linked list is searched, creating a network element object (attributes: a network element ID and an empty to-be-scheduled task object linked list), adding the to-be-scheduled task object into the to-be-scheduled task object linked list in the network element object, and adding the network element object into the network element object linked list in the network element group object; otherwise, directly adding the to-be-scheduled task object into the to-be-scheduled task object linked list in the network element object; and finally, notifying the task scheduling module waiting on the to-be-scheduled task area.
Step S206: waiting for a notification of the task execution result in the task execution result area, searching for and obtaining a result according to the task serial number after receiving the notification, deleting the task from the task scheduling internal area and the Redis task scheduling global area, and returning the execution result to the client.
Step S207: if the waiting task execution result is timeout, deleting the task from the task scheduling internal area and the Redis task scheduling global area, and returning execution timeout failure to the client.
Step S102: scheduling a ready-to-execute task in the task scheduling internal area and then scheduling an executable task in the task scheduling global area by the task scheduling module, starting the task execution module, and transmitting a task serial number to the task execution module by the task scheduling module.
As shown in FIG. 5, when step S102 is executed, the specific steps are as follows.
Step S300: starting scheduling by the task scheduling module when the scheduling notification is waited in the task scheduling internal area or the waiting time is timeout, specifically, firstly scheduling a ready-to-execute task according to the waiting time and the priority of the internal task of the gateway, and then scheduling an executable task in the Redis scheduling global area according to the rate limiting and the priority of the global task.
Step S301: scanning the to-be-scheduled task area and dividing into three loops, wherein an outer loop is a network element group object linked list, a middle loop is a network element object linked list in the network element group object, and an inner loop is a to-be-scheduled task list in the network element object; step S301 to step S311 is an inner loop, and all executable tasks and timeout failure tasks on a network element are scheduled.
Step S302: obtaining a task with the highest priority on the to-be-scheduled task list List(1) of the network element NE(i) to constitute the task list List-MaxPriority with the maximum priority.
Step S303: obtaining a task with the maximum waiting time (Task-MaxWaitime) on
List-MaxPriority.
Step S304: determining whether the Task-MaxWaitime exceeds the task execution timeout duration, if not, taking the task as the ready-to-execute task, executing step S308, and further scheduling a final executable task on the Redis scheduling global area, which will be described in detail in FIG. 6.
Step S305: if the Task-MaxWaitime exceeds the task execution timeout duration, adding the task waiting timeout failure into the task result area, and notifying the task interface module of obtaining the result.
Step S306: deleting the task on List(i) and List-MaxPriority, i.e., deleting from the to-be-scheduled task area.
Step S307: determining whether the task with the priority is scheduled completely, that is, whether the List-MaxPriority is empty, if not, repeating step S303, otherwise, executing step
S311.
Step S311: determining whether the task on the network element NE(i) is scheduled completely, that is, whether the List(i) is empty, if not, repeating step S302, otherwise, executing step S312.
Step S312: determining whether all network elements in the to-be-scheduled task area are scanned completely, 1f not, 1 = 1 + 1, continuously processing a next network element, otherwise, continuously waiting for the scheduling notification or waiting for the scheduling timeout before performing a next round of scheduling.
Step S309-step S310, if the ready-to-execute task is further successfully scheduled in the
Redis scheduling global area, deleting the task in the to-be-scheduled task area, starting a task execution module, and transmitting a task serial number; if the scheduling fails, executing step
S307.
As shown in FIG. 6, when step S308 is executed, the specific steps are as follows.
Step S400: taking the network element group ID (NEGRP) in the ready-to-execute task as
Key, and obtaining a list GrpTaskList from the Redis scheduling global area.
Step S401: traversing the GrpTaskList, counting the total number of tasks with the task execution state of “executing” in the GrpTaskList node data, i.e., the current flow of the network element group (CurGrpFlow), counting the total number of tasks with the task execution state of “executing” in the GrpTaskList node data and the network element ID in the GrpTaskList node data being the same as the network element ID in the ready-to-execute task, that is, the current flow of the network element group (CurNEFlow), and obtaining the maximum value of the priority of all tasks with the network element ID in the GrpTaskList node data being the same as the network element ID in the ready-to-execute task, that is, the global maximum task priority
GlobalMaxPriority.
Step S402: determining whether the priority of the ready-to-execute task is not less than
GlobalMaxPriority, if not, the scheduling fails, executing step S307, otherwise, performing the network element group rate-limited scheduling.
Step S403: determining whether the network element group rate limiting threshold of the ready-to-execute task is greater than CurGrpFlow, if not, the scheduling fails, executing step
S307, otherwise, performing network element rate-limited scheduling.
Step S404: determining whether the network element rate limiting threshold of the ready-to-execute task is greater than CurNEFlow, if not, the scheduling fails, executing step
S307, otherwise, the task is successfully scheduled.
Step S405: modifying the status of the task with the same serial number as the ready-to-execute task on GrpTaskList to “executing”, and then executing step S310.
Step S103: sending a task execution request to the task execution micro-service according to task execution service routing parameter in the task by the task execution module; storing a task execution result returned by the task execution micro-service into the task scheduling internal area and notifying the task interface module of obtaining the task execution result by the task execution module.
As shown in FIG. 7, when step S103 is executed, the specific steps are as follows.
Step S500: receiving the task serial number transmitted by the scheduling module when the task execution module is started to obtain the executable task from the to-be-executed task area, and deleting the task.
Step S501: sending the task to the task execution micro-service according to the routing parameters in the executable task, and waiting for returning a result.
Step S502: after the task execution result is obtained, deleting the task from the Redis scheduling global area, adding the result into the task result area, and notifying the task interface module, wherein the task interface module obtains the task execution result from the task result area and returns the task execution result to the client.
The distributed task scheduling gateway scheduling method based on rate limiting described in the present invention solves the technical problem of realizing task scheduling according to a time sequence, priority, a resource group and resource rate limiting by configuring scheduling parameters on a configuration library; compared with a task gateway of a Spring Cloud framework, the present invention provides a novel distributed task scheduling method, which realizes resource rate limiting with more complex logic and more flexible configuration, and ensures the reasonable use of resources.
The foregoing 1s a further detailed description of the present invention in conjunction with specific preferred embodiments, and it cannot be assumed that the specific implementation of the present invention is limited to these descriptions.
For those of ordinary skill in the technical field of the present invention, some other simple deductions or substitutions can be made without departing from the concept of the present invention and should be considered as falling within the scope of the present invention.

Claims (5)

1. A distributed task scheduling gateway scheduling method based on rate limiting, comprising the following steps: step S100: creating a distributed task scheduling gateway cluster at a server by adopting a micro-service framework, constructing a task interface module, a task scheduling module, a task execution module and a task scheduling internal area in the task scheduling gateway, wherein the task scheduling internal area comprises a to-be-scheduled task area, a to-be-executed task area and a task execution result area, and constructing a task scheduling global area on a distributed shared memory database Redis of a server, wherein the task scheduling gateways share the task scheduling global area, and the task scheduling internal area and the task scheduling global area constitute a task scheduling area; step S101: after receiving a task submitted by a client, firstly performing scheduling preprocessing on the task by the task interface module to obtain a preprocessed task and updating the preprocessed task to the task scheduling internal area and the task scheduling global area; then notifying the task scheduling module by the task interface module of scheduling task execution; and finally waiting for a task execution result by the task interface module in the task scheduling internal area; step S102: scheduling a ready-to-execute task in the task scheduling internal area and then scheduling an executable task in the task scheduling global area by the task scheduling module, starting the task execution module, and transmitting a task serial number to the task execution module by the task scheduling module; wherein when step S102 is executed, the task scheduling module scans each resource in the to-be-scheduled task area, obtains a task list waiting for scheduling on the resource, and obtains a ready-to-execute task according to a duration for tasks waiting to be scheduled and task priority; the ready-to-execute task undergoes priority and rate-limited scheduling in the task scheduling global area, and if the scheduling is successful, the task execution module is started, a task serial number is transmitted, meanwhile, the state of the task successfully scheduled is updated to be “executing” in the task scheduling global area, and the task successfully scheduled is deleted in the to-be-scheduled task area;
when step S102 is executed, the task scheduling module scans the task list waiting to be scheduled on the resource, obtains a task sequence with the highest task priority, then takes out a task with the longest waiting scheduling time from the sequence, and compares the waiting scheduling time with a task execution timeout threshold; if the waiting scheduling time is greater than the task execution timeout threshold, an execution timeout failure result is directly added into the task execution result area, and the task is deleted from the task scheduling area; otherwise, the task is taken as the ready-to-execute task;
when step S102 is executed, the task scheduling module generates a task serial number and starting time for tasks waiting to be scheduled, wherein the task serial number is unique on the task scheduling gateway cluster; according to a tenant parameter in the task, a task scheduling configuration library is inquired, a tenant is authenticated, and priority of tasks is set; according to a task type and a resource identification parameter in the task, a task scheduling configuration library is inquired, and task execution micro-service routing, a task execution timeout threshold, a resource group and a resource rate limiting threshold are set;
step S103: sending a task execution request to the task execution micro-service according to task execution service routing parameter in the task by the task execution module;
storing a task execution result returned by the task execution micro-service into the task scheduling internal area and notifying the task interface module of obtaining the task execution result by the task execution module; wherein when step S102 and step S103 are executed, a resource group ID in the ready-to-execute task is taken as Redis Key to obtain a global task list on all gateways on the resource group in the task scheduling global area, and a scan list obtains the maximum value of the task priority identical to the resource ID in the ready-to-execute task and performs determination: if the maximum value of the task priority is greater than the priority of the ready-to-execute task, the task scheduling fails; otherwise, rate-limited scheduling is performed,
according to the resource group ID and a resource ID in the ready-to-execute task, the number of tasks with the task state of “executing” in the global task list is counted to obtain a current flow of the resource group and a current flow of the resource and perform determination: if the current flow of the resource group and the current flow of the resource are less than a resource group rate limiting threshold and a resource rate limiting threshold in the ready-to-execute task, respectively, the ready-to-execute task is successfully scheduled, and the task state is modified to be “executing” in the global task list; otherwise, the ready-to-execute task scheduling fails; according to the task serial number successfully scheduled, the task successfully scheduled is deleted from the to-be-scheduled task area, the task execution module is started, and the task serial number is transmitted; after the task execution module is started, according to the task serial number, a task that needs to be executed is obtained and deleted from the to-be-executed task area, and then according to a routing parameter of the task that needs to be executed, a task execution request is sent to the task execution micro-service, the returned task execution result is stored into the task result area, and the task interface module is notified of obtaining the task execution result; when step S103 is executed, after receiving the notification of the task execution result, the task interface module takes out the task execution result from the task execution result area, and returns the result to the client; the task interface module deletes a task with the returned task execution result on the Redis task scheduling global area and the task execution result area according to the resource group ID and the task serial number in the task execution results; if a waiting duration of the task interface module in the task execution result area exceeds the task execution timeout threshold, the task interface module directly returns execution failure to the client, and deletes the task in the task scheduling area.
2. The distributed task scheduling gateway scheduling method based on rate limiting according to claim 1, wherein when step S100 is executed, the task scheduling gateway is a micro-service cluster, and the task submitted by the client is distributed to the task scheduling gateway through load balancing to perform unified scheduling execution; the task scheduling gateway performs task scheduling by adopting time queuing, task priority and resource rate limiting, wherein the resource rate limiting mode comprises resource group rate limiting and resource rate limiting; the task scheduling in the resource rate limiting mode 1s the maximum number of tasks which are used concurrently based on the resource and the resource group in the task, and the resource is only used sequentially in a limited number of times in a single task.
3. The distributed task scheduling gateway scheduling method based on rate limiting according to claim 1, wherein when step S100 is executed, the task scheduling internal area comprises the to-be-scheduled task area, the to-be-executed task area and the task execution result area, a data structure of the task scheduling internal area adopts a linked list structure, and operation threads on the task scheduling internal area are synchronized, the to-be-scheduled task area is a resource group object linked list, a node attribute of thereof comprises a resource group ID and a resource object linked list, a node attribute of the resource object linked list comprises a resource ID and a to-be-scheduled task object linked list, and a node attribute of the to-be-scheduled task object linked list comprises a task serial number, a task scheduling state, task priority, starting time for tasks waiting to be scheduled, a task execution timeout duration, a network element group ID, a network element ID, a network element group rate limiting threshold and a network element rate limiting threshold, a linked list node of the to-be-executed task area is a to-be-executed task object, and an attribute of the to-be-executed task object comprises a task serial number, task execution micro-service routing and service data; a linked list node of the task execution result area is a task execution result object, and an attribute of the task execution result object comprises a task serial number and result data.
4. The distributed task scheduling gateway scheduling method based on rate limiting according to claim 3, wherein when step S100 is executed, a Redis List data structure is adopted in the task scheduling global area to store data, a key name is a resource group ID, a key value is a list of all tasks that use resources in the resource group, node data comprises a task serial number, task priority, a task scheduling state and a resource ID, the task scheduling state comprises to-be-scheduled and executing, a data storage duration is set to be equal to the task execution timeout duration, and Redis automatically clears data according to the set data storage duration; when the task scheduling global area is created, a Redis global lock pool is created, and a distributed global lock is set for each resource group; the task scheduling gateway obtains the global lock before operating the task scheduling global area and releases the global lock after the operation is completed.
5. The distributed task scheduling gateway scheduling method based on rate limiting according to claim 4, wherein the method comprises: grouping all resources, wherein a searching speed of tasks on the task scheduling area is effectively improved after grouping; dividing a plurality of resources which need to be subjected to total rate limiting into a resource group, wherein a rate limiting threshold of the resource group is less than the sum of the rate limiting thresholds of all the resources in the resource group; dividing a resource which does not need resource group rate limiting into a plurality of resource groups, wherein a rate limiting threshold of each resource group is equal to the sum of the rate limiting thresholds of all the resources in the group; initializing and clearing the task scheduling area when the task scheduling gateway is started; after the task interface module preprocesses the task to obtain the preprocessed task, the task state being “to-be-scheduled”, searching for the to-be-scheduled task area according to the resource group ID and the resource ID, obtaining the to-be-scheduled task, and adding the to-be-scheduled task into a task list on the node object of the corresponding resource ID; in the task scheduling global area, obtaining and locking a global lock from the Redis global lock pool according to a resource group ID in the preprocessed task, obtaining a task list by taking the resource group ID as a Key, adding the to-be-scheduled task into the list, and releasing the global lock.
LU503247A 2022-05-16 2022-12-23 Distributed task scheduling gateway scheduling method based on rate limiting LU503247B1 (en)

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210525528.5A CN114625520B (en) 2022-05-16 2022-05-16 Distributed task scheduling gateway scheduling method based on current limiting

Publications (1)

Publication Number Publication Date
LU503247B1 true LU503247B1 (en) 2023-06-26

Family

ID=81907254

Family Applications (1)

Application Number Title Priority Date Filing Date
LU503247A LU503247B1 (en) 2022-05-16 2022-12-23 Distributed task scheduling gateway scheduling method based on rate limiting

Country Status (2)

Country Link
CN (1) CN114625520B (en)
LU (1) LU503247B1 (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115174479B (en) * 2022-07-19 2023-10-13 天翼云科技有限公司 Flow control method and device
CN117076057B (en) * 2023-10-18 2024-01-26 成都阿加犀智能科技有限公司 AI service request scheduling method, device, equipment and medium

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104346215A (en) * 2013-08-07 2015-02-11 中兴通讯股份有限公司 Task scheduling service system and method
CN109150957A (en) * 2018-06-29 2019-01-04 中译语通科技股份有限公司 A kind of micro services concurrent control system
CN110753131A (en) * 2019-11-04 2020-02-04 网易(杭州)网络有限公司 Microservice distributed current limiting method and device, storage medium and electronic equipment
US11076019B2 (en) * 2019-11-15 2021-07-27 F5 Networks, Inc. Scheduling services on a platform including configurable resources
CN112367268B (en) * 2020-11-24 2022-07-05 苏宁云计算有限公司 Current limiting method and device for micro-service
CN113535362B (en) * 2021-07-26 2023-07-28 北京计算机技术及应用研究所 Distributed scheduling system architecture and micro-service workflow scheduling method
CN113672367A (en) * 2021-08-16 2021-11-19 深圳壹账通智能科技有限公司 Distributed timing task scheduling method and system

Also Published As

Publication number Publication date
CN114625520A (en) 2022-06-14
CN114625520B (en) 2022-08-30

Similar Documents

Publication Publication Date Title
LU503247B1 (en) Distributed task scheduling gateway scheduling method based on rate limiting
US11758006B2 (en) Provisioning multiple network resources
US7103628B2 (en) System and method for dividing computations
US7568022B2 (en) Automated display of an information technology system configuration
CN113169952A (en) Container cloud management system based on block chain technology
US20060129419A1 (en) Coupling of a business component model to an information technology model
JP6881575B2 (en) Resource allocation systems, management equipment, methods and programs
EP0919912B1 (en) Multiserver workflow system
JP2010134518A (en) Method of managing configuration of computer system, computer system, and program for managing configuration
US20220318071A1 (en) Load balancing method and related device
WO2021143590A1 (en) Distributed container image construction scheduling system and method
Yuan et al. Efficient resource management for cloud computing
CN106533961B (en) Flow control method and device
CN114448983A (en) ZooKeeper-based distributed data exchange method
CN102087618A (en) Resource management method and system for cloud computing operating system
US11900155B2 (en) Method, device, and computer program product for job processing
Fan et al. A scheduler for serverless framework base on kubernetes
CN112291320A (en) Distributed two-layer scheduling method and system for quantum computer cluster
Özcan et al. A hybrid load balancing model for multi-agent systems
US20240184895A1 (en) Asynchronous ping messages for determining capability of systems for executing asynchronous protocols
CN115904673B (en) Cloud computing resource concurrent scheduling method, device, system, equipment and medium
CN114996025A (en) Network defense method based on edge technology
US20190327289A1 (en) Supercomputer system, method of data transmission in such supercomputer system and associated computer program product
CN117539599A (en) Resource scheduling method and device, electronic equipment and storage medium
KR100950487B1 (en) Network Management System and Operating Method thereof

Legal Events

Date Code Title Description
FG Patent granted

Effective date: 20230626