Task scanning method, device, equipment and system for intelligent frequency conversion
Through the intelligent frequency conversion task scanning method, the task scanning frequency is dynamically adjusted, which solves the problems of high-priority task processing and task backlog, and improves system throughput and user experience.
Patent Information
- Application Number
- CN202411774280.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-04
- Publication Date
- 2025-04-11
AI Technical Summary
The prior art cannot effectively handle high-priority tasks, and the timing scheduler has fixed frequency configurations for task table scanning and cannot flexibly adjust, resulting in reduced system throughput or task backlog.
Through the intelligent frequency conversion task scanning method, the task status in the task table is monitored, the number of tasks in execution and backlog are counted, and the scanning frequency is dynamically adjusted according to the number of tasks and time intervals to ensure that high-optimal tasks are processed in a timely manner and prevent task backlogs.
It realizes flexible adjustment of scanning frequency, avoids waste of system resources and task backlog, and improves system throughput and user experience.
Smart Images

Figure CN119806767A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of software development, and in particular to an intelligent frequency conversion task scanning method, device, equipment and system. Background Art
[0002] In cloud services, physical machine activation, renewal, expansion and other related operations are relatively time-consuming asynchronous tasks. General scheduling systems persist tasks in data, use timed table scanning to scan tasks to be executed, and send tasks to message queues (MQ) for asynchronous execution.
[0003] However, the current message processing method cannot meet the needs of tasks with high priority. At the same time, the frequency configuration of the scheduled scheduler to scan the task table is fixed, so the scanning frequency cannot be flexibly modified to adapt to the current task execution progress. If the scanning frequency is set too low, the system throughput will be reduced and resources will be wasted; if the scanning frequency is set too high, the system will not be able to complete the processing, resulting in empty scanning or a large number of tasks being piled up in MQ and unable to be processed. Summary of the invention
[0004] In view of this, the present invention provides a task scanning method, device, equipment and system with intelligent frequency conversion, which solves the system problems caused by too high or too low scanning frequency through intelligent frequency conversion. At the same time, task priority is used to ensure that high-priority tasks are processed in a timely manner, and task backlog problems caused by a large number of messages being accumulated in MQ can be prevented.
[0005] In a first aspect, the present invention provides a task scanning method for intelligent frequency conversion, which can be applied to a controller, such as a central controller, and includes:
[0006] Querying the status of each task in the task table, where at least one task in the task table is reported by at least one client, and at least one task is scanned and sent to the message queue at a first time interval, and the status of the task includes being executed and being backlogged;
[0007] Count the number of tasks in execution and backlog, and calculate the sum of all tasks in execution and squeezed state;
[0008] Determine whether the sum of the number of tasks is greater than or equal to a first threshold; if so, adjust the scanning frequency, calculate the second time interval according to the sum of the number of tasks and the first time interval, and generate indication information including the second time interval;
[0009] The instruction information is sent to the scheduler, so that the scheduler scans the task table at the second time interval and sends the scanned tasks to the message queue.
[0010] The method provided in this aspect monitors the status of each task in the query task table, determines whether there is a backlog of tasks in the current message queue, and automatically adjusts the scanning frequency when a backlog of system tasks is detected, thereby controlling the scheduler to scan tasks according to the new scanning frequency to slow down the number of tasks placed in the message queue, or delay the time interval for placing tasks, so that the system can process the backlog tasks as soon as possible to prevent a large number of tasks from being accumulated and causing system congestion.
[0011] In addition, when the system has excess processing power, the time interval between scanning tasks can be intelligently shortened to fully utilize system resources and reduce resource waste.
[0012] In combination with the first aspect, in a possible implementation manner, calculating the second time interval according to the sum of the number of tasks and the first time interval includes:
[0013] Obtain the number of tasks to be processed in the initial scan and the first preset percentage to calculate the second threshold; compare whether the sum of the number of tasks is greater than or equal to the second threshold; if so, calculate the time consumed for task execution per unit time based on the number of tasks to be processed in the initial scan and the sum of the number of tasks, and determine the second time interval based on the time consumed and the number of tasks to be processed in the initial scan.
[0014] In combination with the first aspect, in a possible implementation, the method further includes: if the sum of the number of tasks is less than a second threshold, the scanning frequency is not adjusted, the scheduler continues to scan the pending tasks, and the scanned pending tasks are sent to the message queue.
[0015] In combination with the first aspect, in another possible implementation, the method also includes: if the sum of the number of tasks is less than a first threshold, it is determined that there is no backlog of tasks, and the first time interval is gradually reduced until it is reduced to the minimum value of the scanning time interval and stops, and the tasks to be processed are obtained according to the minimum scanning time interval, and the tasks to be processed obtained by the scan are sent to the message queue.
[0016] In combination with the first aspect, in another possible implementation, before querying the status of each task in the task table, it also includes: obtaining the user identifier and / or task type included in each task reported by at least one client; setting the priority of each task according to at least one of the user identifier and the task type, and sorting all tasks in order of priority; generating a task table based on all the sorted tasks.
[0017] In combination with the first aspect, in another possible implementation manner, the state of the task further includes: an initialization state and an execution completion state; and the method further includes:
[0018] Detect the status of each task in the task table in real time and change the status of each task;
[0019] When receiving a task request sent from a client, setting the state of the first task in the task request to a pending state;
[0020] When the first task in the task list is sent to the request queue message, the state of the first task is changed from a pending state to a backlog state;
[0021] When the detection consumer receives the first task in the message queue, the state of the first task is changed from the backlog state to the processing state;
[0022] When the first task is processed and completed, the processing state is changed to the completed state.
[0023] In a second aspect, the present invention further provides an intelligent variable frequency task scanning device, the device comprising:
[0024] A query module is used to query the status of each task in the task table, at least one task in the task table is reported by at least one client, and at least one task is scanned and sent to the message queue at a first time interval, and the status of the task includes being executed and being backlogged;
[0025] The calculation module is used to count the number of tasks in execution and backlog, and calculate the sum of all tasks in execution and squeezed state;
[0026] A judging module, used to judge whether the sum of the number of tasks is greater than or equal to a first threshold;
[0027] a processing module, configured to adjust the scanning frequency when the judging module judges that the value is greater than or equal to the first threshold value, calculate the second time interval according to the sum of the number of tasks and the first time interval, and generate indication information including the second time interval;
[0028] The sending module is used to send the indication information to the scheduler, so that the scheduler scans the task table according to the second time interval and sends the scanned tasks to the message queue.
[0029] In a third aspect, the present invention provides a computer device, comprising: a memory and a processor, the memory and the processor are communicatively connected to each other, computer instructions are stored in the memory, and the processor executes an intelligent frequency conversion task scanning method of the first aspect or any corresponding embodiment thereof by executing the computer instructions.
[0030] In a fourth aspect, the present invention provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to enable a computer to execute the task scanning method for intelligent frequency conversion of the first aspect or any corresponding embodiment thereof.
[0031] In addition, the present invention provides a computer program product, including computer instructions, which are used to enable a computer to execute the task scanning method of intelligent frequency conversion in the above-mentioned first aspect or any corresponding embodiment.
[0032] In a fifth aspect, the present invention further provides a task scanning system for intelligent frequency conversion, the system comprising: at least one client, a scheduler, a central controller, at least one physical machine and a database;
[0033] Wherein, at least one client is used to report at least one task to the database, each task including a user identifier and / or a task type;
[0034] A database, used for generating a task table with statuses of each task according to at least one task reported by at least one client;
[0035] A scheduler, configured to scan tasks in the task table at certain time intervals, and send the scanned tasks to a task list, wherein the tasks in the task list are processed and executed by at least one physical machine according to priority;
[0036] A central controller is used to execute the task scanning method of intelligent frequency conversion in the above-mentioned first aspect or any corresponding embodiment thereof.
[0037] The present invention provides an intelligent variable frequency task scanning method, device and equipment, which add the priority of each task in the task table so that the scheduler can preferentially scan and execute high-priority tasks. In addition, the scanning rules of the timing scheduler are dynamically modified through the API interface to prevent the system from wasting system resources or idling due to the initial setting of the scanning frequency being too large or too small.
[0038] When scanning tasks, the pending tasks are scanned in descending order according to the priority status, and the number of pending tasks to be scanned is dynamically adjusted according to the number of backlog tasks through the intelligent scanning frequency replenisher, and the scanned pending tasks are sent to the message queue. This improves the system's throughput, availability, and user experience.
[0039] Compared with general physical machine scheduling solutions, this method is more practical and easier to use, improves user experience, increases system throughput, reduces resource waste, and plays a role in preparing and paving the way for the implementation of physical machine scheduling projects. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0041] Figure 1 is a flowchart of a task scanning method for intelligent frequency conversion according to an embodiment of the present invention;
[0042] Figure 2 is a flowchart of another task scanning method for intelligent frequency conversion according to an embodiment of the present invention;
[0043] Figure 3 is a flow chart of an intelligent frequency conversion scanning mechanism according to an embodiment of the present invention;
[0044] Figure 4 is a flowchart of scheduling tasks according to priority levels according to an embodiment of the present invention;
[0045] Figure 5 is a schematic diagram of a task state transfer process according to an embodiment of the present invention;
[0046] Figure 6 is a structural block diagram of a task scanning device according to an embodiment of the present invention;
[0047] Figure 7 It is a schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0048] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0049] In the description of the present invention, it should be noted that, unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, or it can be the internal communication of two components. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0050] Furthermore, the terms “first” and “second” are used for descriptive purposes only and should not be understood as indicating or implying relative importance.
[0051] The technical features involved in the different embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.
[0052] The technical solution provided by the embodiment of the present invention solves the system problems caused by too high or too low scanning frequency through intelligent frequency conversion. At the same time, it ensures that high-priority tasks are processed in a timely manner through task priority, and prevents the problem of inflexible task processing caused by a large number of messages being accumulated in the message queue (Message Queue, MQ), thereby improving the user experience of the system.
[0053] An embodiment of the present invention provides an embodiment of a task scanning method for intelligent frequency conversion. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0054] In this embodiment, a task scanning method of intelligent frequency conversion is provided, which can be used for a network device, such as a task processing central controller, referred to as a "central controller". The central controller can be a network device, such as a server or a data center, which is not limited in this embodiment.
[0055] Figure 1 is a flow chart of a task scanning method for intelligent frequency conversion according to an embodiment of the present invention, the process comprising:
[0056] Step S101: Query the status of each task in the task table.
[0057] At least one task in the task table is reported by at least one client, and at least one task is scanned and sent to the message queue at a first time interval, and the task status includes: being executed and being backlogged. In addition, the task status in the task table can also be an initialization status (i.e., the task status just recorded) or an execution completed status.
[0058] Step S102: Count the number of tasks in execution and in backlog, and calculate the sum of the number of tasks in the execution and squeeze states.
[0059] In the task table, each task contains a task status and records relevant information of the current task, such as the task name, the user identification / user ID from the client, and the status of the current task, such as the "activation" physical machine status, or the "closure" physical machine status, etc. This embodiment does not limit this.
[0060] In this embodiment, it is assumed that in the current task table, after scanning, the number of tasks in the "executing" state is e1, and the number of tasks in the "backlog" state is b1, and the sum of the two task numbers is e1+b1.
[0061] Step S103: Determine whether the sum of the number of tasks is greater than or equal to a first threshold.
[0062] The first threshold may be customized by the system or determined according to actual business. If yes, execute step S104.
[0063] Step S104: adjusting the scanning frequency, calculating the second time interval according to the sum of the number of tasks and the first time interval, and generating indication information including the second time interval.
[0064] Specifically, the task processing controller queries the number of tasks in execution and backlog in the task table. If the number is greater than the first threshold, the intelligent backfill strategy is executed to determine whether the scanning frequency needs to be adjusted. If yes, that is, adjustment is required, the adjusted scanning frequency, that is, the second time interval, is calculated, and the scanning frequency is transmitted to the timing scheduler through a message / signal.
[0065] Step S105: Send the instruction information to the scheduler, so that the scheduler scans the task table at the second time interval and sends the scanned tasks to the message queue.
[0066] After receiving the message or signal, the timer scheduler scans the tasks in the database according to the instruction and sends the scanned tasks to the message queue MQ.
[0067] Specifically, see Figure 2 , which is a flow chart of another intelligent frequency conversion task scanning method provided in this embodiment.
[0068] Before executing the method flow of this embodiment, some parameters are set first, and the specific settings are as follows:
[0069] - Set the initial scanning time interval (in seconds); this can be understood as the aforementioned first time interval s1.
[0070] - Set the number of tasks to be processed in the initial scan n1, which is the sum of the number of tasks in the current task table with the status of "initialization", "executing" and "backlog". These statuses are pre-recorded in the task table.
[0071] -The reduction in scanning time for each scan is m1%; understood as: the interval between two scans of a task in the database; for example, the first time interval scanned at time t1 is s1, and the second time interval scanned at time t2 is s2. The calculation formula for the change in time intervals corresponding to times t1 and t2 is: m1% = (s1-s2) / s1×100%.
[0072] - minimum scanning interval f1 (seconds);
[0073] - It is allowed that the backlog threshold m2% (which can be determined based on n1) of the initial time interval s1 is not adjusted.
[0074] In addition, this embodiment also includes information such as pre-setting other parameters, which is not limited in this embodiment.
[0075] The above-mentioned step S103 calculates the second time interval based on the sum of the number of tasks and the first time interval, specifically including: obtaining the number of tasks to be processed in the initial scan (n1) and a first preset percentage (such as m2%) to calculate the second threshold value (n1*m2%); comparing whether the sum of the number of tasks is greater than or equal to the second threshold value; if so, calculating the time consumption (v1) of task execution per unit time based on the number of tasks to be processed in the initial scan (n1) and the sum of the number of tasks, and determining the second time interval (s1=v1*n1) based on the time consumption (v1) and the number of tasks to be processed in the initial scan (n1).
[0076] In such Figure 2 In the example shown, this includes:
[0077] Step S201: The central controller queries the task table for the number of tasks being executed and in backlog.
[0078] Step S202: Start and execute the intelligent replenishment strategy. The start judgment condition is to judge whether there is a backlog of tasks in the message queue. For the specific judgment principle, refer to the above step S103.
[0079] A specific implementation method for determining whether the scanning frequency needs to be adjusted is:
[0080] Step S203: Determine whether the sum of the number of tasks being executed and the number of tasks in backlog, e1+b1, is less than or equal to a second threshold value n1*m2%.
[0081] Among them, after scanning, the number of tasks in the "executing" state is e1, the number of tasks in the "backlog" state is b1, and the sum of the two task numbers is e1+b1.
[0082] Step S306: If there is a backlog and e1+b1≤n1*m2%, that is, the sum of the number of tasks is less than the second threshold, the scanning frequency will not be adjusted, the first time interval s1 will not be adjusted, the scheduler will continue to scan the pending tasks, and the scanned pending tasks will be sent to the message queue. No backlog processing will be performed at this time.
[0083] Step S307: Continue scanning n1 tasks to be processed and send out MQ message queues.
[0084] If there is a backlog of messages in the MQ, and step S303: when it is determined that e1+b1>n1*m2%, it is necessary to adjust the scanning time interval, calculate the adjusted scanning frequency, and transmit the scanning frequency to the timing scheduler via a message / signal.
[0085] Step S304: Calculate the unit task execution time according to s1 and (e1+b1). Assume that the unit task execution time is represented by v1, v1=s1 / (n1-e1-b1).
[0086] Step S305: Calculate the time v1*n1 required to execute the task number n1 according to v1, use v1*n1 as the second time interval, and reassign s1=v1*n1. Generate indication information including v1*n1, and send the indication information to the scheduler.
[0087] The method further includes: Step S305: calculating the number of pending tasks n1-e1-b1 to be scanned in the current round, and sending MQ messages for these pending tasks.
[0088] In addition, the method provided in this embodiment also includes: in the case of no backlog of tasks, that is, if the sum of the number of tasks is less than a first threshold, it is determined that there is no backlog of tasks, and the first time interval is gradually reduced until it is reduced to the minimum value of the scanning time interval and stops, and the tasks to be processed are obtained according to the minimum scanning time interval, and the tasks to be processed obtained by scanning are sent to the message queue.
[0089] Specifically, in the scanning process, if the time interval s1 is set to be long and the system processes task requests at a high enough speed, then e1+b1=0, and there are surplus resources. In order to avoid wasting resources, the scanning time interval s1 can be intelligently reduced. When s1 is reduced, the original m1% is still maintained, gradually approaching the most reasonable value.
[0090] Step S401: gradually reduce s1, wherein each reduction ratio is m1% of the original value.
[0091] Step S402: When the reduced time interval s1' is less than the minimum scanning interval f1, messages corresponding to n1 tasks to be executed are sent each time, and these messages are transmitted to the consumer end for consumption and execution.
[0092] The method provided in this embodiment monitors the status of each task in the query task table, determines whether there is a backlog of tasks in the current message queue, and automatically adjusts the scanning frequency when a backlog of system tasks is detected, thereby controlling the scheduler to scan tasks at the new scanning frequency to slow down the number of tasks placed in the message queue, or delay the time interval for placing tasks, so that the system can process the backlog tasks as soon as possible to prevent a large number of tasks from being accumulated and causing system congestion.
[0093] In addition, when the system has excess processing power, the time interval between scanning tasks can be intelligently shortened to fully utilize system resources and reduce resource waste.
[0094] See also Figure 3 , is a flow chart of an intelligent frequency conversion scanning mechanism provided by this embodiment, the process includes: a timing scheduler, a task processing central controller, a task table and a client, etc., wherein the frequency conversion process specifically includes:
[0095] First, the task table is scanned at an initial fixed frequency. The task processing controller formulates a replenishment scanning frequency strategy by calculating the task processing and backlog level. Then, the controller adjusts the scanning frequency through the API interface; or, the scanning frequency can be adjusted manually through the API interface.
[0096] The timer scheduler scans tasks in the task table according to the Cron rules. For example, if the initial scanning frequency is f1, the API interface of the Cron rule can be modified through the central controller or manual adjustment, so that the timer scheduler scans tasks according to the variable frequency scanning frequency f2, realizing manual or automatic frequency conversion function.
[0097] Cron rules, also known as Cron expressions, are a type of syntax used by the Cron daemon in the Unix operating system to set scheduled tasks. The Cron daemon is a background process in the Unix system that periodically executes specified commands or scripts.
[0098] In addition, in another possible implementation of this embodiment, Figure 4 As shown, the above method also includes: before querying the status of each task in the task table, it also includes: the business system inserts a task with a set priority, and the timing scheduler sorts the scan tasks in descending order of priority, giving priority to high-priority tasks.
[0099] Specifically, the business system obtains the user identifier and / or task type included in each task reported by at least one client; sets the priority of each task according to at least one of the user identifier and the task type, and sorts all tasks in the order of priority; generates a task table based on all sorted tasks, so that all tasks in the task table are arranged in order of priority, which can be sorted in order from high to low priority, or in order from low to high, which is not limited in this embodiment.
[0100] In addition, the above method flow also includes modifying the status of each task in real time to update the status of each task in the task table.
[0101] Specifically, Figure 5 As shown, an implementation method includes: real-time detection of the status of each task in the task table, and changing the status of each task; when a task request is received from a client, setting the status of the first task in the task request to a pending state; when the first task in the task table is sent to the request queue message, changing the status of the first task from a pending state to a backlog state; when the consumer receives the first task in the message queue, changing the status of the first task from a backlog state to a processing state; when the first task is processed, changing the processing state to a completed state. The task status flow process is as follows:
[0102] 1. When a task is inserted by the business system, it is set to pending status.
[0103] 2. When the task processing controller sends an MQ message, the task changes from the pending state to the backlog state.
[0104] 3. After receiving the message, the consumer changes the task backlog status to the processing status.
[0105] 4. After the processing is completed, it changes to the completed status.
[0106] In this embodiment, it can be found that this solution adds priority tasks, preferentially scans and executes high-priority tasks, and uses an intelligent scanning frequency replenisher to dynamically modify the scanning rules of the timing scheduler through an API interface to prevent the system from wasting system resources or idling due to the initial setting of the scanning frequency being too large or too small.
[0107] When scanning tasks, the system scans pending tasks in descending order according to their priority status, and dynamically adjusts the number of pending tasks to be scanned according to the number of backlog tasks through the intelligent scanning frequency replenisher, and sends MQ messages for the scanned pending tasks. This improves the system's throughput, availability, and user experience.
[0108] Compared with general physical machine scheduling solutions, this method is more practical and easier to use, improves user experience, increases system throughput, reduces resource waste, and plays a role in preparing and paving the way for the implementation of physical machine scheduling projects.
[0109] In this embodiment, a task scanning device is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can be a combination of software and / or hardware that implements a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.
[0110] This embodiment provides a task scanning device, such as Figure 6 As shown, the device includes: a query module 610, a calculation module 620, a judgment module 630, a processing module 640 and a sending module 650. In addition, the device may also include other more or fewer modules, such as a storage module, etc., which is not limited in this embodiment.
[0111] The query module 610 is used to query the status of each task in the task table, where at least one task in the task table is reported by at least one client, and the at least one task is scanned and sent to the message queue at a first time interval, and the status of the task includes being executed and being backlogged.
[0112] The calculation module 620 is used to count the number of tasks being executed and in the backlog, and calculate the sum of the number of tasks in the executing and squeezed states.
[0113] The judgment module 630 is used to judge whether the sum of the number of tasks is greater than or equal to a first threshold.
[0114] The processing module 640 is used to adjust the scanning frequency when the judgment module determines that it is greater than or equal to the first threshold, calculate the second time interval according to the sum of the number of tasks and the first time interval, and generate indication information including the second time interval.
[0115] The sending module 650 is used to send the indication information to the scheduler, so that the scheduler scans the task table according to the second time interval and sends the scanned tasks to the message queue.
[0116] Optionally, in a specific implementation, the processing module 640 is specifically used to obtain the number of tasks to be processed in the initial scan and the first preset percentage to calculate the second threshold;
[0117] Comparing whether the sum of the number of tasks is greater than or equal to the second threshold;
[0118] If yes, the time consumed for executing the tasks per unit time is calculated according to the number of tasks to be processed in the initial scan and the sum of the number of tasks, and the second time interval is determined according to the time consumed and the number of tasks to be processed in the initial scan.
[0119] Optionally, in another specific implementation, the processing module 640 is also used to not adjust the scanning frequency if the sum of the number of tasks is less than the second threshold, continue scanning the tasks to be processed through the scheduler, and send the scanned tasks to be processed to the message queue.
[0120] Optionally, in another specific embodiment, the processing module 640 is also used to determine that there is no backlog of tasks if the sum of the number of tasks is less than a first threshold value, and gradually reduce the first time interval until it is reduced to the minimum value of the scanning time interval and stop, and obtain the tasks to be processed according to the minimum scanning time interval, and send the tasks to be processed obtained by the scan to the message queue.
[0121] Optionally, in another specific implementation, the query module 610 is also used to: obtain the user identifier and / or task type included in each task reported by at least one client; set the priority of each task according to at least one of the user identifier and the task type, and sort all tasks in the order of priority; and generate a task table based on all sorted tasks.
[0122] In addition, the above device also includes an update module, which is Figure 6 Not shown in the figure, the update module is used to detect the status of each task in the task table in real time and change the status of each task.
[0123] Furthermore, when the specific update module receives a task request sent from a client, it sets the status of the first task in the task request to a pending status; when the first task in the task table is sent to a request queue message, the status of the first task is changed from a pending status to a backlog status; when it is detected that the consumer end has received the first task in the message queue, the status of the first task is changed from a backlog status to a processing status; when the first task is processed, the processing status is changed to a completed status.
[0124] The further functional description of each of the above modules and units is the same as that of the above corresponding embodiments and will not be repeated here.
[0125] The task scanning device in this embodiment is presented in the form of a functional unit, where the unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.
[0126] The embodiment of the present invention also provides a computer device having the above Figure 7 The task scanning device shown.
[0127] See also Figure 7 , is a schematic diagram of the structure of a computer device provided by an optional embodiment of the present invention, the computer device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. The various components are connected to each other using different buses for communication, and can be installed on a common motherboard or in other ways as needed. The processor can process instructions executed in the computer device, including instructions stored in or on the memory to display graphical information of the GUI on an external input / output device (such as a display device coupled to the interface).
[0128] In some optional embodiments, if desired, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple computer devices can be connected, and each device provides part of the necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 7 A processor 10 is taken as an example.
[0129] The processor 10 may be a central processing unit, a network processor or a combination thereof. The processor 10 may further include a hardware chip. The hardware chip may be a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic or any combination thereof.
[0130] The memory 20 stores instructions executable by at least one processor 10, so that the at least one processor 10 executes the task scanning method shown in the above embodiment.
[0131] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may include a memory remotely arranged relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0132] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid state drive; the memory 20 may also include a combination of the above types of memory.
[0133] The computer device also includes an input device 30 and an output device 40. The processor 10, the memory 20, the input device 30 and the output device 40 may be connected via a bus or other means. Figure 7 The example of connecting through bus is taken in the following.
[0134] The input device 30 can receive input digital or character information, and generate key signal input related to the user settings and function control of the computer device, such as a touch screen, a keypad, a mouse, a track pad, a touch pad, an indicator bar, one or more mouse buttons, a trackball, a joystick, etc. The output device 40 may include a display device, an auxiliary lighting device (e.g., an LED) and a tactile feedback device (e.g., a vibration motor), etc. The above-mentioned display device includes but is not limited to a liquid crystal display, a light emitting diode, a display and a plasma display. In some optional embodiments, the display device can be a touch screen.
[0135] In addition, the computer device also includes a communication interface, which is used for the computer device to communicate with other devices or a communication network.
[0136] Optionally, the computer device in this embodiment may be a central controller or a network device for executing the above Figures 1 to 5 All or part of the method steps in the method flow.
[0137] In addition, this embodiment also provides a task scanning system for intelligent frequency conversion, which includes: at least one client, a scheduler, a central controller, at least one physical machine and a database, wherein at least one client is used to report at least one task to the database, each of the tasks includes a user identifier and / or a task type; the database is used to generate a task table with each task status based on at least one task reported by at least one client.
[0138] The scheduler is used to scan the tasks in the task table at a certain time interval and send the scanned tasks to the task list, and the tasks in the task list are processed and executed by at least one physical machine according to the priority; the central controller is used to execute the above Figures 1 to 5 All or part of the method steps in the method flow.
[0139] The present invention provides an intelligent variable frequency task scanning system, which adds the priority of each task in the task table so that the scheduler can preferentially scan and execute high priority tasks. In addition, the scanning rules of the timing scheduler are dynamically modified through the API interface to prevent the system from wasting system resources or idling due to the initial setting of the scanning frequency being too large or too small.
[0140] When scanning tasks, the pending tasks are scanned in descending order according to the priority status, and the number of pending tasks to be scanned is dynamically adjusted according to the number of backlog tasks through the intelligent scanning frequency replenisher, and the scanned pending tasks are sent to the message queue. This improves the system's throughput, availability, and user experience.
[0141] Compared with general physical machine scheduling solutions, this method is more practical and easier to use, improves user experience, increases system throughput, reduces resource waste, and plays a role in preparing and paving the way for the implementation of physical machine scheduling projects.
[0142] An embodiment of the present invention also provides a computer-readable storage medium, and the above-mentioned method according to the embodiment of the present invention can be implemented in hardware, firmware, or can be implemented as a computer code that can be recorded in a storage medium, or can be implemented by downloading through a network and originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware.
[0143] The storage medium may be a disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid state drive, etc.; further, the storage medium may also include a combination of the above types of memories. It is understood that a computer, a processor, a microprocessor controller or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by the computer, processor or hardware, the task scanning method shown in the above embodiment is implemented.
[0144] Embodiments of the present application may also provide a computer program product, including computer program instructions, which, when executed by a processor, cause the processor to perform the steps in the above method. Wherein, the computer program product may be written in any combination of one or more programming languages to perform program codes for performing the operations of the disclosed embodiments, wherein the programming languages include object-oriented programming languages, such as Java, C++, etc., and also include conventional procedural programming languages, such as "C" language or similar programming languages. The program code may be executed entirely on a user computing device, partially on a user device, as an independent software package, partially on a user computing device, partially on a remote computing device, or entirely on a remote computing device or server.
[0145] The above embodiments are only used to illustrate the technical solutions of the embodiments of the present invention, rather than to limit them. Although the embodiments of the present invention are described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some of the technical features therein by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A task scanning method for intelligent frequency conversion, characterized in that: The method comprises: Querying the status of each task in the task table, wherein at least one task in the task table is reported by at least one client, and the at least one task is scanned and sent to the message queue at a first time interval, and the status of the task includes being executed and being backlogged; Count the number of tasks in execution and backlog, and calculate the sum of all tasks in execution and squeezed state; Determine whether the sum of the number of tasks is greater than or equal to a first threshold; If yes, adjusting the scanning frequency, calculating the second time interval according to the sum of the number of tasks and the first time interval, and generating indication information including the second time interval; The indication information is sent to the scheduler, so that the scheduler scans the task table according to the second time interval and sends the scanned tasks to the message queue.
2. The method according to claim 1, characterized in that The calculating the second time interval according to the sum of the number of tasks and the first time interval includes: Obtain the number of tasks to be processed in the initial scan and the first preset percentage to calculate the second threshold; Comparing whether the sum of the number of tasks is greater than or equal to the second threshold; If yes, the time consumed for executing the tasks per unit time is calculated according to the number of tasks to be processed in the initial scan and the sum of the number of tasks, and the second time interval is determined according to the time consumed and the number of tasks to be processed in the initial scan.
3. The method according to claim 2, characterized in that The method further comprises: If the sum of the number of tasks is less than the second threshold, the scanning frequency is not adjusted, the scheduler continues to scan the tasks to be processed, and the scanned tasks to be processed are sent to the message queue.
4. The method according to any one of claims 1 to 3, characterized in that: The method further comprises: If the sum of the number of tasks is less than the first threshold, it is determined that there is no backlog of tasks, and the first time interval is gradually reduced until it is reduced to the minimum value of the scanning time interval and stops, and the tasks to be processed are obtained according to the scanning time interval of the minimum value, and the tasks to be processed obtained by scanning are sent to the message queue.
5. The method according to claim 1, characterized in that Before querying the status of each task in the task table, the method further includes: Obtaining a user identifier and / or a task type included in each task reported by at least one client; Setting the priority of each task according to at least one of the user identifier and the task type, and sorting all tasks in order of priority; The task table is generated according to all the sorted tasks.
6. The method according to claim 5, characterized in that The task status also includes: an initialization status and an execution completion status; the method also includes: Detect the status of each task in the task table in real time and change the status of each task; When receiving a task request sent from a client, setting the state of the first task in the task request to a pending state; When the first task in the task table is sent to the request queue message, the state of the first task is changed from a pending state to a backlog state; When detecting that the consumer end receives the first task in the message queue, changing the state of the first task from a backlog state to a processing state; When the first task is processed and completed, the processing state is changed to a completed state.
7. An intelligent variable frequency task scanning device, characterized in that: The device comprises: A query module, used to query the status of each task in the task table, wherein at least one task in the task table is reported by at least one client, and the at least one task is scanned and sent to the message queue at a first time interval, and the status of the task includes being executed and being backlogged; The calculation module is used to count the number of tasks in execution and backlog, and calculate the sum of all tasks in execution and squeezed state; A judging module, used to judge whether the sum of the number of tasks is greater than or equal to a first threshold; a processing module, configured to adjust the scanning frequency if the judging module determines that the value is greater than or equal to the first threshold, calculate the second time interval according to the sum of the number of tasks and the first time interval, and generate indication information including the second time interval; The sending module is used to send the indication information to the scheduler, so that the scheduler scans the task table according to the second time interval and sends the scanned tasks to the message queue.
8. A computer device, characterized in that: comprising a memory and a processor, wherein the memory and the processor are connected; The memory stores computer instructions, and the processor executes the task scanning method of intelligent frequency conversion according to any one of claims 1 to 6 by executing the computer instructions.
9. A computer-readable storage medium, characterized in that: The computer readable storage medium has computer instructions stored thereon. The computer instructions are used to enable a computer to execute the task scanning method of intelligent frequency conversion according to any one of claims 1 to 7.
10. An intelligent variable frequency task scanning system, characterized in that: The system includes: at least one client, a scheduler, a central controller, at least one physical machine and a database, wherein: The at least one client is used to report at least one task to the database, each of the tasks including a user identifier and / or a task type; The database is used to generate a task table with statuses of various tasks according to at least one task reported by at least one client; The scheduler is used to scan the tasks in the task table at a certain time interval, and send the scanned tasks to a task list, and the tasks in the task list are processed and executed by at least one physical machine according to the priority; The central controller is used to execute the task scanning method of intelligent frequency conversion as described in any one of claims 1 to 6.
Citation Information
Cited By
Content delivery account number zero clearing processing method, content delivery account number management system and content delivery system
CN120614145A
Content delivery account zeroing processing method, content delivery account management system, content delivery system
CN120614145B