Task scheduling method and device, electronic equipment and computer readable storage medium

By transferring tasks from the thread pool to the asynchronous thread pool for asynchronous processing under high concurrency of the server, the problem of high cost under high concurrency is solved, and both efficiency and cost are reduced.

CN118535308APending Publication Date: 2024-08-23PINGAN YIQIANBAO E COMMERCE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410729169.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-05
Publication Date
2024-08-23

AI Technical Summary

Technical Problem

When the existing technology handles high concurrent traffic, it adds message middleware to reduce peak pressure, resulting in high access and maintenance costs. It is necessary to find ways to reduce costs.

Method used

When the server enters a high concurrency state, tasks that meet asynchronous processing conditions are screened out, transferred from the current thread pool to the asynchronous thread pool, and task data is obtained and processed based on basic configuration information and interface scheduling configuration information to implement asynchronous processing.

Benefits of technology

There is no need to add message middleware, and tasks are processed directly through the asynchronous thread pool, which reduces server pressure and costs and improves task processing efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118535308A
    Figure CN118535308A
Patent Text Reader

Abstract

The invention relates to the technical field of cloud storage, and provides a task scheduling method and device, electronic equipment and a computer readable storage medium, and the method comprises the steps: responding to a server, entering a task high concurrency state, and determining a target task meeting an asynchronous processing condition in to-be-processed tasks of the server; deploying the target task from a current thread pool to an asynchronous thread pool; for a target task in the asynchronous thread pool, based on basic configuration information of the target task, querying interface scheduling configuration information of the target task in an interface scheduling configuration table; and according to the basic configuration information and the interface scheduling configuration information, obtaining to-be-processed business data corresponding to the target task at a specified storage position, and carrying out asynchronous processing on the target task based on the to-be-processed business data. According to the technical scheme provided by the invention, the pressure of the server is reduced and the task processing efficiency is improved while the cost increase caused by adding the message-oriented middleware is avoided.
Need to check novelty before this filing date? Find Prior Art

Description

[Technical field]

[0001] The present application relates to the field of cloud storage technology, and in particular to a task scheduling method and device, an electronic device, and a computer-readable storage medium. [Background technology]

[0002] With the increase in online business volume, network traffic often surges, such as when sudden marketing activities and social news occur. High concurrency of traffic puts a lot of pressure on the server, which can easily lead to insufficient server resources or even downtime.

[0003] In this regard, related technologies often adopt the method of adding message middleware such as activeMQ, RabbitMQ, Kafka, etc. to handle high concurrent traffic peaks to reduce server pressure. Specifically, an additional message middleware cluster can be built. However, with the access of open source message middleware, certain access costs will be incurred, and maintenance costs will also increase significantly.

[0004] Therefore, how to reduce the consumption cost while shaving the peak of high concurrent traffic has become a technical problem that needs to be solved urgently. [Summary of the invention]

[0005] The embodiments of the present application provide a task scheduling method and device, an electronic device, and a computer-readable storage medium, which are intended to solve the technical problem in the related art that the cost of adding a message middleware to achieve peak shaving of high concurrent traffic is too high.

[0006] In the first aspect, an embodiment of the present application provides a task scheduling method, including: in response to a server entering a high task concurrency state, determining a target task that meets asynchronous processing conditions among the pending tasks of the server; allocating the target task from the current thread pool to the asynchronous thread pool; for the target task in the asynchronous thread pool, based on the basic configuration information of the target task, querying the interface scheduling configuration information of the target task in the interface scheduling configuration table; according to the basic configuration information and the interface scheduling configuration information, obtaining the pending business data corresponding to the target task in a designated storage location, and asynchronously processing the target task based on the pending business data.

[0007] In the second aspect, an embodiment of the present application provides a task scheduling device, including: a task acquisition unit, used to determine a target task that meets the asynchronous processing conditions among the pending tasks of the server in response to the server entering a high-concurrency task state; an asynchronous adjustment unit, used to allocate the target task from the current thread pool to the asynchronous thread pool; an information acquisition unit, used to query the interface scheduling configuration information of the target task in the interface scheduling configuration table based on the basic configuration information of the target task for the target task in the asynchronous thread pool; an asynchronous processing unit, used to obtain the pending business data corresponding to the target task in a designated storage location according to the basic configuration information and the interface scheduling configuration information, and asynchronously process the target task based on the pending business data.

[0008] In a third aspect, an embodiment of the present application provides an electronic device, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are configured to execute the method described in the first aspect above.

[0009] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium storing computer-executable instructions, wherein the computer-executable instructions are used to execute the method described in the first aspect above.

[0010] The above technical solution aims to solve the technical problem in the related technology that adding message middleware to achieve peak shaving of high concurrent traffic consumes too much cost. First, in response to the server entering a high concurrent task state, a target task that meets the asynchronous processing conditions is determined among the pending tasks of the server.

[0011] Among them, the high task concurrency state refers to the state where the amount of tasks that the server needs to process exceeds the normal processing level of the server due to a sharp increase in traffic. If the server enters the high task concurrency state, it means that it is urgent to handle the peak of traffic to reduce the task processing pressure of the server and maintain the normal operation of the server. The asynchronous processing condition refers to the conditions required for tasks to be processed asynchronously. At this time, the target tasks that can be processed asynchronously can be screened through the asynchronous processing conditions, and these target tasks can be processed asynchronously to achieve peak shaving of a large number of tasks and reduce the pressure on the server.

[0012] Then, the target task is deployed from the current thread pool to the asynchronous thread pool. After the target task is deployed to the asynchronous thread pool, the target task is eligible for asynchronous processing, which reduces the amount of tasks that the current thread pool of the server needs to process, which is equivalent to peak shaving of the current high concurrent task volume of the server.

[0013] Then, for the target task in the asynchronous thread pool, based on the basic configuration information of the target task, the interface scheduling configuration information of the target task is queried in the interface scheduling configuration table.

[0014] The basic configuration information of the target task includes, but is not limited to, one or more of the task name, task processing rules, historical processing time, next time, task paging size, and task start time. Each task has corresponding interface configuration information in the interface scheduling configuration table. In other words, the basic configuration information of the task in the interface scheduling configuration table is stored in association with the interface scheduling configuration information. Therefore, the interface scheduling configuration information associated with the basic configuration information of the target task can be queried in the interface scheduling configuration table. Among them, the interface scheduling configuration information of the target task includes, but is not limited to, one or more of the business type, required system, number of redo times, and scheduling configuration parameters.

[0015] Finally, according to the basic configuration information and the interface scheduling configuration information, the to-be-processed business data corresponding to the target task is obtained in a designated storage location, and the target task is asynchronously processed based on the to-be-processed business data.

[0016] The designated storage location stores the pending business data of each task. Furthermore, the pending business data associated with the basic configuration information and the interface scheduling configuration information of the target task, that is, the pending business data of the target task, can be queried in the designated storage location. At this point, the target task can be asynchronously processed through the pending business data of the target task.

[0017] Compared with the related art method of balancing the traffic carried by the server through message middleware, the above technical solution cancels the setting of message middleware and directly releases the pressure on the server by transferring part of the server's tasks to the asynchronous thread pool for asynchronous processing. While avoiding the cost increase caused by the addition of message middleware, it reduces the pressure on the server and improves the efficiency of task processing.

Brief Description of the Drawings

[0018] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0019] Figure 1 A flowchart of a task scheduling method according to an embodiment of the present application is shown;

[0020] Figure 2A schematic diagram of a task scheduling process according to an embodiment of the present application is shown;

[0021] Figure 3 A block diagram of a task scheduling device according to an embodiment of the present application is shown;

[0022] Figure 4 A block diagram of an electronic device according to an embodiment of the present application is shown. [Specific implementation method]

[0023] In the related art, the method of adding message middleware to the server is often adopted to cut the peak of high concurrent traffic to reduce the pressure on the server. However, with the access of message middleware, the cost consumed by the server also increases significantly. In this regard, this application directly transfers some tasks in high concurrent traffic to the asynchronous thread pool for asynchronous processing without adding additional message middleware, which greatly reduces the peak cutting cost.

[0024] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions 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 ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0025] Figure 1 A flowchart of a task scheduling method according to an embodiment of the present application is shown.

[0026] like Figure 1 As shown, a task scheduling method according to an embodiment of the present application includes:

[0027] Step 102 : in response to the server entering a high task concurrency state, determining a target task that meets an asynchronous processing condition from the tasks to be processed of the server.

[0028] The high task concurrency state refers to a state in which a sharp increase in traffic causes the amount of tasks that the server needs to process to exceed the server's normal processing level. If the server enters the high task concurrency state, it means that there is an urgent need to shave the traffic peak in order to reduce the server's task processing pressure and maintain the normal operation of the server.

[0029] In a possible design, it is necessary to determine in advance whether the server has entered a high-concurrency task state.

[0030] Specifically, if the server meets one or more of the following high concurrency conditions, it is determined that the server enters the task high concurrency state.

[0031] In a possible design, the high concurrency condition includes: the total number of pending tasks of the server is greater than a first number threshold. The first number threshold refers to the maximum number of tasks that can be processed when the server can operate normally. When the total number of pending tasks of the server is greater than the first number threshold, it means that there are too many pending tasks, and the server can be deemed to have entered the high concurrency state of the task.

[0032] In another possible design, the high concurrency condition includes: the number of tasks newly added to be processed by the server within the first specified time interval is greater than a second number threshold. The second number threshold refers to the maximum value of the task increment within the first specified time interval that the server can handle if it can operate normally. Once the number of tasks newly added to be processed by the server within the first specified time interval is greater than the second number threshold, it means that a large number of tasks are concurrent in a short period of time, which exceeds the current processing capacity of the server. At this time, it can be determined that the server has entered the task high concurrency state.

[0033] In another possible design, the high concurrency condition includes: the number of tasks to be processed newly added by the server in multiple consecutive second specified time intervals is greater than a third quantity threshold. The third quantity threshold refers to the maximum value of the continuous task increments in multiple second specified time intervals that the server can handle when it can operate normally. Once the number of tasks to be processed newly added by the server in multiple consecutive second specified time intervals is greater than the third quantity threshold, it means that the task increments in multiple cycles in a short period of time are too large and have exceeded the current processing capacity of the server. At this time, it can be determined that the server has entered the task high concurrency state.

[0034] In another possible design, the high concurrency condition includes: the remaining idle resources of the server are less than a specified resource threshold. The specified resource threshold refers to the minimum amount of resources required for the server to operate normally. When the remaining idle resources of the server are less than the specified resource threshold, the remaining resources of the server are insufficient to support its normal operation to process tasks. At this time, it can be determined that the server has entered the task high concurrency state.

[0035] In another possible design, the high concurrency condition includes: the remaining idle resources of the server are less than the total resources required for the newly added tasks to be processed by the server within the third specified time interval. In other words, the remaining idle resources of the server do not match the increment of the tasks to be processed by the server, or the remaining idle resources of the server are insufficient to support the server to process the increment of the tasks to be processed within the third specified time interval. At this time, it can be determined that the server has entered the task high concurrency state.

[0036] Of course, any at least two of the above high concurrency conditions can be used in combination, so as to determine whether the server is in a high task concurrency state under the joint action of multiple dimensions. In addition, the first specified time interval, the second specified time interval, the third specified time interval and each threshold mentioned in the context described in this application can be flexibly set based on the actual processing requirements of the server and the actual task reception situation, and are not limited here.

[0037] Asynchronous processing conditions refer to the conditions required for tasks to be processed asynchronously. At this time, the target tasks that can be processed asynchronously can be screened through the asynchronous processing conditions, and these target tasks can be processed asynchronously to achieve peak shaving of a large number of tasks and reduce the pressure on the server.

[0038] In one possible design, the asynchronous processing conditions include: if the required processing time of the task to be processed is greater than or equal to a specified time threshold, and / or the real-time processing requirement of the task to be processed is less than a specified requirement threshold, the task to be processed is determined as the target task.

[0039] If the processing time required for the pending task is greater than or equal to the specified time threshold, it means that the pending task is time-consuming to process and will occupy server resources for a long time. Therefore, it can be processed asynchronously as a target task.

[0040] The real-time processing requirement reflects the urgency of the task for processing. The higher the real-time processing requirement, the sooner the task needs to be processed. Therefore, if the real-time processing requirement of the task to be processed is less than the specified requirement threshold, it means that the processing urgency of the task to be processed is not high, so it can be used as a target task for asynchronous processing.

[0041] In one possible design, the method for obtaining the real-time processing requirement of the task to be processed includes: obtaining associated configuration information related to the real-time processing requirement of the target task; and determining the requirement corresponding to the associated configuration information in a predetermined requirement set.

[0042] Among them, the associated configuration information related to the real-time processing requirement includes but is not limited to the task name, task start time, and task completion time. For example, a task with a specified name can be set to have a high real-time processing requirement. For another example, the earlier the task start time, the more time the task takes and the more it needs to be processed as soon as possible. At this time, a high real-time processing requirement can be set for the task. For another example, the closer the current time is to the task completion time, the higher the urgency of task processing, and a high real-time processing requirement can be set for the task.

[0043] In one possible design, associated configuration information related to the real-time processing requirement of the target task is obtained; characteristic values ​​corresponding to multiple pieces of the associated configuration information are obtained; characteristic values ​​corresponding to the associated configuration information whose weights are greater than a specified weight threshold are amplified according to a predetermined amplification rule; after the amplification, the product of the characteristic values ​​of at least two pieces of the associated configuration information is obtained; a requirement matrix is ​​constructed based on the characteristic values ​​corresponding to the multiple pieces of the associated configuration information and the product; and the real-time processing requirement is determined based on the requirement matrix.

[0044] Among them, the eigenvalues ​​of multiple items of the associated configuration information can be set as a row matrix and a column matrix respectively, the product of the mth element of the row matrix and the nth element of the column matrix is ​​used as the element of the mth column and nth row of the demand matrix, and the rank of the demand matrix is ​​set to the real-time processing demand of the target task.

[0045] Therefore, the real-time processing requirement of the task can be obtained through its actual configuration. The real-time processing requirement can effectively reflect the processing urgency of the task, thereby helping to reasonably select tasks with low processing urgency for asynchronous processing and reduce the pressure on the server.

[0046] Step 104: allocate the target task from the current thread pool to the asynchronous thread pool.

[0047] After the target task is deployed to the asynchronous thread pool, the target task is eligible for asynchronous processing, which reduces the amount of tasks that the current thread pool of the server needs to process, thereby being equivalent to peak shaving of the current high concurrent task volume of the server.

[0048] Step 106: for the target task in the asynchronous thread pool, based on the basic configuration information of the target task, query the interface scheduling configuration information of the target task in the interface scheduling configuration table.

[0049] The basic configuration information of the target task includes, but is not limited to, one or more of the task name, task processing rules, historical processing time, next time, task paging size, and task start time. Each task has corresponding interface configuration information in the interface scheduling configuration table. In other words, the basic configuration information of the task in the interface scheduling configuration table is stored in association with the interface scheduling configuration information. Therefore, the interface scheduling configuration information associated with the basic configuration information of the target task can be queried in the interface scheduling configuration table. Among them, the interface scheduling configuration information of the target task includes, but is not limited to, one or more of the business type, required system, number of redo times, and scheduling configuration parameters.

[0050] Specifically, the basic configuration information of the target task may be sent to a processor indicated in the basic configuration information; an interface scheduling configuration table in the processor may be obtained, and the interface scheduling configuration information matching the basic configuration information may be searched in the interface scheduling configuration table.

[0051] Step 108: Acquire the to-be-processed business data corresponding to the target task in a designated storage location according to the basic configuration information and the interface scheduling configuration information, and asynchronously process the target task based on the to-be-processed business data.

[0052] The designated storage location stores the pending business data of each task. Furthermore, the pending business data associated with the basic configuration information and the interface scheduling configuration information of the target task, that is, the pending business data of the target task, can be queried in the designated storage location. At this point, the target task can be asynchronously processed through the pending business data of the target task.

[0053] Compared with the related art method of balancing the traffic carried by the server through message middleware, the above technical solution cancels the setting of message middleware and directly releases the pressure on the server by transferring part of the server's tasks to the asynchronous thread pool for asynchronous processing. While avoiding the cost increase caused by the addition of message middleware, it reduces the pressure on the server and improves the efficiency of task processing.

[0054] In one possible design, if the asynchronous processing of the target task is successful, a first identifier is set for the to-be-processed business data corresponding to the target task in the designated storage location. The first identifier is used to reflect that the to-be-processed business data has been processed and successfully processed, so that the data with the first identifier can be avoided in subsequent task processing to improve the efficiency of task processing.

[0055] In one possible design, if asynchronous processing of the target task fails, it is determined whether the current number of failures reaches a predetermined maximum number of failures. If the judgment result is yes, a second identifier is set for the pending business data corresponding to the target task in the designated storage location; if the judgment result is no, the step of asynchronously processing the target task is returned.

[0056] That is, if the task processing times reaches the predetermined maximum number of failures and still fails, a second identifier is set for the pending business data corresponding to the target task. It can be seen that the second identifier is used to reflect that the pending business data is data of the task that failed to be processed.

[0057] Furthermore, in response to the to-be-processed business data acquiring the second identifier, the task execution information of the target task is updated, so as to restart the asynchronous processing of the target task based on the updated task execution information.

[0058] In other words, the failed tasks can be compensated. Specifically, the second identifier can be used to identify the pending business data that has failed in asynchronous processing and has no chance to continue asynchronous processing, and the processing opportunity can be increased for the target task to which the pending business data belongs, and the asynchronous processing of the target task can be restarted. In this way, the failed tasks can be restarted to improve the success rate of task processing.

[0059] Figure 2 A schematic diagram of a task scheduling process according to an embodiment of the present application is shown.

[0060] like Figure 2 As shown, first, the business system processes the target tasks that are time-consuming and / or have low real-time requirements through an asynchronous thread pool under high concurrency, and saves the business data of the target tasks into the task scheduling table according to pre-configured classifications and agreed formats.

[0061] On this basis, the data processing scheduling is triggered every minute through the scheduling system. In the data processing scheduling, all valid data in the scheduling task configuration table are scanned. Among them, the data in the scheduling task configuration table includes but is not limited to one or more of the task name, task processing rules, historical processing time, next time, task paging size, and task start time. Next, the next execution time of the target task, the processor and other information are obtained, and the information is passed to the processor. Based on the information, the processor searches the interface scheduling configuration table for the business type, required system, number of redos, scheduling configuration parameters and other contents corresponding to the target task. At this point, the scheduling task configuration table is combined with the information in the interface scheduling configuration table, and the corresponding data is queried in the task scheduling table, that is, the business data corresponding to the target task.

[0062] Next, the target task is processed asynchronously. Specifically, after the processor processes the business data, it updates the task schedule according to the processing result. If the processing is successful, the data is updated to pass, and the data will not be obtained again in the future. If the processing fails, the number of failures of the data is updated and compared to see if the maximum number of failures has been reached. If the upper limit of the number of retries has been reached, the status is updated to the upper limit of retries.

[0063] For failed tasks that have reached the upper limit of retries, compensation scheduling can be performed. Specifically, the business data of the failed task is obtained in the task scheduling table, and then the information corresponding to the failed task in the interface scheduling configuration table is changed, such as the number of redo times, scheduling configuration parameters, etc., to increase the number of retries of the failed task or modify the task execution rules of the failed task, so that the failed task can be asynchronously processed again, thereby improving the success rate of task processing under high concurrency.

[0064] Through the above technical solutions, the server pressure caused by the sharp increase in network traffic is transferred, so that the application system can evenly bear the pressure brought by high concurrent traffic. At the same time, this goal is achieved without accessing a third-party message middleware, reducing dependence on the third-party environment and reducing learning, access and maintenance costs. On this basis, the processing logic can be dynamically configured, and can be quickly and dynamically adjusted according to the production line traffic situation and related business logic. In addition, compensation configuration can be carried out for specific business data in a targeted manner to improve the fine level of control granularity of task processing, especially for task failure processing caused by abnormal situations such as network jitter and short-term unavailability of dependent external systems. It has excellent compensation effect.

[0065] Figure 3 A block diagram of a task scheduling device according to an embodiment of the present application is shown.

[0066] like Figure 3 As shown, according to an embodiment of the present application, a task scheduling device 300 includes: a task acquisition unit 302, which is used to determine a target task that meets the asynchronous processing conditions among the pending tasks of the server in response to the server entering a high-concurrency task state; an asynchronous adjustment unit 304, which allocates the target task from the current thread pool to the asynchronous thread pool; an information acquisition unit 306, which is used to query the interface scheduling configuration information of the target task in the interface scheduling configuration table based on the basic configuration information of the target task for the target task in the asynchronous thread pool; an asynchronous processing unit 308, which is used to obtain the pending business data corresponding to the target task in a specified storage location according to the basic configuration information and the interface scheduling configuration information, and asynchronously process the target task based on the pending business data.

[0067] In one possible design, the task scheduling device 300 also includes: a high concurrency state determination unit, which is used to determine that the server enters the task high concurrency state if the server meets one or more of the following high concurrency conditions, wherein the high concurrency conditions include: the total number of pending tasks of the server is greater than a first quantity threshold; the number of pending tasks newly added by the server within a first specified time interval is greater than a second quantity threshold; the number of pending tasks newly added by the server within multiple consecutive second specified time intervals is greater than a third quantity threshold; the remaining free resources of the server are less than a specified resource threshold; and the remaining free resources of the server are less than the total resources required for the pending tasks newly added by the server within a third specified time interval.

[0068] In one possible design, the task acquisition unit 302 is used to: if the required processing time of the task to be processed is greater than or equal to a specified time threshold, and / or the real-time processing requirement of the task to be processed is less than a specified requirement threshold, determine the task to be processed as the target task.

[0069] In one possible design, the task scheduling device 300 also includes: a demand setting unit, which is used to obtain associated configuration information related to the real-time processing demand of the target task; determine the demand corresponding to the associated configuration information in a predetermined demand set; or obtain the eigenvalues ​​corresponding to multiple pieces of the associated configuration information; according to a predetermined amplification rule, amplify the eigenvalues ​​corresponding to the associated configuration information whose weights are greater than a specified weight threshold; after performing the amplification, obtain the product of the eigenvalues ​​of at least two pieces of the associated configuration information; construct a demand matrix based on the eigenvalues ​​corresponding to multiple pieces of the associated configuration information and the product; based on the demand matrix, determine the real-time processing demand.

[0070] In one possible design, the information acquisition unit 306 is used to: send the basic configuration information of the target task to the processor indicated in the basic configuration information; obtain the interface scheduling configuration table in the processor, and search the interface scheduling configuration information that matches the basic configuration information in the interface scheduling configuration table.

[0071] In one possible design, the task scheduling device 300 also includes: an identification setting unit, which is used to set a first identification for the pending business data corresponding to the target task in the designated storage location if the asynchronous processing of the target task is successful; a judgment unit, which is used to judge whether the current number of failures has reached a predetermined maximum number of failures if the asynchronous processing of the target task fails, and when the judgment result is yes, set a second identification for the pending business data corresponding to the target task in the designated storage location if the judgment result is no; and return to the step of asynchronously processing the target task.

[0072] In one possible design, the task scheduling device 300 also includes: a compensation processing unit, which is used to update the task execution information of the target task in response to the business data to be processed obtaining the second identifier, so as to restart the asynchronous processing of the target task based on the updated task execution information.

[0073] The task scheduling device 300 uses any of the solutions in the above embodiments, and therefore has all the above technical effects, which will not be described in detail here.

[0074] Figure 4 A block diagram of an electronic device according to an embodiment of the present application is shown.

[0075] like Figure 4 As shown, an electronic device 400 of an embodiment of the present application includes at least one memory 402; and a processor 404 in communication with the at least one memory 402; wherein the memory stores instructions executable by the at least one processor 404, and the instructions are configured to execute the scheme described in any of the above embodiments. Therefore, the electronic device 400 has the same technical effects as any of the above embodiments, which will not be described in detail here.

[0076] The electronic devices of the embodiments of the present application exist in various forms, including but not limited to:

[0077] (1) Mobile communication devices: These devices are characterized by their mobile communication functions and their main purpose is to provide voice and data communications. These terminals include: smart phones (such as iPhone), multimedia phones, functional phones, and low-end phones.

[0078] (2) Ultra-mobile personal computer devices: These devices fall into the category of personal computers, have computing and processing capabilities, and generally also have mobile Internet access features. These terminals include: PDA, MID and UMPC devices, such as iPad.

[0079] (3) Portable entertainment devices: These devices can display and play multimedia content. They include audio and video players (such as iPods), handheld game consoles, e-books, as well as smart toys and portable car navigation devices.

[0080] (4) Server: A device that provides computing services. The server consists of a processor, hard disk, memory, system bus, etc. The server is similar to a general computer architecture, but because it needs to provide highly reliable services, it has higher requirements in terms of processing power, stability, reliability, security, scalability, and manageability.

[0081] (5) Other electronic devices with data interaction functions.

[0082] In addition, an embodiment of the present application provides a computer-readable storage medium storing computer-executable instructions, which are used to perform the following steps: in response to a server entering a high-concurrency task state, determining a target task that meets asynchronous processing conditions among the pending tasks of the server; allocating the target task from the current thread pool to the asynchronous thread pool; for the target task in the asynchronous thread pool, based on the basic configuration information of the target task, querying the interface scheduling configuration information of the target task in the interface scheduling configuration table; according to the basic configuration information and the interface scheduling configuration information, obtaining the pending business data corresponding to the target task in a designated storage location, and asynchronously processing the target task based on the pending business data.

[0083] It should be noted that the above functions or steps that can be implemented by the computer-readable storage medium or electronic device can refer to the relevant description in the aforementioned method embodiment. To avoid repetition, they will not be described one by one here.

[0084] The above describes in detail the technical solution of the present application in combination with the accompanying drawings. Through the technical solution of the present application, compared with the method of balancing the traffic carried by the server through the message middleware in the related art, the setting of the message middleware is cancelled, and the pressure on the server is released by directly transferring part of the tasks of the server to the asynchronous thread pool for asynchronous processing. While avoiding the cost increase caused by the addition of message middleware, the pressure on the server is reduced and the efficiency of task processing is improved.

[0085] It should be understood that the term "and / or" used in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship.

[0086] It should be understood that, although the terms first, second, etc. may be used to describe the identifiers in the embodiments of the present application, these identifiers should not be limited to these terms. These terms are only used to distinguish the identifiers from each other. For example, without departing from the scope of the embodiments of the present application, the first identifier may also be referred to as the second identifier, and similarly, the second identifier may also be referred to as the first identifier.

[0087] The word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrases "if it is determined" or "if (stated condition or event) is detected" may be interpreted as "when it is determined" or "in response to determining" or "when detecting (stated condition or event)" or "in response to detecting (stated condition or event)", depending on the context.

[0088] The terms used in the embodiments of the present application are only for the purpose of describing specific embodiments, and are not intended to limit the present application. The singular forms "a", "said" and "the" used in the embodiments of the present application and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings.

[0089] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0090] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of hardware plus software functional units.

[0091] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).

[0092] The embodiments described above are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such 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, and should all be included in the protection scope of the present invention.

Claims

1. A task scheduling method, characterized in that: include: In response to the server entering a high task concurrency state, determining a target task that meets an asynchronous processing condition from the tasks to be processed of the server; Allocate the target task from the current thread pool to the asynchronous thread pool; For the target task in the asynchronous thread pool, based on the basic configuration information of the target task, query the interface scheduling configuration information of the target task in the interface scheduling configuration table; According to the basic configuration information and the interface scheduling configuration information, the to-be-processed business data corresponding to the target task is acquired in a designated storage location, and the target task is asynchronously processed based on the to-be-processed business data.

2. The task scheduling method according to claim 1, characterized in that: Before the step of determining the target task that meets the asynchronous processing condition among the tasks to be processed of the server, the method further includes: If the server meets one or more of the following high concurrency conditions, it is determined that the server enters the task high concurrency state, wherein the high concurrency conditions include: The total number of tasks to be processed by the server is greater than a first number threshold; The number of tasks to be processed newly added by the server within the first specified time interval is greater than a second number threshold; The number of tasks to be processed newly added by the server within a plurality of consecutive second specified time intervals is greater than a third number threshold; The remaining idle resources of the server are less than a specified resource threshold; and The remaining idle resources of the server are less than the total resources required by the tasks to be processed newly added to the server within the third specified time interval.

3. The task scheduling method according to claim 1, characterized in that: The step of determining a target task that satisfies an asynchronous processing condition from among the tasks to be processed by the server includes: If the required processing time of the task to be processed is greater than or equal to a specified time threshold, and / or the real-time processing requirement of the task to be processed is less than a specified requirement threshold, the task to be processed is determined as the target task.

4. The task scheduling method according to claim 3, characterized in that: Methods for obtaining the real-time processing requirement of the task to be processed include: Acquire the associated configuration information related to the real-time processing requirement of the target task; Determining the demand degree corresponding to the associated configuration information in a predetermined demand degree set; or Obtaining characteristic values ​​corresponding to each of the plurality of associated configuration information; According to a predetermined amplification rule, amplify the feature value corresponding to the associated configuration information whose weight is greater than a specified weight threshold; After performing the amplification process, obtaining the product of the characteristic values ​​of at least two items of associated configuration information; Constructing a demand matrix based on the eigenvalues ​​corresponding to the plurality of associated configuration information and the product; Based on the demand matrix, the real-time processing demand is determined.

5. The task scheduling method according to any one of claims 1 to 4, characterized in that: The querying of the interface scheduling configuration information of the target task in the interface scheduling configuration table based on the basic configuration information of the target task includes: Sending the basic configuration information of the target task to the processor indicated in the basic configuration information; An interface scheduling configuration table in the processor is obtained, and the interface scheduling configuration information matching the basic configuration information is searched in the interface scheduling configuration table.

6. The task scheduling method according to claim 5, characterized in that: Also includes: If the asynchronous processing of the target task is successful, a first identifier is set for the to-be-processed business data corresponding to the target task at the designated storage location; If the asynchronous processing of the target task fails, it is determined whether the current number of failures reaches the predetermined maximum number of failures. When the judgment result is yes, a second identifier is set for the to-be-processed business data corresponding to the target task in the designated storage location; When the judgment result is no, return to the step of asynchronously processing the target task.

7. The task scheduling method according to claim 6, characterized in that: Also includes: In response to the to-be-processed business data acquiring the second identifier, the task execution information of the target task is updated so as to restart the asynchronous processing of the target task based on the updated task execution information.

8. A task scheduling device, characterized in that: include: A task acquisition unit, configured to determine, in response to the server entering a high-concurrency task state, a target task that satisfies an asynchronous processing condition from the tasks to be processed of the server; An asynchronous adjustment unit allocates the target task from the current thread pool to the asynchronous thread pool; An information acquisition unit, configured to query the interface scheduling configuration information of the target task in the asynchronous thread pool based on the basic configuration information of the target task in the interface scheduling configuration table; The asynchronous processing unit is used to obtain the to-be-processed business data corresponding to the target task in a designated storage location according to the basic configuration information and the interface scheduling configuration information, and asynchronously process the target task based on the to-be-processed business data.

9. An electronic device, characterized in that: include: at least one processor; and, a memory communicatively coupled to the at least one processor; The memory stores instructions executable by the at least one processor, wherein the instructions are configured to execute the method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: Computer executable instructions are stored, and the computer executable instructions are used to execute the method according to any one of claims 1 to 7.