Task processing method and cloud server

By extracting task processing requests in the cloud server and determining the target process based on memory requirements, the existing cloud servers are solved inadequate resource utilization and unreasonable memory regulation when processing big data tasks, and efficient task processing and cloud server stability are achieved.

CN120196416APending Publication Date: 2025-06-24GREAT WALL MOTOR CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510305678.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-14
Publication Date
2025-06-24

AI Technical Summary

Technical Problem

When handling big data tasks, existing cloud servers cannot fully utilize and coordinate the resources of each process in the cloud server, resulting in low processing efficiency and cannot reasonably regulate task processing based on the memory occupancy rate of the cloud server, resulting in a high possibility of cloud server crash.

Method used

A task processing method is proposed. By extracting a task processing request from a business processing database, determining the target process based on the task processing request, the target process is at least one idle process, and sending the task processing request to the target process, the target process processes the task processing request and outputs the processing result. This method can determine the appropriate number of target processes based on the memory required for task processing requests, ensuring that the number of target processes is consistent with the memory conditions of the task processing requests and the cloud server.

Benefits of technology

By executing task processing requests at the same time by multiple target processes, the processing efficiency of task processing requests is improved, the cloud server is avoided, and the stability and efficiency of cloud servers are ensured.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120196416A_ABST
    Figure CN120196416A_ABST
Patent Text Reader

Abstract

The invention provides a task processing method and a cloud server, which are applied to the technical field of large task processing, and the method comprises the following steps: during task processing, extracting a task processing request from a business processing database, determining a target process based on the task processing request and / or the memory occupancy rate of the cloud server, in this way, the number of the target processes matched with the task processing request and suitable for the current cloud server state can be determined, and when the finally determined appropriate number of target processes execute the task processing request at the same time, the efficiency of the task processing request can be improved, and it can be ensured that the cloud server cannot be blocked or crashed; according to the task processing method, the task processing request is issued to the target process, the target process processes the task processing request and outputs the processing result, so that only the target process executes the task processing request, other processes do not execute the task processing request, and the task processing efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the technical field of large task processing, and particularly relates to a task processing method and a cloud server. Background Art

[0002] A cloud server is a virtualized server that can dynamically allocate computing resources and provide elastic computing capabilities. It connects the in-vehicle system with the cloud server through a cloud computing platform to achieve data transmission, storage, and processing, and provides various intelligent services and functions for the vehicle.

[0003] In practical applications, a large amount of vehicle data is often processed based on a cloud server. When the existing cloud server processes big data tasks, it cannot fully utilize and coordinate the resources of each process in the cloud server, resulting in low processing efficiency, and it cannot reasonably regulate the task processing process based on the memory occupancy rate of the cloud server, resulting in a high possibility of cloud server crashes. Summary of the Invention

[0004] In view of this, the purpose of this application is to propose a task processing method and a cloud server to solve the problem of low processing efficiency of the cloud server when processing big data tasks.

[0005] Based on the above purpose, the first aspect of this application provides a task processing method, which is applied to a cloud server. The cloud server includes multiple idle processes, and the method includes:

[0006] Extract a task processing request from the business processing database;

[0007] Based on the task processing request, determine a target process, where the target process is at least one of the idle processes;

[0008] Send the task processing request to the target process, and the target process processes the task processing request and outputs a processing result.

[0009] This method can determine an appropriate number of target processes based on the memory required by the task processing request. The number of target processes determined in this way can exactly match the task processing request and the current memory situation of the cloud server. In this way, when the target process processes the task processing request and outputs a processing result, when an appropriate number of target processes execute the task processing request simultaneously, a large amount of data in the same task processing request can be allocated to different target processes for execution. In this way, multiple target processes execute tasks simultaneously, which can not only improve the processing efficiency of the task processing request, but also ensure that the cloud server does not experience lag or crashes.

[0010] Optionally, the determining a target process based on the task processing request includes:

[0011] Parse the task processing request to obtain the task to be processed, where each task processing request corresponds to at least one task to be processed;

[0012] Determine the target process based on the number of tasks to be processed.

[0013] When determining the target process, first parse the task processing request to obtain the task to be processed, and then determine the number of target processes that is adapted to the number of tasks to be processed and applicable to the current memory occupancy of the cloud server based on the number of tasks to be processed. In this way, when the finally determined appropriate number of target processes execute the task processing request simultaneously, a large amount of data in the same task processing request can be distributed to different target processes for execution. In this way, multiple target processes execute tasks simultaneously, which can not only improve the efficiency of the task processing request, but also ensure that the cloud server will not freeze or crash.

[0014] Optionally, the determining the target process based on the number of tasks to be processed includes:

[0015] Obtain the memory occupancy rate of the cloud server;

[0016] In response to the number of tasks to be processed being less than the first preset number, determine the first preset number of idle processes as the target processes;

[0017] In response to the number of tasks to be processed being equal to the first preset number, determine the first preset number of idle processes as the target processes;

[0018] In response to the number of tasks to be processed being greater than the first preset number and the memory occupancy rate of the cloud server being less than the preset occupancy rate, determine the first preset number of idle processes as the target processes;

[0019] In response to the number of tasks to be processed being greater than the first preset number and the memory occupancy rate of the cloud server being greater than the preset occupancy rate, determine the second preset number of idle processes as the target processes, where the second preset number is less than the first preset number.

[0020] When the number of tasks to be processed is less than the first preset number, the memory required to process these tasks to be processed is small. Therefore, there is no need to consider the memory occupancy rate of the cloud server, and directly determine the first preset number of idle processes as the target processes. When the number of tasks to be processed is greater than the first preset number, the memory required to process these tasks to be processed is large. Therefore, it is necessary to further combine the memory occupancy rate of the cloud server to determine the number of target processes. In this way, the number of target processes that matches both the number of tasks to be processed and the memory occupancy rate of the cloud server can be finally determined. When the target processes with the finally determined appropriate number simultaneously execute the task processing request, it can not only improve the efficiency of the task processing request, but also ensure that the cloud server will not experience lag or crash.

[0021] Optionally, when the task processing request is sent to the target processes, the target processes process the task processing request and output a processing result, including:

[0022] In response to the number of target processes being the same as the number of tasks to be processed, each task to be processed is respectively sent to a target process. Each target process processes the corresponding task to be processed and outputs a task processing result. The task processing results output by all target processes are combined to generate the processing result corresponding to the task processing request and output;

[0023] Or, in response to the number of target processes being less than the number of tasks to be processed, one or more tasks to be processed are sent to a target process. Each target process processes the corresponding one or more tasks to be processed and outputs the task processing result corresponding to each task to be processed. The task processing results output by all target processes are combined to generate the processing result corresponding to the task processing request and output.

[0024] When the number of target processes is the same as the number of tasks to be processed, controlling each target process to correspond to a task to be processed respectively, and each target process processes the corresponding task to be processed and outputs a task processing result can greatly improve the efficiency of task processing. When the number of target processes is less than the number of tasks to be processed, controlling each target process to process the corresponding one or more tasks to be processed can reduce the number of target processes used, reduce the memory space occupied when the target processes execute tasks simultaneously, and thus avoid the cloud server from lagging or crashing. At the same time, it can also ensure that multiple tasks to be processed can be executed by the same or different target processes simultaneously, ensuring the processing efficiency and avoiding the situation where a certain task to be processed waits for too long.

[0025] Optionally, each target process processes the corresponding task to be processed and outputs a task processing result, including:

[0026] Parse the to-be-processed task to obtain multiple pieces of to-be-processed data;

[0027] Configure multiple task processing threads for the target process, where the number of the task processing threads is less than or equal to a first preset threshold;

[0028] Allocate multiple pieces of to-be-processed data to each of the task processing threads, and the task processing threads process the multiple pieces of to-be-processed data and output data processing results;

[0029] Merge the data processing results output by all the task processing threads to generate a task processing result.

[0030] When the target process processes a corresponding to-be-processed task, allocate multiple pieces of to-be-processed data to each of the task processing threads, and the task processing threads process the multiple pieces of to-be-processed data and output data processing results. In this way, it can be ensured that each piece of to-be-processed data can be processed by a task processing thread, without causing data loss or omission. In addition, multiple task processing threads process simultaneously, which can greatly improve the data processing efficiency.

[0031] Optionally, each target process processes corresponding multiple to-be-processed tasks and outputs a task processing result corresponding to each to-be-processed task, including:

[0032] Configure multiple task processing threads for the target process, where the number of the task processing threads is greater than the number of the to-be-processed tasks and less than or equal to a second preset threshold;

[0033] Allocate multiple task processing threads to each of the to-be-processed tasks, and the multiple task processing threads process the to-be-processed task simultaneously and output a task processing result corresponding to the to-be-processed task.

[0034] Allocate multiple task processing threads to each of the to-be-processed tasks, and the multiple task processing threads process the to-be-processed task simultaneously. In this way, a large amount of data in the same to-be-processed task can be distributed to different task processing threads for simultaneous execution. In this way, multiple task processing threads execute a to-be-processed task simultaneously, which can improve the processing efficiency of each to-be-processed task and will not cause duplicate processing or omission of the to-be-processed tasks.

[0035] Optionally, the multiple task processing threads process the to-be-processed task simultaneously and output a task processing result corresponding to the to-be-processed task, including:

[0036] Parse the to-be-processed task to obtain multiple pieces of to-be-processed data;

[0037] Allocate multiple pieces of data to be processed to each of the task processing threads, and the task processing threads process the multiple pieces of data to be processed and output data processing results;

[0038] Merge the data processing results output by all task processing threads to generate a task processing result.

[0039] When the target process processes corresponding multiple tasks to be processed, allocate multiple task processing threads to each task to be processed, and each task processing thread corresponds to multiple pieces of data to be processed. In this way, it can be ensured that each piece of data to be processed can be processed by a task processing thread, without causing data loss or omission. In addition, multiple task processing threads process a task to be processed simultaneously, which can greatly improve the task processing efficiency.

[0040] Optionally, the target process processes the task processing request and outputs a processing result, including:

[0041] In response to the target process starting to process the task processing request, mark the first marking information for the task processing request in the service processing database, and monitor the processing duration of the target process for processing the task processing request;

[0042] In response to the processing duration reaching the preset duration and no processing result being output, stop processing the task processing request, and mark the second marking information for the task processing request in the service processing database;

[0043] In response to determining that the processing duration is less than the preset duration and a processing result is output, mark the third marking information for the task processing request in the service processing database;

[0044] In response to determining that the processing duration is equal to the preset duration and a processing result is output, mark the third marking information for the task processing request in the service processing database.

[0045] During the process that the target process processes the task processing request and outputs a processing result, when the processing duration reaches a preset duration and no processing result is output, it indicates that the task processing times out, and the task with processing timeout is marked with second marking information. At this time, based on the second marking information, the situation of task processing can be determined; when it is determined that the processing duration is less than or equal to the preset duration and a processing result is output, it indicates that the task processing is normal, and the task with normal processing is marked with third marking information. At this time, based on the third marking information, the situation of task processing can be determined. In this way, the situation of task processing can be quickly understood based on the second marking information and the third marking information; in addition, by marking the second marking information and the third marking information in the business processing database, the marking information after task processing can be updated to the business processing database in a timely manner, which is convenient for subsequent execution of related operations and ensures that a certain task processing request will not be omitted or processed repeatedly.

[0046] Optionally, the method further includes:

[0047] Search for and delete the task processing request corresponding to the second marking information from the business processing database;

[0048] And / or in response to receiving a new task processing request, arrange the task processing request in chronological order and store it in the business processing database.

[0049] In this way, the task processing requests with processing duration timeout can be deleted regularly or periodically, avoiding occupying the resources of the business processing database.

[0050] Based on the same inventive concept, a second aspect of the present application provides a cloud server, including a memory, a processor, and a computer program stored on the memory and running on the processor. When the processor processes the program, it implements the method according to any one of the above first aspects.

[0051] Based on the same inventive concept, a third aspect of the present application provides a task processing device. The task processing device includes a cloud server, and the cloud server includes a plurality of idle processes.

[0052] The task processing device includes:

[0053] An extraction module, configured to extract a task processing request from the business processing database;

[0054] A determination module, configured to determine a target process based on the task processing request, where the target process is at least one of the idle processes;

[0055] An execution module, configured to send the task processing request to the target process, and the target process processes the task processing request and outputs a processing result.

[0056] Based on the same inventive concept, a fourth aspect of the present application provides a computer-readable storage medium storing computer instructions for causing a computer to process the task processing method according to any one of the first aspects above.

[0057] Based on the same inventive concept, a fifth aspect of the present application provides a computer program product including computer program instructions that, when run on a computer, cause the computer to process the task processing method according to any one of the first aspects above.

[0058] As can be seen from the above, for the task processing method and the cloud server provided in the present application, when processing a task, first, a task processing request is extracted from a service processing database, and then a target process is determined based on the task processing request, where the target process is at least one of the idle processes. In this way, an appropriate number of target processes can be determined based on the memory required by the task processing request, and the number of the determined target processes can exactly match the task processing request and the memory situation of the current cloud server. Thus, when the target processes process the task processing request and output a processing result, when an appropriate number of target processes simultaneously execute the task processing request, a large amount of data in the same task processing request can be distributed to different target processes for execution. In this way, multiple target processes execute the task simultaneously, which can not only improve the processing efficiency of the task processing request but also ensure that the cloud server does not freeze or crash. Then, the task processing request is sent to the target processes, and the target processes process the task processing request and output a processing result. In this way, the task processing request will only be sent to the determined target processes, and only the target processes will execute the task processing request, and other processes will not execute the task processing request, avoiding the situation of multiple processes simultaneously competing for a task processing request and causing deadlocks, ensuring that multiple threads in the cloud server can work in coordination and improving the task processing efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0059] To more clearly illustrate the technical solutions in the present application or related technologies, the following will briefly introduce the drawings required for use in the description of the embodiments or related technologies. Obviously, the drawings in the following description are only the embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.

[0060] Figure 1 It is the first flow diagram of the task processing method according to the embodiment of the present application;

[0061] Figure 2 It is the second flow diagram of the task processing method according to the embodiment of the present application;

[0062] Figure 3 Schematic diagram of the task processing device according to an embodiment of the present application;

[0063] Figure 4 Schematic diagram of the cloud server according to an embodiment of the present application. Detailed implementation manners

[0064] To make the objectives, technical solutions and advantages of the present application clearer and more understandable, the present application will be further described in detail below with reference to specific embodiments and the accompanying drawings.

[0065] It should be noted that unless otherwise defined, the technical terms or scientific terms used in the embodiments of the present application should have the ordinary meanings understood by those of ordinary skill in the art to which the present application belongs. The "first", "second" and similar terms used in the embodiments of the present application do not denote any order, quantity or importance, but are only used to distinguish different components. The terms such as "including" or "comprising" mean that the elements or items appearing before this term cover the elements or items listed after this term and their equivalents, without excluding other elements or items. The terms such as "connected" or "coupled" are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. The terms such as "upper", "lower", "left" and "right" are only used to represent relative positional relationships, and when the absolute position of the object being described changes, the relative positional relationship may also change accordingly.

[0066] With the continuous development and maturity of cloud computing technology, cloud servers of vehicles have been more and more widely used, promoting the intelligent and interconnected development of the automotive industry.

[0067] The cloud server of a vehicle refers to the cloud computing technology applied in the automotive field, which provides various services and applications through the cloud server to achieve data interaction and information sharing between vehicles and between the vehicle and the outside world. It is based on cloud computing technology and stores and processes a large amount of vehicle data and applications through the cloud server, including the position of the vehicle, driving status, sensor data, in-vehicle entertainment, intelligent navigation, etc.

[0068] A cloud server is a virtualized server that can dynamically allocate computing resources and provide elastic computing capabilities. It connects the in-vehicle system of the vehicle with the cloud server through a cloud computing platform to realize data transmission, storage and processing, and provides various intelligent services and functions for the vehicle.

[0069] The specific functions of the cloud server include:

[0070] Remote monitoring and management: Through the cloud server, vehicle information can be uploaded to the cloud platform, and the driver can view the real-time status and position of the vehicle at any time through a terminal such as a mobile phone.

[0071] Data storage and processing: The cloud server stores and processes a large amount of vehicle data, including driving status, sensor data, etc.

[0072] Intelligent driving assistance: Provide intelligent driving assistance functions, such as real-time traffic information, automatic navigation, etc.

[0073] Fault diagnosis and maintenance: Detect vehicle faults in advance and provide repair suggestions.

[0074] In practical applications, a large amount of vehicle data is often processed based on the cloud server, such as batch export of emergency rescue data, batch import of large customer data, statistical sorting of user remote control habits, calculation and processing of a large amount of vehicle condition data, etc. The processing of a large amount of data often requires a large amount of memory space and a very high CPU occupancy rate.

[0075] Currently, the following problems exist when processing a large amount of data:

[0076] 1. Processing each task processing request separately results in a long business processing time or a high calculation amount. A very high calculation amount is extremely likely to cause the system of the cloud server to freeze, or even crash directly, resulting in the unavailability of the cloud server.

[0077] 2. If the synchronous method is used to process business tasks, the next task needs to wait for the previous task to complete before it can execute the next task. This will cause multiple tasks to queue up, and the utilization efficiency of each process in the cloud server is not high, resulting in a waste of resources, and the extremely long waiting time brings a bad experience to users.

[0078] 3. Multiple threads in the cloud server cannot work in coordination. There may be a situation where some threads cannot be fully utilized, or there may be a situation where multiple threads simultaneously compete for a business task, resulting in deadlocks.

[0079] 4. When the task data volume is large, generally a third-party plugin is used for processing, resulting in low processing efficiency and the problem of system instability caused by the crash of the third-party plugin.

[0080] 5. It is impossible to reasonably regulate the task processing process based on the system memory space and CPU occupancy rate of the cloud server, resulting in a high possibility of the cloud server crashing.

[0081] To sum up, the existing cloud servers cannot make full use of and coordinate the resources of each process in the cloud server when processing big data tasks, resulting in low processing efficiency, and cannot reasonably regulate the task processing process based on the memory occupancy rate of the cloud server, resulting in a high possibility of the cloud server crashing.

[0082] Based on this, see Figure 1, this application provides a task processing method, which is applied to a cloud server. The cloud server includes multiple idle processes, and an idle process refers to a process in the cloud server that is not currently executing a task.

[0083] A process is an execution activity of a program on a certain data set in a computer. It is the basic unit for the system to allocate resources and is the foundation of the operating system structure. In the early computer structures designed for processes, a process was the basic execution entity of a program; in contemporary computer structures designed for threads, a process is a container for threads. A program is a description of instructions, data, and their organizational forms, and a process is the entity of a program.

[0084] A process can have many threads, and each thread executes different tasks in parallel. A thread is the smallest unit that the operating system can perform operation scheduling on. It is contained within a process and is the actual operating unit within the process. A thread refers to a single sequential control flow within a process. Multiple threads can be concurrent within a process, and each thread executes different tasks in parallel.

[0085] The task processing method provided by this application specifically includes the following steps:

[0086] Step S100: Extract a task processing request from the business processing database;

[0087] Step S200: Based on the task processing request, determine a target process, where the target process is at least one of the idle processes;

[0088] Step S300: Send the task processing request to the target process, and the target process processes the task processing request and outputs a processing result.

[0089] Specifically, the business processing database is a collection of all business processing requests currently received by the cloud server, and all business processing requests in the business processing database are queued in ascending order of time. And each business processing request in the business processing database is marked with corresponding marking information. For example, when the business processing request has been completed, its corresponding marking information may be "completed" or "1"; when the business processing request times out, its corresponding marking information may be "execution timeout" or "2", etc.

[0090] When the cloud server receives a new task processing request, the task processing request is arranged in ascending order of time and stored in the business processing database, so that the business processing database is updated.

[0091] The cloud server aggregates all the business processing requests that have been received currently in the business processing database and marks each business processing request, which can enhance the overall control ability of the cloud server for all the received business processing requests and avoid situations such as some business processing requests being lost or some business processing requests being executed repeatedly.

[0092] Exemplarily, the business processing request can be a request sent by a user to the cloud server or a request sent by a development side to the cloud server. The content of the business service request can be "vehicle condition data export", "vehicle mileage statistics", "vehicle remote control data export", etc.

[0093] When performing task processing, a task processing request is extracted from the business processing database. Since multiple task processing requests in the business processing database are arranged in ascending order of time, the extracted task processing request must be the one that the cloud server received earliest among the multiple task processing requests waiting to be processed in the business processing database. This can ensure the timeliness and effectiveness of the task processing request and avoid the situation of the task processing request being processed repeatedly or waiting for too long.

[0094] After extracting the task processing request, based on the task processing request, a target process is determined, and the target process is at least one of the idle processes.

[0095] Among them, since the processing tasks and processing contents corresponding to each task processing request are different, the memory required to execute each task processing request is different. In addition, when the memory occupancy rate of the cloud server (including memory occupancy rate and / or CPU occupancy rate) is different, the amount of tasks it can execute or the memory space available for executing tasks is also different. If the cloud server is forced to execute a very large amount of tasks when its memory occupancy rate is very high, it is very likely to cause the cloud server to freeze or even crash, greatly reducing the task processing efficiency.

[0096] Therefore, in this application, based on the task processing request, a target process is determined, and the target process is at least one of the idle processes.

[0097] The more target processes there are, the more processes can execute the task processing request simultaneously, and the higher the processing efficiency of the task processing request. However, at the same time, the memory and CPU occupancy rates required for multiple target processes to execute tasks simultaneously are also higher.

[0098] Correspondingly, the fewer target processes there are, the fewer processes can execute the task processing request simultaneously, and the lower the processing efficiency of the task processing request. However, at the same time, the memory and CPU occupancy rates required for fewer target processes to execute tasks simultaneously are also lower.

[0099] Therefore, in this application, by comprehensively considering the memory required for the task processing request and / or the memory occupancy rate of the cloud server, the number of target processes matching the task processing request is determined, so as to make full use of and coordinate the resources of each process in the cloud server. In this way, when the appropriate number of target processes finally determined execute the task processing request simultaneously, the efficiency of the task processing request can be improved, and it can be ensured that the cloud server will not experience jams or crashes.

[0100] After determining the target process, the task processing request is sent to the target process, and the target process processes the task processing request and outputs a processing result. In this way, the task processing request will only be sent to the determined target process, and only the target process will execute the task processing request, and other processes will not execute the task processing request, avoiding the situation of deadlock caused by multiple processes simultaneously competing for a task processing request, and also avoiding the situation where some processes cannot be fully utilized while some processes continuously process multiple tasks, ensuring that multiple threads in the cloud server can work in coordination and improving the task processing efficiency.

[0101] The processing result can be "executed and successful", or "executed and failed", or a preset default value (such as "0"). When the processing result is the preset default value, it indicates that a failure occurred during the task execution process.

[0102] In this application, when performing task processing, first, the task processing request is extracted from the business processing database, and then, based on the task processing request and / or the memory occupancy rate of the cloud server, the target process is determined. The target process is at least one of the idle processes. In this way, the appropriate number of target processes can be determined based on the memory required to process the task processing request. The number of target processes determined in this way can exactly match the task processing request and the current memory situation of the cloud server. In this way, when the target process processes the task processing request and outputs a processing result, when the appropriate number of target processes execute the task processing request simultaneously, a large amount of data in the same task processing request can be distributed to different target processes for execution. In this way, multiple target processes execute the task simultaneously, which can not only improve the processing efficiency of the task processing request, but also ensure that the cloud server will not experience jams or crashes. Then, the task processing request is sent to the target process, and the target process processes the task processing request and outputs a processing result. In this way, the task processing request will only be sent to the determined target process, and only the target process will execute the task processing request, and other processes will not execute the task processing request, avoiding the situation of deadlock caused by multiple processes simultaneously competing for a task processing request, ensuring that multiple threads in the cloud server can work in coordination and improving the task processing efficiency.

[0103] Since the number of tasks to be processed included in different task processing requests is different, and the memory required to process different task processing requests is also different, it is very crucial to determine an appropriate number of target processes based on different task requests.

[0104] Based on this, in some embodiments, step S200 of determining a target process based on the task processing request includes:

[0105] Step S210, parsing the task processing request to obtain tasks to be processed, where each task processing request corresponds to at least one task to be processed;

[0106] Step S220, determining a target process based on the number of tasks to be processed.

[0107] Specifically, after extracting the task processing request, parse the task processing request to obtain tasks to be processed. Each task processing request corresponds to at least one task to be processed, and the task to be processed is a specific processing task included in the task processing request.

[0108] Exemplarily, when the task processing request is "export of vehicle condition information", parsing this task processing request may obtain four tasks to be processed such as "export of vehicle speed information", "export of fuel tank information", "export of engine gear information", and "export of transmission information".

[0109] When the task processing request is "mileage statistics", parsing this task processing request may obtain one task to be processed such as "export of mileage data".

[0110] Since the number of tasks to be processed included in the task processing request is different, the memory required to execute the task processing request is also different. When the number of tasks to be processed is large, a large amount of memory is required to execute more tasks to be processed; when the number of tasks to be processed is small, less memory is required to execute fewer tasks to be processed.

[0111] Therefore, in this application, when determining the target process, first parse the task processing request to obtain tasks to be processed, and then determine the number of target processes that is adapted to the number of tasks to be processed and applicable to the current memory occupancy of the cloud server based on the number of tasks to be processed. In this way, when the finally determined appropriate number of target processes execute the task processing request simultaneously, a large amount of data in the same task processing request can be allocated to different target processes for execution. In this way, multiple target processes execute tasks simultaneously, which can not only improve the efficiency of the task processing request but also ensure that the cloud server does not experience lag or crash.

[0112] Since the memory required to process the pending tasks in different task processing requests is different, and the overall memory required to process different numbers of pending tasks is also different, therefore, how to determine the target process based on the number of pending tasks is another problem that urgently needs to be solved.

[0113] Based on this, in some embodiments, step S220 of determining the target process based on the number of pending tasks includes:

[0114] Step S221, obtain the memory occupancy rate of the cloud server;

[0115] Step S222, in response to the number of pending tasks being less than the first preset number, determine the first preset number of idle processes as the target process;

[0116] Step S223, in response to the number of pending tasks being equal to the first preset number, determine the first preset number of idle processes as the target process;

[0117] Step S224, in response to the number of pending tasks being greater than the first preset number and the memory occupancy rate of the cloud server being less than or equal to the preset occupancy rate, determine the first preset number of idle processes as the target process;

[0118] Step S225, in response to the number of pending tasks being greater than the first preset number and the memory occupancy rate of the cloud server being greater than the preset occupancy rate, determine the second preset number of idle processes as the target process, where the second preset number is less than the first preset number.

[0119] Specifically, the first preset number is a preset smaller number, and the first preset number is less than or equal to 5. Exemplarily, the first preset number is one, two, or three.

[0120] The second preset number is a number smaller than the first preset number, and the second preset number can be the maximum number of threads that are allowed to run simultaneously when the memory occupancy rate of the cloud server is greater than the preset occupancy rate. Exemplarily, the second preset number can be two or one.

[0121] The preset occupancy rate is a safety threshold for the memory occupancy rate of the preset cloud server. When the memory occupancy rate is less than or equal to this preset occupancy rate, it means that the memory occupancy rate of the cloud server is small and multiple threads can be allowed to execute tasks simultaneously; when the memory occupancy rate is greater than this preset occupancy rate, it means that the memory occupancy rate of the cloud server is large and multiple threads cannot be allowed to execute tasks simultaneously, otherwise it will cause the cloud server to crash or freeze.

[0122] Therefore, in the present application, when the number of the tasks to be processed is less than or equal to the first preset number, the number of the tasks to be processed is small. Even if a thread is allocated to each task to be processed, the total number of threads is also small. The memory required when these threads execute tasks simultaneously is also very small, and it will hardly cause the cloud server to freeze or crash (regardless of the memory occupancy rate of the cloud server). Therefore, the first preset number of the idle processes is determined as the target processes. In this way, the number of the determined target processes is the same as the number of the tasks to be processed, greatly improving the processing efficiency of the subsequent tasks to be processed. At the same time, because the number of the target processes is small, it will not cause the cloud server to freeze or crash either.

[0123] When the number of the tasks to be processed is greater than the first preset number and the memory occupancy rate of the cloud server is less than or equal to the preset occupancy rate, it indicates that the number of the tasks to be processed is large. If a target process is allocated to each task to be processed, the number of the target processes is also large, and the memory required when multiple target processes execute tasks simultaneously is large. However, since the memory occupancy rate of the cloud server is less than or equal to the preset occupancy rate, it means that the memory occupancy rate of the cloud server is low at this time, and multiple threads can be allowed to execute tasks simultaneously. Therefore, at this time, the first preset number of the idle processes can be determined as the target processes. In this way, the number of the determined target processes is the same as the number of the tasks to be processed, greatly improving the processing efficiency of the subsequent tasks to be processed. At the same time, because the memory occupancy rate of the cloud server is low, even if multiple target processes execute tasks simultaneously, it will not cause the cloud server to freeze or crash.

[0124] When the number of the tasks to be processed is greater than the first preset number and the memory occupancy rate of the cloud server is greater than the preset occupancy rate, it indicates that the number of the tasks to be processed is large. If a target process is allocated to each task to be processed, the number of the target processes is also large, and the memory required when multiple target processes execute tasks simultaneously is large. However, since the memory occupancy rate of the cloud server is greater than the preset occupancy rate, it means that the memory occupancy rate of the cloud server is large at this time, and multiple threads cannot be allowed to execute tasks simultaneously. Therefore, at this time, the second preset number of the idle processes can be determined as the target processes, and the second preset number is less than the first preset number, so as to ensure that the cloud server will not freeze or crash when the second preset number of target processes execute tasks simultaneously.

[0125] In this application, when the number of tasks to be processed is less than or equal to the first preset number, the memory required to process these tasks to be processed is small. Therefore, there is no need to consider the memory occupancy rate of the cloud server, and directly determine the first preset number of idle processes as the target processes. When the number of tasks to be processed is greater than the first preset number, the memory required to process these tasks to be processed is large. Therefore, it is necessary to further combine the memory occupancy rate of the cloud server to determine the number of target processes. In this way, the number of target processes that matches both the number of tasks to be processed and the memory occupancy rate of the cloud server can be finally determined. When the target processes with the finally determined appropriate number simultaneously execute the task processing request, it can not only improve the efficiency of the task processing request, but also ensure that the cloud server will not experience lag or crash.

[0126] Further, after determining the appropriate number of target processes, how to control the target processes to process the task processing request is a very crucial step.

[0127] Based on this, in some embodiments, step S300 issues the task processing request to the target processes, and the target processes process the task processing request and output a processing result, including:

[0128] Step S310, in response to the number of target processes being the same as the number of tasks to be processed, issue each task to be processed to a target process respectively. Each target process processes the corresponding task to be processed and outputs a task processing result, and combines the task processing results output by all target processes to generate and output the processing result corresponding to the task processing request.

[0129] Step S320, in response to the number of target processes being less than the number of tasks to be processed, issue one or more tasks to be processed to a target process. Each target process processes the corresponding one or more tasks to be processed and outputs the task processing result corresponding to each task to be processed, and combines all the task processing results output by all target processes to generate and output the processing result corresponding to the task processing request.

[0130] Specifically, when the number of target processes is the same as the number of tasks to be processed, each task to be processed is issued to a target process respectively. In this way, each target process corresponds to a task to be processed, and each target process processes the corresponding task to be processed and outputs a task processing result. The task processing result can be "task executed successfully" or "task executed failed", etc.

[0131] Merge the task processing results output by all target processes to generate the processing result corresponding to the task processing request and output it. During the merging process, when all task processing results are "task executed successfully", the processing result corresponding to the merged task processing request is "executed and successful"; when at least one task processing result is "task execution failed", the processing result corresponding to the merged task processing request is "executed and failed"; when at least one task processing result is a preset default value (such as "0"), the processing result corresponding to the merged task processing request is the preset default value.

[0132] In this case, each target process corresponds to a task to be processed. Each target process processes the corresponding task to be processed and outputs the task processing result, which can greatly improve the efficiency of task processing.

[0133] When the number of target processes is less than the number of tasks to be processed, issue one or more of the tasks to be processed to a target process to ensure that all tasks to be processed can be executed by multiple target processes. At this time, one target process corresponds to one or more tasks to be processed.

[0134] Exemplarily, there are 10 tasks to be processed, but only 2 target processes. Then, 5 tasks to be processed are issued to one target process, and the other 5 tasks to be processed are issued to another target process. In this way, the two target processes can execute all 10 tasks to be processed.

[0135] Or, there are 3 tasks to be processed, but only 2 target processes. Then, 2 tasks to be processed are issued to one target process, and the other 1 task to be processed is issued to another target process. In this way, the two target processes can execute all 3 tasks to be processed.

[0136] Each target process processes the corresponding one or more tasks to be processed and outputs the task processing result corresponding to each task to be processed. The task processing result can be "task executed successfully" or "task execution failed", etc.

[0137] Merge the task processing results output by all target processes to generate the processing result corresponding to the task processing request and output it. During the merging process, when all task processing results are "task executed successfully", the processing result corresponding to the merged task processing request is "executed and successful"; when at least one task processing result is "task execution failed", the processing result corresponding to the merged task processing request is "executed and failed"; when at least one task processing result is a preset default value (such as "0"), the processing result corresponding to the merged task processing request is the preset default value.

[0138] In this case, each target process processes the corresponding one or more to-be-processed tasks and outputs the task processing result corresponding to each to-be-processed task, which can reduce the number of target processes used, reduce the memory space occupied when the target processes execute tasks simultaneously, and thus avoid the cloud server from getting stuck or crashing. At the same time, it can also ensure that multiple to-be-processed tasks can be executed by the same or different target processes simultaneously, ensuring the processing efficiency and avoiding the situation where a certain to-be-processed task waits for too long.

[0139] In this application, when the number of target processes is the same as the number of to-be-processed tasks, control each target process to correspond to one to-be-processed task respectively. Each target process processes the corresponding one to-be-processed task and outputs the task processing result, which can greatly improve the task processing efficiency; when the number of target processes is less than the number of to-be-processed tasks, control each target process to process the corresponding one or more to-be-processed tasks, which can reduce the number of target processes used, reduce the memory space occupied when the target processes execute tasks simultaneously, and thus avoid the cloud server from getting stuck or crashing. At the same time, it can also ensure that multiple to-be-processed tasks can be executed by the same or different target processes simultaneously, ensuring the processing efficiency and avoiding the situation where a certain to-be-processed task waits for too long.

[0140] After allocating the to-be-processed tasks to the corresponding target processes, in each target process, how to process the to-be-processed tasks in an orderly manner is another problem to be solved.

[0141] Based on this, in some embodiments, each target process in step S310 or step S320 processes the corresponding one to-be-processed task and outputs the task processing result, including:

[0142] Step S311, parsing the to-be-processed task to obtain multiple to-be-processed data;

[0143] Step S312, configuring multiple task processing threads for the target process, where the number of task processing threads is less than or equal to the first preset threshold;

[0144] Step S313, allocating multiple to-be-processed data to each task processing thread, and the task processing thread processes the multiple to-be-processed data and outputs the data processing result;

[0145] Step S314, merging the data processing results output by all task processing threads to generate the task processing result.

[0146] Specifically, when a target process processes the corresponding one to-be-processed task and outputs the task processing result, first parse the to-be-processed task to obtain multiple to-be-processed data.

[0147] Then, configure multiple task processing threads for the target process. The number of task processing threads is less than or equal to a first preset threshold. In this way, it can be ensured that the number of task processing threads is not too large and will not occupy too much memory space. At the same time, multiple task processing threads can process multiple pieces of data to be processed simultaneously.

[0148] Among them, the first preset threshold is the maximum value of the task processing threads that a single target process can include when processing a task to be processed. When a single target process processes a task to be processed, if the number of task processing threads is less than or equal to the first preset threshold, it can meet the task processing requirements, have a relatively high processing efficiency, and occupy little memory, which is the optimal state for the target process to process data.

[0149] Then, allocate multiple pieces of data to be processed to each of the task processing threads. The task processing threads process the multiple pieces of data to be processed and output data processing results. In this way, it can be ensured that each piece of data to be processed can be processed by a task processing thread, without causing data loss or omission.

[0150] In addition, since the time for each task processing thread to process a piece of data to be processed is very short, the processing time for each task processing thread to process multiple pieces of data to be processed is also not long. In this way, by allocating multiple pieces of data to be processed to each of the task processing threads and having multiple task processing threads process simultaneously, the data processing efficiency can be greatly improved, and there will be no problems of duplicate data processing or data loss.

[0151] Among them, the data processing result can be "data processing successful" or "data processing failed", etc.

[0152] Finally, merge the data processing results output by all task processing threads to generate a task processing result. During the merging process, when all data processing results are "data processing successful", the merged task processing result is "task execution successful"; when at least one data processing result is "data processing failed", the merged task processing result is "task execution failed"; when at least one data processing result is a preset default value (such as "0"), the merged task processing result is the preset default value.

[0153] In this application, when the target process processes a corresponding task to be processed, allocate multiple pieces of data to be processed to each of the task processing threads. The task processing threads process the multiple pieces of data to be processed and output data processing results. In this way, it can not only ensure that each piece of data to be processed can be processed by a task processing thread, without causing data loss or omission, but also, with multiple task processing threads processing simultaneously, the data processing efficiency can be greatly improved.

[0154] In some embodiments, when each target process processes the corresponding multiple to-be-processed tasks and outputs the task processing result corresponding to each to-be-processed task in step S320, it includes:

[0155] Step S321: Configure multiple task processing threads for the target process, where the number of task processing threads is greater than the number of to-be-processed tasks and less than or equal to a second preset threshold;

[0156] Step S322: Allocate multiple task processing threads to each to-be-processed task, and the multiple task processing threads simultaneously process the to-be-processed task and output the task processing result corresponding to the to-be-processed task.

[0157] Specifically, when each target process processes the corresponding multiple to-be-processed tasks, configure multiple task processing threads for the target process, where the number of task processing threads is greater than the number of to-be-processed tasks and less than or equal to a second preset threshold, so as to ensure that as many task processing threads as possible are configured under the condition of allowing memory, and the task processing efficiency is improved as much as possible.

[0158] Among them, the second preset threshold is the maximum value of the task processing threads that a single target process can include when processing multiple to-be-processed tasks. When the number of task processing threads is greater than the second preset threshold, the number of task processing threads in a single target process is too large, occupying too much memory, which is not conducive to the operation of the target process.

[0159] In this application, allocate multiple task processing threads to each to-be-processed task, and the multiple task processing threads simultaneously process the to-be-processed task. In this way, a large amount of data in the same to-be-processed task can be distributed to different task processing threads for simultaneous execution. In this way, multiple task processing threads simultaneously execute a to-be-processed task, which can improve the processing efficiency of each to-be-processed task and will not cause duplicate processing or omission of the to-be-processed tasks.

[0160] In some embodiments, when the multiple task processing threads in step S322 simultaneously process the to-be-processed task and output the task processing result corresponding to the to-be-processed task, it includes:

[0161] Step S3221: Analyze the to-be-processed task to obtain multiple to-be-processed data;

[0162] Step S3222: Allocate multiple to-be-processed data to each task processing thread, and the task processing thread processes the multiple to-be-processed data and outputs the data processing result;

[0163] Step S3223: Merge the data processing results output by all task processing threads to generate the task processing result.

[0164] Specifically, when multiple task processing threads process the task to be processed simultaneously, first, the task to be processed is parsed to obtain multiple pieces of data to be processed. Then, multiple pieces of data to be processed are allocated to each of the task processing threads, and the task processing threads process the multiple pieces of data to be processed and output data processing results. In this way, it can be ensured that each piece of data to be processed can be processed by a task processing thread, without data loss or omission.

[0165] In addition, since the time for each task processing thread to process a piece of data to be processed is very short, the processing time for each task processing thread to process multiple pieces of data to be processed is also not long. Thus, by allocating multiple pieces of data to be processed to each of the task processing threads and having multiple task processing threads process simultaneously, the data processing efficiency can be greatly improved, and there will be no problem of duplicate data processing or data loss.

[0166] Among them, the data processing result can be "data processing successful" or "data processing failed", etc.

[0167] Finally, the data processing results output by all task processing threads are merged to generate a task processing result. During the merging process, when all data processing results are "data processing successful", the merged task processing result is "task execution successful"; when at least one data processing result is "data processing failed", the merged task processing result is "task execution failed"; when at least one data processing result is a preset default value (such as "0"), the merged task processing result is the preset default value.

[0168] In this application, when the target process processes multiple tasks to be processed corresponding to it, multiple task processing threads are allocated to each task to be processed, and each task processing thread corresponds to multiple pieces of data to be processed. In this way, it can be ensured that each piece of data to be processed can be processed by a task processing thread, without data loss or omission. In addition, multiple task processing threads processing a task to be processed simultaneously can greatly improve the task processing efficiency.

[0169] In some embodiments, the target process processes the task processing request in step S300 and outputs a processing result, including:

[0170] Step S310': In response to the target process starting to process the task processing request, mark the first marking information for the task processing request in the service processing database, and monitor the processing duration of the target process for processing the task processing request;

[0171] Step S320': In response to the processing duration reaching the preset duration and no processing result being output, stop processing the task processing request, and mark the second marking information for the task processing request in the service processing database;

[0172] Step S330': In response to determining that the processing duration is less than the preset duration and a processing result is output, mark the third marking information for the task processing request in the service processing database;

[0173] Step S340': In response to determining that the processing duration is equal to the preset duration and a processing result is output, mark the third marking information for the task processing request in the service processing database.

[0174] Specifically, during the process where the target process processes the task processing request and outputs a processing result:

[0175] When the target process starts to process the task processing request, mark the first marking information for the task processing request in the service processing database. In this way, the marking information corresponding to the task processing request in the service processing database can be updated in a timely manner, ensuring that the task processing request will not be processed repeatedly or missed during subsequent processing. Exemplarily, the first marking information can be "Task processing in progress".

[0176] When the target process starts to process the task processing request, monitor the processing duration of the target process for processing the task processing request.

[0177] When the processing duration reaches the preset duration and no processing result is output, stop processing the task processing request, and mark the second marking information for the task processing request in the service processing database. Exemplarily, the second marking information can be "Task processing timeout".

[0178] The preset duration is the longest processing time required for processing a certain task processing request. When the processing duration reaches the preset duration, it indicates that the current time for processing the task processing request has reached the longest processing time.

[0179] Therefore, when the processing duration reaches the preset duration and no processing result is output, it indicates that the time for processing the current task processing request has reached the maximum processing time but still no processing result is output, which means that the current task processing has timed out. Continuing to process the task processing request will only further increase the processing duration and occupy memory but still no processing result will be output. Therefore, at this time, the processing of the task processing request is stopped, and the second marking information is marked for the task processing request in the service processing database. In this way, the timeout task can be stopped in time to avoid wasting memory and processing time, and the marking information corresponding to the task processing request in the service processing database can be updated in time, which is convenient for subsequent other operations.

[0180] When the processing duration is less than or equal to the preset duration and a processing result is output, it indicates that the processing duration is short at this time and the processing result is successfully output. At this time, the third marking information is marked for the task processing request in the service processing database. In this way, the marking information corresponding to the task processing request in the service processing database can be updated in time, which is convenient for subsequent other operations.

[0181] The third marking information may be the same as the processing result. Exemplarily, when the processing result is "executed and successful", the third marking information may also be "executed and successful".

[0182] In this application, during the process that the target process processes the task processing request and outputs the processing result, when the processing duration reaches the preset duration and no processing result is output, it indicates that the task processing has timed out, and the second marking information is marked for the timed-out task. At this time, the situation of the task processing can be determined based on the second marking information; when it is determined that the processing duration is less than or equal to the preset duration and a processing result is output, it indicates that the task processing is normal, and the third marking information is marked for the normally processed task. At this time, the situation of the task processing can be determined based on the third marking information. In this way, the situation of the task processing can be quickly understood based on the second marking information and the third marking information; in addition, marking the second marking information and the third marking information in the service processing database can update the marking information after the task processing to the service processing database in time, which is convenient for subsequent execution of related operations and ensures that a certain task processing request will not be omitted or processed repeatedly.

[0183] In some embodiments, the method further includes: searching for and deleting the task processing request corresponding to the second marking information from the service processing database. In this way, the task processing requests with a timeout processing duration can be deleted regularly or periodically, avoiding occupying the resources of the service processing database.

[0184] In some embodiments, refer to Figure 2As described above, the task processing method of the present application is applied to a cloud server, which includes multiple idle processes. The idle processes may include an execution task thread pool and a timeout task thread pool. Each thread may include multiple threads, and each thread pool executes different steps.

[0185] The cloud server may further include a timed task fetching thread pool and a timed expired task cleaning thread pool.

[0186] The task processing method may further include:

[0187] 1. The timed task fetching thread pool (for example, it can be named "Check Queuing Task Thead Pool") executes periodic checks on the tasks waiting to be executed in the task table (i.e., the business processing database).

[0188] 2. The timed expired task cleaning thread pool (for example, it can be named "Delete Expired Task ScheduledPool") is used to periodically detect the tasks that have timed out in the task table and perform timeout cleaning operations (i.e., find and delete the task processing requests corresponding to the second marking information from the business processing database).

[0189] 3. The execution task thread pool (for example, it can be named "task Execute Thread Pool") is used to execute specific tasks to be processed, such as batch data import and export, real-time statistics of vehicle condition data, and other services.

[0190] 4. The timeout task thread pool (for example, it can be named "task Future Pool") is used to process the execution results of tasks. By detecting whether the task has timed out, it judges the execution results of the tasks (i.e., in response to the processing duration reaching the preset duration and no processing result being output, stop processing the task processing request).

[0191] 5. When a new task is created, a task to be executed will be inserted into the database and sorted in ascending order according to the creation time (i.e., in response to receiving a new task processing request, the task processing request is sorted in ascending order of time and stored in the business processing database).

[0192] 6. The timed task fetching thread pool will periodically query the tasks to be executed in the database, effectively avoiding the problem of dirty data caused by multiple processes simultaneously fetching the same record and updating the database fields when multiple processes have high concurrency in fetching tasks.

[0193] 7. Update the start execution time of the to-be-executed task (i.e., the task processing request) retrieved by the query, and set the status of the task to in execution (i.e., in response to the start of the target process to process the task processing request, mark the first mark information for the task processing request in the service processing database, and monitor the processing duration of the target process to process the task processing request).

[0194] 8. Put the to-be-executed task into the execution task thread pool, and the thread pool arranges threads to execute large service processing according to the situation.

[0195] 9. At the same time, obtain a reference to the thread execution result and put the reference into the timeout task thread pool, and this thread pool will arrange threads to perform timeout detection of the task result as needed.

[0196] 10. If the task is still in the running state after timeout, cancel the currently executing task and update the status of the task to execution timeout (i.e., in response to the processing duration reaching the preset duration and no processing result is output, stop processing the task processing request, and mark the second mark information for the task processing request in the service processing database).

[0197] 11. If it is detected that the task is in the completed state, update the current task to execution completed (i.e., in response to determining that the processing duration is less than the preset duration and the processing result is output, mark the third mark information for the task processing request in the service processing database).

[0198] 12. Regularly clean up expired tasks. The thread pool will regularly check the tasks with execution timeout in the task database. The judgment method is: if the task execution time > (current time - timeout time * 2), it is judged that this task has executed timeout, update the execution status of the task to execution timeout, and update the task status in time.

[0199] The task processing method described in this application also has the following technical effects:

[0200] (1) It can uniformly allocate and schedule all task processing requests. On the one hand, it reduces the complexity of service development. On the other hand, it makes overall planning for large services, making large services more controllable and having higher stability.

[0201] (2) No third-party components are used in the entire task processing process. The operation and maintenance personnel only need to deploy the service, which can prevent system instability caused by the collapse of third-party components, and is lightweight and convenient for deployment.

[0202] (3) The concurrency (i.e., the number of target processes) and the horizontal expansion service (i.e., the number of task processing threads in each target process) can be reasonably adjusted according to the memory occupancy of the task processing request and the memory occupancy rate of the cloud server, dynamically limiting the concurrent execution volume to ensure processing efficiency and avoid the cloud server from freezing or crashing.

[0203] (4) Implement flexible multi-task scheduling and multi-node sharing to efficiently solve various problems brought by multi-tasks, high concurrency, high time consumption, high computing, and long business processing.

[0204] It should be noted that the method of the embodiment of the present application can be processed by a single device, such as a computer or a server. The method of this embodiment can also be applied to a distributed scenario and completed by multiple devices cooperating with each other. In this distributed scenario, one of the multiple devices can only process one or more steps in the method of the embodiment of the present application, and these multiple devices will interact with each other to complete the described method.

[0205] It should be noted that some embodiments of the present application are described above. In some cases, the actions or steps recorded in the above embodiments can be processed in a different order from that in the above embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In certain embodiments, multi-task processing and parallel processing are also possible or may be advantageous.

[0206] Based on the same inventive concept, corresponding to the method of any of the above embodiments, the present application also provides a task processing device, the task processing device includes a cloud server, and the cloud server includes multiple idle processes.

[0207] Refer to Figure 3 , the task processing device includes:

[0208] An extraction module 100, configured to extract a task processing request from a service processing database;

[0209] A determination module 200, configured to determine a target process based on the task processing request, and the target process is at least one of the idle processes;

[0210] An execution module 300, configured to send the task processing request to the target process, and the target process processes the task processing request and outputs a processing result.

[0211] In some embodiments, the determination module 200 is further configured to:

[0212] Parsing the task processing request to obtain a task to be processed, where each task processing request corresponds to at least one task to be processed;

[0213] Determine a target process based on the number of tasks to be processed.

[0214] In some embodiments, the determining module 200 is further configured to:

[0215] Obtain the memory occupancy rate of the cloud server;

[0216] In response to the number of tasks to be processed being less than a first preset number, determine the first preset number of idle processes as the target process;

[0217] In response to the number of tasks to be processed being greater than the first preset number and the memory occupancy rate of the cloud server being less than a preset occupancy rate, determine the first preset number of idle processes as the target process;

[0218] In response to the number of tasks to be processed being greater than the first preset number and the memory occupancy rate of the cloud server being greater than the preset occupancy rate, determine the second preset number of idle processes as the target process, where the second preset number is less than the first preset number.

[0219] In some embodiments, the execution module 300 is further configured to:

[0220] In response to the number of target processes being the same as the number of tasks to be processed, distribute each task to be processed to a target process respectively. Each target process processes the corresponding task to be processed and outputs a task processing result, and combines the task processing results output by all target processes to generate and output the processing result corresponding to the task processing request;

[0221] In response to the number of target processes being less than the number of tasks to be processed, distribute one or more tasks to be processed to a target process. Each target process processes the corresponding one or more tasks to be processed and outputs the task processing result corresponding to each task to be processed, and combines all the task processing results output by all target processes to generate and output the processing result corresponding to the task processing request.

[0222] In some embodiments, the execution module 300 is further configured to:

[0223] Parse the task to be processed to obtain multiple pieces of data to be processed;

[0224] Configure multiple task processing threads for the target process, where the number of task processing threads is less than a first preset threshold;

[0225] Allocate multiple pieces of data to be processed to each of the task processing threads, and the task processing threads process the multiple pieces of data to be processed and output data processing results;

[0226] Merge the data processing results output by all task processing threads to generate a task processing result.

[0227] In some embodiments, the execution module 300 is further configured to:

[0228] Configure multiple task processing threads for the target process, where the number of task processing threads is greater than the number of tasks to be processed and less than a second preset threshold;

[0229] Allocate multiple task processing threads to each of the tasks to be processed, and the multiple task processing threads process the task to be processed simultaneously and output the task processing result corresponding to the task to be processed.

[0230] In some embodiments, the execution module 300 is further configured to:

[0231] Parse the task to be processed to obtain multiple pieces of data to be processed;

[0232] Allocate multiple pieces of data to be processed to each of the task processing threads, and the task processing threads process the multiple pieces of data to be processed and output data processing results;

[0233] Merge the data processing results output by all task processing threads to generate a task processing result.

[0234] In some embodiments, the execution module 300 is further configured to:

[0235] In response to the target process starting to process the task processing request, mark first marking information for the task processing request in the service processing database, and monitor the processing duration of the target process for processing the task processing request;

[0236] In response to the processing duration reaching a preset duration and no processing result being output, stop processing the task processing request, and mark second marking information for the task processing request in the service processing database;

[0237] In response to determining that the processing duration is less than the preset duration and a processing result is output, mark third marking information for the task processing request in the service processing database.

[0238] In some embodiments, the extraction module 100 is further configured to:

[0239] Search for and delete the task processing request corresponding to the second marking information from the service processing database;

[0240] and / or in response to receiving a new task processing request, arranging the task processing request in chronological order and storing it in the service processing database.

[0241] For the convenience of description, when describing the above device, it is divided into various modules according to functions and described separately. Of course, when implementing this application, the functions of each module can be implemented in the same or multiple software and / or hardware.

[0242] The device in the above embodiment is used to implement the corresponding task processing method in any of the foregoing embodiments, and has the beneficial effects of the corresponding method embodiment, which will not be elaborated here.

[0243] Based on the same inventive concept, corresponding to the method in any of the above embodiments, the present application also provides a cloud server, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor processes the program, it implements the task processing method described in any of the above embodiments.

[0244] Figure 4 FIG. shows a more specific schematic hardware structure diagram of the cloud server provided in this embodiment. The device may include: a processor 1010, a memory 1020, an input / output interface 1030, a communication interface 1040, and a bus 1050. Among them, the processor 1010, the memory 1020, the input / output interface 1030, and the communication interface 1040 are communicatively connected to each other inside the device through the bus 1050.

[0245] The processor 1010 may be implemented in a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, etc., and is used to process relevant programs to implement the technical solutions provided in the embodiments of this specification.

[0246] The memory 1020 may be implemented in the form of a ROM (Read Only Memory), a RAM (Random Access Memory), a static storage device, a dynamic storage device, etc. The memory 1020 may store an operating system and other application programs. When implementing the technical solutions provided in the embodiments of this specification through software or firmware, the relevant program codes are stored in the memory 1020 and called and processed by the processor 1010.

[0247] The input / output interface 1030 is used to connect to the input / output module to achieve information input and output. The input / output module can be configured as a component in the device (not shown in the figure), or can be externally connected to the device to provide corresponding functions. Among them, the input device can include a keyboard, a mouse, a touch screen, a microphone, various sensors, etc., and the output device can include a display, a speaker, a vibrator, an indicator light, etc.

[0248] The communication interface 1040 is used to connect to the communication module (not shown in the figure) to achieve communication interaction between this device and other devices. Among them, the communication module can achieve communication through wired means (such as USB, network cable, etc.), or can also achieve communication through wireless means (such as mobile network, WIFI, Bluetooth, etc.).

[0249] The bus 1050 includes a path to transmit information between various components of the device (such as the processor 1010, the memory 1020, the input / output interface 1030, and the communication interface 1040).

[0250] It should be noted that although the above device only shows the processor 1010, the memory 1020, the input / output interface 1030, the communication interface 1040, and the bus 1050, in the specific implementation process, the device may also include other components necessary for normal operation. In addition, those skilled in the art can understand that the above device may also only include the components necessary to implement the solution of the embodiments of this specification, and does not necessarily include all the components shown in the figure.

[0251] The cloud server of the above embodiment is used to implement the corresponding task processing method in any of the foregoing embodiments, and has the beneficial effects of the corresponding method embodiments, which will not be elaborated here.

[0252] Based on the same inventive concept, corresponding to the method of any of the above embodiments, the present application also provides a non-transitory computer-readable storage medium. The non-transitory computer-readable storage medium stores computer instructions, and the computer instructions are used to cause the computer to process the task processing method described in any of the above embodiments.

[0253] The computer-readable medium of this embodiment includes permanent and non-permanent, removable and non-removable media, and information storage can be implemented by any method or technology. The information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassette tapes, magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information accessible by a computing device.

[0254] The computer instructions stored in the storage medium of the above embodiment are used to cause the computer to process the task processing method described in any of the above embodiments, and have the beneficial effects of the corresponding method embodiments, which will not be elaborated here.

[0255] Based on the same inventive concept, corresponding to the method of any of the above embodiments, the present application also provides a computer program product, including computer program instructions. When the computer program instructions run on a computer, the computer is caused to process the task processing method described in any of the above embodiments, and has the beneficial effects of the corresponding method embodiments, which will not be elaborated here.

[0256] It can be understood that before using the technical solutions of the various embodiments in the present disclosure, the types, usage scopes, usage scenarios, etc. of the personal information involved will be informed to the user in an appropriate manner, and the user's authorization will be obtained.

[0257] For example, in response to receiving an active request from the user, a prompt message is sent to the user to clearly prompt the user that the operation of processing their request will require obtaining and using the user's personal information. Thus, the user can autonomously choose whether to provide personal information to software or hardware such as a cloud server, application program, server, or storage medium that processes the technical solutions of the present disclosure based on the prompt message.

[0258] As an optional but non-limiting implementation manner, the manner of sending a prompt message to the user in response to receiving an active request from the user can be, for example, in the form of a pop-up window. The prompt message can be presented in text in the pop-up window. In addition, the pop-up window can also carry a selection control for the user to choose "agree" or "disagree" to provide personal information to the cloud server.

[0259] It should be understood that the above notification and the process of obtaining user authorization are merely illustrative and do not limit the implementation manner of the present disclosure. Other manners that comply with relevant laws and regulations can also be applied to the implementation manner of the present disclosure.

[0260] Those of ordinary skill in the art should understand that the discussion of any of the above embodiments is only exemplary and is not intended to imply that the scope of the present application is limited to these examples; within the concept of the present application, the technical features in the above embodiments or different embodiments can also be combined, the steps can be implemented in any order, and there are many other variations in different aspects of the embodiments of the present application as described above. For the sake of brevity, they are not provided in detail.

[0261] In addition, for the sake of simplicity of description and discussion, and in order not to make the embodiments of the present application difficult to understand, the well-known power / ground connections to integrated circuit (IC) chips and other components may or may not be shown in the provided drawings. In addition, the device may be shown in block diagram form in order to avoid making the embodiments of the present application difficult to understand, and this also takes into account the fact that the details of the implementation manner of these block diagram devices are highly dependent on the platform on which the embodiments of the present application will be implemented (that is, these details should be completely within the understanding of those skilled in the art). In the case where specific details (such as circuits) are set forth to describe the exemplary embodiments of the present application, it will be apparent to those skilled in the art that the embodiments of the present application can be implemented without these specific details or with variations of these specific details. Therefore, these descriptions should be considered illustrative rather than restrictive.

[0262] Although the present application has been described in connection with specific embodiments of the present application, many alternatives, modifications, and variations of these embodiments will be apparent to those of ordinary skill in the art based on the foregoing description. For example, other memory architectures (such as dynamic RAM (DRAM)) can be used with the embodiments discussed.

[0263] The embodiments of the present application are intended to cover all such alternatives, modifications, and variations that fall within the broad scope of the present application. Therefore, any omissions, modifications, equivalent substitutions, improvements, etc. made within the spirit and principle of the embodiments of the present application shall be included within the protection scope of the present application.

Claims

1. A task processing method, characterized in that: Applied to a cloud server, the cloud server includes a plurality of idle processes, and the method includes: Extracting task processing requests from a business processing database; Determine a target process based on the task processing request, where the target process is at least one of the idle processes; The task processing request is sent to the target process, and the target process processes the task processing request and outputs a processing result.

2. The method according to claim 1, characterized in that The step of determining a target process based on the task processing request includes: Parsing the task processing request to obtain tasks to be processed, each of the task processing request corresponds to at least one task to be processed; Based on the number of tasks to be processed, a target process is determined.

3. The method according to claim 2, characterized in that The determining of the target process based on the number of tasks to be processed includes: Obtaining the memory usage of the cloud server; In response to the number of the tasks to be processed being less than a first preset number, determining the first preset number of idle processes as target processes; In response to the number of tasks to be processed being equal to a first preset number, determining the first preset number of idle processes as target processes; In response to the number of the tasks to be processed being greater than a first preset number and the memory occupancy rate of the cloud server being less than a preset occupancy rate, determining the first preset number of idle processes as target processes; In response to the number of tasks to be processed being greater than a first preset number and the memory occupancy of the cloud server being greater than a preset occupancy, a second preset number of idle processes are determined as target processes, and the second preset number is less than the first preset number.

4. The method according to claim 3, characterized in that The sending of the task processing request to the target process, wherein the target process processes the task processing request and outputs a processing result, includes: In response to the number of target processes being the same as the number of tasks to be processed, each of the tasks to be processed is sent to a target process respectively, each target process processes a corresponding task to be processed and outputs a task processing result, and the task processing results output by all target processes are combined to generate a processing result corresponding to the task processing request and output; Or, in response to the number of target processes being less than the number of tasks to be processed, one or more of the tasks to be processed are sent to a target process, each target process processes the corresponding one or more tasks to be processed and outputs the task processing results corresponding to each task to be processed, and all task processing results output by all target processes are merged to generate the processing results corresponding to the task processing request and output them.

5. The method according to claim 4, characterized in that Each target process processes a corresponding task to be processed and outputs a task processing result, including: Parsing the tasks to be processed to obtain multiple pieces of data to be processed; Configuring a plurality of task processing threads for the target process, wherein the number of the task processing threads is less than or equal to a first preset threshold; Allocating a plurality of pieces of data to be processed to each of the task processing threads, wherein the task processing threads process the plurality of pieces of data to be processed and output data processing results; The data processing results output by all task processing threads are merged to generate the task processing result.

6. The method according to claim 4, characterized in that Each target process processes the corresponding plurality of tasks to be processed and outputs a task processing result corresponding to each task to be processed, including: Configuring a plurality of task processing threads for the target process, wherein the number of the task processing threads is greater than the number of tasks to be processed and less than or equal to a second preset threshold; Multiple task processing threads are allocated to each of the tasks to be processed, and the multiple task processing threads process the tasks to be processed simultaneously and output task processing results corresponding to the tasks to be processed.

7. The method according to claim 6, characterized in that The multiple task processing threads simultaneously process the pending tasks and output task processing results corresponding to the pending tasks, including: Parsing the tasks to be processed to obtain multiple pieces of data to be processed; Allocating a plurality of pieces of data to be processed to each of the task processing threads, wherein the task processing threads process the plurality of pieces of data to be processed and output data processing results; The data processing results output by all task processing threads are merged to generate the task processing result.

8. The method according to claim 1, characterized in that The target process processes the task processing request and outputs a processing result, including: In response to the target process starting to process the task processing request, marking first marking information for the task processing request in the business processing database, and monitoring the processing time of the target process processing the task processing request; In response to the processing time reaching a preset time and no processing result is output, the processing of the task processing request is stopped, and second marking information is marked for the task processing request in the business processing database; In response to determining that the processing time is less than a preset time and outputting a processing result, marking third marking information for the task processing request in the business processing database; In response to determining that the processing duration is equal to the preset duration and outputting the processing result, third marking information is marked for the task processing request in the business processing database.

9. The method according to claim 8, characterized in that The method further comprises: Searching and deleting the task processing request corresponding to the second marking information from the business processing database; And / or in response to receiving a new task processing request, arranging the task processing request in chronological order and storing it in the business processing database.

10. A cloud server comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that: When the processor processes the program, the method according to any one of claims 1 to 9 is implemented.