Task scheduling and processing method and device, computer equipment and storage medium
Through task scheduling and processing methods, task identification and regional identification are used to optimize task execution sequence and resource allocation, solving the problems of operation and maintenance complexity and resource waste caused by independent deployment in each city, improving system performance and resource utilization efficiency, and realizing different Resource sharing and collaborative work among regions.
Patent Information
- Application Number
- CN202410614456.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-17
- Publication Date
- 2024-08-23
AI Technical Summary
In the existing real estate business, each city independently deploys microservice systems, resulting in repeated deployment and maintenance work, increasing operation and maintenance complexity and costs, low resource utilization efficiency, and complex and time-consuming system upgrades. There is a waste of resources, especially in cities with small traffic.
Using task scheduling and processing methods, through task schedulers and microservice module clusters, task identifiers and regional identifiers are used to optimize task execution order and resource allocation, achieve regional management of tasks and resource sharing, and reduce repeated deployment and maintenance work.
It improves system performance and response speed, optimizes resource utilization efficiency, reduces operation and maintenance complexity and cost, realizes resource sharing and collaborative work between different regions, and simplifies data management and analysis.
Smart Images

Figure CN118535302A
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of computer technology, and in particular to a task scheduling and processing method, apparatus, computer equipment, and storage medium. Background Art
[0002] In the real estate business, the method of independently deploying a complete microservice system for each city is usually adopted. Although this method can provide good data isolation for data security issues in different cities, it brings obvious disadvantages.
[0003] First, due to the same business logic, there is a lot of repeated deployment and maintenance work between different cities, which increases the complexity and cost of operation and maintenance. Secondly, when the system needs to be upgraded or updated, the services in each city need to be handled separately, which not only increases the complexity of operation, but also greatly prolongs the update cycle. In addition, for cities with less traffic, this method is prone to waste of server resources, and as the business expands to more cities, this waste of resources and duplication of maintenance work will become more prominent.
[0004] In short, the current approach has obvious shortcomings in terms of operation and maintenance efficiency, resource utilization, and system upgrades. Summary of the invention
[0005] One purpose of the embodiments of the present application is to provide a task scheduling and processing method, device, equipment and storage medium to solve the technical problems that the related technologies are obviously insufficient in operation and maintenance efficiency, resource utilization and system upgrade.
[0006] In a first aspect, a task scheduling and processing method is provided, which is applied to a task scheduling system, wherein the task scheduling system includes a task scheduler and a microservice module cluster, wherein the microservice module cluster includes a plurality of microservice modules, and different microservice modules are used to process different tasks, including:
[0007] The task scheduler receives a task processing request, the task processing request includes a task identifier and a region identifier, the task identifier is used to indicate a task to be executed, and the region identifier is used to indicate a request region corresponding to the task processing request;
[0008] The task scheduler generates a task processing instruction corresponding to the task processing request, wherein the task processing instruction carries the area identifier;
[0009] The task scheduler sends the task processing instruction to the target microservice module corresponding to the task identifier, and the target microservice module executes the task to be executed according to the area identifier;
[0010] The task scheduler receives the task result data obtained after the target microservice module executes the task;
[0011] The task scheduler generates a task processing response corresponding to the task processing request according to the task result data.
[0012] In combination with the first aspect, in a possible implementation method, there are multiple task processing requests; before the task scheduler generates the target task processing instruction according to the target task identifier, it also includes: the task scheduler generates a request processing queue according to the priority of the area identifier in each task processing request, wherein the order of the each task processing request in the request processing queue is positively correlated with the priority of the area identifier corresponding to the each task processing request; the task scheduler generates the task processing instruction corresponding to the task processing request, including: the task scheduler generates the task processing instruction corresponding to the task processing request according to the request processing queue.
[0013] It can be seen that the task scheduler in this embodiment can not only effectively process multiple task processing requests, but also optimize the execution order of tasks according to the priorities of the region identifiers, thereby improving the performance and response speed of the system.
[0014] In combination with the first aspect, in a possible implementation method, there are multiple task processing requests; the task scheduler sends the task processing instruction to the target microservice module corresponding to the task identifier, including: the task scheduler generates an instruction issuance queue according to the priority of the area identifier in each task processing instruction, wherein the order of each task processing instruction in the instruction issuance queue is positively correlated with the priority of the area identifier in each task processing instruction; the task scheduler sends the task processing instruction to the target microservice module corresponding to the task identifier according to the instruction issuance queue.
[0015] It can be seen that the task instruction issuing mechanism based on priority and area identification in this embodiment helps to achieve balanced distribution of task loading and improve resource utilization efficiency, while ensuring that urgent and high-priority tasks can be processed in a timely manner.
[0016] In combination with the first aspect, in a possible implementation method, there are multiple task processing requests. Before the task scheduler generates a task processing instruction corresponding to the task processing request, the method also includes: the task scheduler detects whether the number of requests of the multiple task processing requests exceeds a preset request value; if so, the task scheduler obtains the area identifier corresponding to each task processing request in the multiple task processing requests to obtain an unscheduled area identifier; the task scheduler determines the number of scheduled area identifiers corresponding to each unscheduled area identifier, the number of scheduled area identifiers is the number of area identifiers that are currently scheduled, and the currently scheduled area identifier refers to the area identifier corresponding to the task being executed by the microservice module in the microservice module cluster; the task scheduler suspends processing of a target task processing request among the multiple task processing requests, and the target task processing request is a task processing request corresponding to an unscheduled area identifier whose number of scheduled area identifiers exceeds the preset area concurrency number.
[0017] It can be seen that in this embodiment, the task scheduler will not be overloaded in a specific area under high concurrency conditions, and can balance the load and avoid potential service interruptions. That is, it can effectively manage a large number of task processing requests, ensure the stability and response speed of the system, and avoid excessive consumption of system resources.
[0018] In combination with the first aspect, in a possible implementation method, the target microservice module executes the task to be executed according to the area identifier, including: the target microservice module queries the area database associated with the area identifier in the target microservice module according to the area identifier, and obtains the target database corresponding to the area identifier; the target microservice module queries the target database for execution data associated with the task to be executed according to the task processing instruction; the target microservice module executes the task to be executed according to the execution data, and obtains task result data obtained after executing the task.
[0019] It can be seen that the target microservice module in this embodiment can locate and process data related to a specific area according to the area identifier. The data exists in a database consistent with the area, thereby ensuring that the task can be correctly executed for the specific area, which helps to improve the accuracy and efficiency of task processing.
[0020] In combination with the first aspect, in a possible implementation method, the target microservice module queries the target database for execution data associated with the task to be executed according to the task processing instruction, including: the target microservice module parses the task to be executed in the task processing instruction to obtain at least one subtask to be executed; the target microservice module uses the subtask as a query identifier, queries the target database to obtain the first data associated with each subtask; when the target microservice module detects that the amount of the first data is greater than or equal to a preset threshold, the target microservice module aggregates the first data to obtain execution data; or, when the target microservice module detects that the amount of the first data is less than a preset threshold, the target microservice module sends an error prompt to the task scheduler.
[0021] It can be seen that the target microservice module in this embodiment can ensure that there is sufficient data support when executing tasks, thereby improving the accuracy and reliability of task execution. At the same time, it can also promptly notify the system administrator or scheduler about insufficient data so that corresponding measures can be taken.
[0022] In combination with the first aspect, in a possible implementation method, the task scheduler generates a task processing response corresponding to the task processing request based on the task result data, including: updating the message queue in the task scheduling system based on the task result data; generating a task processing response corresponding to the task processing request based on the message queue.
[0023] It can be seen that in this embodiment, the task scheduler reflects the status and results of task execution by updating the message queue, which helps the task scheduling system to maintain real-time monitoring and tracking of the task execution status.
[0024] In a second aspect, a task scheduling and processing device is provided, which is applied to a task scheduling system, wherein the task scheduling system includes a task scheduler and a microservice module cluster, wherein the microservice module cluster includes a plurality of microservice modules, and different microservice modules are used to process different tasks, wherein the device includes:
[0025] A receiving unit, configured to receive a task processing request, wherein the task processing request includes a task identifier and a region identifier, wherein the task identifier is used to indicate a task to be executed, and the region identifier is used to indicate a request region corresponding to the task processing request;
[0026] A generating unit, configured to generate a task processing instruction corresponding to the task processing request, wherein the task processing instruction carries the area identifier;
[0027] A sending unit, used to send the task processing instruction to the target microservice module corresponding to the task identifier, and execute the task to be executed according to the area identifier;
[0028] The receiving unit is further used to receive task result data obtained after the target microservice module executes the task;
[0029] The generating unit is further configured to generate a task processing response corresponding to the task processing request according to the task result data.
[0030] In a third aspect, an embodiment of the present invention provides a computer device, including:
[0031] at least one processor; and,
[0032] a memory communicatively connected to the at least one processor; wherein,
[0033] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to the first aspect.
[0034] In a fourth aspect, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program, wherein the computer program includes program instructions, and when the program instructions are executed by a processor, the processor executes the method as described in the first aspect.
[0035] In the scheme implemented by the above-mentioned task scheduling and processing method, device, computer equipment and storage medium, first, the task scheduler receives a task processing request, and the task processing request includes a task identifier and an area identifier. The task identifier is used to indicate the task to be executed, and the area identifier is used to indicate the request area corresponding to the task processing request. Secondly, the task scheduler generates a task processing instruction corresponding to the task processing request, and the task processing instruction carries the area identifier. Then, the task scheduler sends the task processing instruction to the target microservice module corresponding to the task identifier, and the target microservice module executes the task to be executed according to the area identifier. Then, the task scheduler receives the task result data obtained after the target microservice module executes the task. Finally, the task scheduler generates a task processing response corresponding to the task processing request based on the task result data. The method can accurately identify and locate the geographical area corresponding to the task processing request according to the regional identifier in each task processing request, so that the task can be managed according to the geographical location or other regional attributes, which is conducive to regional service optimization and resource management, and improves the response speed; secondly, the method further realizes centralized task scheduling through the microservice module cluster, that is, unified release and service management promote resource sharing and collaborative work between different regions, and realizes the transformation of independent release between multiple regions into unified release of unified services, reducing the complexity and workload of separate deployment in different regions, and further reducing the cost of maintaining independent systems in different regions through unified task scheduling and management; further, when facing task requests from different regions, the task scheduler can evenly distribute the requests to the corresponding microservice modules for processing according to the different regions and task types, each microservice module processes its own task type, and the functional boundaries of each unit are clear and independent of each other, which can effectively disperse the load and prevent single point overload; finally, in the method, each microservice module independently processes the tasks of a specific area, and the obtained task result data is then uniformly collected and responded by the task scheduler, which further optimizes the data flow path, simplifies data management, and provides convenience for data analysis and decision support. Overall, this task scheduling method greatly enhances the dynamic scheduling capability, resource utilization efficiency and service personalization level of the task scheduling system, and provides users with more accurate and rapid service response capabilities. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments of the present application will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0037] Figure 1A It is a schematic diagram of a scene that can be implemented in the prior art;
[0038] Figure 1B It is a scenario schematic diagram of a task scheduling and processing method in one embodiment of the present invention;
[0039] Figure 2 It is a flowchart of a task scheduling and processing method in one embodiment of the present invention;
[0040] Figure 3 is a structural diagram of a task scheduling and processing device in one embodiment of the present invention;
[0041] Figure 4 It is a schematic diagram of the structure of a computer device in one embodiment of the present invention. DETAILED DESCRIPTION
[0042] In order to make the purpose, technical solutions 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 intended to limit the present application. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present application.
[0043] It should be noted that, if there is no conflict, the various features in the embodiments of the present application can be combined with each other, all within the scope of protection of the present application. In addition, although the functional module division is performed in the device schematic diagram and the logical order is shown in the flow chart, in some cases, the steps shown or described can be performed in a sequence different from the module division in the device or the flow chart. Furthermore, the words "first", "second", "third", etc. used in this application do not limit the data and execution order, but only distinguish the same items or similar items with basically the same functions and effects.
[0044] The present invention is described in detail below through specific embodiments.
[0045] The technical solution of the present application can be applied to a variety of scenarios, and is particularly suitable for distributed systems and environments that require regional data isolation or customization.
[0046] In the existing technology, each city needs to configure a task scheduler separately, and each city independently deploys a complete set of microservices. Figure 1A , Figure 1A A schematic diagram of a scenario that can be implemented in the prior art is shown in FIG. Figure 1AAs mentioned above, taking regions A, B, and C as examples, region A has a separately configured task scheduler, a complete set of microservices is independently deployed in region A, and the corresponding region A database, and the microservices in region A can handle business 1, business 2, and business 3, etc.; a complete set of microservices is independently deployed in region B, and the corresponding region B database, and the microservices in region B can handle business 1, business 2, and business 3, etc.; a complete set of microservices is independently deployed in region C, and the corresponding region C database, and the microservices in region C can handle business 1, business 2, and business 3, etc. It can be seen that the business logic of different regions is the same.
[0047] Since the business logic is the same, there are multiple different physical services for the same business logic, which leads to a large amount of repeated deployment and maintenance work between different cities, increasing the complexity and cost of operation and maintenance. Secondly, when the system needs to be upgraded or updated, all independent services in all cities need to be released once, that is, the services in each city need to be handled separately, which not only increases the complexity of the operation, but also greatly prolongs the update cycle. In addition, for cities with less traffic, this method is prone to waste of server resources, and as the business expands to more cities, this waste of resources and duplication of maintenance work will become more prominent.
[0048] In view of this, the technical solution of this application is proposed, please see Figure 1B , Figure 1B A scenario diagram of a task scheduling and processing method provided in an embodiment of the present application, in which there is a task scheduling system 10 involved, the task scheduling system 10 includes a task scheduler 20 and a microservice module cluster 30, the microservice module cluster 30 includes a plurality of microservice modules 40, different microservice modules are used to process different tasks, wherein each microservice module can access databases 50 in different regions. As shown in FIG1 , different microservice modules 40 can access the contents of the database, such as the A region database, the B region database, and the C region database, and so on, which are not fully displayed here.
[0049] Each microservice module 40 can be designed for different real estate business needs, such as property management, rental management, sales management, etc. Each microservice module can retrieve data from different regional databases as needed. Figure 1B In the present invention, no matter processing tasks related to area A, area B or area C, the corresponding microservice modules can access and utilize the database resources of these areas, further making task processing more flexible and efficient. That is, the present application allows the task scheduling system to dynamically retrieve or store data from the most relevant database according to the specific needs of the task.
[0050] Furthermore, each microservice module can retrieve data corresponding to the regional identifier in the database according to the regional identifier corresponding to different tasks. In a specific implementation, the regional identifier can be the name of a city.
[0051] Specifically, the task scheduling system 10 is a centralized system that is responsible for processing all incoming task requests and assigning them to appropriate microservice modules for processing. The task scheduling system 10 may also include a message queue 60. The message queue 60 is an asynchronous communication mechanism that allows the sender and receiver of a message to be online without having to be online at the same time; the message queue is usually used to decouple system components and improve the scalability and robustness of the system; in a distributed system, the message queue can effectively handle high concurrency and high throughput scenarios and provide reliable messaging services.
[0052] Specifically, the task scheduler 20 is the core component of the task scheduling system 10. It receives external or internal task processing requests. Each task processing request contains a specific task identifier and a region identifier. It is responsible for generating corresponding task processing instructions based on the requested task identifier, and sending these instructions together with the region identifier to the corresponding microservice module 40 for execution. It also needs to receive the result data returned by the microservice module 40 after executing the task, and generate a task processing response based on these data. For example, when new house information is entered into the system, the system can publish the house update message to the message queue, which is then processed by the microservice module subscribed to the queue, such as updating the house database, sending notifications to subscribed users, etc. Or, in the transaction process, after key steps such as contract signing and payment are completed, the relevant status update message can be sent to the message queue, which is processed by the microservice module responsible for transaction status tracking and updates the transaction record in the database.
[0053] Specifically, the microservice module cluster 30 is composed of multiple microservice modules 40, which can be physically separated servers or virtualized service instances. Each microservice module 40 can handle a specific type of task to ensure maximum processing efficiency and resource utilization.
[0054] Specifically, the microservice modules 40 are independent service units, each of which has its own scope of responsibility and processing logic. Each microservice module can seamlessly switch the data source in the database according to the task instruction to ensure that the task obtains the most appropriate and timely data support.
[0055] Specifically, the database 50 is independent of the microservice module 40 and can be accessed by multiple microservice modules. This means that different microservice modules, although they are responsible for different tasks, can access one or more shared databases to access data. This architectural design allows data resources to be shared by multiple modules, promoting data sharing and communication between different modules. The database 50 or storage structure of each region is designed to respond to requests for specific region identifiers to ensure the locality and relevance of data.
[0056] For example, real estate company A has business all over the world and needs to handle property management, leasing and sales requests from different regions. The task scheduling system 10 is deployed in the company's infrastructure to effectively manage these business requests. The task scheduler 20 is located at the core of the task scheduling system and is responsible for receiving business requests from different regions. For example, when a new leasing request arrives, the task scheduler 20 analyzes the content and source of the request and assigns it to the most suitable microservice module 40 for processing. The microservice module cluster 30 consists of multiple microservice modules 40, each of which is independently deployed and expanded and can handle specific real estate business types.
[0057] Among them, each microservice module 40 can call one or more databases 50 customized for different regions according to the regional identifier. These databases 50 store data related to real estate business in each region, such as property information, lease contracts, sales records, etc. Since each database 50 is region-specific, they can comply with local laws and regulations and meet specific business needs. For example, a database in North America may need to comply with US housing regulations, while a database in Europe may need to support multiple currencies and languages.
[0058] When the task scheduler 20 receives a business request, it analyzes the content and source of the request, and then forwards it to the corresponding microservice module 40 through the microservice module cluster 30. After receiving the request, the microservice module 40 calls the database 50 according to the regional identifier in the business request to obtain the necessary data, and then performs the corresponding business processing. After the processing is completed, the microservice module 40 returns the result to the task scheduler 20, and the task scheduler 20 feeds back the result to the external requester. Among them, the task scheduler can analyze the domain name in the business request to obtain the regional identifier in the business request.
[0059] Or in another case, the user selects "Shanghai" as the search city on the real estate information platform B and enters the search conditions, such as price range, house type, location, etc.; the task scheduler 20 receives the house search request, identifies the city information in the request as "Shanghai", and generates a house information processing instruction; the task scheduler 20 assigns the house search task to the house retrieval microservice module 40 corresponding to "Shanghai" through the microservice module cluster 30; the house retrieval microservice module 40 retrieves the house information that meets the user's search conditions from the "Shanghai" database 50; the house details microservice module 40 obtains the detailed information of the selected house and displays it to the user; the house viewing appointment microservice module 40 processes the user's house viewing appointment request and updates the appointment information in the "Shanghai" database; all house-related data (such as house information, appointment records, user feedback) are stored in the "Shanghai" regional database 50; after the microservice module 40 completes the processing, it returns the search results, house details and appointment status to the task scheduler, and the scheduler displays them to the user.
[0060] based on Figure 1B The present application also proposes a task scheduling and processing method to solve the above problems. The following is a detailed introduction.
[0061] See also Figure 2 , Figure 2 A flowchart of a task scheduling and processing method provided by an embodiment of the present invention is characterized in that it is applied to a task scheduling system, wherein the task scheduling system includes a task scheduler and a microservice module cluster, wherein the microservice module cluster includes multiple microservice modules, and different microservice modules are used to process different tasks. The method includes the following steps:
[0062] S10. The task scheduler receives a task processing request, where the task processing request includes a task identifier and a region identifier, where the task identifier is used to indicate a task to be executed, and the region identifier is used to indicate a request region corresponding to the task processing request.
[0063] Among them, the task scheduler is responsible for receiving, parsing and processing task processing requests. In this solution, the primary responsibility of the task scheduler is to receive task processing requests from the outside. The above request is the entry point for the system to interact with the external environment and the trigger point for the start of task scheduling. In addition, after the processing is completed, the task scheduler may also need to return the result according to the regional identification, such as multi-language support at the application layer or regional storage of data, to ensure that the task execution results meet the specific needs of the region.
[0064] Among them, the task scheduler usually has an intelligent algorithm that can decide how to efficiently allocate tasks to corresponding processing units based on factors such as task type, priority, and resource requirements.
[0065] Among them, a task processing request refers to an instruction sent from an external system or user to the task scheduler, requesting the execution of a task. This request usually contains all the necessary information required to execute the task, such as task type, parameters, execution environment, etc.
[0066] The task ID is a unique identifier in the task processing request, which is used to indicate the type of task or specific operation to be performed. The task ID can be the name, number or other form of identification of the task, which is unique here. For example, on a real estate information platform, the task ID may represent different business operations such as "house search", "appointment for house viewing" or "transaction settlement".
[0067] The region ID is used to indicate the request region corresponding to the task processing request. It identifies the geographical attribute of the task, that is, it determines the microservice module in which the task should be assigned for processing. In the scenario of a real estate information platform, the region ID may represent the city or region where the user is located, such as "Shanghai", "Beijing" or "Guangzhou".
[0068] In the specific implementation, after the user determines the city they are in through positioning or other means, they will use the specific domain name of the city to access the service. For example, if the user is in Beijing, they may access it through "beijing.example.com". The outermost layer of the service is a k8s cluster service that supports multiple domain names. This service is responsible for receiving requests from different domain names, and determining the city visited by the user based on the domain name, thereby determining the regional identifier in the request, and routing the request to the microservice module cluster based on the regional identifier in the request. The microservice module cluster points to the corresponding database based on the regional identifier. Ultimately, all data related to the city will be stored in a specific database bound to the regional identifier, achieving proper distribution and isolation of data.
[0069] Specifically, the region identifier enables the task scheduler to accurately direct requests to the most appropriate processing node. For example, in a global service cloud platform, based on the user's geographical information, the task scheduler can select the data center closest to the user to process the request, which can greatly reduce latency and improve user experience.
[0070] It can be seen that after receiving the task processing request, the task scheduler in this embodiment will perform a double match based on the task identifier and the region identifier to decide which specific microservice module to send the request to for processing. Under the microservice module cluster architecture, different microservice modules may be responsible for different business logics, so efficient and accurate task processing can be achieved by matching the task identifier and the region identifier.
[0071] S20. The task scheduler generates a task processing instruction corresponding to the task processing request, where the task processing instruction carries the area identifier.
[0072] Among them, the task processing instruction is parsed by the task scheduler in the task processing request. The task identifier and the regional identifier are understood, and the specific task type and the corresponding geographical area of the request are understood. The task scheduler further generates the corresponding task processing instruction according to the task identifier and the regional identifier. The above-mentioned task processing instruction contains all the information required to process the task, such as the specific operation of the task, data processing rules, execution order, task priority, estimated completion time, required resource types, etc., for reference by the microservice module when processing the task. For example, the task processing instruction can be a data structure, such as a JSON object or an XML document, containing all the necessary instruction information. For example, if a task processing request is about searching for houses in the Beijing area, then the task processing instruction will carry "Beijing" as the regional identifier and be sent to the microservice module responsible for processing the house search in the Beijing area.
[0073] The task processing instruction also includes a regional identifier. After receiving the instruction, the microservice module cluster can immediately know which microservice module the task is assigned to based on the task identifier, and further determine which region's specific requirements need to be followed based on the regional identifier. For example, if the regional identifier indicates that the task is a rental request from Germany, the microservice module will use German legal terms and business rules to process the request.
[0074] It can be seen that by generating task processing instructions carrying area identifiers, the task scheduler can ensure that tasks are correctly assigned to microservice modules that can handle specific area requirements, that is, it can ensure that tasks are processed at the right location, at the right time, and in the right way, thereby improving the flexibility and efficiency of the system.
[0075] S30: The task scheduler sends the task processing instruction to the target microservice module corresponding to the task identifier, and the target microservice module executes the task to be executed according to the area identifier.
[0076] Among them, after generating the task processing instruction, the task scheduler can send the task processing instruction to the target microservice module corresponding to the task identifier through the communication protocol and network transmission.
[0077] For example, the task scheduler may use message queues, publish / subscribe mechanisms, RESTful APIs, or other communication mechanisms to issue task processing instructions to microservice modules.
[0078] The target microservice module is determined according to the task identifier and the region identifier, and is responsible for executing the operation corresponding to the task identifier and can process data of a specific region related to the region identifier. In this solution, each microservice module is usually focused on executing a specific task or a group of related tasks.
[0079] Specifically, after receiving the task processing instruction, the target microservice module will execute the task according to the regional identifier in the instruction, which may include accessing and operating the database inside the module or the external database, communicating with other microservice modules or external systems, and returning the processing results. For example, if a task processing request is about searching for houses in the Beijing area, then the task processing instruction will carry "Beijing" as the regional identifier and be sent to at least one microservice module responsible for processing the search for houses in the Beijing area. The at least one microservice module will access and process the database related to the Beijing area according to the regional identifier, execute the task, and return the result.
[0080] Optionally, when executing a task, the microservice module may need to access context information related to the task, such as user information, session status, etc. The above context information is usually passed in the task processing instruction, or obtained through other mechanisms within the microservice module.
[0081] It can be seen that this implementation can ensure that tasks are correctly assigned to target microservice modules that can handle specific regional needs through the task scheduler. Further, the cooperation between the task scheduler and the microservice module realizes a high degree of automation and optimization of task processing, thereby improving the performance and reliability of the entire system.
[0082] S40. The task scheduler receives task result data obtained after the target microservice module executes the task.
[0083] The task result data may include but is not limited to the task execution status (success or failure), any output data generated during the execution process, performance indicators, execution logs, and possible error messages or exceptions. In addition, the format and content of the task result data depends on the type of task and the design of the microservice module. For example, for a property management task, the task result data may include property maintenance status updates, fee settlement information, tenant feedback, etc.
[0084] Specifically, if the execution status of the task result data is failure, the result data may also include an error code or error message to help diagnose the problem; the output data may include but is not limited to calculated data and processed files; performance indicators may include execution time, amount of memory used, I / O operations, etc.; the execution log is used to understand the specific situation of the task during execution.
[0085] Among them, once the task is executed, the target microservice module will send the task result data back to the task scheduler. This process is implemented through a pre-defined interface or callback mechanism to ensure that the task scheduler can receive feedback from the microservice module.
[0086] It can be seen that this embodiment receives and processes task result data through the task scheduler, which not only ensures the closed loop of task execution, but also provides a feedback and monitoring mechanism, thereby improving system reliability and user satisfaction.
[0087] S50: The task scheduler generates a task processing response corresponding to the task processing request according to the task result data.
[0088] Among them, the task processing response represents the task scheduler converting the output of the microservice module after executing the task into feedback on the original request. The task processing response usually includes the status of the task execution (success or failure), result details, and instructions for any subsequent operations.
[0089] For example, the task processing response may include, but is not limited to, the task execution time, resource consumption, and any warning or error information.
[0090] In a specific implementation, after receiving the task result data, the task scheduler will process it, which may include verifying the correctness of the result, recording the execution log, updating the task status, and taking further actions based on the result data.
[0091] Optionally, if the task is executed successfully, the task scheduler passes the result data to other system components or services, or directly returns the result to the original requester. The task processing response may contain the success status, execution results, and any relevant output data. The original requester may be a user interface, other microservice modules, or an external system. The task processing response provides them with feedback on the task execution, so that they can take corresponding actions based on the response.
[0092] Optionally, if the task execution fails, the task scheduler will trigger the error handling process, such as a retry mechanism, notifying the monitoring system, or reallocating the task to other microservice modules. The task processing response may include an error code, error message, and the reason for the failure.
[0093] It can be seen that in this embodiment, by generating the corresponding task processing response, the task scheduler not only completes a complete task execution cycle, but also provides the caller with necessary feedback, so that it can understand the task execution status and make decisions accordingly, thereby improving system reliability and responsiveness.
[0094] The method can accurately identify and locate the geographical area corresponding to the task processing request according to the regional identifier in each task processing request, so that the task can be managed according to the geographical location or other regional attributes, which is conducive to regional service optimization and resource management, and improves the response speed; secondly, the method further realizes centralized task scheduling through the microservice module cluster, that is, unified release and service management promote resource sharing and collaborative work between different regions, and realizes the transformation of independent release between multiple regions into unified release of unified services, reducing the complexity and workload of separate deployment in different regions, and further reducing the cost of maintaining independent systems in different regions through unified task scheduling and management; further, when facing task requests from different regions, the task scheduler can evenly distribute the requests to the corresponding microservice modules for processing according to the different regions and task types, each microservice module processes its own task type, and the functional boundaries of each unit are clear and independent of each other, which can effectively disperse the load and prevent single point overload; finally, in the method, each microservice module independently processes the tasks of a specific area, and the obtained task result data is then uniformly collected and responded by the task scheduler, which further optimizes the data flow path, simplifies data management, and provides convenience for data analysis and decision support. Overall, this task scheduling method greatly enhances the dynamic scheduling capability, resource utilization efficiency and service personalization level of the task scheduling system, and provides users with more accurate and rapid service response capabilities.
[0095] In one possible example, there are multiple task processing requests; before the task scheduler generates the target task processing instruction according to the target task identifier, it also includes: the task scheduler generates a request processing queue according to the priority of the area identifier in each task processing request, wherein the order of each task processing request in the request processing queue is positively correlated with the priority of the area identifier corresponding to each task processing request; the task scheduler generates the task processing instruction corresponding to the task processing request, including: the task scheduler generates the task processing instruction corresponding to the task processing request according to the request processing queue.
[0096] When there are multiple task processing requests, each request has a region identifier and a task identifier, and each task processing request includes a region identifier indicating the region corresponding to the request.
[0097] Among them, the priority setting of regional identifiers can be based on geographical or administrative importance. Taking Beijing as an example, as it is the capital of China, its importance is self-evident. Therefore, when performing task scheduling or data processing, requests from the Beijing region may be given the highest priority. Especially in the case of limited resources, the system may give priority to allocating resources to high-priority regions (such as Beijing). This includes but is not limited to computing resources, network bandwidth, storage, etc.
[0098] For example, in the housing rental scenario, considering the economic conditions and population density of different cities, the priority examples for multiple cities may be as follows:
[0099] Beijing, Beijing has a strong housing rental market. The rental requests in this city may be set to the highest priority, so the rental platform will respond to rental requests in the Beijing area faster, speed up the approval process, and quickly coordinate housing and customers; Shanghai, Shanghai's rental prices and demand are usually high, and the rental platform may give Shanghai's rental requests a higher priority to ensure efficient matching of housing and meet high demand; Guangzhou is an economically prosperous city with a stable rental market. For the rental demand in Guangzhou, the platform will also appropriately increase the processing priority to maintain its market vitality; Shenzhen, because Shenzhen has many high-tech companies and young professionals, its rental demand is also strong, and the rental platform will ensure that the rental demand in the Shenzhen market can be processed in a timely manner. Therefore, when the rental platform receives rental applications from these four cities, it will first process the rental applications from Beijing according to the set city priority, followed by Shanghai, Guangzhou and Shenzhen. If the application volume in Beijing and Shanghai is high, the system may dynamically adjust and increase the resource investment in processing these two cities to ensure efficient service.
[0100] The request processing queue defines the order of task processing requests, which is positively correlated with the priority of the region identifier, indicating that task processing requests with high priority will be placed at the front of the queue and processed first. Furthermore, the management of the request processing queue can be based on a variety of strategies, such as first-in-first-out (FIFO), priority queue, work stealing, etc. The above strategies can be selected according to business requirements and system design, and are not limited here.
[0101] In a specific implementation, before the task scheduler generates a target task processing instruction based on the target task identifier, it organizes the task processing requests into a request processing queue according to the priority of the region identifier in each request. In the request processing queue, the order of the task processing requests is positively correlated with the priority of their region identifiers, which means that task processing requests corresponding to region identifiers with higher priorities will be placed at the front of the queue, and those with lower priorities will be placed at the back.
[0102] Optionally, the task scheduler needs to continuously monitor and manage the request processing queue to ensure that the order and priority of the queue reflect current business needs and environmental changes. If a new task processing request arrives, the task scheduler will insert it into the appropriate position in the queue based on the region identification priority of the new request.
[0103] It can be seen that the task scheduler in this embodiment can not only effectively process multiple task processing requests, but also optimize the execution order of tasks according to the priorities of the region identifiers, thereby improving the performance and response speed of the system.
[0104] In one possible example, there are multiple task processing requests; the task scheduler sends the task processing instruction to the target microservice module corresponding to the task identifier, including: the task scheduler generates an instruction sending queue according to the priority of the area identifier in each task processing instruction, wherein the order of each task processing instruction in the instruction sending queue is positively correlated with the priority of the area identifier in each task processing instruction; the task scheduler sends the task processing instruction to the target microservice module corresponding to the task identifier according to the instruction sending queue.
[0105] Among them, the priority setting of regional identifiers can be based on geographical or administrative importance. Taking Beijing as an example, as it is the capital of China, its importance is self-evident. Therefore, when performing task scheduling or data processing, requests from the Beijing region may be given the highest priority. Especially in the case of limited resources, the system may give priority to allocating resources to high-priority regions (such as Beijing). This includes but is not limited to computing resources, network bandwidth, storage, etc.
[0106] The order of task processing instructions in the instruction dispatch queue is positively correlated with the priority of their corresponding area identifiers, that is, the task processing instructions corresponding to the area identifiers with high priority will be placed at the front of the queue. In actual operation, in order to respond to emergencies or priority changes, the task scheduler may need to dynamically adjust the instruction dispatch queue to ensure that key tasks can be dispatched and executed in a timely manner.
[0107] Specifically, the task scheduler issues task processing instructions to the target microservice modules corresponding to each task identifier according to the order of the instruction issuance queue to ensure that the execution order of the tasks is consistent with the predetermined priority.
[0108] For example, suppose there are three task processing requests in the system, two of which come from region A and one from region B. Based on the predetermined business rules, the task priority of region B is higher. The task scheduler generates three task processing instructions and determines that the task priority of region B is the highest, so it is placed at the top of the task processing queue. According to the instruction delivery queue, the system first sends the task processing instruction to the microservice module that obeys region B; then sends the task processing instruction of region A.
[0109] It can be seen that the task instruction issuing mechanism based on priority and area identification in this embodiment helps to achieve balanced distribution of task loading and improve resource utilization efficiency, while ensuring that urgent and high-priority tasks can be processed in a timely manner.
[0110] In one possible example, there are multiple task processing requests. Before the task scheduler generates a task processing instruction corresponding to the task processing request, the method also includes: the task scheduler detects whether the number of the multiple task processing requests exceeds a preset request value; if so, the task scheduler obtains the area identifier corresponding to each task processing request in the multiple task processing requests to obtain an unscheduled area identifier; the task scheduler determines the number of scheduled area identifiers corresponding to each unscheduled area identifier, the number of scheduled area identifiers is the number of area identifiers that are currently scheduled, and the currently scheduled area identifier refers to the area identifier corresponding to the task being executed by the microservice module in the microservice module cluster; the task scheduler suspends processing of a target task processing request among the multiple task processing requests, and the target task processing request is a task processing request corresponding to an unscheduled area identifier whose number of scheduled area identifiers exceeds the preset area concurrency number.
[0111] Among them, the preset request value can be a threshold set according to the processing capacity of the microservice module and the load capacity of the system during system design, and is not uniquely limited here.
[0112] Specifically, setting a preset request value is a means of monitoring the system load to determine whether the system is approaching or has reached the upper limit of its processing capacity. Specifically, when there are multiple task processing requests, the task scheduler needs to ensure that the system can effectively process these requests while avoiding excessive concentration of resources in one or a few areas, resulting in a decrease in the service quality of other areas.
[0113] Among them, the unscheduled area identifier refers to the area identifier that has not been scheduled by the task scheduler or the related tasks have not been accepted for execution by any microservice module. That is, when the number of requests exceeds the preset value, the task scheduler will identify all the unscheduled area identifiers, and the tasks corresponding to these area identifiers have not been assigned to any microservice module for processing.
[0114] Among them, the unscheduled region identifier searches for the number of scheduled region identifiers in the microservice module cluster. Specifically, in the process of the task scheduler determining the number of scheduled region identifiers corresponding to each unscheduled region identifier, the task scheduler uses each unscheduled region identifier as a query identifier, queries the microservice module cluster, and obtains a scheduled region identifier that is consistent with each unscheduled region identifier, that is, when determining the scheduled region identifier corresponding to each unscheduled region identifier, there is no need to limit it to a specific microservice module, and it is necessary to query in the microservice cluster to obtain the number of scheduled region identifiers under the cluster.
[0115] For example, a real estate rental platform D covers rental business in four cities: Beijing, Shanghai, Guangzhou and Shenzhen. Each city has a preset concurrent processing request value, for example, only 100 rental applications can be processed at the same time. On weekends, a large number of rental applications flooded into the system, and the task scheduler found that the number of rental requests in Beijing had exceeded 200. The task scheduler first obtained all these requests and identified Beijing as an unscheduled area. Then it checked the number of rental requests currently being processed in Beijing and found that the number currently being processed in Beijing had reached 100. Then the task scheduler would suspend scheduling new rental requests in Beijing. The "pause" here means that no more requests from Beijing will be allocated to the service module until some of the requests being processed are completed, releasing new processing capacity, thereby preventing system overload and ensuring that requests are processed within a reasonable time, while maintaining a balance in scheduling in each region.
[0116] The preset regional concurrency number can be set according to the system design and business requirements. There is no unique limitation here. The preset regional concurrency number is to prevent too many requests in a certain area or service category, which may cause system overload or response delay.
[0117] Optionally, the task scheduler may record the requests while suspending the processing of the target task processing requests, and reschedule them when system resources are sufficient, or take other measures to process the requests.
[0118] For example, in the real estate rental platform D, there are multiple regions, regions A, B, and C, and each region has multiple service requests waiting to be processed. The task scheduler of the platform sets the maximum concurrent processing request (preset regional concurrency) of each region to 100. At a certain point in time, the system receives 500 service requests, all of which contain their respective regional identifiers. The task scheduler first detects whether these 500 requests exceed the preset request value. Assuming that the preset total system request value is 400, this exceeds the maximum processing capacity of the system. Due to too many requests, the task scheduler then needs to obtain the unscheduled regional identifier, that is, there are three unscheduled regional identifiers. The unscheduled regional identifier of region A is a, and the corresponding regional identifier number is 200, the unscheduled regional identifier of region B is b, and the corresponding regional identifier number is 200, and the unscheduled regional identifier of region C is c, and the corresponding regional identifier number is 100. The task scheduler finds that there are 120 requests being processed in region A (i.e., the number of scheduled region IDs consistent with a is 120), 80 requests in region B (i.e., the number of scheduled region IDs consistent with b is 80), and 150 requests in region C (i.e., the number of scheduled region IDs consistent with c is 150). Based on the previously set regional concurrency (100), the task scheduler determines that the requests from regions A and C have exceeded the set upper limit, while region B has not yet reached this upper limit. Therefore, the task scheduler will suspend processing some requests from regions A and C until the number of requests being processed drops below 100. New service requests from regions A and C will be placed in a waiting state until a certain number of service requests currently being processed are completed, while service requests from region B will continue to be processed in order because they are not overloaded.
[0119] It can be seen that in this embodiment, the task scheduler will not be overloaded in a specific area under high concurrency conditions, and can balance the load and avoid potential service interruptions. That is, it can effectively manage a large number of task processing requests, ensure the stability and response speed of the system, and avoid excessive consumption of system resources.
[0120] In a possible example, the target microservice module executes the task to be executed according to the area identifier, including: the target microservice module queries the area database associated with the area identifier in the target microservice module according to the area identifier, and obtains the target database corresponding to the area identifier; the target microservice module queries the target database for execution data associated with the task to be executed according to the task processing instruction; the target microservice module executes the task to be executed according to the execution data, and obtains task result data obtained after executing the task.
[0121] The database contains specific regional identifiers, that is, each regional identifier is associated with a specific regional database, and the database contains all relevant data consistent with the regional identifier, such as customer information, property information, transaction records, etc. The database is the source of data required to perform the task to be performed.
[0122] Among them, the above database ensures that the processed data is associated with the mission execution area, further supporting geographic area capabilities or data isolation requirements.
[0123] The execution data may include information such as specific requirements of the task, required resources, and execution order, and the execution data may be customized according to the specific needs of the task and regional characteristics to ensure that the task can be processed according to the predetermined business logic and efficiency requirements.
[0124] Among them, the specific implementation of the task to be executed by the target microservice module based on the queried execution data may include accessing and operating data in the target database, interacting with external systems, generating reports or updating records, etc.
[0125] For example, in the real estate rental platform D, different types of rental information are managed by different microservice modules, and each microservice module can retrieve the corresponding rental data in the database through the regional identifier, and then be responsible for processing rental requests, such as the release of new housing sources, rent payment processing, rental applications, etc. User A submitted a rental request on platform D, hoping to rent a 50-square-meter south-facing apartment in a certain area in Shanghai. The rental request will be attached with a regional identifier, such as "Shanghai-Xuhui District", and the corresponding task identifier is "rent a 50-square-meter south-facing apartment". After receiving the request, the task scheduler of platform D will "rent a 50-square-meter south-facing apartment" according to the task identifier and assign it to the microservice module responsible for the area, called the "rental service module"; then, after receiving the task, the rental service module will query the regional database associated with it in the module according to the regional identifier, that is, the "Xuhui rental database"; according to the task processing instructions, the rental service module queries the Xuhui rental database for execution data related to user A's rental request, such as a list of available apartments, prices, locations, and other information; the rental service module uses the queried execution data to process user A's rental request, which may include matching user needs, checking the availability of apartments, calculating rents, etc. After executing the task, the rental service module will generate task result data, such as confirming the rented apartment information, rent, lease period, etc., and return this information to user A and / or update the status on platform D.
[0126] It can be seen that the target microservice module in this embodiment can locate and process data related to a specific area according to the area identifier. The data exists in a database consistent with the area, thereby ensuring that the task can be correctly executed for the specific area, which helps to improve the accuracy and efficiency of task processing.
[0127] In a possible example, the target microservice module queries the target database for execution data associated with the task to be executed according to the task processing instruction, including: the target microservice module parses the task to be executed in the task processing instruction to obtain at least one subtask to be executed; the target microservice module uses the subtask as a query identifier, queries the target database to obtain the first data associated with each subtask; when the target microservice module detects that the amount of the first data is greater than or equal to a preset threshold, the target microservice module aggregates the first data to obtain execution data; or, when the target microservice module detects that the amount of the first data is less than a preset threshold, the target microservice module sends an error prompt to the task scheduler.
[0128] The above-mentioned task to be performed can be divided into multiple subtasks, each of which represents a specific part or step of the task. Each subtask has its own specific query identifier, which is used to query the data associated with it in the target database, and each subtask may correspond to one or more data records.
[0129] The first data represents the data necessary for executing the subtask. For example, if the subtask is "calculating sales", the first data may include sales records and price information.
[0130] Among them, the above-mentioned preset threshold is used to confirm whether the minimum requirements for executing the task are met. If the amount of first data is greater than or equal to the preset threshold, it means that there is sufficient data to support the execution of the task. At this time, all retrieved first data will be aggregated to form the final execution data; if it is detected that the amount of first data is less than the preset threshold, the target microservice module will consider that the data is insufficient and the task cannot be executed. In this case, the target microservice module will send an error prompt to the task scheduler, notifying the scheduler that the task execution conditions are not met and further processing or waiting for more data is required.
[0131] The above-mentioned preset threshold is set according to the requirements of the task and the design of the system. It reflects the amount of data required for task execution. The preset threshold can be adjusted according to actual conditions to adapt to different business requirements and system loads.
[0132] The execution data is used to execute the task to be executed.
[0133] For example, there is a function in the real estate rental platform D that allows users to filter houses according to specific conditions (such as location, price range, room type, etc.). The user chooses to find a "two-bedroom, one-living room" house in "Chaoyang District" and sets the rent in the price range of "3,000-5,000 yuan". The above conditions are combined to form a task processing instruction; the target microservice module first parses this task processing instruction to determine the subtasks to be executed, and the obtained subtasks may be "locating houses in Chaoyang District", "filtering two-bedroom, one-living room house types" and "filtering the price range of 3,000-5,000 yuan"; each subtask will be searched in the target database with it as a query identifier, and the query may obtain a variety of first data such as a list of each room type and a list of houses in each price range; if the number of first data associated with a subtask reaches the preset threshold, it means that there is enough data for further integration and analysis. For example, if there are at least 10 houses in the screening results that meet the user's conditions, the microservice module will aggregate these houses to form execution data. If a subtask returns insufficient data, for example, there are no "two-bedroom, one-living-room" properties in "Chaoyang District" that meet the user's price range, then the amount of data may be lower than the threshold. In this case, the microservice module will send an error prompt to the task scheduler, and the task scheduler may further recommend to the user to adjust the search conditions based on this prompt, or notify the user that not enough properties were found under the current search conditions.
[0134] It can be seen that the target microservice module in this embodiment can ensure that there is sufficient data support when executing tasks, thereby improving the accuracy and reliability of task execution. At the same time, it can also promptly notify the system administrator or scheduler about insufficient data so that corresponding measures can be taken.
[0135] In a possible example, the task scheduler generates a task processing response corresponding to the task processing request based on the task result data, including: updating a message queue in the task scheduling system based on the task result data; and generating a task processing response corresponding to the task processing request based on the message queue.
[0136] Among them, the message queue is a data structure used to store and manage task messages that need to be processed so that they can be processed in sequence.
[0137] Among them, updating the message queue may include adding the task result data as a new message item to the queue, or updating the status of an existing message item to reflect the completion of the task, or adjusting the task status or priority in the message queue according to the task result data.
[0138] The task processing response includes the task execution status, result data, and possible error information or abnormal conditions.
[0139] For example, the backend system of the rental platform receives a rental request from user Ms. Zhang, which includes a task identifier (such as "rental request") and a regional identifier (such as "Pudong New District, Shanghai"). Ms. Zhang hopes to find a two-bedroom, one-living room apartment in Pudong New District with a rent of 4,000-6,000 yuan. The task scheduler generates a corresponding task processing instruction based on the received task processing request, and this instruction carries the regional identifier "Pudong New District, Shanghai". The task scheduler further sends this task processing instruction to the target microservice module corresponding to the "rental request" - the housing source search module, and the housing source search module performs the search task according to the regional identifier "Pudong New District, Shanghai". At the same time, there are multiple similar rental requests to be processed. The task scheduler will arrange the task processing instructions according to the priority of each regional identifier to ensure that the requests from high-priority areas are processed first, and before generating the task processing instruction, the task scheduler will first check whether the number of pending task requests exceeds the preset request number threshold. If so, the system will suspend the processing of requests with too high concurrency in those areas to prevent overload. The housing search module searches for matching housing data in the corresponding regional database according to the regional identifier. It can parse the detailed rental requirements (such as rental range, room type, etc.) in the task processing instruction, and then query the database to obtain the data associated with each subtask. At this time, the number of data obtained by the query meets the preset threshold. The housing search module summarizes this data as the execution result of the task. The task scheduler updates the message queue in the task scheduling system according to the task result data returned by the housing search module, and generates a task processing response corresponding to the task processing request according to the latest status of the message queue. The response is a web link containing a list of matching housing sources. Ms. Zhang can view and select the housing source she likes through this link.
[0140] It can be seen that in this embodiment, the task scheduler reflects the status and results of task execution by updating the message queue, which helps the task scheduling system to maintain real-time monitoring and tracking of the task execution status.
[0141] It should be noted that, in each of the above-mentioned embodiments, there is not necessarily a certain order between the above-mentioned steps. A person skilled in the art can understand, based on the description of the embodiments of the present application, that in different embodiments, the above-mentioned steps may have different execution orders, that is, they may be executed in parallel, may be executed interchangeably, and so on.
[0142] As another aspect of the embodiment of the present application, the embodiment of the present application provides a task scheduling and processing device. The task scheduling and processing device can be a software module, and the software module includes a number of instructions stored in a memory, and the processor can access the memory and call the instructions for execution to complete the task scheduling and processing method described in each of the above embodiments.
[0143] See also Figure 3 , Figure 3 Schematic diagram of a task scheduling and processing device provided in an embodiment of the present application. Figure 3 As shown, it is characterized in that it is applied to a task scheduling system, the task scheduling system includes a task scheduler and a microservice module cluster, the microservice module cluster includes multiple microservice modules, different microservice modules are used to process different tasks, and the task scheduling and processing device includes:
[0144] A receiving unit 301 is used to receive a task processing request, wherein the task processing request includes a task identifier and a region identifier, wherein the task identifier is used to indicate a task to be executed, and the region identifier is used to indicate a request region corresponding to the task processing request;
[0145] A generating unit 302, configured to generate a task processing instruction corresponding to the task processing request, wherein the task processing instruction carries the area identifier;
[0146] The issuing unit 303 is used to issue the task processing instruction to the target microservice module corresponding to the task identifier, and execute the task to be executed according to the area identifier;
[0147] The receiving unit 301 is further used to receive task result data obtained after the target microservice module executes the task;
[0148] The generating unit 302 is further configured to generate a task processing response corresponding to the task processing request according to the task result data.
[0149] The method can accurately identify and locate the geographical area corresponding to the task processing request according to the regional identifier in each task processing request, so that the task can be managed according to the geographical location or other regional attributes, which is conducive to regional service optimization and resource management, and improves the response speed; secondly, the method further realizes centralized task scheduling through the microservice module cluster, that is, unified release and service management promote resource sharing and collaborative work between different regions, and realizes the transformation of independent release between multiple regions into unified release of unified services, reducing the complexity and workload of separate deployment in different regions, and further reducing the cost of maintaining independent systems in different regions through unified task scheduling and management; further, when facing task requests from different regions, the task scheduler can evenly distribute the requests to the corresponding microservice modules for processing according to the different regions and task types, each microservice module processes its own task type, and the functional boundaries of each unit are clear and independent of each other, which can effectively disperse the load and prevent single point overload; finally, in the method, each microservice module independently processes the tasks of a specific area, and the obtained task result data is then uniformly collected and responded by the task scheduler, which further optimizes the data flow path, simplifies data management, and provides convenience for data analysis and decision support. Overall, this task scheduling method greatly enhances the dynamic scheduling capability, resource utilization efficiency and service personalization level of the task scheduling system, and provides users with more accurate and rapid service response capabilities.
[0150] In one embodiment, there are multiple task processing requests; before the task scheduler generates a target task processing instruction according to the target task identifier, the generating unit 302 is also used for: the task scheduler generates a request processing queue according to the priority of the area identifier in each task processing request, wherein the order of each task processing request in the request processing queue is positively correlated with the priority of the area identifier corresponding to each task processing request; in the task scheduler generating the task processing instruction corresponding to the task processing request, the generating unit 302 is also used for: the task scheduler generates the task processing instruction corresponding to the task processing request according to the request processing queue.
[0151] In one embodiment, there are multiple task processing requests; when the task scheduler sends the task processing instruction to the target microservice module corresponding to the task identifier, the sending unit 303 is also used for: the task scheduler generates an instruction sending queue according to the priority of the area identifier in each task processing instruction, wherein the order of each task processing instruction in the instruction sending queue is positively correlated with the priority of the area identifier in each task processing instruction; the task scheduler sends the task processing instruction to the target microservice module corresponding to the task identifier according to the instruction sending queue.
[0152] In one embodiment, there are multiple task processing requests. Before the task scheduler generates the task processing instructions corresponding to the task processing requests, the generation unit 302 is also used for: the task scheduler detects whether the number of the multiple task processing requests exceeds the preset request value; if so, the task scheduler obtains the area identifier corresponding to each task processing request in the multiple task processing requests to obtain the unscheduled area identifier; the task scheduler determines the number of scheduled area identifiers corresponding to each unscheduled area identifier, the number of scheduled area identifiers is the number of area identifiers that are currently scheduled, and the currently scheduled area identifier refers to the area identifier corresponding to the task being executed by the microservice module in the microservice module cluster; the task scheduler suspends processing of the target task processing request among the multiple task processing requests, and the target task processing request is the task processing request corresponding to the unscheduled area identifier whose number of scheduled area identifiers exceeds the preset area concurrency number.
[0153] In one embodiment, when the target microservice module executes the task to be executed according to the area identifier, the generating unit 302 is further used for: the target microservice module queries the area database associated with the area identifier in the target microservice module according to the area identifier, and obtains the target database corresponding to the area identifier; the target microservice module queries the execution data associated with the task to be executed in the target database according to the task processing instruction; the target microservice module executes the task to be executed according to the execution data, and obtains the task result data obtained after executing the task.
[0154] In one embodiment, the target microservice module queries the target database for execution data associated with the task to be executed according to the task processing instruction, and the generation unit 302 is also used for: the target microservice module parses the task to be executed in the task processing instruction to obtain at least one subtask to be executed; the target microservice module uses the subtask as a query identifier and queries the target database to obtain the first data associated with each subtask; when the target microservice module detects that the amount of the first data is greater than or equal to a preset threshold, the target microservice module aggregates the first data to obtain execution data; or, when the target microservice module detects that the amount of the first data is less than a preset threshold, the target microservice module sends an error prompt to the task scheduler.
[0155] In one embodiment, when the task scheduler generates a task processing response corresponding to the task processing request based on the task result data, the generation unit 302 is also used to: update the message queue in the task scheduling system based on the task result data; and generate the task processing response corresponding to the task processing request based on the message queue.
[0156] The task scheduling and processing device can also be constructed by hardware devices. For example, the task scheduling and processing device can be constructed by one or more chips, and each chip can work in coordination with each other to complete the task scheduling and processing methods described in the above embodiments. For another example, the task scheduling and processing device can also be constructed by various logic devices, such as a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA), a single-chip microcomputer, an ARM (Acorn RISC Machine) or other programmable logic device, discrete gate or transistor logic, discrete hardware components, or any combination of these components.
[0157] It should be noted that the above-mentioned task scheduling and processing device can execute the task scheduling and processing method provided in the implementation mode of this application, and has the functional modules and beneficial effects corresponding to the execution method. For technical details not fully described in the implementation mode of the task scheduling and processing device, please refer to the task scheduling and processing method provided in the implementation mode of this application.
[0158] See also Figure 4 , Figure 4 4 is a schematic diagram of a computer device provided in an embodiment of the present application. The computer device includes one or more processors 41 and a memory 42. The memory 42 is connected to the one or more processors 41, for example, connected to the processor 41 via a bus.
[0159] The processor 41 is configured to support the computer device to perform the corresponding functions in the method in the above method embodiment. The processor 41 can be a central processing unit (CPU), a network processor (NP), a hardware chip or any combination thereof. The above hardware chip can be an application specific integrated circuit (ASIC), a programmable logic device (PLD) or a combination thereof. The above PLD can be a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL) or any combination thereof.
[0160] The memory 42 is used to store program codes, etc. The memory 42 may include a volatile memory (VM), such as a random access memory (RAM); the memory 42 may also include a non-volatile memory (NVM), such as a read-only memory (ROM), a flash memory, a hard disk drive (HDD) or a solid-state drive (SSD); the memory 42 may also include a combination of the above-mentioned types of memories.
[0161] The memory 42 can be used to store non-volatile software programs, non-volatile computer executable programs and modules, such as program instructions / modules corresponding to the vehicle diagnostic method in the embodiment of the present application. The processor 41 executes the various functional applications and data processing of the vehicle diagnostic method and computer equipment by running the non-volatile software programs, instructions and modules stored in the memory, that is, realizes the functions of the vehicle diagnostic method and various modules or units of the computer equipment provided in the above method embodiment.
[0162] The memory 42 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and an application required for at least one function. The data storage area may store data created according to the use of the vehicle diagnostic device, etc. In some embodiments, the memory 42 may optionally include a memory remotely arranged relative to the processor, and these remote memories may be connected to the vehicle diagnostic device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0163] The one or more modules are stored in the memory, and when executed by the one or more processors, perform the task scheduling and processing method in any of the above-mentioned method embodiments, for example, execute the method steps described in the above-mentioned method embodiments to realize the functions of the modules described in the above-mentioned device embodiments.
[0164] An embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, wherein the computer program includes program instructions, and when the program instructions are executed by a computer, the computer executes the method described in the above embodiment.
[0165] A person skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the program can be stored in a computer-readable storage medium, and when the program is executed, it can include the processes of the embodiments of the above-mentioned methods. The storage medium can be a disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc.
[0166] The above disclosure is only the preferred embodiment of the present application, which certainly cannot be used to limit the scope of rights of the present application. Therefore, equivalent changes made according to the claims of the present application are still within the scope covered by the present application.
Claims
1. A task scheduling and processing method, characterized in that: Applied to a task scheduling system, the task scheduling system includes a task scheduler and a microservice module cluster, the microservice module cluster includes multiple microservice modules, and different microservice modules are used to process different tasks. The method includes: The task scheduler receives a task processing request, the task processing request includes a task identifier and a region identifier, the task identifier is used to indicate a task to be executed, and the region identifier is used to indicate a request region corresponding to the task processing request; The task scheduler generates a task processing instruction corresponding to the task processing request, wherein the task processing instruction carries the area identifier; The task scheduler sends the task processing instruction to the target microservice module corresponding to the task identifier, and the target microservice module executes the task to be executed according to the area identifier; The task scheduler receives the task result data obtained after the target microservice module executes the task; The task scheduler generates a task processing response corresponding to the task processing request according to the task result data.
2. The method according to claim 1, characterized in that There are multiple task processing requests; before the task scheduler generates a target task processing instruction according to the target task identifier, the task scheduler further includes: The task scheduler generates a request processing queue according to the priority of the region identifier in each task processing request, wherein the order of each task processing request in the request processing queue is positively correlated with the priority of the region identifier corresponding to each task processing request; The task scheduler generating a task processing instruction corresponding to the task processing request includes: The task scheduler generates a task processing instruction corresponding to the task processing request according to the request processing queue.
3. The method according to claim 1, characterized in that There are multiple task processing requests; the task scheduler sends the task processing instruction to the target microservice module corresponding to the task identifier, including: The task scheduler generates an instruction dispatch queue according to the priority of the region identifier in each task processing instruction, wherein the order of each task processing instruction in the instruction dispatch queue is positively correlated with the priority of the region identifier in each task processing instruction; The task scheduler sends the task processing instruction to the target microservice module corresponding to the task identifier according to the instruction sending queue.
4. The method according to claim 1, characterized in that: There are multiple task processing requests. Before the task scheduler generates task processing instructions corresponding to the task processing requests, the method further includes: The task scheduler detects whether the number of the plurality of task processing requests exceeds a preset request value; If yes, the task scheduler obtains the region identifier corresponding to each of the multiple task processing requests to obtain an unscheduled region identifier; The task scheduler determines the number of scheduled region identifiers corresponding to each unscheduled region identifier, where the number of scheduled region identifiers is the number of currently scheduled region identifiers, and the currently scheduled region identifiers are region identifiers corresponding to tasks being executed by microservice modules in the microservice module cluster; The task scheduler suspends processing of a target task processing request among the multiple task processing requests, where the target task processing request is a task processing request corresponding to an unscheduled area identifier whose number of scheduled area identifiers exceeds a preset area concurrency number.
5. The method according to claim 1, characterized in that The target microservice module executes the task to be executed according to the area identifier, including: The target microservice module queries the regional database associated with the regional identifier in the target microservice module according to the regional identifier to obtain the target database corresponding to the regional identifier; The target microservice module queries the target database for execution data associated with the task to be executed according to the task processing instruction; The target microservice module executes the task to be executed according to the execution data, and obtains task result data obtained after executing the task.
6. The method according to claim 5, characterized in that The target microservice module queries the target database for execution data associated with the task to be executed according to the task processing instruction, including: The target microservice module parses the task to be executed in the task processing instruction to obtain at least one subtask to be executed; The target microservice module uses the subtask as a query identifier, and queries the target database to obtain the first data associated with each subtask; When the target microservice module detects that the amount of the first data is greater than or equal to a preset threshold, the target microservice module aggregates the first data to obtain execution data; or, When the target microservice module detects that the amount of the first data is less than a preset threshold, the target microservice module sends an error prompt to the task scheduler.
7. The method according to claim 1, characterized in that The task scheduler generates a task processing response corresponding to the task processing request according to the task result data, including: According to the task result data, updating the message queue in the task scheduling system; A task processing response corresponding to the task processing request is generated according to the message queue.
8. A task scheduling and processing device, characterized in that: Applied to a task scheduling system, the task scheduling system includes a task scheduler and a microservice module cluster, the microservice module cluster includes multiple microservice modules, and different microservice modules are used to process different tasks. The device includes: A receiving unit, configured to receive a task processing request, wherein the task processing request includes a task identifier and a region identifier, wherein the task identifier is used to indicate a task to be executed, and the region identifier is used to indicate a request region corresponding to the task processing request; A generating unit, configured to generate a task processing instruction corresponding to the task processing request, wherein the task processing instruction carries the area identifier; A sending unit, used to send the task processing instruction to the target microservice module corresponding to the task identifier, and execute the task to be executed according to the area identifier; The receiving unit is further used to receive task result data obtained after the target microservice module executes the task; The generating unit is further configured to generate a task processing response corresponding to the task processing request according to the task result data.
9. A computer device, characterized in that: The method comprises a memory and a processor, wherein the memory is connected to the processor, and the processor is used to execute one or more computer programs stored in the memory. When the processor executes the one or more computer programs, the computer device implements the method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program includes program instructions, and when the program instructions are executed by a processor, the processor is caused to perform the method according to any one of claims 1 to 7.
Citation Information
Cited By
Regional digital brain-based supply and elimination scheduling platform
CN118863483A
