Integrated task execution management methods, devices, storage media, and systems
Patent Information
- Application Number
- CN202310689537.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-12
- Publication Date
- 2026-09-01
- Estimated Expiration
- 2043-06-12
AI Technical Summary
[0004]但是,现有技术仍存在如下缺陷:借助内核提供的SpinLock或Mutex实现的锁不适用于分布式环境,无法控制多个机器节点并发操作;而当前分布式锁方案不仅不能适用于现场控制并发数的需求、无法均匀地将任务分配到每个节点上执行,还存在配置流程复杂、监控分析困难的问题
[0025] This invention provides an integrated task execution management method, apparatus, computer-readable storage medium, and system. By defining global or local locks for different task types, and upon receiving an integrated task to be executed, only the server's task that has acquired the maximum number of task locks is executed at any given time. This execution management method, apparatus, computer-readable storage medium, and system improve the efficiency and stability of computing resource utilization.
Smart Images

Figure CN116841734B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of public cloud integrated task execution management technology, and in particular to an integrated task execution management method, apparatus, computer-readable storage medium and system. Background Technology
[0002] Public cloud refers to cloud services provided by third-party providers to users via the public Internet. Users can access the cloud and enjoy various services, including but not limited to computing, storage, and networking. Users residing in a public cloud environment are called tenants, and data and services between tenants are generally isolated. An application service can run multiple instances (nodes), each providing the same service through load balancing. Large customers have various integration tasks, the execution of which requires thread resources. When a certain type of task is numerous and blocking occurs during execution, the available threads in the system thread pool can easily be exhausted, causing other tasks to be in a waiting state, even higher-priority tasks may not be executed for a long time.
[0003] In existing technologies, in a single-machine environment, in order to achieve atomicity in the operation of shared resources by multiple processes or threads, the SpinLock or Mutex mechanism provided by the kernel can be used to ensure that only one process or thread operates on the shared resource. In a distributed environment, distributed locks can be used to control the concurrent operation of nodes on multiple machines, ensuring that only one type of task is being executed at any given time, thus preventing data or state from being corrupted.
[0004] However, existing technologies still have the following drawbacks: locks implemented using SpinLock or Mutex provided by the kernel are not suitable for distributed environments and cannot control concurrent operations of multiple machine nodes; while current distributed lock solutions not only cannot meet the needs of controlling the number of concurrent operations on-site and cannot evenly distribute tasks to each node for execution, but also have problems such as complex configuration processes and difficulties in monitoring and analysis.
[0005] Therefore, there is a need for an integrated task execution management method, apparatus, computer-readable storage medium, and system to overcome the aforementioned deficiencies in the prior art. Summary of the Invention
[0006] This invention provides an integrated task execution management method, apparatus, computer-readable storage medium, and system to improve the efficiency of computing resource utilization.
[0007] An embodiment of the present invention provides an integrated task execution management method. The execution management method includes: obtaining configuration information sent by a user; defining and initializing task locks corresponding to different task types according to the configuration information; obtaining lock information corresponding to the task locks; the lock information includes task type, lock type, server IP address, and maximum number of threads; the lock type includes local locks and global locks; when receiving an integrated task to be executed, obtaining the lock information of a first task lock corresponding to the task to be executed and the task priority of the task to be executed; and assigning the task to be executed to a first server IP address corresponding to the first task lock, so that the first server performs execution management of the task to be executed according to a preset competitive execution method, the task priority of the task to be executed, and the maximum number of threads of the first task lock; the integrated task to be executed includes one or more tasks to be executed.
[0008] As an improvement to the above scheme, defining and initializing task locks corresponding to different task types based on the configuration information specifically includes: defining task locks corresponding to each task type to be configured based on the configuration information; the configuration information includes the user's expected lock type, the corresponding task type to be configured, and the expected maximum number of threads; the user's expected lock type includes local locks and global locks; traversing the second task locks whose user's expected lock type is a local lock, initializing the maximum number of threads of the second task lock on the current container node to the expected maximum number of threads, and allocating a corresponding second server IP address to the second task lock based on the expected maximum number of threads; traversing the third task locks whose user's expected lock type is a global lock to obtain the total number of nodes and the number of active nodes of the third task lock, initializing the third task lock based on the expected maximum number of threads, the total number of nodes, and the number of active nodes, and allocating a corresponding third server IP address to the third task lock based on the expected maximum number of threads.
[0009] As an improvement to the above scheme, the first server performs execution management of the tasks to be executed according to a preset competition execution method, the task priority of the tasks to be executed, and the maximum number of threads of the first task lock. Specifically, this includes: the first server competing for the first task lock, and obtaining the first task from the list of tasks to be executed when the competition is successful; the list of tasks to be executed includes at least the tasks to be executed; according to the task priority of the first task, the first tasks are sorted from high to low priority to obtain a task execution sequence, and the first number of first tasks in the task execution sequence are executed sequentially, and the corresponding task is deleted from the list of tasks to be executed after the first task is executed; the preset number is the maximum number of threads; the above steps are repeated.
[0010] As an improvement to the above scheme, the first server competes for the first task lock, specifically including: obtaining the first lock information of the first task lock and determining whether the first lock type of the first task lock is a global lock; the first lock information includes the first lock type and the first maximum number of threads; when the first lock type is a global lock, traversing the instance list of the first task lock to obtain the number of lock instances occupied by the first server, and determining whether lock competition or lock release should be performed based on the number of lock instances and the first maximum number of threads; if lock competition should be performed, attempting to acquire the first task lock using the first lock information, determining whether the competition is successful based on the acquisition result, and if the competition is successful, changing the server occupying the first task lock to the first server and updating the lock occupation information of the first server; if the competition fails, repeating this step.
[0011] As an improvement to the above scheme, after determining whether lock contention or lock release should be performed based on the number of lock instances and the first maximum number of threads, the execution management method further includes: if lock release should be performed, then the first task lock is released.
[0012] As an improvement to the above solution, the execution management method further includes: when receiving an export instruction sent by a user, exporting the integration scheme or process corresponding to the task to be migrated to a first resource file, exporting the first task lock to be migrated corresponding to the task to be migrated to the first resource file, and using topological sorting to export the resources on which the integration scheme or process depends to the first resource file; the export instruction includes the task to be migrated; when receiving an environment migration instruction sent by a user, obtaining a second task lock to be migrated from the environment migration instruction, reconfiguring the second task lock to be migrated according to the migration environment information, and importing the second resource file into the migration environment; the environment migration instruction includes the migration environment, migration environment information, and the second resource file, the second resource file including the second task lock to be migrated.
[0013] As an improvement to the above scheme, the execution management method further includes: traversing the server instance table to obtain the latest update time of the current server; determining whether the current server is abnormal based on the latest update time and a preset abnormal threshold; when the current server is determined to be abnormal, releasing the lock instance occupied by the current server and re-initializing lock loading; and broadcasting a notification to all servers except the current server to re-initialize lock loading.
[0014] Another embodiment of the present invention provides an integrated task execution management device, which includes a lock configuration unit and an execution management unit. The lock configuration unit is used to acquire configuration information sent by a user, define and initialize task locks corresponding to different task types based on the configuration information, and obtain lock information corresponding to the task locks. The lock information includes task type, lock type, server IP address, and maximum number of threads. The lock type includes local locks and global locks. The execution management unit is used to, when receiving an integrated task to be executed, acquire the lock information of a first task lock corresponding to the task to be executed and the task priority of the task to be executed, and assign the task to the first server IP address corresponding to the first task lock, so that the first server performs execution management of the task to be executed according to a preset competitive execution method, the task priority of the task to be executed, and the maximum number of threads of the first task lock. The integrated task to be executed includes one or more tasks to be executed.
[0015] As an improvement to the above scheme, the lock configuration unit is used to: define task locks corresponding to each type of task to be configured according to the configuration information; the configuration information includes the user's expected lock type, the corresponding type of task to be configured, and the expected maximum number of threads; the user's expected lock type includes local locks and global locks; traverse the second task locks whose user's expected lock type is a local lock, initialize the maximum number of threads of the second task lock in the current container node to the expected maximum number of threads, and allocate a corresponding second server IP address to the second task lock according to the expected maximum number of threads; traverse the third task locks whose user's expected lock type is a global lock to obtain the total number of nodes and the number of active nodes of the third task lock, initialize the third task lock according to the expected maximum number of threads, the total number of nodes, and the number of active nodes, and allocate a corresponding third server IP address to the third task lock according to the expected maximum number of threads.
[0016] As an improvement to the above scheme, the execution management unit is further configured to: a first server compete for a first task lock, and obtain a first task from the list to be executed when the competition is successful; the list to be executed includes at least the tasks to be managed; according to the task priority of the first task, sort the first tasks from high to low priority to obtain a task execution sequence, execute the first task in the task execution sequence in sequence with the first preset number of tasks, and delete the corresponding task from the list to be executed after the first task is executed; the preset number is the maximum number of threads; repeat the above steps.
[0017] As an improvement to the above scheme, the execution management unit is further configured to: obtain the first lock information of the first task lock and determine whether the first lock type of the first task lock is a global lock; the first lock information includes the first lock type and the first maximum number of threads; when the first lock type is a global lock, traverse the instance list of the first task lock to obtain the number of lock instances occupied by the first server, and determine whether lock contention or lock release should be performed based on the number of lock instances and the first maximum number of threads; if lock contention should be performed, attempt to obtain the first task lock using the first lock information, determine whether the contention is successful based on the acquisition result, and if the contention is successful, change the occupying server of the first task lock to the first server and update the lock occupation information of the first server; if the contention fails, repeat this step.
[0018] As an improvement to the above scheme, the execution management unit is further configured to: release the first task lock if lock release is currently required.
[0019] As an improvement to the above solution, the execution management device further includes an export migration unit, which is used to: when receiving an export instruction sent by a user, export the integration scheme or process corresponding to the task to be migrated to a first resource file, export the first task lock to be migrated corresponding to the task to be migrated to the first resource file, and use topological sorting to export the resources on which the integration scheme or the process depends to the first resource file; the export instruction includes the task to be migrated; when receiving an environment migration instruction sent by a user, obtain a second task lock to be migrated from the environment migration instruction, reconfigure the second task lock to be migrated according to the migration environment information, and import the second resource file into the migration environment; the environment migration instruction includes the migration environment, migration environment information, and the second resource file, the second resource file including the second task lock to be migrated.
[0020] As an improvement to the above solution, the execution management device further includes an exception tolerance unit, which is used to: traverse the server instance table to obtain the latest update time of the current server; determine whether the current server is abnormal based on the latest update time and a preset exception threshold; when the current server is determined to be abnormal, release the lock instance occupied by the current server and reinitialize the lock loading; and broadcast a notification to all servers except the current server to reinitialize the lock loading.
[0021] Another embodiment of the present invention provides a computer-readable storage medium including a stored computer program, wherein, when the computer program is executed, it controls the device where the computer-readable storage medium is located to perform the integrated task execution management method as described above.
[0022] One embodiment of the present invention provides a computer program product that, when run on a computer, causes the computer to execute the integrated task execution management method described above.
[0023] Another embodiment of the present invention provides an integrated task execution management system, the execution management system including a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein the processor executes the computer program to implement the integrated task execution management method as described above.
[0024] Compared with existing technologies, this technical solution has the following beneficial effects:
[0025] This invention provides an integrated task execution management method, apparatus, computer-readable storage medium, and system. By defining global or local locks for different task types, and upon receiving an integrated task to be executed, only the server's task that has acquired the maximum number of task locks is executed at any given time. This execution management method, apparatus, computer-readable storage medium, and system improve the efficiency and stability of computing resource utilization.
[0026] Furthermore, the integrated task execution management method, apparatus, computer-readable storage medium, and system provided by the present invention also support configuration export and import, thereby enabling rapid deployment from the environment to be migrated to the migration environment, thus improving the efficiency and convenience of setting up the execution management environment. Attached Figure Description
[0027] Figure 1 This is a flowchart illustrating an integrated task execution management method according to an embodiment of the present invention;
[0028] Figure 2 This is a logical flowchart of a task redistribution process provided in an embodiment of the present invention;
[0029] Figure 3 This is a schematic diagram of an integrated task execution management device provided in an embodiment of the present invention. Detailed Implementation
[0030] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention. Specific Implementation Example 1
[0032] The present invention first describes an integrated task execution management method. Figure 1 This is a flowchart illustrating an integrated task execution management method according to an embodiment of the present invention.
[0033] like Figure 1 As shown, the execution management method includes:
[0034] S1: Obtain the configuration information sent by the user, define and initialize task locks corresponding to different task types according to the configuration information, and obtain the lock information corresponding to the task locks.
[0035] The lock information includes task type, lock type, server IP address, and maximum number of threads; the lock type includes local locks and global locks. Local locks apply to all container nodes, controlling the maximum concurrency of this type of task on each node. Global locks apply to all container nodes, controlling the maximum concurrency of this type of task across all nodes. After successfully saving the task locks, the lock entries are initialized according to the configured number of threads, and an execution server IP is randomly assigned to each lock.
[0036] In this technical solution, a custom global lock can restrict a task to be executed only in a single thread within a single container process; a custom local lock can make full use of the resources of each container without occupying all the task threads of each container, and can control the maximum number of execution threads for this type of task in each container.
[0037] In one embodiment, defining and initializing task locks corresponding to different task types based on the configuration information specifically includes: defining task locks corresponding to each task type to be configured based on the configuration information; the configuration information includes the user's expected lock type, the corresponding task type to be configured, and the expected maximum number of threads; the user's expected lock type includes local locks and global locks; traversing the second task locks whose user's expected lock type is a local lock, initializing the maximum number of threads of the second task lock on the current container node to the expected maximum number of threads, and allocating a corresponding second server IP address to the second task lock based on the expected maximum number of threads; traversing the third task locks whose user's expected lock type is a global lock to obtain the total number of nodes and the number of active nodes of the third task lock, initializing the third task lock based on the expected maximum number of threads, the total number of nodes, and the number of active nodes, and allocating a corresponding third server IP address to the third task lock based on the expected maximum number of threads.
[0038] S2: When a management integration task to be executed is received, the lock information of the first task lock corresponding to the management task to be executed and the task priority of the management task to be executed are obtained, and the management task to be executed is assigned to the first server IP address corresponding to the first task lock, so that the first server performs execution management of the management task to be executed according to the preset competition execution method, the task priority of the management task to be executed and the maximum number of threads of the first task lock; the management integration task to be executed includes one or more management tasks to be executed.
[0039] In practical applications, after an integrated process with a background task lock is configured generates a task, only the task that wins the task lock can be executed, while the other tasks are queued.
[0040] In one embodiment, the first server performs execution management of the tasks to be executed according to a preset competition execution method, the task priority of the tasks to be executed, and the maximum number of threads for the first task lock. Specifically, this includes: the first server competing for the first task lock and obtaining a first task from the list of tasks to be executed when the competition is successful; the list of tasks to be executed includes at least the tasks to be executed; sorting the first tasks from high to low priority according to their task priority to obtain a task execution sequence, executing the first preset number of tasks in the task execution sequence in sequence, and deleting the corresponding task from the list of tasks to be executed after the first task is executed; the preset number is the maximum number of threads; and repeating the above steps.
[0041] In one embodiment, the first server competing for the first task lock specifically includes: obtaining the first lock information of the first task lock and determining whether the first lock type of the first task lock is a global lock; when the first lock type is a global lock, traversing the instance list of the first task lock to obtain the number of lock instances occupied by the first server, and determining whether lock competition or lock release should be performed based on the number of lock instances and the first maximum number of threads; if lock competition should be performed, attempting to obtain the first task lock using the first lock information, determining whether the competition is successful based on the acquisition result, and if the competition is successful, changing the server occupying the first task lock to the first server and updating the lock occupation information of the first server; if the competition fails, repeating this step.
[0042] The first lock information includes a first lock type and a first maximum number of threads. The calculation process for the first maximum number of threads is as follows: obtain the total number of global lock nodes and the number of active nodes, and take the integer value closest to the total number of nodes divided by the number of active nodes as the first maximum number of threads.
[0043] In one embodiment, determining whether to engage in lock contention or lock release based on the number of lock instances and the first maximum number of threads specifically includes: when the number of lock instances reaches the first maximum number of threads, lock release should be performed; when the number of lock instances does not reach the first maximum number of threads, lock contention should be performed.
[0044] During lock contention, an attempt is made to acquire the distributed lock (i.e., the corresponding task lock) using the lock information. If the acquisition is successful, the contention is successful, and the server holding the lock should be changed to the current server, and the lock holding status of the current server node should be updated. If the acquisition fails, the contention is unsuccessful, indicating that the lock may have been held by another server. The contention is then terminated, and the next piece of data is iterated to compete again.
[0045] In one embodiment, after determining whether lock contention or lock release should occur based on the number of lock instances and the first maximum number of threads, the execution management method further includes: if lock release should occur, releasing the first task lock and repeating the aforementioned traversal and determination process. The traversal and determination process involves: traversing the instance list of the first task lock to obtain the number of lock instances occupied by the first server, and determining whether lock contention or lock release should occur based on the number of lock instances and the first maximum number of threads.
[0046] In practical applications, there may be a need to migrate existing integration schemes or processes to a new environment. In order to achieve the same effect of improving computing resource utilization efficiency and stability in the new environment in a convenient and efficient manner, topological sorting is used to export the dependent resources to the resource file when exporting the integration scheme or process. When importing into the new environment (described as the "migration environment" in this article), the global lock associated with the task is also imported into the environment. At the same time, the execution server that allocates the lock is reinitialized according to the server cluster of the new environment.
[0047] In one embodiment, the execution management method further includes: when receiving an export instruction sent by a user, exporting the integration scheme or process corresponding to the task to be migrated to a first resource file, exporting the first task lock to be migrated corresponding to the task to be migrated to the first resource file, and using topological sorting to export the resources on which the integration scheme or process depends to the first resource file; the export instruction includes the task to be migrated; when receiving an environment migration instruction sent by a user, obtaining a second task lock to be migrated from the environment migration instruction, reconfiguring the second task lock to be migrated according to the migration environment information, and importing the second resource file into the migration environment; the environment migration instruction includes the migration environment, migration environment information, and the second resource file, the second resource file including the second task lock to be migrated. In one embodiment, the first resource file and the second resource file refer to the same file.
[0048] In practical applications, in order to improve the fault tolerance of execution management and enable the task ownership of the container node to be redistributed to other nodes when a single point of failure occurs, a scheduled monitoring task needs to be executed at a preset time interval (e.g., 20 minutes). When an abnormality is detected in the container, the task of the faulty node is redistributed. Figure 2 This is a logical flowchart of the task redistribution process provided in an embodiment of the present invention, as follows: 1) Traverse the server instance table. For example, if the server's update time is 40 minutes ago, it is considered that the server has been abnormally shut down; 2) Release the lock instance occupied by the offline server; 3) The current server reinitializes the lock loading; 4) Use the MQ broadcast mechanism to broadcast to notify other servers to reinitialize the lock loading.
[0049] In one embodiment, the execution management method further includes: traversing the server instance table to obtain the latest update time of the current server; determining whether the current server is abnormal based on the latest update time and a preset abnormal threshold; when the current server is determined to be abnormal, releasing the lock instance occupied by the current server and re-initializing lock loading; and broadcasting a notification to all servers except the current server to re-initialize lock loading.
[0050] Through the above process, this solution achieves the following compared to existing technologies: 1) It can fully and flexibly utilize the resources of each container node in the cluster; 2) It can control both the global maximum concurrency and the maximum concurrency of each node; 3) The defined task locks can be reused to integrate related tasks; 4) The task locks support visual configuration and can be quickly migrated to the production environment through export and import.
[0051] This invention describes an integrated task execution management method and system. By defining global or local locks for different task types, and upon receiving an integrated task to be executed, only the server's task that has acquired the maximum number of task locks is executed at any given time. This execution management method, device, computer-readable storage medium, and system improve the efficiency and stability of computing resource utilization. Furthermore, the integrated task execution management method described in this invention also supports configuration export and import, enabling rapid deployment from the environment to be migrated to the migration environment, thereby improving the efficiency and convenience of setting up the execution management environment. Specific Implementation Example 2
[0053] In addition to the methods described above, embodiments of the present invention also disclose an integrated task execution management device. Figure 3 This is a schematic diagram of an integrated task execution management device provided in an embodiment of the present invention.
[0054] like Figure 3As shown, the execution management device includes a lock configuration unit and an execution management unit. The lock configuration unit is used to obtain configuration information sent by the user, define and initialize task locks corresponding to different task types based on the configuration information, and obtain lock information corresponding to the task locks. The lock information includes task type, lock type, server IP address, and maximum number of threads. The lock type includes local locks and global locks. The execution management unit is used to, when receiving a management integration task to be executed, obtain the lock information of the first task lock corresponding to the management task to be executed and the task priority of the management task to be executed, and assign the management task to the first server IP address corresponding to the first task lock, so that the first server performs execution management of the management task to be executed according to a preset competitive execution method, the task priority of the management task to be executed, and the maximum number of threads of the first task lock. The management integration task to be executed includes one or more management tasks to be executed.
[0055] In one embodiment, the lock configuration unit is configured to: define task locks corresponding to each type of task to be configured according to the configuration information; the configuration information includes the user-expected lock type, the corresponding type of task to be configured, and the expected maximum number of threads; the user-expected lock type includes local locks and global locks; traverse the second task locks whose user-expected lock type is a local lock, initialize the maximum number of threads of the second task lock on the current container node to the expected maximum number of threads, and allocate a corresponding second server IP address to the second task lock according to the expected maximum number of threads; traverse the third task locks whose user-expected lock type is a global lock to obtain the total number of nodes and the number of active nodes of the third task lock, initialize the third task lock according to the expected maximum number of threads, the total number of nodes, and the number of active nodes, and allocate a corresponding third server IP address to the third task lock according to the expected maximum number of threads.
[0056] In one embodiment, the execution management unit is further configured to: a first server compete for a first task lock, and upon successful competition, obtain a first task from a list of tasks to be executed; the list of tasks to be executed includes at least the tasks to be managed; based on the task priority of the first task, sort the first tasks from high to low priority to obtain a task execution sequence, sequentially execute the first task at the top of the task execution sequence a predetermined number of times, and delete the corresponding task from the list of tasks to be executed after the first task is executed; the predetermined number is the maximum number of threads; and repeat the above steps.
[0057] In one embodiment, the execution management unit is further configured to: obtain the first lock information of the first task lock and determine whether the first lock type of the first task lock is a global lock; the first lock information includes the first lock type and the first maximum number of threads; when the first lock type is a global lock, traverse the instance list of the first task lock to obtain the number of lock instances occupied by the first server, and determine whether lock contention or lock release should be performed based on the number of lock instances and the first maximum number of threads; if lock contention should be performed, attempt to obtain the first task lock using the first lock information, determine whether the contention is successful based on the result, and if the contention is successful, change the server occupying the first task lock to the first server and update the lock occupation information of the first server; if the contention fails, repeat this step.
[0058] In one embodiment, the execution management unit is further configured to: release the first task lock if lock release is currently appropriate.
[0059] In one embodiment, the execution management device further includes an export migration unit, which is configured to: when receiving an export instruction sent by a user, export the integration scheme or process corresponding to the task to be migrated to a first resource file, export the first task lock corresponding to the task to be migrated to the first resource file, and use topological sorting to export the resources on which the integration scheme or process depends to the first resource file; the export instruction includes the task to be migrated; when receiving an environment migration instruction sent by a user, obtain a second task lock to be migrated from the environment migration instruction, reconfigure the second task lock to be migrated according to the migration environment information, and import the second resource file into the migration environment; the environment migration instruction includes the migration environment, migration environment information, and the second resource file, the second resource file including the second task lock to be migrated.
[0060] In one embodiment, the execution management device further includes an exception tolerance unit, which is configured to: traverse the server instance table to obtain the latest update time of the current server; determine whether the current server is abnormal based on the latest update time and a preset exception threshold; when the current server is determined to be abnormal, release the lock instance occupied by the current server and reinitialize the lock loading; and broadcast a notification to all servers other than the current server to reinitialize the lock loading.
[0061] If the unit integrated into the execution management device is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments of the present invention can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. Another embodiment of the present invention provides a computer-readable storage medium including a stored computer program, wherein, when the computer program is executed, it controls the device where the computer-readable storage medium is located to execute the integrated task execution management method as described above.
[0062] The computer program includes computer program code, which can be in the form of source code, object code, executable file, or some intermediate form. The computer-readable medium can include any entity or device capable of carrying the computer program code, recording media, USB flash drive, portable hard drive, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc. It should be noted that the content included in the computer-readable medium can be appropriately added or removed according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electrical carrier signals and telecommunication signals.
[0063] An embodiment of the present invention provides a computer program product that, when run on a computer, causes the computer to execute the integrated task execution management method described above, and can achieve all the technical effects corresponding to the aforementioned method.
[0064] It should be noted that the device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Furthermore, in the accompanying drawings of the device embodiments provided by this invention, the connection relationships between units indicate that they have communication connections, which can be specifically implemented as one or more communication buses or signal lines. Those skilled in the art can understand and implement this without any creative effort.
[0065] This invention describes an integrated task execution management device and computer-readable storage medium. By defining global or local locks for different task types, and upon receiving an integrated task to be executed, only the server tasks that have acquired the maximum number of task locks are executed at any given time. This execution management device and computer-readable storage medium improve the efficiency and stability of computing resource utilization. Furthermore, this invention also supports configuration export and import, enabling rapid deployment from the environment to be migrated to the migration environment, thereby improving the efficiency and convenience of setting up the execution management environment. Specific Implementation Example 3
[0067] In addition to the methods and apparatus described above, embodiments of the present invention also describe an integrated task execution management system.
[0068] The execution management system includes a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor. When the processor executes the computer program, it implements the integrated task execution management method as described above.
[0069] The processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor can be a microprocessor or any conventional processor. The processor is the control center of the device, connecting various parts of the device via various interfaces and lines.
[0070] The memory can be used to store the computer programs and / or modules. The processor implements various functions of the device by running or executing the computer programs and / or modules stored in the memory and by calling data stored in the memory. The memory may mainly include a program storage area and a data storage area. The program storage area may store the operating system, at least one application program required for a function (such as sound playback function, image playback function, etc.), etc.; the data storage area may store data created according to the use of the mobile phone (such as audio data, phonebook, etc.). In addition, the memory may include high-speed random access memory, and may also include non-volatile memory, such as hard disk, memory, plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, at least one disk storage device, flash memory device, or other volatile solid-state storage device.
[0071] This invention describes an integrated task execution management system. By defining global or local locks for different task types, and upon receiving an integrated task to be executed, only the server's task that has acquired the maximum number of task locks is executed at any given time. This execution management method, device, computer-readable storage medium, and system improve the efficiency and stability of computing resource utilization. Furthermore, the integrated task execution management system described in this invention also supports configuration export and import, enabling rapid deployment from the environment to be migrated to the migration environment, thereby improving the efficiency and convenience of setting up the execution management environment.
[0072] The above description represents the preferred embodiments of the present invention. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principles of the present invention, and these improvements and modifications are also considered to be within the scope of protection of the present invention.
Claims
1. An integrated task execution management method, characterized in that, The execution management method includes: Obtain configuration information sent by the user, define and initialize task locks corresponding to different task types based on the configuration information, and obtain lock information corresponding to the task locks: the lock information includes task type, lock type, server IP address, and maximum number of threads; the lock type includes local lock and global lock; When a management integration task to be executed is received, the lock information of the first task lock corresponding to the management task to be executed and the task priority of the management task to be executed are obtained. The management task to be executed is then assigned to the first server IP address corresponding to the first task lock, so that the first server performs execution management of the management task to be executed according to the preset competition execution method, the task priority of the management task to be executed and the maximum number of threads of the first task lock. The management integration task to be executed includes one or more management tasks to be executed. The step of defining and initializing task locks corresponding to different task types based on the configuration information specifically includes: Based on the configuration information, task locks corresponding to each type of task to be configured are defined; the configuration information includes the user's desired lock type, the corresponding type of task to be configured, and the expected maximum number of threads; the user's desired lock type includes local locks and global locks. Iterate through the second task locks whose lock type is local lock as expected by the user, initialize the maximum number of threads of the second task lock in the current container node to the expected maximum number of threads, and allocate the corresponding second server IP address to the second task lock according to the expected maximum number of threads; Iterate through the third task locks whose lock type is global lock to obtain the total number of nodes and the number of active nodes of the third task lock. Based on the expected maximum number of threads, the total number of nodes and the number of active nodes, initialize the third task lock and allocate a corresponding third server IP address to the third task lock based on the expected maximum number of threads.
2. The integrated task execution management method according to claim 1, characterized in that, The first server manages the execution of tasks based on a preset competitive execution method, the task priority of the tasks to be executed, and the maximum number of threads for the first task lock. Specifically, this includes: The first server competes for the first task lock and, upon successful competition, retrieves the first task from the list of tasks to be executed; the list of tasks to be executed includes at least the management tasks to be executed. Based on the task priority of the first task, the first tasks are sorted from high to low priority to obtain a task execution sequence. The first number of first tasks in the task execution sequence are executed sequentially, and the first task is removed from the list to be executed after the first task is completed. The preset number is the maximum number of threads. Repeat the steps above.
3. The integrated task execution management method according to claim 2, characterized in that, The first server competes for the first task lock, specifically including: Obtain the first lock information of the first task lock, and determine whether the first lock type of the first task lock is a global lock; the first lock information includes the first lock type and the first maximum number of threads; When the first lock type is a global lock, the instance list of the first task lock is traversed to obtain the number of lock instances occupied by the first server. Based on the number of lock instances and the first maximum number of threads, it is determined whether lock contention or lock release should be performed. If lock contention is required at present, attempt to acquire the first task lock using the first lock information. Determine whether the contention is successful based on the acquisition result. If the contention is successful, change the server holding the first task lock to the first server and update the lock holding information of the first server. If the contention fails, repeat this step.
4. The integrated task execution management method according to claim 3, characterized in that, After determining whether to engage in lock contention or lock release based on the number of lock instances and the first maximum number of threads, the execution management method further includes: If the lock should be released now, then release the first task lock.
5. The integrated task execution management method according to claim 1, characterized in that, The execution management method also includes: When an export command is received from a user, the integration scheme or process corresponding to the task to be migrated is exported to the first resource file, the first task lock corresponding to the task to be migrated is exported to the first resource file, and the resources on which the integration scheme or process depends are exported to the first resource file using topological sorting; the export command includes the task to be migrated. When an environment migration command sent by a user is received, a second task lock to be migrated is obtained from the environment migration command, the second task lock to be migrated is reconfigured according to the migration environment information, and a second resource file is imported into the migration environment; the environment migration command includes the migration environment, migration environment information, and a second resource file, the second resource file including the second task lock to be migrated.
6. The integrated task execution management method according to any one of claims 1-5, characterized in that, The execution management method also includes: Iterate through the server instance table to get the latest update time of the current server; Based on the most recent update time and the preset abnormal threshold, determine whether the current server is abnormal. When the current server is determined to be abnormal, release the lock instance occupied by the current server and reinitialize the lock loading. The broadcast notifies all servers other than the current server to reinitialize lock loading.
7. An integrated task execution management device, characterized in that, The execution management device includes a lock configuration unit and an execution management unit, wherein... The lock configuration unit is used to obtain configuration information sent by the user, define and initialize task locks corresponding to different task types according to the configuration information, and obtain lock information corresponding to the task lock: the lock information includes task type, lock type, server IP address and maximum number of threads; the lock type includes local lock and global lock; The execution management unit is used to, when receiving a management integration task to be executed, obtain the lock information of the first task lock corresponding to the management task to be executed and the task priority of the management task to be executed, and assign the management task to the first server IP address corresponding to the first task lock, so that the first server performs execution management of the management task to be executed according to the preset competition execution method, the task priority of the management task to be executed and the maximum number of threads of the first task lock; the management integration task to be executed includes one or more management tasks to be executed. The lock configuration unit is used to: define task locks corresponding to each type of task to be configured according to the configuration information; the configuration information includes the user's expected lock type, the corresponding type of task to be configured, and the expected maximum number of threads; the user's expected lock type includes local locks and global locks; traverse the second task locks whose user's expected lock type is a local lock, initialize the maximum number of threads of the second task lock in the current container node to the expected maximum number of threads, and allocate a corresponding second server IP address to the second task lock according to the expected maximum number of threads; traverse the third task locks whose user's expected lock type is a global lock to obtain the total number of nodes and the number of active nodes of the third task lock, initialize the third task lock according to the expected maximum number of threads, the total number of nodes, and the number of active nodes, and allocate a corresponding third server IP address to the third task lock according to the expected maximum number of threads.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored computer program, wherein, when the computer program is executed, it controls the device where the computer-readable storage medium is located to perform the integrated task execution management method as described in any one of claims 1 to 6.
9. An integrated task execution management system, characterized in that, The execution management system includes a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein the processor executes the computer program to implement the integrated task execution management method as described in any one of claims 1 to 6.
10. A computer program product, characterized in that, When the computer program product is run on a computer, it causes the computer to perform the integrated task execution management method as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Distributed lock implementation method in cloud computing environment
CN110445864A
Service request processing method and device, computer equipment and storage medium
CN113553196A