A task management method and device, a storage medium, and an electronic device
By using Redis service for task rate limiting management and dynamically adjusting task rate limiting configuration values, the problem of excessive resource consumption in the computing cluster service is solved, and efficient task scheduling and precise resource allocation are achieved, thereby improving system stability and processing efficiency.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- BEIJING HONGTENG INTELLIGENT TECH CO LTD
- Filing Date
- 2024-12-17
- Publication Date
- 2026-06-19
Smart Images

Figure CN122240249A_ABST
Abstract
Description
Technical Field
[0001] This specification relates to the field of computer technology, and in particular to a task management method, apparatus, storage medium, and electronic device. Background Technology
[0002] With the rapid development of the Internet and the era of big data, the complexity and quantity of computing tasks are constantly increasing. To handle these tasks, many enterprises and organizations have begun to use multiple computing services (i.e., computing cluster services) for concurrent processing. Typically, the differences in resource consumption (such as CPU, I / O, and disk) among computing tasks make the rational scheduling of tasks particularly important. Summary of the Invention
[0003] This specification provides a task management method, apparatus, storage medium, and electronic device, the technical solutions of which are as follows:
[0004] Firstly, embodiments of this specification provide a task management method, the method comprising:
[0005] Receive a target task request for a target task, and determine the target task name corresponding to the target task request;
[0006] Determine the task load value corresponding to the target task name, and determine the task rate limiting configuration value in the Redis service based on the target task name;
[0007] Based on the task rate limiting configuration value and the task running load value, the target task request is processed as a target task.
[0008] In one feasible implementation, determining the task rate limiting configuration value in the Redis service based on the target task name includes:
[0009] Based on the target task name, perform a key-value query in the Redis service to obtain the task rate limiting configuration key-value.
[0010] In one feasible implementation, the step of obtaining the task rate limiting configuration key-value by performing a key-value query in the Redis service based on the target task name includes:
[0011] Use the target task name as the target key identifier, and query the task rate limiting configuration value corresponding to the target key identifier in the key-value pair mapping relationship of the Redis service;
[0012] The key-value pair mapping relationship includes at least one key identifier corresponding to a reference task name and a rate limiting configuration value corresponding to the key identifier.
[0013] In one feasible implementation, the method further includes:
[0014] The Redis service is used to monitor the task execution information and service resource hosting information of at least one reference task.
[0015] Based on the task execution information and the service resource carrying information, determine the task to be adjusted and the recommended rate limiting configuration value of the task to be adjusted, and adjust the key-value pair mapping relationship based on the recommended rate limiting configuration value of the task to be adjusted.
[0016] In one feasible implementation, the step of processing the target task request based on the task rate limiting configuration value and the task runtime load value includes:
[0017] The task runtime load value and the task rate limiting configuration value are compared to obtain the configuration comparison result.
[0018] If the configuration comparison result is a task rate limiting execution type, then the target task request is subjected to target task rate limiting processing, and the task running load value is monitored to perform the step of comparing the task running load value and the task rate limiting configuration value to obtain the configuration comparison result;
[0019] If the configuration comparison result is a normal task execution type, then the target task request will be processed for target task execution.
[0020] In one feasible implementation, the task load value includes the number of tasks running, and the task rate limiting configuration value includes the number of tasks subject to rate limiting.
[0021] The step of comparing the task's runtime load value and the task's rate limiting configuration value to obtain the configuration comparison result includes:
[0022] Compare the number of tasks running with the number of tasks subject to rate limiting;
[0023] If the number of tasks running is less than the number of tasks subject to rate limiting, then a first configuration comparison result for the task rate limiting execution type is generated.
[0024] If the number of tasks running is greater than or equal to the number of tasks with throttling limits, a second configuration comparison result for the normal execution type of the task is generated.
[0025] In one feasible implementation, after performing target task execution processing on the target task request, the method further includes:
[0026] Determine the target task and its completion process;
[0027] The task load value of the target task is updated in the Redis service.
[0028] The Redis service updates the task request execution status of the target task.
[0029] Secondly, embodiments of this specification provide a task management device, the device comprising:
[0030] The task request module is used to receive a target task request for a target task and determine the target task name corresponding to the target task request.
[0031] The task management module is used to determine the task running load value corresponding to the target task name, and to determine the task rate limiting configuration value in the Redis service based on the target task name;
[0032] The task processing module is used to process the target task request based on the task rate limiting configuration value and the task running load value.
[0033] In one feasible implementation, the task management module is used for:
[0034] Based on the target task name, perform a key-value query in the Redis service to obtain the task rate limiting configuration key-value.
[0035] In one feasible implementation, the task management module is used for:
[0036] Use the target task name as the target key identifier, and query the task rate limiting configuration value corresponding to the target key identifier in the key-value pair mapping relationship of the Redis service;
[0037] The key-value pair mapping relationship includes at least one key identifier corresponding to a reference task name and a rate limiting configuration value corresponding to the key identifier.
[0038] In one feasible implementation, the device is further used for:
[0039] The Redis service is used to monitor the task execution information and service resource hosting information of at least one reference task.
[0040] Based on the task execution information and the service resource carrying information, determine the task to be adjusted and the recommended rate limiting configuration value of the task to be adjusted, and adjust the key-value pair mapping relationship based on the recommended rate limiting configuration value of the task to be adjusted.
[0041] In one feasible implementation, the task processing module is configured to:
[0042] The task runtime load value and the task rate limiting configuration value are compared to obtain the configuration comparison result.
[0043] If the configuration comparison result is a task rate limiting execution type, then the target task request is subjected to target task rate limiting processing, and the task running load value is monitored to perform the step of comparing the task running load value and the task rate limiting configuration value to obtain the configuration comparison result;
[0044] If the configuration comparison result is a normal task execution type, then the target task request will be processed for target task execution.
[0045] In one feasible implementation, the task load value includes the number of tasks running, and the task rate limiting configuration value includes the number of tasks subject to rate limiting.
[0046] The task processing module is used for:
[0047] Compare the number of tasks running with the number of tasks subject to rate limiting;
[0048] If the number of tasks running is less than the number of tasks subject to rate limiting, then a first configuration comparison result for the task rate limiting execution type is generated.
[0049] If the number of tasks running is greater than or equal to the number of tasks with throttling limits, a second configuration comparison result for the normal execution type of the task is generated.
[0050] In one feasible implementation, after performing target task execution processing on the target task request, the method further includes:
[0051] Determine the target task and its completion process;
[0052] The task load value of the target task is updated in the Redis service.
[0053] The Redis service updates the task request execution status of the target task.
[0054] Thirdly, embodiments of this specification provide a computer storage medium storing a plurality of instructions adapted for loading by a processor and executing the above-described method steps.
[0055] Fourthly, embodiments of this specification provide an electronic device that may include: a processor and a memory; wherein the memory stores a computer program adapted to be loaded by the processor and to execute the above-described method steps.
[0056] The beneficial effects of the technical solutions provided in some embodiments of this specification include at least the following:
[0057] In one or more embodiments of this specification, the service platform receives a target task request for a target task, determines the target task name corresponding to the target task request, determines the task runtime load value corresponding to the target task name, determines the task rate limiting configuration value in the Redis service based on the target task name, and processes the target task request based on the task rate limiting configuration value and the task runtime load value. This achieves efficient reception, intelligent scheduling, and precise allocation of resources for task requests. It not only effectively avoids system resource overload and ensures the stability of task execution, but also dynamically adapts to changes in task load, improving the overall processing efficiency and reliability of the system, while providing powerful scalability for task management in distributed scenarios. Attached Figure Description
[0058] To more clearly illustrate the technical solutions in the embodiments or prior art of this specification, the drawings used in the description of the embodiments or prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this specification. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0059] Figure 1 This is a schematic diagram of a task management system provided in the embodiments of this specification;
[0060] Figure 2 This is a flowchart illustrating a task management method provided in an embodiment of this specification;
[0061] Figure 3 This is a pseudocode diagram illustrating a target task request response provided in an embodiment of this specification;
[0062] Figure 4 This is a flowchart illustrating another embodiment of a task management method provided in the embodiments of this specification;
[0063] Figure 5 This is a schematic diagram of a target task processing method provided in an embodiment of this specification;
[0064] Figure 6 This is a schematic diagram of a configuration comparison process provided in the embodiments of this specification;
[0065] Figure 7 This is a schematic diagram of a task execution and post-processing update provided in the embodiments of this specification;
[0066] Figure 8 This is a schematic diagram of the device structure of a task control device provided in the embodiments of this specification;
[0067] Figure 9This is a schematic diagram of the structure of an electronic device provided in the embodiments of this specification;
[0068] Figure 10 This is a schematic diagram of the operating system and user space structure provided in the embodiments of this specification;
[0069] Figure 11 yes Figure 10 Architecture diagram of the Android operating system in China;
[0070] Figure 12 yes Figure 10 Architecture diagram of the iOS operating system. Detailed Implementation
[0071] The technical solutions in the embodiments of this specification will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this specification, and not all embodiments. Based on the embodiments in this specification, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this specification.
[0072] In the description of this specification, it should be understood that the terms "first," "second," etc., are used for descriptive purposes only and should not be construed as indicating or implying relative importance. In the description of this specification, it should be noted that, unless otherwise expressly specified and limited, "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, products, or devices. Those skilled in the art can understand the specific meaning of the above terms in this specification based on the specific circumstances. Furthermore, in the description of this specification, unless otherwise stated, "multiple" means two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, and B alone. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship.
[0073] In related technologies, for computing cluster services, different types of computing tasks may have drastically different requirements for system resources. For example, some computing tasks may require a large amount of computing power, while others may have higher requirements for I / O or network bandwidth. If these computing tasks are not arranged reasonably, certain resource-intensive tasks may consume too much of the computing cluster service's system resources, causing other tasks to fail smoothly, or even causing system overload, thereby affecting the stability and reliability of the system.
[0074] In the era of big data, rational task scheduling can not only improve system resource utilization but also enhance overall processing efficiency and reliability. In practical applications, it is necessary to combine specific business needs and technical architecture to select appropriate task management methods to cope with the ever-increasing challenges of computing tasks, thereby providing strong support for enterprise digital transformation and data-driven decision-making.
[0075] Please see Figure 1 This is a schematic diagram of a task management system provided in this specification. Figure 1 As shown, the task management system may include at least a client cluster and a service platform 100.
[0076] The client cluster may include at least one client, such as Figure 1 As shown, it specifically includes client 1 corresponding to user 1, client 2 corresponding to user 2, ..., client n corresponding to user n, where n is an integer greater than 0.
[0077] Each client in a client cluster can be an electronic device with communication capabilities, including but not limited to: wearable devices, handheld devices, personal computers, tablets, in-vehicle devices, smartphones, computing devices, or other processing devices connected to a wireless modem. Electronic devices may have different names in different networks, such as: user equipment, access terminal, user unit, user station, mobile station, mobile station, remote station, remote terminal, mobile device, user terminal, electronic device, wireless communication device, user agent or user device, cellular phone, cordless phone, personal digital assistant (PDA), and electronic devices in 5G networks or future evolved networks.
[0078] The service platform 100 can be a standalone server device, such as a rack-mount, blade, tower, or cabinet-type server device, or a workstation, mainframe, or other hardware device with strong computing power; or it can be a server cluster composed of multiple servers. The servers in the service cluster can be composed in a symmetrical manner, wherein each server is functionally and hierarchically equivalent in the transaction chain, and each server can provide services independently. The independent provision of services can be understood as not requiring the assistance of other servers.
[0079] In one or more embodiments of this specification, the service platform 100 can establish a communication connection with at least one client in the client cluster, and complete data interaction during the task management process based on the communication connection, such as online transaction data interaction. For example, the service platform 100 can respond to a target task request initiated by the client for a target task based on the task management method of this specification. The service platform 100 receives the target task request for the target task, determines the target task name corresponding to the target task request, determines the task running load value corresponding to the target task name, determines the task rate limiting configuration value in the Redis service based on the target task name, and performs target task processing on the target task request based on the task rate limiting configuration value and the task running load value.
[0080] It should be noted that the service platform 100 establishes a communication connection with at least one client in the client cluster via a network for interactive communication. This network can be a wireless network or a wired network. Wireless networks include, but are not limited to, cellular networks, wireless LANs, infrared networks, or Bluetooth networks. Wired networks include, but are not limited to, Ethernet, universal serial bus (USB), or controller area networks. In one or more embodiments of the specification, technologies and / or formats including Hyper Text Markup Language (HTML), Extensible Markup Language (XML), etc., are used to represent data exchanged over the network (such as target compressed packets). Furthermore, conventional encryption technologies such as Secure Socket Layer (SSL), Transport Layer Security (TLS), Virtual Private Network (VPN), and Internet Protocol Security (IPsec) can be used to encrypt all or some links. In other embodiments, customized and / or dedicated data communication technologies can be used to replace or supplement the aforementioned data communication technologies.
[0081] The task management system embodiments provided in this specification and the task management methods described in one or more embodiments belong to the same concept. The execution entity corresponding to the task management method involved in one or more embodiments of this specification can be the aforementioned service platform 100; the execution entity corresponding to the task management method involved in one or more embodiments of this specification can also be the electronic device corresponding to the client, specifically determined based on the actual application environment. The implementation process of the task management system embodiments can be detailed in the following method embodiments, and will not be repeated here.
[0082] The present specification will now be described in detail with reference to specific embodiments.
[0083] In one embodiment, such as Figure 2 As shown, a task management method is proposed, which can be implemented using a computer program and run on a task management device based on the von Neumann architecture. This computer program can be integrated into an application or run as a standalone utility application. The task management device can be a service platform. The service platform uses Redis to build a computing cluster to provide computing services. The service platform achieves efficient management of multiple tasks through Redis.
[0084] Redis (Remote Dictionary Server) is a high-performance, open-source, distributed, in-memory key-value database that supports various data structures. It is renowned for its ultra-low latency, high throughput, and flexibility. In this document, Redis is used as the core data storage and real-time task management tool.
[0085] Specifically, the task management method includes:
[0086] S102: Receive a target task request for a target task, and determine the target task name corresponding to the target task request;
[0087] Target task request: refers to a specific task or task processing requirement currently received by the system, such as a user-initiated data processing, computing task, or service call request.
[0088] Target task name: A name used to identify the task type, typically used for task categorization. For example, DATA_ANALYSIS_TASK or IMAGE_PROCESS_TASK.
[0089] As an illustration, the service platform receives a target task request for a certain target task through an interface or service, parses the task-related identification information (such as task type or task parameters) from the target task request, determines the target task name based on the task-related identification information, and then maps it to a preset task type in Redis or other storage systems.
[0090] For example, please see Figure 3 , Figure 3 This is a pseudocode diagram illustrating a target task request and response; in Figure 3In this code, `receiveTaskRequest()` is used to receive task request data from external sources (such as a target task request). The task request data can be JSON passed through an HTTP interface or messages pulled from a message queue (such as Kafka or RabbitMQ). `taskRequest.getTaskName()` is used to extract the target task name from the target task request. `taskName` is a unique identifier for the task, which determines the task type and subsequent task scheduling rules. `taskRequest.getResources()` retrieves the resource configuration information required by the target task. The return value is usually a resource requirement description object, including information such as CPU, memory, and bandwidth. Based on this resource configuration information, subsequent task response processing can be conveniently performed.
[0091] S104: Determine the task load value corresponding to the target task name, and determine the task rate limiting configuration value in the Redis service based on the target task name;
[0092] The task load values include, but are not limited to, the number of task instances currently running for the target task type, the amount of resources consumed when executing the target task type (such as CPU, memory, or network bandwidth), and the current computational processing priority of the target task type.
[0093] Task rate limiting configuration value: The concurrent execution limit set in the Redi service for the target task type in advance to prevent resource overload, that is, the threshold set for the task running load value.
[0094] As an example, the system records and statistically analyzes the task load values (such as quantity and resource consumption) of the target task currently being executed through the monitoring module or Redis service.
[0095] For example, it can be implemented based on a counter in Redis, as shown below:
[0096] Key: TASK_COUNT_IMAGE_RECOGNITION
[0097] Value: The number of tasks currently running.
[0098] Furthermore, the Redis service stores the rate limiting limit for each task type. For example:
[0099] Key: TASK_LIMIT_IMAGE_RECOGNITION
[0100] Value: Maximum allowed concurrency, for example, 10.
[0101] At this point, the service platform's system can determine the task rate limiting configuration value in the Redis service by using the target task name, and then compare the task rate limiting configuration value with the task's running load value to provide a basis for task scheduling.
[0102] S106: Based on the task rate limiting configuration value and the task running load value, perform target task processing on the target task request;
[0103] Target task processing: This refers to deciding whether to execute, delay, or reallocate tasks based on system resource availability, ensuring system stability and the rationality of task scheduling.
[0104] For example, the system will compare the current target task's workload (such as the current target task's processing capacity) with the task rate limiting configuration value in real time to ensure that the execution of the target task request does not exceed the resource's carrying capacity. If it is detected that the target task request is about to exceed the task rate limiting configuration value, the system will automatically take rate limiting control measures, such as delaying execution or scheduling to other computing nodes.
[0105] Example: Current status: The runtime load value of the target task IMAGE_RECOGNITION_TASK is 8 (i.e., 8 tasks are currently executing). The rate limit configured in the Redis service is 10. Result: The system can accept a maximum of 2 new task requests; otherwise, the rate limiting mechanism will be triggered.
[0106] For example, scenario description: A user initiates a video analysis task, and it is necessary to determine whether to execute the video analysis task.
[0107] Request received: "task_type":"video_analysis","input_data":"video_url"
[0108] After parsing the request, the target task name is determined to be: VIDEO_ANALYSIS_TASK.
[0109] The system queries the task rate limiting configuration value and the task running load value. The Redis service status is as follows: current task running load value (TASK_COUNT_VIDEO_ANALYSIS): 5, and the queried task rate limiting configuration value (TASK_LIMIT_VIDEO_ANALYSIS): 8. The system finds that 5 < 8, so the current video analysis task request is acceptable.
[0110] Execute the task: The system adds the task to the scheduling queue, calls the processing module to perform video analysis, and updates the running load value in real time: Redis operation: INCR TASK_COUNT_VIDEO_ANALYSIS.
[0111] If the task is completed: Redis operation: DECR TASK_COUNT_VIDEO_ANALYSIS.
[0112] Rate limiting scenario (if the limit is reached): If the running load value is already 8, the system will trigger rate limiting: delay the task to the task queue to wait for execution, or assign the task to other nodes.
[0113] In one or more embodiments of this specification, the service platform receives a target task request for a target task, determines the target task name corresponding to the target task request, determines the task runtime load value corresponding to the target task name, determines the task rate limiting configuration value in the Redis service based on the target task name, and processes the target task request based on the task rate limiting configuration value and the task runtime load value. This achieves efficient reception, intelligent scheduling, and precise allocation of resources for task requests. It not only effectively avoids system resource overload and ensures the stability of task execution, but also dynamically adapts to changes in task load, improving the overall processing efficiency and reliability of the system, while providing powerful scalability for task management in distributed scenarios.
[0114] In one or more embodiments, determining the task rate limiting configuration value in the Redis service based on the target task name can be done in the following ways:
[0115] Based on the target task name, perform a key-value query in the Redis service to obtain the task rate limiting configuration key-value.
[0116] Task rate limiting configuration key-value: The value stored in the Redis service for the task rate limiting value, used to query the concurrency limit of a specific task.
[0117] Target task name: A unique identifier for the task, used to dynamically generate Redis keys to facilitate key-value lookup operations.
[0118] As an example, a Redis key identifier is constructed based on the task name, as follows:
[0119] For example: TASK_LIMIT_ <taskname>
[0120] If the task name is IMAGE_PROCESSING_TASK, the corresponding Redis key is TASK_LIMIT_IMAGE_PROCESSING_TASK.
[0121] Next, query the key-value pair in Redis to retrieve the rate limiting configuration. Redis's GET command can directly retrieve the value of the key. If the key does not exist, it returns the default rate limiting value.
[0122] Furthermore, the step of obtaining the task rate limiting configuration key-value by performing a key-value query in the Redis service based on the target task name includes:
[0123] Use the target task name as the target key identifier, and query the task rate limiting configuration value corresponding to the target key identifier in the key-value pair mapping relationship of the Redis service;
[0124] The key-value pair mapping relationship includes at least one key identifier corresponding to a reference task name and a rate limiting configuration value corresponding to the key identifier.
[0125] Target key identifier: This is a mapping key to the target task name, used to uniquely identify the rate limiting configuration of the task. It typically uses a standardized naming convention, such as TASK_LIMIT_<task name>.
[0126] Key-value pair mapping: Redis stores key-value pairs for task rate limiting configurations. Key: The mapping identifier for the task name, and Value: The rate limiting configuration value associated with the task (such as the maximum allowed concurrency).
[0127] The reference task name is a standardized name for certain tasks in the key-value pair mapping relationship, used as a reference when querying rate limiting configuration values.
[0128] For example, suppose the following rate limiting configuration is stored in Redis:
[0129] TASK_LIMIT_IMAGE_PROCESSING_TASK=10
[0130] TASK_LIMIT_VIDEO_ANALYSIS_TASK=5
[0131] When the target task name is IMAGE_PROCESSING_TASK:
[0132] The target key identifier corresponding to the Redis query key is:
[0133] TASK_LIMIT_IMAGE_PROCESSING_TASK
[0134] Redis service returned: 10
[0135] Optionally, if the Redis service query identifies the target task name, it can determine the recommended task name that is similar to the target task name in the key-value pair mapping relationship, query the rate limiting configuration value corresponding to the recommended task name, and return the rate limiting configuration value.
[0136] In one or more embodiments of this specification, the method of querying the task rate limiting configuration value in Redis by the target task name supports real-time querying and updating of task rate limiting configuration, facilitates the expansion of task types, and avoids system anomalies due to missing keys by combining reference task names and default value processing. It leverages the high-performance characteristics of Redis to quickly respond to task scheduling needs, supports hierarchical management, batch querying and distributed rate limiting configuration, and is suitable for complex task management scenarios.
[0137] Please see Figure 4 , Figure 4 This is a flowchart illustrating another embodiment of a task management method proposed in this specification. Based on the high-performance characteristics of the Redis service, the service platform system can monitor task execution in real time and dynamically adjust rate limiting values according to requirements, thereby achieving flexible resource management. Specifically:
[0138] S2002: Monitor the task execution information and service resource carrying information of at least one reference task through the Redis service;
[0139] Reference Task: A task type stored in the Redis service that serves as a benchmark task for monitoring and analysis.
[0140] Task execution information: Dynamic data describing the running status and execution of tasks (such as various reference tasks). This includes, but is not limited to: the current number of tasks (such as the number of concurrent tasks), execution time, and success rate / failure rate.
[0141] Service resource usage information: The current resource usage of the system or node. This includes: CPU utilization, memory usage, network bandwidth, and disk I / O.
[0142] This example illustrates how Redis stores dynamic information about task execution in real time, allowing users to retrieve task running status by querying counters, timestamps, or status information in Redis. Task execution information is then generated based on this dynamic information and running status. The system also retrieves current system resource usage from a monitoring module (such as Prometheus or a built-in monitoring tool), assesses resource consumption by tasks using data from Redis, and generates service resource carrying information based on this assessment.
[0143] S2004: Based on the task execution information and the service resource carrying information, determine the task to be adjusted and the recommended rate limiting configuration value of the task to be adjusted, and adjust the key-value pair mapping relationship based on the recommended rate limiting configuration value of the task to be adjusted.
[0144] Tasks to be adjusted: Tasks whose current running status is abnormal (such as excessive resource consumption or increased failure rate) need to have their rate limiting configuration reset.
[0145] Recommended rate limiting configuration value: The optimal task concurrency limit value is calculated based on task execution information and service resource capacity information. The recommended rate limiting configuration value balances task performance and resource usage to avoid system overload.
[0146] Task key-value pair adjustment: Key-value update operations that store task rate limiting configuration values in Redis.
[0147] In one feasible implementation, rules are pre-set to filter tasks to be adjusted, such as filtering tasks to be adjusted according to the following rules:
[0148] The current number of concurrent tasks is close to or exceeds the rate limit.
[0149] The task execution time is abnormal (e.g., a significant increase in latency).
[0150] Service resource utilization has reached the warning threshold (e.g., CPU utilization exceeds 90%).
[0151] Then, by combining the task execution information and resource capacity information, the recommended rate limit value calculated by one or more recommended rate limit value models is obtained and the rate limit configuration value is dynamically adjusted.
[0152] Optional, recommended rate limiting model: Recommended rate limiting value = Total available resources / Resource requirement per task; Recommended rate limiting value = Average task success rate × Current system capacity;
[0153] Optionally, the recommended rate limiting value model can be trained using a machine learning model with sample data. By inputting the task execution information and service resource carrying information of the reference task into the recommended rate limiting value model, the recommended rate limiting value model determines the task to be adjusted and the recommended rate limiting configuration value of the task to be adjusted, and outputs the task to be adjusted and the recommended rate limiting configuration value.
[0154] As an illustration, the training process for the recommended current limiting model can be carried out in the following way:
[0155] The training process of the feature matching model is explained below:
[0156] Model creation: Create an initial recommended rate limiting value model based on a machine learning model for rate limiting update scenarios;
[0157] Sample data acquisition: Acquire a large amount of sample data. The sample data is based on the historical sample data of the service platform. The historical sample data includes sample task execution information and sample service resource carrying information for multiple tasks.
[0158] Sample data labeling: Based on the needs of rate limiting update scenarios, an expert service is introduced to manually label the sample data with corresponding sample tags. The sample tags include the tag of the task to be updated and the recommended rate limiting configuration value tag corresponding to the task to be updated.
[0159] Model training process: Input sample data into the initial recommendation rate limiting model for at least one round of model training to obtain the predicted task to be updated and the predicted recommendation rate limiting configuration value. Based on the predicted task to be updated and the task label, the model loss function is used to determine the task prediction loss value. Based on the predicted recommendation rate limiting configuration value and the recommendation rate limiting configuration value label, the model loss function is used to determine the rate limiting configuration loss value. The model loss is calculated based on the task prediction loss value and the rate limiting configuration loss value. The model parameters of the initial recommendation rate limiting model are adjusted based on the model loss until the model training termination condition is met to obtain the recommendation rate limiting model.
[0160] Optionally, the model's training termination conditions may include, for example, the loss function value being less than or equal to a preset loss function threshold, or the number of iterations reaching a preset threshold. Specific training termination conditions can be determined based on actual circumstances and are not specifically limited here.
[0161] It should be noted that the machine learning models involved in one or more embodiments of this specification include, but are not limited to, fitting one or more of the following machine learning models: Convolutional Neural Network (CNN) model, Deep Neural Network (DNN) model, Recurrent Neural Networks (RNN) model, embedding model, Gradient Boosting Decision Tree (GBDT) model, Logistic Regression (LR) model, etc.
[0162] Optionally, the model loss function may include, but is not limited to, the hinge loss function, the cross-entropy loss function, the contrastive loss function, etc.
[0163] In the embodiments described in this specification, by monitoring task execution information and service resource capacity through Redis, the system can dynamically identify tasks that need adjustment, automatically update the task rate limiting configuration in Redis based on the recommended rate limiting value calculated in real time, and optimize resource allocation.
[0164] Please see Figure 5 , Figure 5 This is a flowchart illustrating a target task processing method as presented in this specification. Specifically, the target task processing based on the task rate limiting configuration value and the task runtime load value can be performed as follows:
[0165] S3002: Compare the task's runtime load value and the task's rate limiting configuration value to obtain the configuration comparison result;
[0166] The judgment results after comparing the task load value with the rate limiting configuration value are divided into two types:
[0167] Task rate limiting execution type: The current load exceeds the rate limiting configuration value, and rate limiting processing needs to be triggered.
[0168] Normal task execution type: The current load is within the rate limiting range and the task can be processed normally.
[0169] This example illustrates querying the task runtime load value and task rate limiting configuration value from Redis. The values of the two are then compared.
[0170] If the task's runtime load value is greater than or equal to the task's rate limiting configuration value, the result is a task rate limiting execution type.
[0171] Otherwise, the result is a normal task execution type.
[0172] S3004: If the configuration comparison result is a task rate limiting execution type, then the target task request is subjected to target task rate limiting processing, and the task running load value is monitored to perform the step of comparing the task running load value and the task rate limiting configuration value to obtain the configuration comparison result;
[0173] Task rate limiting execution type: The current task load exceeds the rate limiting configuration value, and the execution of the task needs to be limited. The handling methods include, but are not limited to, delaying the execution of the task, discarding the request, or redistributing it to a low-load node.
[0174] This is an illustrative example of restricting task execution based on task priority or queuing strategies. This can be achieved, but is not limited to, the following methods:
[0175] Delayed execution: Add the task to the waiting queue and execute it after the load decreases.
[0176] Discard request: Returns a failure response directly, suitable for low-priority tasks.
[0177] Reassign: Distribute the task to other nodes with lower load.
[0178] Furthermore, a retry delay time is set. After the retry delay time is reached, the current task load value is detected, and the changes in the task load value and the rate limiting configuration value are continuously monitored. Then, S3002 is executed.
[0179] S3006: If the configuration comparison result is a normal task execution type, then the target task request is processed for target task execution.
[0180] Normal task execution type: The current task load is within the rate limiting configuration range, and task requests can be processed directly. Target task execution processing: Allocate resources according to the normal process and start task execution.
[0181] As an example, check if the task configuration comparison result indicates a normal task execution type. If the condition is met: directly allocate computing resources and start task processing. Update the task counter in the Redis service (e.g., using the INCR operation). After the task is completed, decrement the counter (e.g., using the DECR operation).
[0182] In one or more embodiments of this specification, the task execution status is intelligently determined by comparing the task load value and the rate limiting configuration value, distinguishing between rate-limited execution type and normal execution type. Under rate-limited conditions, strategies such as delayed execution, reallocation, or request dropping are adopted to dynamically adjust the task load; under normal conditions, resources are directly allocated to start task processing. This process ensures efficient utilization of system resources, avoids overload risks, and simultaneously guarantees task execution efficiency and system stability.
[0183] Please see Figure 6 , Figure 6 This is a schematic diagram of a configuration comparison process proposed in this specification. Optionally, the task runtime load value includes the number of tasks running, and the task rate limiting configuration value includes the number of tasks with rate limiting. The process of processing the target task request based on the task rate limiting configuration value and the task runtime load value can be performed as follows:
[0184] S4002: Compare the number of tasks running with the number of tasks with the rate limit;
[0185] Task execution count: The number of task instances currently being executed, such as the number of tasks being processed in the task queue. This can be stored as a counter using the Redis service.
[0186] Task limit value: The maximum number of concurrent tasks set for a certain task type.
[0187] S4004: If the number of tasks running is less than the number of tasks with rate limiting, then generate the first configuration comparison result of the task rate limiting execution type;
[0188] If the number of tasks running is less than the task rate limit, a first configuration comparison result is generated, allowing the tasks to continue execution, and the task status is marked as normal execution type. The system calls the execution module, allocates resources, and starts the task.
[0189] S4006: If the number of tasks running is greater than or equal to the number of tasks with flow restrictions, then generate a second configuration comparison result for the normal execution type of the task.
[0190] If the number of tasks running is greater than or equal to the task rate-limiting limit, a second configuration comparison result is generated; then the task status is marked as rate-limiting execution type, and the system takes rate-limiting measures on task requests, including but not limited to the following methods:
[0191] Add the task to the waiting queue.
[0192] The task request was rejected.
[0193] Assign it to a low-load node.
[0194] In one or more embodiments of this specification, the above method enables dynamic judgment of task status and corresponding processing strategies by comparing the number of tasks running with the rate limiting value; real-time monitoring of task load to avoid system resource overload and dynamic rate limiting; and rate limiting strategies to ensure system stability and reliability when the load is close to or exceeds the limit.
[0195] Please see Figure 7 , Figure 7 This is a schematic diagram of a task execution and post-processing update process proposed in this specification. After performing the target task execution processing on the target task request, the following methods can also be referenced:
[0196] S5002: Determine the target task completion process;
[0197] Once the target task is determined to be completed, the system needs to record the task completion status to provide a basis for the next step of processing or resource release.
[0198] This is an example of checking the return result of task execution: Task completed successfully: Mark the task as completed. Task failed: Mark the task as failed, which may trigger a retry or error logging.
[0199] Mark task completion: Update task status, such as recording the task completion timestamp or status information in Redis.
[0200] S5004: Update the task load value of the target task in the Redis service;
[0201] Task runtime load value update processing: Reduce the task runtime load value for the target task recorded in Redis, indicating that the number of target tasks currently being executed has decreased.
[0202] An illustrative example of a Redis key used to determine the workload of a task:
[0203] Example key name: TASK_COUNT_<task name>.
[0204] Then update the load value:
[0205] Call the Redis DECR command to decrease the counter value.
[0206] If the task fails, it will not affect the counter update.
[0207] S5006: Update the task request execution status of the target task in the Redis service.
[0208] Record the final state of the target task in the Redis service for easy subsequent querying, analysis, or retrying.
[0209] The statuses include: COMPLETED, FAILED, and RUNNING.
[0210] An illustrative example of a Redis key used to determine the execution status of a task: Example key name: TASK_STATUS_<task name>. Updating task status: Successful completion: Set the status to COMPLETED and record the completion timestamp. Execution failure: Set the status to FAILED and record the error message.
[0211] In one or more embodiments of this specification, the system achieves automated status management and resource scheduling updates after task execution is completed through the above method, thereby improving the maintainability of task scheduling and the efficiency of resource utilization.
[0212] In one or more embodiments described in this specification, the beneficial effects of this solution include, but are not limited to, the following aspects:
[0213] Improve system performance: Rate limiting mechanisms can effectively control task concurrency, reduce system load, and thus improve overall performance and response speed.
[0214] Resource optimization: Allocate and utilize resources rationally to avoid performance bottlenecks caused by resource contention and achieve higher resource utilization efficiency.
[0215] Enhance system stability: By preventing overload, improve system reliability, reduce the frequency of failures, and ensure business continuity and stability.
[0216] Flexible task management: Dynamically adjusts task rate limits to quickly adapt to changing business needs and provide flexible response capabilities.
[0217] Simplify operation and maintenance management: Redis's intuitive key-value pair structure simplifies task monitoring and management processes, improving operation and maintenance efficiency.
[0218] Timely feedback and monitoring: Real-time monitoring of task execution and rapid feedback on system status help to quickly identify and resolve potential problems.
[0219] Overall, task management methods can significantly improve the efficiency, stability, and flexibility of the system, providing solid technical support for business development.
[0220] The following will combine Figure 8 This specification provides a detailed description of the task management device provided in the embodiments. It should be noted that... Figure 8 The task control device shown is used to execute this instruction manual. Figures 1 to 7 The methods shown in the embodiments are illustrated for ease of explanation, showing only the parts related to the embodiments of this specification. For specific technical details not disclosed, please refer to this specification. Figures 1 to 7 The example shown.
[0221] Please see Figure 8 This diagram illustrates the structure of a task management device according to an embodiment of this specification. The task management device 1 can be implemented as all or part of a user terminal through software, hardware, or a combination of both. According to some embodiments, the task management device 1 includes a task request module 11, a task management module 12, and a task processing module 13, specifically used for:
[0222] Task request module 11 is used to receive a target task request for a target task and determine the target task name corresponding to the target task request;
[0223] Task management module 12 is used to determine the task running load value corresponding to the target task name, and determine the task rate limiting configuration value in the Redis service based on the target task name;
[0224] The task processing module 13 is used to process the target task request based on the task rate limiting configuration value and the task running load value.
[0225] In one feasible implementation, the task management module 12 is used for:
[0226] Based on the target task name, perform a key-value query in the Redis service to obtain the task rate limiting configuration key-value.
[0227] In one feasible implementation, the task management module 12 is used for:
[0228] Use the target task name as the target key identifier, and query the task rate limiting configuration value corresponding to the target key identifier in the key-value pair mapping relationship of the Redis service;
[0229] The key-value pair mapping relationship includes at least one key identifier corresponding to a reference task name and a rate limiting configuration value corresponding to the key identifier.
[0230] In one feasible implementation, the device 1 is further used for:
[0231] The Redis service is used to monitor the task execution information and service resource hosting information of at least one reference task.
[0232] Based on the task execution information and the service resource carrying information, determine the task to be adjusted and the recommended rate limiting configuration value of the task to be adjusted, and adjust the key-value pair mapping relationship based on the recommended rate limiting configuration value of the task to be adjusted.
[0233] In one feasible implementation, the task processing module 13 is configured to:
[0234] The task runtime load value and the task rate limiting configuration value are compared to obtain the configuration comparison result.
[0235] If the configuration comparison result is a task rate limiting execution type, then the target task request is subjected to target task rate limiting processing, and the task running load value is monitored to perform the step of comparing the task running load value and the task rate limiting configuration value to obtain the configuration comparison result;
[0236] If the configuration comparison result is a normal task execution type, then the target task request will be processed for target task execution.
[0237] In one feasible implementation, the task load value includes the number of tasks running, and the task rate limiting configuration value includes the number of tasks subject to rate limiting.
[0238] The task processing module 13 is used for:
[0239] Compare the number of tasks running with the number of tasks subject to rate limiting;
[0240] If the number of tasks running is less than the number of tasks subject to rate limiting, then a first configuration comparison result for the task rate limiting execution type is generated.
[0241] If the number of tasks running is greater than or equal to the number of tasks with throttling limits, a second configuration comparison result for the normal execution type of the task is generated.
[0242] In one feasible implementation, after performing target task execution processing on the target task request, the method further includes:
[0243] Determine the target task and its completion process;
[0244] The task load value of the target task is updated in the Redis service.
[0245] The Redis service updates the task request execution status of the target task.
[0246] It should be noted that the task management device provided in the above embodiments is only illustrated by the division of the above functional modules when executing the task management method. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the task management device and the task management method embodiments provided in the above embodiments belong to the same concept, and the implementation process is detailed in the method embodiments, which will not be repeated here.
[0247] The example numbers in this specification are for descriptive purposes only and do not represent the superiority or inferiority of the examples.
[0248] In one or more embodiments of this specification, the service platform receives a target task request for a target task, determines the target task name corresponding to the target task request, determines the task runtime load value corresponding to the target task name, determines the task rate limiting configuration value in the Redis service based on the target task name, and processes the target task request based on the task rate limiting configuration value and the task runtime load value. This achieves efficient reception, intelligent scheduling, and precise allocation of resources for task requests. It not only effectively avoids system resource overload and ensures the stability of task execution, but also dynamically adapts to changes in task load, improving the overall processing efficiency and reliability of the system, while providing powerful scalability for task management in distributed scenarios.
[0249] This specification also provides a computer storage medium that can store multiple instructions adapted to be loaded and executed by a processor as described above. Figures 1 to 7 The task management method described in the illustrated embodiment can be found in the following document for a detailed execution process. Figures 1 to 7 The specific details of the illustrated embodiments will not be elaborated here.
[0250] This specification also provides a computer program product that stores at least one instruction, said at least one instruction being loaded and executed by the processor as described above. Figures 1 to 7 The task management method described in the illustrated embodiment can be found in the following document for a detailed execution process. Figures 1 to 7 The specific details of the illustrated embodiments will not be elaborated here.
[0251] Please refer to Figure 9 This diagram illustrates a structural block diagram of an electronic device provided in an exemplary embodiment of this specification. The electronic device in this specification may include one or more components such as a processor 110, a memory 120, an input device 130, an output device 140, and a bus 150. The processor 110, memory 120, input device 130, and output device 140 may be connected via the bus 150.
[0252] Processor 110 may include one or more processing cores. Processor 110 connects to various parts of the electronic device using various interfaces and lines, and performs various functions and processes data by running or executing instructions, programs, code sets, or instruction sets stored in memory 120, and by calling data stored in memory 120. Optionally, processor 110 may be implemented using at least one hardware form of digital signal processing (DSP), field-programmable gate array (FPGA), or programmable logic array (PLA). Processor 110 may integrate one or more of the following: central processing unit (CPU), graphics processing unit (GPU), and modem. The CPU primarily handles the operating system, user interface, and applications; the GPU is responsible for rendering and drawing the displayed content; and the modem handles wireless communication. It is understood that the modem may also not be integrated into processor 110 and may be implemented separately using a communication chip.
[0253] The memory 120 may include random access memory (RAM) or read-only memory (ROM). Optionally, the memory 120 may include a non-transitory computer-readable storage medium. The memory 120 may be used to store instructions, programs, code, code sets, or instruction sets. The memory 120 may include a program storage area and a data storage area. The program storage area may store instructions for implementing an operating system, instructions for implementing at least one function (such as touch functionality, sound playback functionality, image playback functionality, etc.), instructions for implementing the various method embodiments described below, etc. The operating system may be the Android system, including systems deeply developed based on the Android system, the iOS system developed by Apple Inc., including systems deeply developed based on the iOS system, or other systems. The data storage area may also store data created by the electronic device during use, such as phonebook data, audio and video data, chat log data, etc.
[0254] See Figure 10 As shown, the memory 120 can be divided into operating system space and user space. The operating system runs in the operating system space, while native and third-party applications run in the user space. To ensure that different third-party applications can achieve good running performance, the operating system allocates corresponding system resources for each application. However, different application scenarios within the same third-party application have different requirements for system resources. For example, in local resource loading scenarios, third-party applications have high requirements for disk read speed; in animation rendering scenarios, third-party applications have high requirements for GPU performance. Since the operating system and third-party applications are independent of each other, the operating system often cannot promptly perceive the current application scenario of a third-party application, resulting in the operating system's inability to adapt system resources accordingly to the specific application scenario of the third-party application.
[0255] In order for the operating system to distinguish the specific application scenarios of third-party applications, it is necessary to establish data communication between the third-party applications and the operating system. This would allow the operating system to obtain the current scenario information of the third-party applications at any time, and then perform targeted system resource adaptation based on the current scenario.
[0256] Taking the Android operating system as an example, the programs and data stored in memory 120 are as follows: Figure 11 As shown, the memory 120 can store the Linux kernel layer 320, the system runtime library layer 340, the application framework layer 360, and the application layer 380. The Linux kernel layer 320, system runtime library layer 340, and application framework layer 360 belong to the operating system space, while the application layer 380 belongs to the user space. The Linux kernel layer 320 provides low-level drivers for various hardware components of the electronic device, such as display drivers, audio drivers, camera drivers, Bluetooth drivers, Wi-Fi drivers, and power management. The system runtime library layer 340 provides support for key features of the Android system through several C / C++ libraries. For example, the SQLite library provides database support, the OpenGL / ES library provides 3D graphics support, and the Webkit library provides browser kernel support. The system runtime library layer 340 also provides the Android runtime library, which mainly provides core libraries that allow developers to write Android applications using the Java language. The Application Framework Layer 360 provides various APIs that may be used when building applications. Developers can also use these APIs to build their own applications, such as activity management, window management, view management, notification management, content provider, package management, call management, resource management, and location management. At least one application runs in the Application Layer 380. These applications can be native applications that come with the operating system, such as contacts, SMS, clock, and camera apps; or third-party applications developed by third-party developers, such as games, instant messaging, and photo editing apps.
[0257] Taking the operating system as an example (iOS), the programs and data stored in memory 120 are as follows: Figure 12 As shown, the iOS system includes: Core OS layer 420, Core Services layer 440, Media layer 460, and Cocoa Touch layer 480. Core OS layer 420 includes the operating system kernel, drivers, and low-level program frameworks. These low-level program frameworks provide hardware-level functionality for use by the program frameworks located in Core Services layer 440. Core Services layer 440 provides system services and / or program frameworks required by applications, such as Foundation framework, account framework, advertising framework, data storage framework, network connectivity framework, geolocation framework, motion framework, etc. Media layer 460 provides applications with audiovisual interfaces, such as interfaces related to graphics and images, audio technology, video technology, and AirPlay (wireless playback of audio and video transmission technologies). Cocoa Touch layer 480 provides various commonly used interface-related frameworks for application development and is responsible for user touch interaction on electronic devices. Examples include local notification services, remote push services, advertising frameworks, game tool frameworks, message user interface (UI) frameworks, UIKit frameworks, map frameworks, and so on.
[0258] exist Figure 12 The framework shown includes, but is not limited to, the base framework in the core service layer 440 and the UIKit framework in the touchable layer 480. The base framework provides many basic object classes and data types, offering the most basic system services to all applications, and is independent of the UI. The UIKit framework, on the other hand, provides a basic UI class library for creating touch-based user interfaces. iOS applications can use the UIKit framework to provide their UI, thus providing the application's infrastructure for building user interfaces, drawing, handling user interaction events, responding to gestures, and so on.
[0259] The methods and principles for implementing data communication between third-party applications and the operating system in the iOS system can be found in the Android system, and will not be repeated here.
[0260] The input device 130 is used to receive input instructions or data, and includes, but is not limited to, a keyboard, mouse, camera, microphone, or touch device. The output device 140 is used to output instructions or data, and includes, but is not limited to, a display device and a speaker. In one example, the input device 130 and the output device 140 can be combined into a touch screen, which is used to receive touch operations from the user using a finger, stylus, or any suitable object on or near it, and to display the user interface of various applications. The touch screen is usually located on the front panel of the electronic device. The touch screen can be designed as a full-screen, curved screen, or irregularly shaped screen. The touch screen can also be designed as a combination of a full-screen and a curved screen, or a combination of an irregularly shaped screen and a curved screen; this specification does not limit this aspect.
[0261] In addition, those skilled in the art will understand that the structure of the electronic device shown in the above figures does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown, or combine certain components, or have different component arrangements. For example, the electronic device may also include radio frequency circuits, input units, sensors, audio circuits, wireless fidelity (WiFi) modules, power supplies, Bluetooth modules, etc., which will not be described in detail here.
[0262] In the embodiments of this specification, the executing entity for each step can be the electronic device described above. Optionally, the executing entity for each step can be the operating system of the electronic device. The operating system can be Android, iOS, or other operating systems; this specification does not limit this.
[0263] The electronic device described in this specification can also be equipped with a display device. This display device can be any device capable of displaying information, such as a cathode ray tube display (CR), a light-emitting diode display (LED), an e-ink screen, a liquid crystal display (LCD), or a plasma display panel (PDP). Users can use the display device on the electronic device to view displayed text, images, videos, and other information. The electronic device can be a smartphone, tablet computer, gaming device, AR (Augmented Reality) device, automobile, data storage device, audio playback device, video playback device, laptop, desktop computing device, or wearable device such as a smartwatch, smart glasses, smart helmet, smart bracelet, smart necklace, or smart clothing.
[0264] exist Figure 9 In the illustrated electronic device, which can be a service platform, the processor 110 can be used to call the application stored in the memory 120 and specifically perform the following operations:
[0265] Receive a target task request for a target task, and determine the target task name corresponding to the target task request;
[0266] Determine the task load value corresponding to the target task name, and determine the task rate limiting configuration value in the Redis service based on the target task name;
[0267] Based on the task rate limiting configuration value and the task running load value, the target task request is processed as a target task.
[0268] In one embodiment, when the processor 110 determines the task rate limiting configuration value in the Redis service based on the target task name, it performs the following operations:
[0269] Based on the target task name, perform a key-value query in the Redis service to obtain the task rate limiting configuration key-value.
[0270] In one embodiment, when the processor 110 performs a key-value query in the Redis service based on the target task name to obtain the task rate limiting configuration key-value, it performs the following operations:
[0271] Use the target task name as the target key identifier, and query the task rate limiting configuration value corresponding to the target key identifier in the key-value pair mapping relationship of the Redis service;
[0272] The key-value pair mapping relationship includes at least one key identifier corresponding to a reference task name and a rate limiting configuration value corresponding to the key identifier.
[0273] In one embodiment, the processor 110 further performs the following operations while executing the task management method:
[0274] The Redis service is used to monitor the task execution information and service resource hosting information of at least one reference task.
[0275] Based on the task execution information and the service resource carrying information, determine the task to be adjusted and the recommended rate limiting configuration value of the task to be adjusted, and adjust the key-value pair mapping relationship based on the recommended rate limiting configuration value of the task to be adjusted.
[0276] In one embodiment, the processor 110 performs target task processing on the target task request based on the task rate limiting configuration value and the task runtime load value, and performs the following operations:
[0277] The task runtime load value and the task rate limiting configuration value are compared to obtain the configuration comparison result.
[0278] If the configuration comparison result is a task rate limiting execution type, then the target task request is subjected to target task rate limiting processing, and the task running load value is monitored to perform the step of comparing the task running load value and the task rate limiting configuration value to obtain the configuration comparison result;
[0279] If the configuration comparison result is a normal task execution type, then the target task request will be processed for target task execution.
[0280] In one embodiment, the task load value includes the number of tasks running, and the task rate limiting configuration value includes the number of tasks subject to rate limiting.
[0281] The processor 110 performs the configuration comparison between the task runtime load value and the task rate limiting configuration value, obtains the configuration comparison result, and performs the following operations:
[0282] Compare the number of tasks running with the number of tasks subject to rate limiting;
[0283] If the number of tasks running is less than the number of tasks subject to rate limiting, then a first configuration comparison result for the task rate limiting execution type is generated.
[0284] If the number of tasks running is greater than or equal to the number of tasks with throttling limits, a second configuration comparison result for the normal execution type of the task is generated.
[0285] In one embodiment, after performing the target task execution processing on the target task request, the processor 110 further performs the following operations:
[0286] Determine the target task and its completion process;
[0287] The task load value of the target task is updated in the Redis service.
[0288] The Redis service updates the task request execution status of the target task.
[0289] In one or more embodiments of this specification, the service platform receives a target task request for a target task, determines the target task name corresponding to the target task request, determines the task runtime load value corresponding to the target task name, determines the task rate limiting configuration value in the Redis service based on the target task name, and processes the target task request based on the task rate limiting configuration value and the task runtime load value. This achieves efficient reception, intelligent scheduling, and precise allocation of resources for task requests. It not only effectively avoids system resource overload and ensures the stability of task execution, but also dynamically adapts to changes in task load, improving the overall processing efficiency and reliability of the system, while providing powerful scalability for task management in distributed scenarios.
[0290] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. The storage medium can be a magnetic disk, optical disk, read-only memory, or random access memory, etc.
[0291] The above-disclosed embodiments are merely preferred embodiments of this specification and should not be construed as limiting the scope of this specification. Therefore, any equivalent variations made in accordance with the claims of this specification shall still fall within the scope of this specification.< / taskname>
Claims
1. A task management method, characterized in that, The method includes: Receive a target task request for a target task, and determine the target task name corresponding to the target task request; Determine the task load value corresponding to the target task name, and determine the task rate limiting configuration value in the Redis service based on the target task name; Based on the task rate limiting configuration value and the task running load value, the target task request is processed as a target task.
2. The method according to claim 1, characterized in that, The step of determining the task rate limiting configuration value in the Redis service based on the target task name includes: Based on the target task name, perform a key-value query in the Redis service to obtain the task rate limiting configuration key-value.
3. The method according to claim 2, characterized in that, The step of obtaining the task rate limiting configuration key-value by performing a key-value query in the Redis service based on the target task name includes: Use the target task name as the target key identifier, and query the task rate limiting configuration value corresponding to the target key identifier in the key-value pair mapping relationship of the Redis service; The key-value pair mapping relationship includes at least one key identifier corresponding to a reference task name and a rate limiting configuration value corresponding to the key identifier.
4. The method according to claim 3, characterized in that, The method further includes: The Redis service is used to monitor the task execution information and service resource hosting information of at least one reference task. Based on the task execution information and the service resource carrying information, determine the task to be adjusted and the recommended rate limiting configuration value of the task to be adjusted, and adjust the key-value pair mapping relationship based on the recommended rate limiting configuration value of the task to be adjusted.
5. The method according to claim 1, characterized in that, The step of processing the target task request based on the task rate limiting configuration value and the task runtime load value includes: The task runtime load value and the task rate limiting configuration value are compared to obtain the configuration comparison result. If the configuration comparison result is a task rate limiting execution type, then the target task request is subjected to target task rate limiting processing, and the task running load value is monitored to perform the step of comparing the task running load value and the task rate limiting configuration value to obtain the configuration comparison result; If the configuration comparison result is a normal task execution type, then the target task request will be processed for target task execution.
6. The method according to claim 5, characterized in that, The task load value includes the number of tasks running, and the task rate limiting configuration value includes the number of tasks subject to rate limiting. The step of comparing the task's runtime load value and the task's rate limiting configuration value to obtain the configuration comparison result includes: Compare the number of tasks running with the number of tasks subject to rate limiting; If the number of tasks running is less than the number of tasks subject to rate limiting, then a first configuration comparison result for the task rate limiting execution type is generated. If the number of tasks running is greater than or equal to the number of tasks with throttling limits, a second configuration comparison result for the normal execution type of the task is generated.
7. The method according to claim 5, characterized in that, After performing target task execution processing on the target task request, the method further includes: Determine the target task and its completion process; The task load value of the target task is updated in the Redis service. The Redis service updates the task request execution status of the target task.
8. A task control device, characterized in that, The device includes: The task request module is used to receive a target task request for a target task and determine the target task name corresponding to the target task request. The task management module is used to determine the task running load value corresponding to the target task name, and to determine the task rate limiting configuration value in the Redis service based on the target task name; The task processing module is used to process the target task request based on the task rate limiting configuration value and the task running load value.
9. A computer storage medium, characterized in that, The computer storage medium stores a plurality of instructions, which are adapted to be loaded by a processor and executed as method steps as claimed in any one of claims 1 to 7.
10. An electronic device, characterized in that, include: A processor and a memory; wherein the memory stores a computer program adapted to be loaded by the processor and executed the method steps as claimed in any one of claims 1 to 7.