Distributed scheduling system, task scheduling method and device and computer equipment
By allowing application instances to send instance status reporting messages to any scheduling server in the distributed scheduling system and updating the instance status database, the problem of heartbeat information occupying communication resources is solved and communication efficiency is improved.
Patent Information
- Application Number
- CN202411865705.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-17
- Publication Date
- 2025-04-15
AI Technical Summary
In a distributed scheduling system, there is a large amount of heartbeat information in the communication between the scheduling node and the service node, resulting in wasting of communication resources.
A distributed scheduling system is provided, where the application instance can send instance status reporting messages to any scheduling server, and the scheduling server updates the instance status database, and reduces the communication resource usage of heartbeat information.
By reducing the communication resource occupation of heartbeat information, the communication efficiency of the distributed scheduling system is improved and resource waste is reduced.
Smart Images

Figure CN119829276A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a distributed scheduling system, a task scheduling method, a device and a computer device. Background Art
[0002] Distributed scheduling technology is a technology that can perform task scheduling on multiple scheduling nodes (such as servers) and can also perform tasks on multiple service nodes with applications deployed (such as container instances deployed on terminals). To ensure the efficient operation of the distributed scheduling platform, the scheduling node needs to obtain the real-time status of each service node and determine which service node the task needs to be issued to based on the real-time status.
[0003] In the related art, scheduling nodes and service nodes usually use NETTY (a Java open source framework) as the underlying communication architecture. Under this communication architecture, the status of the service node is stored in the memory of the scheduling node, and the status of the service node is not shared between various scheduling nodes. Each scheduling node needs to send heartbeat information to each service node to determine whether the service node is alive. Therefore, there is a large amount of heartbeat information occupying communication resources during the communication process, resulting in a waste of communication resources. Summary of the invention
[0004] Based on this, it is necessary to provide a distributed scheduling system, task scheduling method, device and computer equipment to address the above technical problems.
[0005] In a first aspect, the present application provides a distributed scheduling system, the system comprising at least one scheduling server and at least one application instance, wherein:
[0006] The application instance is used to send an instance status reporting message to any of the scheduling servers when the first message sending condition is met;
[0007] The scheduling server is used to determine the status information of the application instance based on the instance status reporting message, and update the registered instance data table in the instance status database based on the status information;
[0008] The scheduling server is further used to determine each target application instance corresponding to the target task according to the status information of each application instance in the registered instance data table when there is a target task, and send a task instruction message to each target application instance.
[0009] In one embodiment, the scheduling server is further used to, when there is a target task, perform slicing on the target task to obtain a plurality of target subtasks, and respectively determine the candidate application instances corresponding to each of the target subtasks;
[0010] The scheduling server is further used to determine the target application instance corresponding to each target subtask according to the status information of each candidate application instance in the registered instance data table, and send a task instruction message to each target application instance based on each target subtask;
[0011] The target application instance is further used to execute the target subtask based on the task instruction message.
[0012] In one of the embodiments, the first message sending condition includes at least one of: the time since the last sending of the instance status report message has reached a first preset time length, the load status of the application instance meets the load reporting condition, and the network status of the application instance meets the network reporting condition.
[0013] In one of the embodiments, the application instance is further used to send the instance status reporting message to all the scheduling servers when the second message sending condition is met;
[0014] The second message sending condition is that the time since the last sending of the instance status report message to all the scheduling servers has reached a second preset time, and the second preset time is determined according to the timeout closing time of the TCP connection.
[0015] In one embodiment, the network reporting condition includes a change in the IP address of the application instance.
[0016] The scheduling server is further configured to close the TCP connection between the scheduling server and the old IP address of the application instance when it is determined that the IP address of the application instance has changed based on the instance status reporting message.
[0017] In one of the embodiments, the scheduling server is further used to delete the information of the application instance from the registered instance data table when the instance status report message is not received within a third preset time period, or the status information of the application instance indicates that the application instance is abnormal.
[0018] In one of the embodiments, the scheduling server is further used to determine each target application instance corresponding to the target task based on the time when each application instance last sent the instance status report message, the load status of each application instance and the network status of each application instance.
[0019] In a second aspect, the present application also provides a task scheduling method. The method comprises:
[0020] receiving an instance status reporting message, where the instance status reporting message is sent by the application instance when a first message sending condition is met;
[0021] Determine the status information of the application instance based on the instance status reporting message, and update the registered instance data table in the instance status database based on the status information;
[0022] In the case where a target task exists, each target application instance corresponding to the target task is determined according to the status information of each application instance in the registered instance data table, and a task instruction message is sent to each target application instance.
[0023] In a third aspect, the present application also provides a task scheduling device. The device comprises:
[0024] A receiving module, configured to receive an instance status reporting message, wherein the instance status reporting message is sent by the application instance when a first message sending condition is met;
[0025] A first determination module, configured to determine the status information of the application instance based on the instance status reporting message, and update the registered instance data table in the instance status database based on the status information;
[0026] The second determination module is used to determine each target application instance corresponding to the target task according to the status information of each application instance in the registered instance data table when there is a target task, and send a task instruction message to each target application instance.
[0027] In a fourth aspect, the present application further provides a computer device, wherein the computer device comprises a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, any one of the above methods is implemented.
[0028] In a fifth aspect, the present application further provides a computer-readable storage medium, wherein a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, any of the above methods is implemented.
[0029] In a sixth aspect, the present application further provides a computer program product, wherein the computer program product comprises a computer program, and when the computer program is executed by a processor, any of the above methods is implemented.
[0030] The above-mentioned distributed scheduling system, task scheduling method, device and computer equipment enable the application instance to send an instance status report message to any scheduling server. The scheduling server updates the status information of the application instance to the registered instance data table in the instance status database, so that each scheduling server can determine which application instances can execute the target task by accessing the instance status database when it needs to issue the target task. The embodiment of the present application enables the application instance to communicate with a scheduling server to report whether the service node is alive, thereby greatly reducing the communication resources occupied by the heartbeat information. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] Figure 1 A schematic diagram of the interaction between various devices in a task scheduling system in an embodiment;
[0032] Figure 2 A schematic diagram of interaction between devices in a task scheduling system when a second message sending condition is met in an embodiment;
[0033] Figure 3 A flowchart of a task scheduling method in one embodiment;
[0034] Figure 4 is a structural block diagram of a task scheduling device in one embodiment;
[0035] Figure 5 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0036] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0037] In one embodiment, Figure 1 As shown, a distributed scheduling system is provided, the system includes at least one scheduling server and at least one application instance, wherein the application instance is used to send an instance status report message to any scheduling server when a first message sending condition is met; the scheduling server is used to determine the status information of the application instance based on the instance status report message, and update the registered instance data table in the instance status database based on the status information; the scheduling server is also used to determine each target application instance corresponding to the target task according to the status information of each application instance in the registered instance data table when there is a target task, and send a task instruction message to each target application instance.
[0038] In the embodiment of the present application, the distributed scheduling system is composed of at least one scheduling server and at least one application instance. One application instance corresponds to one application, and the application is used to perform a certain category of tasks. For example, when the application corresponding to the application instance is a payment application, the payment application can be used to perform payment-related tasks.
[0039] An application instance is a container instance, and each application instance is deployed on a terminal. Multiple application instances may be deployed in a terminal, and each application instance has its own IP (Internet Protocol) address and can communicate with the scheduling server independently.
[0040] When the first message sending condition is met, the application instance sends an instance status reporting message to the scheduling server. The instance status reporting message is at least used to update the status of the application instance to the scheduling server. When the scheduling server and the application instance communicate using a communication protocol with a timeout shutdown mechanism (such as any communication protocol based on the TCP (Transmission Control Protocol) protocol), the instance status reporting message can also be used to maintain the communication connection between the scheduling server and the application instance to avoid a situation where there is no communication between a scheduling server and an application instance for a long time, resulting in the scheduling server needing to re-establish a communication connection with the application instance when issuing instructions to the application instance, thereby saving the communication resource overhead consumed in the process of re-establishing the communication connection and saving communication resources.
[0041] Corresponding to the function of the instance status reporting message, the first message sending condition can be divided into a condition involving updating the application instance status and a condition involving maintaining the communication connection. The condition involving updating the application instance status can be a change in the status of the application instance, such as the load of the application instance exceeding the load threshold, the application instance being offline for updating, or any situation that causes the application instance to be unable to accept new tasks.
[0042] The condition involving maintaining the communication connection may be that the communication connection between the application instance and the scheduling server is about to meet the timeout closing condition specified in the communication protocol. For example, the application instance may record the time when it last sent a message to the scheduling server. When this time is about to reach the timeout closing condition specified in the communication protocol (for example, when there are still 5 seconds from the timeout duration corresponding to the timeout closing condition), the application instance may determine that the condition involving maintaining the communication connection is met.
[0043] Each application instance can record the IP addresses of all scheduling servers. When the application instance needs to send an instance status report message, it can randomly select a scheduling server from the various scheduling servers and send the instance status report message to the scheduling server. Alternatively, the application instance can also sort the various scheduling servers from far to near according to the time when the application instance last sent a message to them, and send the instance status report message to the scheduling server ranked first, so that the application instance can communicate with as many scheduling servers as possible on a regular basis and maintain communication connections with as many scheduling servers as possible.
[0044] After receiving the instance status report message, the scheduling server determines the status information of the application instance based on the instance status report message. The status information may include the current IP address of the application instance (in some cases, the IP address assigned to the application instance by the terminal may change), the current load of the application instance, the current online status of the application instance, etc. The scheduling server then accesses the instance status database and sends the above information to the instance status database so that the instance status database updates the registered instance data table.
[0045] The registered instance data table records each application instance that has registered with any scheduling server and the status information of these application instances. When an application instance registers with a scheduling server for the first time, the scheduling server can record the information of the application instance in the registered instance data table. Subsequently, the application instance can send an instance status report message to any scheduling server to update the status information of the application instance in the registered instance data table.
[0046] When there is a target task that needs to be issued to the application instance (such as a task to process a payment request initiated by a user, a task to process payment platform data updates, etc.), the scheduling server can initiate a status information read request to the instance status database to read the status information in the registration instance data table. The scheduling server then obtains the application type and the target task match, that is, each candidate application instance that can process the target task, and then selects the target application instance based on the status information of each candidate application instance. Exemplarily, the scheduling server can select the candidate application instance with the lowest load as the target application instance, select the candidate application instance with the lowest network delay as the target application instance, etc., and the embodiments of the present application do not specifically limit this.
[0047] After determining the target application instance, the scheduling server sends a task instruction message to the target application instance, instructing the target application instance to execute the target task.
[0048] The distributed scheduling system provided by the embodiment of the present application enables the application instance to send an instance status report message to any scheduling server. The scheduling server updates the status information of the application instance to the registered instance data table in the instance status database, so that each scheduling server can determine which application instances can execute the target task by accessing the instance status database when it needs to issue the target task. The embodiment of the present application enables the application instance to communicate with a scheduling server to report whether the application instance is alive, thereby greatly reducing the communication resources occupied by the heartbeat information.
[0049] In one embodiment, the scheduling server is also used to slice the target task when there is a target task, obtain multiple target sub-tasks, and respectively determine the candidate application instances corresponding to each target sub-task; the scheduling server is also used to determine the target application instances corresponding to each target sub-task according to the status information of each candidate application instance in the registration instance data table, and send a task instruction message to each target application instance based on each target sub-task; the target application instance is also used to execute the target sub-task based on the task instruction message.
[0050] In an embodiment of the present application, the scheduling server can slice the target task to obtain multiple target subtasks, and assign different target subtasks to different application instances for processing. Each target subtask is a part of the target task that can be completed by a single application instance alone. For example, for the target task of processing a payment request initiated by a user, the target task can be divided into four subtasks: verifying the payment request, generating a payment order, processing the payment result, and updating the user account according to the payment result. The above four subtasks can be assigned to different application instances respectively. After processing its own subtask, each application instance passes the result of the subtask processing to the application instance responsible for the next subtask, so that each application instance can collaboratively complete the processing of the target task.
[0051] After dividing each target subtask, the scheduling server can determine the candidate application instances that can process these target subtasks for each target subtask. The scheduling server can then refer to the method of determining the target application instance from the candidate application instance in the aforementioned embodiment to determine the target application instance corresponding to each target subtask. The scheduling server then sends a task instruction message to each target application instance, instructing the target application instance to execute the target subtask.
[0052] In one embodiment, the first message sending condition includes at least one of the following: the time since the last instance status report message was sent has reached a first preset time length, the load status of the application instance meets the load reporting condition, and the network status of the application instance meets the network reporting condition.
[0053] In the embodiment of the present application, the application instance can start timing each time after sending an instance status report message, and after the timing duration reaches the first preset duration, send an instance status report message and reset the timing duration. In this case, the instance status report message plays a role similar to a heartbeat message, allowing the scheduling server to perceive that the instance status report message has not been sent to the scheduling server for a long time, and there is a high probability that the application instance will fail, and delete this part of the application instances from the registered instance data table in time.
[0054] The first preset duration can be set by those skilled in the art according to actual needs, for example, it can be set to 30 seconds, 1 minute, etc., and the embodiment of the present application does not make any specific limitation on this.
[0055] It should be noted that since the scheduling server needs to perform a read and write operation on the instance status database each time it receives an instance status report message, in order to avoid all scheduling servers reading and writing the instance status database at the same time, causing excessive load on the instance status database, a different first preset duration can be set for each application instance.
[0056] Exemplarily, when registering an application instance, the scheduling server can select a random number from a preset preset duration increase or decrease range (e.g., positive 5 seconds to negative 5 seconds), add the random number to the preset first preset duration (e.g., 30 seconds), obtain the first preset duration corresponding to the application instance, and then send the first preset duration to the application instance. The application instance uses the first preset duration as the maximum interval between two instance status report messages, so that different application instances stagger the time of sending instance status report messages, reducing the load pressure on the instance status database.
[0057] The application instance can also send an instance status reporting message when the load status meets the load reporting conditions. The load status may include CPU (Central Processing Unit) usage, memory usage, the number of target tasks or target subtasks to be processed, etc. The load reporting condition can be that a certain indicator in the load status is higher than the threshold corresponding to the indicator, or it can be that more than a certain proportion of the indicators are higher than the threshold corresponding to the indicator. The specific setting can be made by technical personnel in this field according to actual needs. In this case, the role of the instance status reporting message is to notify the scheduling server that the load of the application instance is already high and the ability to process new tasks is limited.
[0058] The application instance may also send an instance status report message when the network status meets the network reporting conditions. The network status may include the packet loss rate, delay, bandwidth, etc. when the application instance communicates with the scheduling server or other application instances. The above data may be measured in real time when the application instance communicates with the scheduling server or other application instances, or the application instance may send a special network measurement data packet for measurement at intervals.
[0059] The network reporting condition can be that a certain indicator in the network status is higher than the threshold corresponding to the indicator, or that more than a certain proportion of the indicator is higher than the threshold corresponding to the indicator, which can be set by technicians in this field according to actual needs. In this case, the role of the instance status reporting message is to notify the scheduling server that the network status of the application instance is poor, the ability to receive scheduling server instructions or pass task results to other application instances is poor, and the ability to process new tasks is limited.
[0060] In one embodiment, Figure 2 As shown, the application instance is also used to send an instance status report message to all scheduling servers when the second message sending condition is met; the second message sending condition is that the time since the last time the instance status report message was sent to all scheduling servers has reached a second preset time period, and the second preset time period is determined based on the timeout closing time of the TCP connection.
[0061] In the embodiment of the present application, each application instance and each scheduling server communicate using the TCP protocol. In order to maintain the TCP connection between the application instance and each scheduling server, the application instance can send an instance status report message to all scheduling servers once every second preset time. The second preset time should be less than the timeout closing time of the TCP connection. For example, if the timeout closing time of the TCP connection is 5 minutes, the second preset time can be 3 minutes.
[0062] Similarly, in order to avoid all scheduling servers reading and writing the instance status database at the same time, causing the instance status database to be overloaded, it is also possible to refer to the method of the aforementioned embodiment and set a second preset duration for different application instances, which is randomly increased or decreased by a certain value based on the preset second preset duration. In addition, a random write delay can also be set for each scheduling server. After receiving the instance status report message, the scheduling server needs to wait for the write delay corresponding to the scheduling server, and then write the status information of the application instance into the instance status database.
[0063] Combined with the situation that the application instance needs to send an instance status report message to the random scheduling server at most once every first preset duration, the above process is explained with a practical example. Assume that there are 2 application instances and 2 application servers, the first preset duration of application instance 1 is 25 seconds, and the first preset duration of application instance 2 is 30 seconds. The second preset duration of application instance 1 is 1 minute, and the second preset duration of application instance 2 is 1 minute and 10 seconds. The write latency of scheduling server 1 is 1 second, and the write latency of scheduling server 2 is 2 seconds.
[0064] The initial time when all timers are reset is recorded as 0 seconds. At 25 seconds, application instance 1 sends an instance status report message to the randomly selected scheduling server 2. Scheduling server 2 accesses the instance status database at 27 seconds to update the status information of application instance 1. At 30 seconds, application instance 2 sends an instance status report message to the randomly selected scheduling server 1. Scheduling server 1 accesses the instance status database at 31 seconds to update the status information of application instance 2.
[0065] At 50 seconds, application instance 1 sends an instance status report message to the randomly selected scheduling server 1. Scheduling server 1 accesses the instance status database at 51 seconds. At 1 minute, application instance 2 sends an instance status report message to the randomly selected scheduling server 2. Scheduling server 2 accesses the instance status database at 1 minute and 2 seconds.
[0066] At 1 minute, application instance 1 sends an instance status report message to all scheduling servers. Scheduling server 1 accesses the database at 1 minute and 1 second, and scheduling server 2 accesses the instance status database at 1 minute and 2 seconds.
[0067] At 1 minute and 10 seconds, application instance 2 sends an instance status report message to all scheduling servers, scheduling server 1 accesses the database at 1 minute and 11 seconds, and scheduling server 2 accesses the instance status database at 1 minute and 12 seconds.
[0068] It can be seen that through the above method, the time when each scheduling server accesses the instance state database is mostly different, so a method that is relatively simple to implement and can reduce the instantaneous read and write pressure of the instance state database as much as possible can be provided.
[0069] The distributed scheduling system provided in the embodiment of the present application enables the application instance to send an instance status report message to any scheduling server when the first message sending condition is met, and enables the application instance to send an instance status report message to all scheduling servers when the second message sending condition is met. Therefore, while the application instance generally only needs to report the status to one scheduling server, reducing the communication resources occupied by the heartbeat information, it can also ensure that the TCP connection between the application instance and each scheduling server is always connected, avoiding the situation where the scheduling server and the application instance need to re-establish the connection due to the disconnection of the TCP connection, and further saving communication resources.
[0070] In one embodiment, the network reporting condition includes a change in the IP address of the application instance.
[0071] The scheduling server is also used to close the TCP connection between the scheduling server and the old IP address of the application instance when it is determined that the IP address of the application instance has changed based on the instance status reporting message.
[0072] In the embodiment of the present application, the IP address of the application instance may change under certain conditions. For example, when the application instance is restarted, the terminal where the application instance is located may recycle the IP address of the application instance and assign a new IP address to the application instance. Or when the network configuration of the terminal itself changes, the IP address of the application instance will also change accordingly. After the application instance is assigned a new IP address, it can send an instance status report message to the scheduling server so that the scheduling server can use the new IP address to communicate with the application instance.
[0073] After receiving the instance status report message, if the scheduling server determines that the IP address of the application instance has changed, the scheduling server needs to update the registered instance data table in the instance status database and the communication connection between the scheduling server and the application instance. The scheduling server can actively close the TCP connection between the scheduling server and the old IP address of the application instance (that is, the address before the application instance IP changed), and establish a TCP connection with the new IP address of the application instance, thereby reducing the number of idle connections and saving communication resources.
[0074] For other scheduling servers that have not received the instance status report message, these scheduling servers may first discover that the IP address of the application instance has changed when they need to send a task instruction message to the application instance and read the registered instance data table, or they may receive the instance status report message and discover that the IP address of the application instance has changed when the application instance sends an instance status report message the next time the first message sending condition is met. Regardless of the circumstances under which the scheduling server discovers that the IP address of the application instance has changed, the scheduling server can execute the steps of actively closing the TCP connection between the scheduling server and the old IP address of the application instance, and establishing a TCP connection between the scheduling server and the new IP address of the application instance.
[0075] In one embodiment, the scheduling server is further configured to delete the information of the application instance from the registered instance data table when no instance status report message is received within a third preset time period or the status information of the application instance indicates that the application instance is abnormal.
[0076] In the embodiment of the present application, if the scheduling server does not receive the instance status report message within the third preset time, the scheduling server can determine that there is a problem with the application instance and delete the application instance from the registered instance data table so that subsequent target tasks will no longer be assigned to the application instance for processing. The third preset time can be determined by those skilled in the art according to actual needs, for example, it can be set to 10 minutes, 30 minutes, etc.
[0077] Alternatively, when the status information of the application instance indicates that the application instance is abnormal, the scheduling server may also delete the information of the application instance from the registered instance data table. Abnormal status information may mean that the application instance is about to go offline, a certain indicator in the load status is higher than the threshold corresponding to the indicator, a certain indicator in the network status is higher than the threshold corresponding to the indicator, etc.
[0078] Before the scheduling server deletes the application instance from the registered instance data table, the scheduling server may also try to reconnect with the application instance. For example, the scheduling server may send a test data message to the application instance to instruct the application instance to return a response message to the scheduling server after receiving the test data message. If the scheduling server receives the response message, it may be considered that the application instance is still normal, and the step of deleting the application instance information from the registered instance data table is not performed.
[0079] After the scheduling server deletes the information of the application instance, the scheduling server may also send a message to the application instance to notify that the registration status of the application instance has expired.
[0080] After the application instance returns to normal, the application instance may send a message to the scheduling server again. After detecting that the information of the application instance is not in the registered instance data table, the scheduling server may return a response message to the application instance, instructing the application instance to first complete the registration procedure with the scheduling server. After the application instance completes the registration procedure, the scheduling server adds the information of the application instance back to the registered instance data table.
[0081] In one embodiment, the scheduling server is further used to determine each target application instance corresponding to the target task according to the time when each application instance last sent an instance status report message, the load status of each application instance and the network status of each application instance.
[0082] In the embodiment of the present application, the scheduling server can determine the target application instance according to the time when each application instance last sent an instance status report message, the load status of each application instance, and the network status of each application instance. The closer the time when the application instance last sent an instance status report message is to the current time (indicating that the credibility of the data recorded in the registered instance data table is high), the lower the value of each indicator in the load status (indicating that the load of the application instance is low), and the lower the value of each indicator in the network status (indicating that the network status of the application instance is good), the more likely the application instance is to become the target application instance.
[0083] Exemplarily, the scheduling server may calculate a load score for the application instance based on each indicator in the load state of the application instance, where a higher load score indicates a lower load on the application instance; and calculate a network score for the application instance based on each indicator in the network state of the application instance. A higher network score indicates a better network for the application instance. The scheduling server may further determine a score weight value based on the time when the application instance last sent an instance status report message. The closer the time when the instance status report message was last sent is to the current time, the higher the score weight value.
[0084] The scheduling server may then add the load score and the network score, multiply the result obtained by the addition by the score weight value to obtain the total score of the application instance, and select the application instance with the highest total score as the target application instance.
[0085] In one embodiment, Figure 3 As shown, a task scheduling method is provided, which is applied to a scheduling server and includes:
[0086] Step 302: Receive an instance status reporting message, where the instance status reporting message is sent by the application instance when the first message sending condition is met.
[0087] Step 304: determine the status information of the application instance based on the instance status report message, and update the registered instance data table in the instance status database based on the status information.
[0088] Step 306: if there is a target task, determine the target application instances corresponding to the target task according to the status information of each application instance in the registered instance data table, and send a task instruction message to each target application instance.
[0089] In the embodiment of the present application, after receiving the instance status report message sent by the application instance, the scheduling server determines the status information of the application instance according to the instance status report message, and updates the status information of the application instance to the instance status database. The specific circumstances under which the application instance sends the instance status report message and the specific contents that the status information may include can be referred to the above embodiment, and the embodiment of the present application will not be repeated.
[0090] When there is a target task that needs to be assigned, the scheduling server accesses the instance status database to determine the target application instance that can currently execute the target task and whose status information meets the requirements, and then sends a task instruction message to the target application instance to instruct the target application instance to execute the target task.
[0091] The task scheduling method provided in the embodiment of the present application enables the application instance to send an instance status report message to any scheduling server. The scheduling server updates the status information of the application instance to the registered instance data table in the instance status database, so that each scheduling server can determine which application instances can execute the target task by accessing the instance status database when it needs to issue the target task. The embodiment of the present application enables the application instance to communicate with a scheduling server to report whether the application instance is alive, thereby greatly reducing the communication resources occupied by the heartbeat information.
[0092] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0093] Based on the same inventive concept, the embodiment of the present application also provides a task scheduling device for implementing the task scheduling method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more task scheduling device embodiments provided below can refer to the limitations on the task scheduling method above, and will not be repeated here.
[0094] In one embodiment, Figure 4 As shown, a task scheduling device 400 is provided, comprising: a receiving module 402, a first determining module 404, and a second determining module 406, wherein:
[0095] The receiving module 402 is used to receive an instance status reporting message, where the instance status reporting message is sent by the application instance when a first message sending condition is met;
[0096] A first determination module 404 is used to determine the status information of the application instance based on the instance status reporting message, and update the registered instance data table in the instance status database based on the status information;
[0097] The second determination module 406 is used to determine each target application instance corresponding to the target task according to the status information of each application instance in the registered instance data table when there is a target task, and send a task instruction message to each target application instance.
[0098] The task scheduling device provided in the embodiment of the present application enables the application instance to send an instance status report message to any scheduling server. The scheduling server updates the status information of the application instance to the registered instance data table in the instance status database, so that each scheduling server can determine which application instances can execute the target task by accessing the instance status database when it needs to issue the target task. The embodiment of the present application enables the application instance to communicate with a scheduling server to report whether the application instance is alive, thereby greatly reducing the communication resources occupied by the heartbeat information.
[0099] Each module in the above device can be implemented in whole or in part by software, hardware or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module above.
[0100] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 5As shown. The computer device includes a processor, a memory and a network interface connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a task scheduling method is implemented.
[0101] Those skilled in the art will understand that Figure 5 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0102] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above-mentioned method embodiments when executing the computer program.
[0103] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.
[0104] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.
[0105] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.
[0106] 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 the memory, database or other medium used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.
[0107] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0108] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A distributed scheduling system, characterized in that: The system includes at least one scheduling server and at least one application instance, wherein: The application instance is used to send an instance status reporting message to any of the scheduling servers when the first message sending condition is met; The scheduling server is used to determine the status information of the application instance based on the instance status reporting message, and update the registered instance data table in the instance status database based on the status information; The scheduling server is further used to determine each target application instance corresponding to the target task according to the status information of each application instance in the registered instance data table when there is a target task, and send a task instruction message to each target application instance.
2. The system according to claim 1, characterized in that The scheduling server is further used to, when there is a target task, perform slicing processing on the target task to obtain multiple target subtasks, and respectively determine the candidate application instances corresponding to each of the target subtasks; The scheduling server is further used to determine the target application instance corresponding to each target subtask according to the status information of each candidate application instance in the registered instance data table, and send a task instruction message to each target application instance based on each target subtask; The target application instance is further used to execute the target subtask based on the task instruction message.
3. The system according to claim 1, characterized in that The first message sending condition includes at least one of: the time since the last sending of the instance status report message has reached a first preset time length, the load status of the application instance meets the load reporting condition, and the network status of the application instance meets the network reporting condition.
4. The system according to claim 3, characterized in that The application instance is further configured to send the instance status reporting message to all the scheduling servers when a second message sending condition is met; The second message sending condition is that the time since the last sending of the instance status report message to all the scheduling servers has reached a second preset time, and the second preset time is determined according to the timeout closing time of the TCP connection.
5. The system according to claim 4, characterized in that The network reporting condition includes a change in the IP address of the application instance, The scheduling server is further configured to close the TCP connection between the scheduling server and the old IP address of the application instance when it is determined that the IP address of the application instance has changed based on the instance status reporting message.
6. The system according to claim 1, characterized in that The scheduling server is further configured to delete the information of the application instance from the registered instance data table if the instance status reporting message is not received within a third preset time period or if the status information of the application instance indicates that the application instance is abnormal.
7. The system according to claim 1, characterized in that The scheduling server is further used to determine each target application instance corresponding to the target task according to the time when each application instance last sent the instance status report message, the load status of each application instance and the network status of each application instance.
8. A task scheduling method, characterized in that: The method is applied to a scheduling server, comprising: receiving an instance status reporting message, where the instance status reporting message is sent by the application instance when a first message sending condition is met; Determine the status information of the application instance based on the instance status reporting message, and update the registered instance data table in the instance status database based on the status information; In the case where a target task exists, each target application instance corresponding to the target task is determined according to the status information of each application instance in the registered instance data table, and a task instruction message is sent to each target application instance.
9. A task scheduling device, characterized in that: The device comprises: A receiving module, configured to receive an instance status reporting message, wherein the instance status reporting message is sent by the application instance when a first message sending condition is met; A first determination module, configured to determine the status information of the application instance based on the instance status reporting message, and update the registered instance data table in the instance status database based on the status information; The second determination module is used to determine each target application instance corresponding to the target task according to the status information of each application instance in the registered instance data table when there is a target task, and send a task instruction message to each target application instance.
10. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, the steps of the method according to claim 8 are implemented.