Task processing method and device, program product and electronic equipment
By analyzing the priority information of task processing requests and the access priority information of downstream services in the task processing system, deciding whether to respond to the distributed content information, solving the problem of poor user experience when service overload is solved, and hierarchical response is achieved to ensure that the core task is responded.
Patent Information
- Application Number
- CN202411962634.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-27
- Publication Date
- 2025-04-25
AI Technical Summary
The prior art causes poor user experience when dealing with service overload of large-scale microservice architecture systems, especially after the downstream service is circuited, content requests that strongly rely on the downstream service will fail, and page content may be missing.
By analyzing the business logic information and distribution content information of the task processing request in the task processing system, determining the priority information of the request, and determining whether to respond to the distribution content information based on the priority information and the access priority information of the downstream service, thereby realizing a hierarchical response.
When the task processing system is overloaded, avoid not responding to the received task processing request at one time, but instead responding in a hierarchical manner based on priority information to ensure that the core tasks are responded and improve user experience.
Smart Images

Figure CN119883558A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present disclosure relate to the field of computer technology, and more specifically, to a task processing method, a task processing device, a computer program product, and an electronic device. Background Art
[0002] This section is intended to provide a background or context to the embodiments of the disclosure that are recited in the claims. No description herein is admitted to be prior art by inclusion in this section.
[0003] For large-scale microservice architecture systems, in order to alleviate the problem of unresponsive services and poor user experience when the system is overloaded, an effective overload control solution needs to be provided.
[0004] In the related technology, when the downstream service is overloaded and the upstream service times out, the downstream service is directly fused to protect the upstream service's own response and relieve downstream pressure. Summary of the invention
[0005] However, when the downstream service is blown, all content requests that strongly depend on the downstream service will fail, which may result in missing page content, reducing the user experience.
[0006] It can be seen that in the related technology, there is a problem that the service overload processing effect is poor, resulting in a poor user experience.
[0007] In view of this, the present disclosure provides a task processing method, a task processing device, a computer program product, and an electronic device to improve the service overload processing effect to a certain extent.
[0008] According to a first aspect of the present disclosure, a task processing method is provided, the method comprising:
[0009] When it is determined that the task processing system is in service overload, analyzing the received task processing request to obtain business logic information and distribution content information corresponding to the task processing request;
[0010] Determining priority information corresponding to the task processing request according to the distribution content information;
[0011] Determining, based on the business logic information, at least one downstream service for processing the distributed content information;
[0012] The downstream service is controlled to determine whether to respond to the distribution content information according to the priority information and corresponding admission priority information.
[0013] In a possible implementation manner, before determining that the task processing system is in service overload, the method further includes:
[0014] Determine whether the current task processing status information meets the overload service protection mechanism startup conditions;
[0015] If the overload service protection mechanism startup condition is met, it is determined that the task processing system is in service overload.
[0016] In a possible implementation manner, determining whether the current task processing status information satisfies the overload service protection mechanism startup condition includes:
[0017] When it is determined that the average waiting time of the task queue in the thread pool at the current moment is greater than a preset threshold, it is determined that the start-up condition of the overload service protection mechanism is met.
[0018] In a possible implementation, the method further includes:
[0019] Determine the number of tasks that the thread pool can carry, the current number of tasks in the task queue in the thread pool at the current moment, and the request time corresponding to the tasks in the task queue in the thread pool at the current moment;
[0020] According to the number of loadable tasks, the current number of tasks and the request time, the average waiting time of the task queue in the thread pool at the current moment is determined.
[0021] In a possible implementation manner, controlling the downstream service to determine whether to respond to the distribution content information according to the priority information and the admission priority information includes:
[0022] If it is determined that the priority level indicated by the priority information is lower than the priority level indicated by the admission priority information, then no response is made to the distribution content information;
[0023] If it is determined that the priority indicated by the priority information is not lower than the priority indicated by the admission priority information, and there is a next-level service of the downstream service, forwarding the distribution content information to the next-level service of the downstream service, so that the next-level service determines whether to respond to the distribution content information according to the priority information and the corresponding admission priority information;
[0024] If it is determined that the priority indicated by the priority information is not lower than the priority indicated by the admission priority information, and there is no next-level service of the downstream service, then a response is made to the distribution content information.
[0025] In a possible implementation, determining priority information corresponding to the task processing request according to the distribution content information includes:
[0026] Determine the business attribute information to which the distribution content information belongs;
[0027] The priority information corresponding to the task processing request is determined according to the business attribute information and a first preset relationship set; wherein the first preset relationship set includes a plurality of sub-relationships corresponding to business attribute information and priorities.
[0028] In a possible implementation, determining priority information corresponding to the task processing request according to the distribution content information includes:
[0029] Determining the account attribute information to which the distributed content information belongs;
[0030] The priority information corresponding to the task processing request is determined according to the account attribute information and the second preset relationship set; wherein the second preset relationship set includes a plurality of sub-relationships corresponding to the account attribute information and the priority.
[0031] According to a second aspect of the present disclosure, there is provided a task processing device, the device comprising:
[0032] An analysis unit, configured to analyze a received task processing request when it is determined that the task processing system is in service overload, and obtain business logic information and distribution content information corresponding to the task processing request;
[0033] A first determining unit, configured to determine priority information corresponding to the task processing request according to the distribution content information;
[0034] A second determining unit, configured to determine at least one downstream service for processing the distributed content information according to the business logic information;
[0035] The processing unit is used to control the downstream service to determine whether to respond to the distribution content information according to the priority information and the corresponding admission priority information.
[0036] In a possible implementation manner, before determining that the task processing system is in service overload, the device further includes a judgment unit, which is used to:
[0037] Determine whether the current task processing status information meets the overload service protection mechanism startup conditions;
[0038] If the overload service protection mechanism startup condition is met, it is determined that the task processing system is in service overload.
[0039] In a possible implementation manner, the device further includes a determining unit, configured to:
[0040] When it is determined that the average waiting time of the task queue in the thread pool at the current moment is greater than a preset threshold, it is determined that the start-up condition of the overload service protection mechanism is met.
[0041] In a possible implementation manner, the device further includes a determining unit, configured to:
[0042] Determine the number of tasks that the thread pool can carry, the current number of tasks in the task queue in the thread pool at the current moment, and the request time corresponding to the tasks in the task queue in the thread pool at the current moment;
[0043] According to the number of loadable tasks, the current number of tasks and the request time, the average waiting time of the task queue in the thread pool at the current moment is determined.
[0044] In a possible implementation manner, the processing unit is configured to:
[0045] If it is determined that the priority level indicated by the priority information is lower than the priority level indicated by the admission priority information, then no response is made to the distribution content information;
[0046] If it is determined that the priority indicated by the priority information is not lower than the priority indicated by the admission priority information, and there is a next-level service of the downstream service, forwarding the distribution content information to the next-level service of the downstream service, so that the next-level service determines whether to respond to the distribution content information according to the priority information and the corresponding admission priority information;
[0047] If it is determined that the priority indicated by the priority information is not lower than the priority indicated by the admission priority information, and there is no next-level service of the downstream service, then a response is made to the distribution content information.
[0048] In a possible implementation manner, the first determining unit is configured to:
[0049] Determine the business attribute information to which the distribution content information belongs;
[0050] The priority information corresponding to the task processing request is determined according to the business attribute information and a first preset relationship set; wherein the first preset relationship set includes a plurality of sub-relationships corresponding to business attribute information and priorities.
[0051] In a possible implementation manner, the first determining unit is configured to:
[0052] Determining the account attribute information to which the distributed content information belongs;
[0053] The priority information corresponding to the task processing request is determined according to the account attribute information and the second preset relationship set; wherein the second preset relationship set includes a plurality of sub-relationships corresponding to the account attribute information and the priority.
[0054] According to a third aspect of the present disclosure, a computer program product is provided, including a computer program, wherein when the computer program is executed by a processor, the method of the first aspect and possible implementations thereof are implemented.
[0055] According to a fourth aspect of the present disclosure, an electronic device is provided, comprising: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to execute the method of the above-mentioned first aspect and its possible implementation methods by executing the executable instructions.
[0056] The technical solution disclosed in this disclosure has the following beneficial effects:
[0057] In the embodiment of the present disclosure, when it is determined that the task processing system is in a service overload, the received task processing request can be analyzed to obtain the business logic information and distribution content information corresponding to the task processing request; then, based on the distribution content information, the priority information corresponding to the task processing request is determined; further, based on the business logic information, at least one downstream service that processes the distribution content information is determined; and, the downstream service is controlled to determine whether to respond to the distribution content information based on the priority information and the corresponding access priority information. It can be seen that in the embodiment of the present disclosure, when the task processing system is in a service overload, it does not fail to respond to the received task processing request at one time, but rather performs a specific analysis of the task processing request, and determines whether to respond to the distribution content information based on the priority information corresponding to the task processing request and the access priority information corresponding to the downstream service, thereby achieving a hierarchical response to ensure that the core tasks in the task processing system are responded to and improve the user experience.
[0058] Other features and advantages of the present disclosure will be described in the following description, and partly become apparent from the description, or be understood by practicing the present disclosure. The purpose and other advantages of the present disclosure can be realized and obtained by the structures particularly pointed out in the written description, claims, and drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0059] In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the drawings required for use in the embodiments of the present disclosure will be briefly introduced below. Obviously, the drawings introduced below are only some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0060] Figure 1A schematic diagram showing a processing request in this exemplary embodiment;
[0061] Figure 2 A schematic diagram of an application scenario in this exemplary embodiment is shown;
[0062] Figure 3 A flowchart showing a task processing method in this exemplary embodiment;
[0063] Figure 4 A schematic diagram showing a processing task processing request in this exemplary embodiment;
[0064] Figure 5 A schematic diagram showing the structure of a task processing device in this exemplary embodiment is shown;
[0065] Figure 6 A schematic structural diagram of an electronic device in this exemplary embodiment is shown. DETAILED DESCRIPTION
[0066] In order to make the purpose, technical solutions and advantages of the present disclosure clearer, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only part of the embodiments of the present disclosure, rather than all of the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present disclosure. In the absence of conflict, the embodiments in the present disclosure and the features in the embodiments can be arbitrarily combined with each other. In addition, although the logical order is shown in the flow chart, in some cases, the steps shown or described can be performed in an order different from that here.
[0067] The term "comprising" and any variations thereof in the specification and claims of the present disclosure are intended to cover non-exclusive protection. For example, a process, method, system, product or device comprising 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.
[0068] In the embodiments of the present disclosure, one or more, "many" refers to two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b or c can represent: a, b, c, ab, ac, bc, or abc, where a, b, c can be single or plural.
[0069] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order, sequence, size, and priority. For example, the first task processing request and the second task processing request in the embodiment of the present disclosure are only used to distinguish different task processing requests. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.
[0070] The following is a description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, which are schematic diagrams of the present disclosure and are not necessarily drawn to scale. Some of the block diagrams shown in the accompanying drawings may be functional entities, which do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software form, or in hardware modules or integrated circuits, or in networks, processors or microcontrollers. The implementation method can be implemented in a variety of forms and should not be understood as being limited to the examples set forth herein. The features, structures or characteristics described in the present disclosure may be combined in one or more implementations in any suitable manner. In the following description, many specific details are provided to provide a full description of the implementation methods of the present disclosure. However, those skilled in the art should be aware that one or more specific details may be omitted when implementing the technical solution of the present disclosure, or one or more specific details may be replaced by other methods, components, devices, steps, etc. It should be noted that in the embodiments of the present disclosure, the dissemination and use of data, etc., are in compliance with relevant national laws and regulations. SUMMARY OF THE INVENTION
[0072] For large-scale microservice architecture systems, effective overload control is crucial to protecting the system, and overload control aims to alleviate the problem of service unresponsiveness when the system is overloaded.
[0073] The overload control designs provided in the related technologies are all for a single service. Specifically, when a downstream service is overloaded, the upstream uses a timeout to fuse the downstream service, thereby protecting its own response and alleviating downstream pressure. However, when the downstream service is fused, all content requests that strongly rely on the downstream service will fail, and the page content may be missing, which reduces the user experience.
[0074] It can be seen that in the related technology, there is a problem that the service overload processing effect is poor, resulting in a poor user experience.
[0075] For example, see Figure 1 , taking the content requested as cloud music content as an example, the content distribution service that executes the content request relies on the account service. And, the content distribution service can receive content requests triggered by the client, and the content request includes, for example, core content such as homepage modules, edge content such as event promotion information, etc.
[0076] Specifically, when the number of requests for a promotion activity surges, the content distribution service receives multiple content requests carrying content promotion information. When the content distribution service determines that the downstream service, namely the account service, is overloaded, it can perform a circuit breaker. In this way, after the account service is circuit-breakered, all content requests that strongly rely on the account service will fail, thereby affecting core content such as the homepage module, for example, the homepage will be blank, reducing the user experience.
[0077] In response to one or more of the above-mentioned problems, the embodiments of the present disclosure provide a task processing method, through which, when it is determined that the task processing system is in a service overload, the received task processing request can be analyzed to obtain the business logic information and distribution content information corresponding to the task processing request; then, based on the distribution content information, the priority information corresponding to the task processing request is determined; further, based on the business logic information, at least one downstream service that processes the distribution content information is determined; and, the downstream service is controlled to determine whether to respond to the distribution content information based on the priority information and the corresponding access priority information. It can be seen that in the embodiments of the present disclosure, when the task processing system is in a service overload, it does not respond to the received task processing request at one time, but rather specifically analyzes the task processing request, and determines whether to respond to the distribution content information based on the priority information corresponding to the task processing request and the access priority information corresponding to the downstream service, thereby achieving a hierarchical response to ensure that the core tasks in the task processing system are responded to and improve the user experience.
[0078] After introducing the basic principles of the present disclosure, various non-limiting embodiments of the present disclosure are described in detail below.
[0079] Application Scenario Overview
[0080] In order to better understand the technical solutions provided by the embodiments of the present disclosure, the following briefly introduces the application scenarios to which the technical solutions provided by the embodiments of the present disclosure are applicable. It should be noted that the application scenarios introduced below are only used to illustrate the embodiments of the present disclosure and are not intended to limit the present disclosure. In specific implementation, the technical solutions provided by the embodiments of the present disclosure can be flexibly applied according to actual needs.
[0081] In order to more clearly introduce the contents of the embodiments of the present disclosure, some key terms are introduced below:
[0082] Thread Pool: A task execution model used to manage and optimize thread usage in a multi-threaded environment, reducing the overhead of thread creation and destruction by reusing threads.
[0083] Overload Protection: A series of measures taken by the system to prevent a sharp drop in system performance or crash when the system faces a request pressure that exceeds its processing capacity.
[0084] Request Statistics: The process of counting and analyzing the requests received and processed by the system to assess the load and performance of the system.
[0085] Microservices Architecture: A software architecture style that decomposes an application into a set of small services, each of which implements a specific business function and works together through lightweight communication mechanisms.
[0086] Service Degradation: When the system is overloaded or unstable, temporarily shut down or reduce the functions of some non-core services to ensure the normal operation of core services.
[0087] Queue Length: The number of requests in the request queue waiting to be processed is one of the important indicators for measuring system load.
[0088] Fault Recovery: The process of restoring the system to normal operation after a fault occurs, including automatic recovery and manual recovery.
[0089] Service Level Agreement (SLA): A formal agreement between a service provider and a customer on service levels, including indicators such as service quality and response time.
[0090] Service Level Objective (SLO): A specific target for system performance based on the service level defined in the SLA, used to measure and monitor service performance.
[0091] RPC service: RPC is the abbreviation of remote procedure call, which allows one computer to call a program on another computer to get the result. In a distributed system, RPC is needed to solve the calling problem between services.
[0092] In the embodiments of the present disclosure, the task processing technology can be applied to business scenarios corresponding to various business platforms or systems that require overload protection. The business platforms may be, for example, music platforms, video playback platforms, product sales platforms, dating platforms, and other types of business platforms. For example, the business scenario of overload protection for a music platform is not limited to this in the embodiments of the present disclosure.
[0093] See also Figure 2 As shown, Figure 2 This is an application scenario to which the technical solution of the embodiment of the present disclosure can be applied. In the scenario diagram, a terminal device 101 and an electronic device 102 are included. The terminal device 101 can be multiple devices. Figure 1 Only one is shown, that is, multiple users can log in to the corresponding business platform based on the corresponding terminal device 101 respectively to trigger a task processing request, and the electronic device 102 can execute the triggered task processing requests of multiple terminal devices 101 to perform overload protection processing on the system corresponding to the business platform corresponding to the terminal device 101.
[0094] The terminal device 101 and the electronic device 102 , as well as each terminal device 101 , may be directly or indirectly connected to each other through one or more networks 103 .
[0095] In the embodiment of the present disclosure, a user can log in to the terminal device 101 to send a task processing request to the electronic device 102, and then the electronic device 102 can determine whether the task processing system is in a service overload. When it is determined that the task processing system is in a service overload, the received task processing request can be analyzed to obtain the business logic information and distribution content information corresponding to the task processing request; then, based on the distribution content information, the priority information corresponding to the task processing request is determined; further, based on the business logic information, at least one downstream service that processes the distribution content information is determined; and, the downstream service is controlled to determine whether to respond to the distribution content information based on the priority information and the corresponding access priority information.
[0096] in, Figure 1 The terminal device 101 may be a mobile phone, a tablet computer (PAD), a personal computer (PC), a smart TV, a smart watch, a smart speaker, a smart car device, and a wearable device, but is not limited thereto. These devices may have the function of supporting triggering task processing requests.
[0097] as well as, Figure 1 The electronic device 102 may be an independent physical server, or a server cluster or distributed system composed of multiple physical servers. It may also be a cloud server or a cloud server cluster that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms, but is not limited to these.
[0098] Of course, the method provided in the embodiment of the present disclosure is not limited to Figure 1 The application scenarios shown may also be used in other possible application scenarios, such as application scenarios where the task processing method is implemented only by electronic devices, and the embodiments of the present disclosure are not limited thereto.
[0099] Exemplary Methods
[0100] To further illustrate the technical solution provided by the embodiments of the present disclosure, this is described in detail below in conjunction with the accompanying drawings and specific implementation methods. Although the embodiments of the present disclosure provide method operation steps as shown in the following embodiments or drawings, more or fewer operation steps may be included in the method based on routine or no creative labor. In the steps where there is no necessary causal relationship logically, the execution order of these steps is not limited to the execution order provided by the embodiments of the present disclosure. The method may be executed in the order of the method shown in the embodiments or drawings or in parallel during the actual processing process or when the device is executed.
[0101] See also Figure 3 , Figure 3 FIG. 1 is a flowchart of a task processing method in an embodiment of the present disclosure. The method process may be performed by an electronic device, such as Figure 2 The electronic device 102 in the embodiment is executed, and the specific implementation process of the method is as follows:
[0102] Step 301: When it is determined that the task processing system is in service overload, the received task processing request is analyzed to obtain the business logic information and distribution content information corresponding to the task processing request.
[0103] In the disclosed embodiment, the electronic device may determine whether the current task processing status information satisfies the overload service protection mechanism startup condition; if the overload service protection mechanism startup condition is satisfied, it is determined that the task processing system is in service overload.
[0104] In the embodiments of the present disclosure, although the average processing time of a request can be used to estimate whether there is an overloaded service, sometimes an increase in the average processing time of a request may not be due to an overload of the current service, but rather an overload of the downstream service on which the service that processes the request depends. Therefore, in order to eliminate the impact of the downstream service call caused by the overloaded service fuse, the embodiments of the present disclosure do not use the average processing time of the request to estimate whether there is an overloaded service. Instead, the average waiting time of the task queue in the thread pool is used to calculate whether the service is overloaded.
[0105] Optionally, when it is determined that the average waiting time of the task queue in the thread pool at the current moment is greater than a preset threshold, it is determined that the overload service protection mechanism startup condition is met.
[0106] In an embodiment of the present disclosure, the electronic device can determine the number of tasks that can be carried by the thread pool, the current number of tasks in the task queue in the thread pool at the current moment, and the request time corresponding to the tasks in the task queue in the thread pool at the current moment, and then can determine the average waiting time of the task queue in the thread pool at the current moment based on the number of tasks that can be carried, the current number of tasks and the request time.
[0107] For example, the following formula can be used to determine the average waiting time of the task queue in the thread pool at the current moment:
[0108] waitTime=(queueCount*rt) / concurrency Formula 1.
[0109] Among them, queueCount is used to represent the current number of tasks in the task queue in the thread pool at the current moment, rt is used to represent the request time corresponding to the tasks in the task queue in the thread pool at the current moment, and concurrency is used to represent the number of tasks that the thread pool can carry.
[0110] For example, if waitTime is 20ms, rt is 10ms, and the number of tasks that the thread pool can carry is 100, the processing capacity of the thread pool can be obtained according to the following formula 2:
[0111] qps=concurrency / rt Formula 2.
[0112] Substituting the above data, we get qps = 100 / 0.01 = 10,000. Assuming that after the thread pool is backlogged, the processing capacity of the thread pool is still 10,000. When multiple task processing requests are suddenly added, for example, there are 11,000 tasks to be processed in the thread pool, 1,000 of them will be queued. At this time, 1000*20 (waitTime) / 100 = 200, that is, only 200 can be accumulated in the thread pool at this time. If more than 200 tasks are accumulated, they will be discarded.
[0113] Assuming that rt increases from 10ms to 20ms, the processing capacity (that is, processing 10,000 soft tasks) remains unchanged, and the number of concurrencies remains unchanged, which will lead to a large accumulation of thread pools and the overload protection will take effect.
[0114] Step 302: Determine the priority information corresponding to the task processing request according to the distribution content information.
[0115] In a possible implementation, the electronic device may determine the business attribute information to which the distribution content information belongs, and then determine the priority information corresponding to the task processing request based on the business attribute information and a first preset relationship set; wherein the first preset relationship set includes multiple sub-relationships corresponding to business attribute information and priorities.
[0116] Optionally, the business attribute information can be determined according to the importance of the business, such as core business or non-core business. The business attribute information can also be determined according to the business direction of the business, such as home page business or promotional business. This is not limited in the embodiments of the present disclosure.
[0117] For example, if the business attribute information of the electronic device distributing content information is a core business, the sub-relationship matching the core business is screened from the first preset relationship set, and then the priority information corresponding to the task processing request is determined according to the priority included in the sub-relationship.
[0118] In one possible implementation, the electronic device may determine the account attribute information to which the distribution content information belongs; determine the priority information corresponding to the task processing request based on the account attribute information and the second preset relationship set; wherein the second preset relationship set includes multiple sub-relationships corresponding to the account attribute information and the priority.
[0119] For example, the electronic device determines that the account attribute information to which the distributed content information belongs is the user level information, and then selects the sub-relationship matching the user level information from the second preset relationship set, and then determines the priority information corresponding to the task processing request according to the priority included in the sub-relationship. Optionally, when multiple sub-relationships are set in the second preset relationship set, the priority information can be adaptively set according to the user level information. For example, if the user level information is the highest level, i.e., level eight, then the corresponding priority is level eight. For another example, if the user level information is level four, then the corresponding priority is level four. Of course, the corresponding method can also be adaptively set, which is not limited in the embodiments of the present disclosure.
[0120] It can be seen that the present disclosure can determine the priority information corresponding to the task processing request from the perspective of the business attribute information to which the distribution content information belongs, and can also determine the priority information corresponding to the task processing request from the perspective of the business attribute information to which the distribution content information belongs. It provides multiple determination methods and enriches the feasibility of the solution.
[0121] In a possible implementation, the electronic device may also comprehensively consider the business attribute information and the account attribute information to which the distribution content information belongs to determine the priority information corresponding to the task processing request, which is not limited in the embodiments of the present disclosure.
[0122] Step 303: Determine at least one downstream service for processing the distribution content information according to the business logic information.
[0123] Step 304: Control the downstream service to determine whether to respond to the distribution content information according to the priority information and the corresponding admission priority information.
[0124] In the disclosed embodiment, the electronic device can determine at least one downstream service that processes the distribution content information based on the business logic information, and control each downstream service to determine whether to respond to the distribution content information according to the priority information and the corresponding access priority information. In other words, in the disclosed embodiment, each downstream service can independently determine whether to respond to the distribution content information, thereby avoiding the situation where no one responds.
[0125] In the embodiment of the present disclosure, each downstream service may perform the following processing:
[0126] Optionally, if the downstream service determines that the priority indicated by the priority information is lower than the priority indicated by the admission priority information, no response is made to the distribution content information.
[0127] Optionally, if the downstream service determines that the priority indicated by the priority information is not lower than the priority indicated by the access priority information, and there is a next-level service of the downstream service, the distribution content information is forwarded to the next-level service of the downstream service, so that the next-level service determines whether to respond to the distribution content information based on the priority information and the corresponding access priority information.
[0128] Optionally, if the downstream service determines that the priority indicated by the priority information is not lower than the priority indicated by the admission priority information, and there is no next-level service of the downstream service, then the distribution content information is responded to.
[0129] In the disclosed embodiment, each level of service can periodically adjust the access priority according to the load situation. This can avoid the problem of mismatch with the service's own processing situation and improve the response effect of the service to task processing requests.
[0130] It can be seen that in the embodiment of the present disclosure, each downstream service can determine whether to accept or discard the task processing request based on its own service access priority, thereby achieving the purpose of hierarchical flow control, avoiding situations such as core content not being displayed, and improving the user experience.
[0131] The following is an introduction to the task processing solution provided by the embodiment of the present disclosure using a specific example. Figure 4 When a user triggers a task processing request based on the cloud music software, the task processing request is routed to the content distribution layer, which then assigns the request priority based on the content carried in the task processing request, and all requests sent to downstream services inherit the same priority. In other words, a task processing request corresponds to a unique priority information. Figure 4 In , the request sent to the downstream service is called a subrequest.
[0132] Furthermore, one or more downstream services are called according to the business logic. When the downstream service receives a sub-request, it first determines whether to accept or discard the sub-request based on its own service admission priority. When the downstream service needs to initiate a sub-request to the downstream service at the next level, it can also determine the downstream service admission priority recorded locally by the downstream service. If the priority of the sub-request is lower than the downstream service admission priority, it is discarded. If there is no record or the priority of the sub-request is higher than the recorded downstream service admission priority, a request is initiated to the downstream service at the next level. In addition, when the downstream service returns the information required by the upstream service, it can also carry its own admission priority in the information. In this way, the upstream service parses the information after receiving the return and updates the downstream service admission priority recorded locally.
[0133] It can be seen that in the embodiments of the present disclosure, different processing is performed on different task processing requests by setting priorities, thereby realizing hierarchical flow control of requests, so that the task processing system can quickly respond to different load conditions, reduce service interruptions of core businesses and other higher priority businesses due to overload, and improve the user experience.
[0134] Exemplary Devices
[0135] The exemplary embodiment of the present disclosure also provides a task processing device. Figure 5 As shown, the task processing device 500 includes the following program modules:
[0136] The analyzing unit 501 is used to analyze the received task processing request when it is determined that the task processing system is in service overload, and obtain the business logic information and distribution content information corresponding to the task processing request;
[0137] A first determining unit 502, configured to determine priority information corresponding to the task processing request according to the distribution content information;
[0138] A second determining unit 503 is used to determine at least one downstream service for processing the distribution content information according to the business logic information;
[0139] The processing unit 504 is used to control the downstream service to determine whether to respond to the distribution content information according to the priority information and the corresponding admission priority information.
[0140] In a possible implementation manner, before determining that the task processing system is in service overload, the device further includes a judgment unit, which is used to:
[0141] Determine whether the current task processing status information meets the overload service protection mechanism startup conditions;
[0142] If the overload service protection mechanism startup condition is met, it is determined that the task processing system is in service overload.
[0143] In a possible implementation manner, the device further includes a determining unit, configured to:
[0144] When it is determined that the average waiting time of the task queue in the thread pool at the current moment is greater than a preset threshold, it is determined that the start-up condition of the overload service protection mechanism is met.
[0145] In a possible implementation manner, the device further includes a determining unit, configured to:
[0146] Determine the number of tasks that the thread pool can carry, the current number of tasks in the task queue in the thread pool at the current moment, and the request time corresponding to the tasks in the task queue in the thread pool at the current moment;
[0147] According to the number of loadable tasks, the current number of tasks and the request time, the average waiting time of the task queue in the thread pool at the current moment is determined.
[0148] In a possible implementation, the processing unit 504 is configured to:
[0149] If it is determined that the priority level indicated by the priority information is lower than the priority level indicated by the admission priority information, then no response is made to the distribution content information;
[0150] If it is determined that the priority indicated by the priority information is not lower than the priority indicated by the admission priority information, and there is a next-level service of the downstream service, forwarding the distribution content information to the next-level service of the downstream service, so that the next-level service determines whether to respond to the distribution content information according to the priority information and the corresponding admission priority information;
[0151] If it is determined that the priority indicated by the priority information is not lower than the priority indicated by the admission priority information, and there is no next-level service of the downstream service, then a response is made to the distribution content information.
[0152] In a possible implementation manner, the first determining unit 502 is configured to:
[0153] Determine the business attribute information to which the distribution content information belongs;
[0154] The priority information corresponding to the task processing request is determined according to the business attribute information and a first preset relationship set; wherein the first preset relationship set includes a plurality of sub-relationships corresponding to business attribute information and priorities.
[0155] In a possible implementation manner, the first determining unit 502 is configured to:
[0156] Determining the account attribute information to which the distributed content information belongs;
[0157] The priority information corresponding to the task processing request is determined according to the account attribute information and the second preset relationship set; wherein the second preset relationship set includes a plurality of sub-relationships corresponding to the account attribute information and the priority.
[0158] Exemplary Program Products
[0159] The exemplary embodiments of the present disclosure also provide a computer program product, which includes a computer program, and when the computer program is executed by a processor, the task processing method described above is implemented.
[0160] In one embodiment, the computer program product may be a tangible product containing a computer program, such as a computer-readable storage medium storing a computer program. The readable storage medium may be a storage medium based on electrical, magnetic, optical, electromagnetic, infrared, or other signals, including but not limited to: random access memory (RAM), read-only memory (ROM), magnetic tape, floppy disk, flash memory (Flash), mechanical hard disk (HDD), solid-state drive (SSD), and the like. Exemplarily, the computer program product may be implemented as a non-volatile storage medium storing a computer program, such as a read-only memory, a NAND flash memory, and the like.
[0161] In one embodiment, the computer program product may be an intangible product including a computer program. Exemplarily, the computer program product may be implemented as a virtual digital product, such as a digital file storing an executable file, an installation package, etc. of the computer program.
[0162] The code of the computer program can be written in one or more programming languages. Programming languages such as C language, Java, C++, etc. The program code can be executed entirely on the user computing device, or partially on the user computing device, or as a separate software package, or partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In the case of a remote computing device, the remote computing device can be connected to the user computing device through any type of network, such as a local area network (LAN), a wide area network (WAN), etc., or can be connected to an external computing device (e.g., an Internet connection provided by an operator).
[0163] Computer programs can be carried or transmitted through electrical, magnetic, optical, electromagnetic, infrared and other signals. Electronic devices can convert signals carrying computer programs into digital signals to run computer programs. When a computer program runs on an electronic device, its code is used to enable the electronic device to execute (more specifically, it can enable the processor of the electronic device to execute) the method steps of various exemplary embodiments of the present disclosure, such as the above-mentioned task processing method, which includes the following steps: Step 301: When it is determined that the task processing system is in service overload, the received task processing request is analyzed to obtain the business logic information and distribution content information corresponding to the task processing request; Step 302: According to the distribution content information, the priority information corresponding to the task processing request is determined; Step 303: According to the business logic information, at least one downstream service for processing the distribution content information is determined; Step 304: Control the downstream service to determine whether to respond to the distribution content information according to the priority information and the corresponding access priority information.
[0164] The above method steps are implemented through a computer program. When it is determined that the task processing system is in a service overload, the received task processing request can be analyzed to obtain the business logic information and distribution content information corresponding to the task processing request; then, based on the distribution content information, the priority information corresponding to the task processing request is determined; further, based on the business logic information, at least one downstream service that processes the distribution content information is determined; and, the downstream service is controlled to determine whether to respond to the distribution content information based on the priority information and the corresponding access priority information. It can be seen that in the embodiment of the present disclosure, when the task processing system is in a service overload, it does not respond to the received task processing request at one time, but rather specifically analyzes the task processing request, and determines whether to respond to the distribution content information based on the priority information corresponding to the task processing request and the access priority information corresponding to the downstream service, thereby achieving a hierarchical response to ensure that the core tasks in the task processing system are responded to and improve the user experience.
[0165] Exemplary Electronic Devices
[0166] The exemplary embodiments of the present disclosure also provide an electronic device. The electronic device may include a processor and a memory. The memory stores executable instructions of the processor, such as a computer program. The processor executes the method steps of various exemplary embodiments of the present disclosure by executing the executable instructions.
[0167] Reference below Figure 6 , the electronic device is exemplarily described in the form of a general-purpose computing device. It should be understood that Figure 6 The electronic device 600 shown is only an example and should not limit the functions and scope of use of the embodiments of the present disclosure.
[0168] like Figure 6 As shown, the electronic device 600 may include: a processor 610 , a memory 620 , a bus 630 , an I / O (input / output) interface 640 , a network adapter 660 , and a display 680 .
[0169] The memory 620 may include a volatile memory, such as a RAM 621, a cache unit 622, and may also include a non-volatile memory, such as a ROM 623. The memory 620 may also include one or more program modules 624, such program modules 624 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or a combination thereof may include the implementation of a network environment. For example, the program module 624 may include each module in the above-mentioned device.
[0170] The processor 610 may include one or more processing units. For example, the processor 610 may include an AP (Application Processor), a modem processor, a GPU (Graphics Processing Unit), an ISP (Image Signal Processor), a controller, an encoder, a decoder, a DSP (Digital Signal Processor), a baseband processor and / or an NPU (Neural-Network Processing Unit), etc.
[0171] Processor 610 can be used to execute executable instructions stored in memory 620, such as the above-mentioned task processing method, which includes the following steps: Step 301: When it is determined that the task processing system is in service overload, analyze the received task processing request to obtain the business logic information and distribution content information corresponding to the task processing request; Step 302: Determine the priority information corresponding to the task processing request based on the distribution content information; Step 303: Determine at least one downstream service that processes the distribution content information based on the business logic information; Step 304: Control the downstream service to determine whether to respond to the distribution content information based on the priority information and the corresponding access priority information.
[0172] By executing the above method steps through the processor 610, when it is determined that the task processing system is in service overload, the received task processing request can be analyzed to obtain the business logic information and distribution content information corresponding to the task processing request; then, according to the distribution content information, the priority information corresponding to the task processing request is determined; further, according to the business logic information, at least one downstream service for processing the distribution content information is determined; and, the downstream service is controlled to determine whether to respond to the distribution content information according to the priority information and the corresponding access priority information. It can be seen that in the embodiment of the present disclosure, when the task processing system is in service overload, it does not respond to the received task processing request at one time, but rather specifically analyzes the task processing request, and determines whether to respond to the distribution content information according to the priority information corresponding to the task processing request and the access priority information corresponding to the downstream service, thereby achieving hierarchical response to ensure that the core tasks in the task processing system are responded to and improve the user experience.
[0173] The bus 630 is used to realize the connection between different components of the electronic device 600, and may include a data bus, an address bus, and a control bus.
[0174] The electronic device 600 can communicate with one or more external devices 700 (eg, a keyboard, a mouse, an external controller, etc.) through the I / O interface 640 .
[0175] The electronic device 600 can communicate with one or more networks through the network adapter 650. For example, the network adapter 650 can provide mobile communication solutions such as 3G / 4G / 5G, or wireless communication solutions such as wireless LAN, Bluetooth, near field communication, etc. The network adapter 660 can communicate with other modules of the electronic device 600 through the bus 630.
[0176] The electronic device 600 may display the service overload determination status and the like through the display 680 .
[0177] although Figure 6 Not shown, other hardware and / or software modules may also be provided in the electronic device 600, including but not limited to: microcode, device drivers, redundant processors, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0178] As can be seen from the above, the technical solution of the present disclosure can be implemented as a method, an apparatus, a system, a computer program product, a storage medium, an electronic device, etc. Those skilled in the art can understand that various aspects of the present disclosure can be specifically implemented in the following forms, namely: a complete hardware implementation, a complete software implementation (including firmware, microcode, etc.), or an implementation combining hardware and software, such as being respectively referred to as a "circuit", "module" or "system".
[0179] It should be understood that the present disclosure is not limited to the specific method steps or structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from the scope thereof. Those skilled in the art will easily think of other embodiments based on the specific embodiments provided by the present disclosure. Therefore, the specific embodiments provided by the present disclosure are only exemplary, and the scope and spirit of the present disclosure are indicated by the claims, and any variations, uses or adaptive changes of the present disclosure should be covered, which follow the general principles of the present disclosure and include common knowledge or customary technical means in the technical field that are not disclosed in the present disclosure.
Claims
1. A task processing method, characterized in that: The method comprises: When it is determined that the task processing system is in service overload, analyzing the received task processing request to obtain business logic information and distribution content information corresponding to the task processing request; Determining priority information corresponding to the task processing request according to the distribution content information; Determining, based on the business logic information, at least one downstream service for processing the distributed content information; The downstream service is controlled to determine whether to respond to the distribution content information according to the priority information and corresponding admission priority information.
2. The method according to claim 1, characterized in that: Before determining that the task processing system is in service overload, the method further includes: Determine whether the current task processing status information meets the overload service protection mechanism startup conditions; If the overload service protection mechanism startup condition is met, it is determined that the task processing system is in service overload.
3. The method according to claim 2, characterized in that Determine whether the current task processing information meets the overload service protection mechanism startup conditions, including: When it is determined that the average waiting time of the task queue in the thread pool at the current moment is greater than a preset threshold, it is determined that the start-up condition of the overload service protection mechanism is met.
4. The method according to claim 3, characterized in that: The method further comprises: Determine the number of tasks that the thread pool can carry, the current number of tasks in the task queue in the thread pool at the current moment, and the request time corresponding to the tasks in the task queue in the thread pool at the current moment; According to the number of loadable tasks, the current number of tasks and the request time, the average waiting time of the task queue in the thread pool at the current moment is determined.
5. The method according to claim 2, characterized in that: Controlling the downstream service to determine whether to respond to the distribution content information according to the priority information and the admission priority information includes: If it is determined that the priority level indicated by the priority information is lower than the priority level indicated by the admission priority information, then no response is made to the distribution content information; If it is determined that the priority indicated by the priority information is not lower than the priority indicated by the admission priority information, and there is a next-level service of the downstream service, forwarding the distribution content information to the next-level service of the downstream service, so that the next-level service determines whether to respond to the distribution content information according to the priority information and the corresponding admission priority information; If it is determined that the priority indicated by the priority information is not lower than the priority indicated by the admission priority information, and there is no next-level service of the downstream service, then a response is made to the distribution content information.
6. The method according to any one of claims 1 to 5, characterized in that: Determining priority information corresponding to the task processing request according to the distribution content information includes: Determine the business attribute information to which the distribution content information belongs; The priority information corresponding to the task processing request is determined according to the business attribute information and a first preset relationship set; wherein the first preset relationship set includes a plurality of sub-relationships corresponding to business attribute information and priorities.
7. The method according to any one of claims 1 to 5, characterized in that: Determining priority information corresponding to the task processing request according to the distribution content information includes: Determining the account attribute information to which the distributed content information belongs; The priority information corresponding to the task processing request is determined according to the account attribute information and the second preset relationship set; wherein the second preset relationship set includes a plurality of sub-relationships corresponding to the account attribute information and the priority.
8. A task processing device, characterized in that: The device comprises: An analysis unit, configured to analyze a received task processing request when it is determined that the task processing system is in service overload, and obtain business logic information and distribution content information corresponding to the task processing request; A first determining unit, configured to determine priority information corresponding to the task processing request according to the distribution content information; A second determining unit, configured to determine at least one downstream service for processing the distributed content information according to the business logic information; The processing unit is used to control the downstream service to determine whether to respond to the distribution content information according to the priority information and the corresponding admission priority information.
9. An electronic device, characterized in that: include: processor; A memory, configured to store executable instructions of the processor; The processor is configured to perform the method of any one of claims 1 to 7 by executing the executable instructions.
10. A computer program product having a computer program stored thereon, characterized in that When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.