Business processing method and device and related equipment

By detecting busy parameters and identification information of instance tasks and selecting appropriate instances to handle services, the problem of poor load balancing of multiple instances is solved, and more uniform load allocation and resource utilization is achieved.

CN119105875APending Publication Date: 2024-12-10BEIJING QIYI CENTURY SCI & TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411290122.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-14
Publication Date
2024-12-10

AI Technical Summary

Technical Problem

In the prior art, the load balancing effect of multiple instances is poor, resulting in some instances being overloaded while other instances being idle.

Method used

By detecting the task busy parameters of each instance, it is determined that the task busy parameters are smaller than the preset value, and selecting the first instance from it according to the instance identification information to process the target service, avoiding load imbalance caused by random allocation.

Benefits of technology

A more uniform load distribution is achieved, and the load balancing effect of multiple instances is improved, avoiding instance overload and resource waste.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119105875A_ABST
    Figure CN119105875A_ABST
Patent Text Reader

Abstract

The invention provides a service processing method and device and related equipment, and the method comprises the steps: detecting a task busy parameter of each instance in K instances under the condition of receiving a target request, the task busy parameter being used for representing the use condition of computing resources of the corresponding instance, the target request being used for requesting to process a target service, and the task busy parameter being used for representing the use condition of computing resources of the corresponding instance; the identification information corresponding to each instance in the K instances is different, the K instances are distributed from small to large according to numbers included in the identification information, and K is an integer greater than 1; determining instances of which task busy parameters are smaller than a preset value in the K instances, and obtaining a candidate instance set; and determining a first instance from the candidate instance set according to the identification information of the instances included in the candidate instance set, and processing the target service by using the first instance. In this way, the load balancing effect of the multiple instances is enhanced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of data processing technology, and in particular, to a business processing method, apparatus, and related equipment. Background Art

[0002] With the continuous development of data processing technology, data processing technology has occupied an increasingly important position in people's lives. For example, data processing technology can be applied to the scenario of instance processing business. Currently, multiple instances are usually set up. When there is a new target business to be processed, it is usually necessary to randomly assign the target business to a certain instance for processing, which causes some instances to be overloaded while other instances are idle. It can be seen that the load balancing effect of multiple instances is currently poor. Summary of the invention

[0003] The embodiments of the present application provide a business processing method, apparatus and related equipment to solve the problem that the load balancing effect of multiple instances is currently poor.

[0004] To solve the above problems, this application is implemented as follows:

[0005] In a first aspect, an embodiment of the present application provides a service processing method, including:

[0006] In the case of receiving a target request, detecting a task busy parameter of each of the K instances, wherein the task busy parameter is used to indicate the usage of computing resources of the corresponding instance, the target request is used to request processing of a target business, the identification information corresponding to each of the K instances is different, and the K instances are distributed in ascending order according to the numbers included in the identification information, and K is an integer greater than 1;

[0007] Determine an instance whose task busyness parameter is less than a preset value among the K instances, and obtain a set of candidate instances;

[0008] According to identification information of instances included in the candidate instance set, a first instance is determined from the candidate instance set, and the target service is processed using the first instance.

[0009] In a second aspect, an embodiment of the present application provides a service processing device, including:

[0010] A detection module, configured to detect a task busy parameter of each of the K instances when a target request is received, wherein the task busy parameter is used to indicate usage of computing resources of the corresponding instance, the target request is used to request processing of a target business, the identification information corresponding to each of the K instances is different, and the K instances are distributed in ascending order according to the numbers included in the identification information, and K is an integer greater than 1;

[0011] A first determination module is used to determine the instances whose task busyness parameters are less than a preset value among the K instances, and obtain a set of candidate instances;

[0012] The processing module is used to determine a first instance from the candidate instance set according to identification information of the instances included in the candidate instance set, and use the first instance to process the target business.

[0013] In a third aspect, an embodiment of the present application further provides an electronic device, comprising: a memory, a processor, and a program stored in the memory and executable on the processor; the processor is used to read the program in the memory to implement the steps in the method described in the first aspect above.

[0014] In a fourth aspect, an embodiment of the present application further provides a readable storage medium for storing a program, which, when executed by a processor, implements the steps in the method described in the first aspect above.

[0015] In a fifth aspect, an embodiment of the present application further provides a computer program product, comprising computer instructions, which, when executed by a processor, implement the steps in the method described in the first aspect above.

[0016] In an embodiment of the present application, instances in a candidate instance set whose task busy parameters are less than a preset value can be determined as instances in an idle state, and based on the identification information of the instances included in the candidate instance set, a first instance is determined from the candidate instance set, and the target business is processed using the first instance. In this way, compared with the method of randomly assigning the target business to a certain instance for processing, thereby causing some instances to be overloaded while other instances are idle, an embodiment of the present application can determine the first instance from the candidate instance set according to the identification information, thereby avoiding the occurrence of the above situation, that is, the load of the target task can be more evenly distributed among the instances in the candidate instance set, thereby enhancing the load balancing effect of multiple instances. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments of the present application will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0018] Figure 1 This is one of the flowcharts of the business processing method provided in the embodiment of the present application;

[0019] Figure 2 This is the second flow chart of the business processing method provided in the embodiment of the present application;

[0020] Figure 3 This is the third flowchart of the business processing method provided in the embodiment of the present application;

[0021] Figure 4 is a structural diagram of a service processing device provided in an embodiment of the present application;

[0022] Figure 5 It is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0023] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0024] The terms "first", "second" etc. in the embodiments of the present application are used to distinguish similar objects, and need not be used to describe a specific order or sequential order. In addition, the terms "include" and "have" and any variation thereof are intended to cover non-exclusive inclusions, for example, the process, method, system, product or equipment comprising a series of steps or units need not be limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or equipment. In addition, "and / or" is used in the present application to represent at least one of connected objects, such as A and / or B and / or C, representing the inclusion of separate A, separate B, separate C, and A and B all exist, B and C all exist, A and C all exist, and 7 situations that A, B and C all exist.

[0025] See also Figure 1 , Figure 1 It is a flowchart of the business processing method provided in the embodiment of the present application. Figure 1 The business processing method shown can be executed by an electronic device.

[0026] like Figure 1 As shown, the business processing method may include the following steps:

[0027] Step 101: upon receiving a target request, detecting a task busy parameter of each of the K instances, wherein the task busy parameter is used to indicate usage of computing resources of the corresponding instance, and the target request is used to request processing of a target business. The identification information corresponding to each of the K instances is different, and the K instances are distributed in ascending order according to the numbers included in the identification information, and K is an integer greater than 1.

[0028] Among them, the type of electronic device in the embodiment of the present application is not limited here. Optionally, the electronic device can be a container cluster management system Kubernetes. Kubernetes can include multiple Pods, and Pod is the smallest schedulable unit. It contains one or more closely related containers. The containers in the Pod will share network and storage resources, as well as specifications on how to run the containers.

[0029] Specifically, a Pod is similar to a virtual machine, but more lightweight. For example, you can run a main application container in a Pod, and then one or more auxiliary containers to support the main application. These containers share network space in the same Pod, including IP addresses and port numbers, and can also share storage volumes.

[0030] In the process of processing tasks, various tasks can be packaged into containers and run in one or more Pods. Kubernetes allocates and manages computing resources by scheduling Pods.

[0031] The target task may be referred to as an asynchronous task, that is, the target task and other tasks are not transmitted to the electronic device synchronously.

[0032] In Kubernetes, Pod is the smallest deployable unit. Each Pod represents a process or application instance running in the cluster, that is, each Pod can contain one or more containers, and the application instance can be referred to as an instance.

[0033] Among them, the task busy parameter is used to indicate the usage of the computing resources of the corresponding instance. The more frequently the computing resources of an instance are used, the larger the task busy parameter is, that is, the busier the instance is; on the contrary, the less frequently the computing resources of an instance are used, the smaller the task busy parameter is, that is, the idler the instance is.

[0034] Optionally, the task busy parameter can be used to represent the utilization rate of the computing resources of the corresponding instance. When the utilization rate is higher, it means that the usage is more frequent; or, the task busy parameter can be used to represent the idle rate of the computing resources of the corresponding instance. When the idle rate is lower, it means that the usage is more frequent. The specific type of the task busy parameter is not limited here.

[0035] In addition, optionally, the task busy parameter of the instance can be determined based on at least one of the parameters such as network status, central processing unit (CPU) usage and memory usage, so that the judgment criteria of the task busy parameter of the instance can be more diversified and flexible.

[0036] Optionally, when the task busy parameter can be used to represent the utilization of the computing resources of the corresponding instance, when the utilization of the computing resources of a certain instance is less than a preset value, it can be determined that the task of the instance is not busy, and thus the instance can be used as a processing instance for new business; when the utilization of the computing resources of a certain instance is greater than or equal to a preset value, it can be determined that the task of the instance is busy, that is, the task processing pressure of the instance is large, and the instance can be skipped to call other instances for processing the target business.

[0037] The specific content of the target service is not limited here. Optionally, the target service may be a navigation service or a real-time communication service.

[0038] Among them, the identification information needs to include numbers, but the specific type of identification information is not limited here. Optionally, the identification information can be an instance name, for example: the names of the three instances can be web-0, web-1 and web-2, that is, the numbers included in the instance names are 0, 1 and 2 respectively; optionally, the identification information can be the instance number, for example: the names of the three instances can be 1, 2 and 3 respectively, in this case, the numbers included in the instance number are 1, 2 and 3 respectively.

[0039] Step 102: Determine the instances whose task busyness parameters are less than a preset value among the K instances, and obtain a set of candidate instances.

[0040] The instances included in the candidate instance set may all be understood as instances with light tasks, and the number of instances included in the candidate instance set is not limited herein. Optionally, the number of instances included in the candidate instance set may be at least 1.

[0041] Step 103: Determine a first instance from the candidate instance set according to identification information of the instances included in the candidate instance set, and use the first instance to process the target service.

[0042] In an embodiment of the present application, through steps 101 to 103, instances in a candidate instance set whose task busy parameters are less than a preset value can be determined as instances in an idle state, and based on the identification information of the instances included in the candidate instance set, a first instance is determined from the candidate instance set, and the target business is processed using the first instance. In this way, compared with the method of randomly assigning the target business to a certain instance for processing, thereby causing some instances to be overloaded while other instances are idle, the embodiment of the present application can determine the first instance from the candidate instance set according to the identification information, thereby improving the accuracy of the first instance determination result, thereby avoiding the occurrence of the above-mentioned situation, that is, the load of the target task can be more evenly distributed among the instances in the candidate instance set, thereby enhancing the load balancing effect of multiple instances.

[0043] It should be noted that the specific manner of determining the first instance from the candidate instance set according to the identification information of the instances included in the candidate instance set is not limited herein.

[0044] As an optional implementation manner, determining a first instance from the candidate instance set according to identification information of the instance included in the candidate instance set, and using the first instance to process the target service includes:

[0045] Determine the instance with the smallest number included in the identification information in the candidate instance set as the first instance;

[0046] The target service is processed using the first instance.

[0047] In an implementation manner of the present application, since the instances in the candidate instance set are distributed in ascending order of the numbers included in the identification information, the instance with the smallest number included in the identification information in the candidate instance set is determined as the first instance, so that tasks can be assigned to the instances in ascending order of the numbers included in the identification information, thereby avoiding the situation where idle instances are skipped, resulting in a waste of instance computing resources.

[0048] As another optional implementation, determining a first instance from the candidate instance set according to identification information of the instance included in the candidate instance set, and using the first instance to process the target service includes:

[0049] Determine the instance with the largest number in the identification information in the candidate instance set as the first instance;

[0050] The target service is processed using the first instance.

[0051] In the implementation manner of the present application, the instance whose identification information includes the largest number in the candidate instance set is determined as the first instance, thereby increasing the diversity and flexibility of the method for determining the first instance.

[0052] It should be noted that, in addition to the above two methods, other implementation methods may include randomly determining an instance in the candidate instance set as the first instance, etc., which will not be elaborated here in detail.

[0053] For example: when the electronic device includes three instances, the identification information of the three instances are all instance names, and the instance names of the three instances are web-0, web-1 and web-2, respectively, and the task busy parameter can be the utilization of computing resources, when it is determined that the utilization of computing resources of the instance named web-0 is greater than or equal to the preset value, and the utilization of computing resources of the instances named web-1 and web-2 are both less than the preset value, the instances named web-1 and web-2 can be determined as instances in the candidate instance set. At the same time, since the identification information of the instance named web-1 is web-1, and the identification information of the instance named web-2 is web-2, it can be understood that web-1 is less than web-2, so the instance named web-1 can be determined as the first instance, and the first instance can be used to process the target business. In this way, the target task can be scheduled in the order of the instance name, so that the load instance of the target task can be more evenly distributed, avoiding the situation where some instances are overloaded while other instances are idle, thereby improving resource utilization and overall system performance.

[0054] As an optional implementation manner, the task busy parameter is the number of tasks currently being executed by the corresponding instance, and when the target request is received, detecting the task busy parameter of each of the K instances includes:

[0055] Upon receiving the target request, detecting the number of tasks currently being executed by each of the K instances;

[0056] The determining of the instances whose task busyness parameters are less than a preset value among the K instances to obtain a set of candidate instances includes:

[0057] Determine an instance in which the number of tasks currently being executed is less than the preset value among the K instances, and obtain a set of candidate instances.

[0058] Among them, determining the instances in which the number of tasks currently being executed is less than the preset value among the K instances to obtain a set of candidate instances can be understood as: all the instances in which the number of tasks currently being executed is less than the preset value among the K instances are determined as instances in the set of candidate instances, that is, all the instances in which the number of tasks currently being executed is less than the preset value among the K instances can be determined as idle instances.

[0059] Among them, the specific method for determining the preset value is not limited here. Optionally, the preset value can be equal to the parallelism, and the parallelism can be the maximum number of threads that can be accommodated in the thread pool, or the above parallelism can also be referred to as the thread size set by the thread pool.

[0060] In the implementation manner of the present application, the task busy parameter is the number of tasks currently being executed of the corresponding instance. By determining the instances among the K instances whose number of tasks currently being executed is less than a preset value, a set of candidate instances is obtained. In this way, compared with the method in which the task busy parameter is other parameters, this implementation manner can make the judgment criteria of the instances in the candidate instance set simpler and clearer, thereby improving the efficiency and accuracy of obtaining the candidate instance set.

[0061] As an optional implementation manner, upon receiving the target request, detecting the number of tasks currently being executed by each instance in the K instances includes:

[0062] When receiving the target request, detecting whether the threads corresponding to the target request exceed the target value of the thread pool, the threads corresponding to the target request being the threads corresponding to the K instances;

[0063] When the number of threads corresponding to processing the target request is less than the target value, the number of tasks currently being executed by each of the K instances is detected.

[0064] The target value may be a preset number, and the specific value does not exceed the maximum number of threads that the thread pool can accommodate. Optionally, the target value is equal to the maximum number of threads that the thread pool can accommodate.

[0065] In the implementation manner of the present application, the number of tasks currently being executed by each of the K instances is detected only when the number of threads corresponding to the target request is less than the target value. In this way, compared with the method of directly calculating whether the number of tasks currently being executed by each instance is less than the preset value, the amount of calculation can be reduced and the calculation efficiency can be improved.

[0066] As an optional implementation manner, the identification information is an instance name, and the instance name corresponds to the instance address one by one;

[0067] The using the first instance to process the target service includes:

[0068] Determine an instance address of the first instance according to the instance name of the first instance;

[0069] The first instance is obtained through the instance address of the first instance, and the target business is processed by using the first instance.

[0070] Among them, the identification information can also be called an identifier, and the identification information can be set by the StatefulSet controller in Kubernetes. Since the instance corresponds to the pod one by one, the instance, Pod and identification information can correspond one by one. In this way, it can be ensured that whether it is creating a Pod, deleting a Pod or updating a Pod, a stable sequence can be maintained (that is, the Pods are distributed in the order of the identification information from small to large).

[0071] It should be noted that the StatefulSet controller can obtain the instance name and instance address corresponding to each Pod, and establish a mapping relationship between the instance name and the corresponding instance address. The above instance address can be understood as the location or storage address of the instance, and can also be called the Internet Protocol (IP) address.

[0072] Among them, StatefulSet is a workload application programming interface (Application Programming Interface, API) object used to manage stateful applications. Compared with other Kubernetes objects, such as Deployment or ReplicaSet, the main features of StatefulSet are:

[0073] 1. Stable, persistent network identity: Each Pod in a StatefulSet has a persistent and unique network identity in the format of $(statefulset name)-$(ordinal). For example, in a StatefulSet named web, the three replicas will have names called web-0, web-1, and web-2.

[0074] 2. Orderly deployment and orderly scaling: For example, Pods are created in order and deleted in reverse order.

[0075] In the process of processing the target business, the orderly expansion and contraction characteristics of StatefulSet are fully utilized, and the instance is scaled up and down in a timely manner in combination with the definition of busy state, so as to achieve the goal of effective resource management. When using StatefulSet to create identification information, it mainly relies on the network identification provided by StatefulSet to complete the orderly scheduling in ascending order of network identification. This combination of ascending scheduling and descending scaling enables the maximum utilization and management of resources.

[0076] In addition, specifically in the application scenario corresponding to the implementation method of the present application, when the service name of the target business is obtained, the IP addresses of all instances can be obtained, and based on the established mapping relationship between the instance name and the IP address, the target task can be dispatched among the K instances in ascending order of the instance name to determine the first instance for processing the target task, and each task can be executed according to the above process, thereby ensuring that each task is dispatched to the corresponding instance in ascending order of the pod name (ie, instance name).

[0077] In the implementation manner of the present application, the identification information is the instance name, and the instance name corresponds one-to-one to the instance address. In this way, the first instance is obtained through the instance address of the first instance, and the first instance is used to process the target business, thereby ensuring the accuracy of the obtained first instance and further ensuring the accuracy of the target business processing result.

[0078] It should be noted that, in order to more fully illustrate the embodiments of the present application, see Figure 2 , Figure 2 A complete embodiment is provided to illustrate the above embodiment. For specific steps, please refer to Figure 2 , Figure 2 The idle instance in can be understood as an instance in the candidate instance set, podname can be understood as identification information, asynchronous task can be understood as target task, kafka can be understood as an electronic device, kafka consumer can be understood as a user of the electronic device, and L2 end can be understood as a requester of the target service. After the L2 end submits the target task to the electronic device, the target task enters the task master table (which can be understood as a table mainly used to store received tasks), and then is submitted to the thread pool, and the task table of the instance is obtained. According to the instance task table, it is determined whether there is an idle instance at present. When there is an idle instance, it is determined whether the mirror state of the idle instance is online. When the mirror state of the idle instance is online (in this way, by judging the mirror state of the idle instance, it can be more accurately determined whether the real-time state of the idle instance is a real idle state), each idle instance is distributed in ascending order (i.e., from small to large) according to podname (i.e., the number included in the identification information), and one of them is determined as the first instance for submission, and the first instance is used to process the target task, and the instance task table is updated, and the updated instance task table is fed back to the kafka consumer.

[0079] It should be noted that after determining the first instance, it is also possible to determine whether there is an asynchronous task corresponding to the target task. If so, the information about the existence of the asynchronous task can be fed back to Kafka.

[0080] In addition, when it is determined according to the instance task table that there are currently no idle instances, it can be determined whether the current number of instances is greater than the maximum number of instances (i.e., the maximum number of instances allowed in the thread pool). When the current number of instances is greater than the maximum number of instances, the process ends; when the current number of instances is less than the maximum number of instances, it is determined whether there are resources (i.e., computing resources) to create idle instances for processing the target tasks. When it is determined that there are resources (i.e., computing resources) and the mirror state of the resources is ready, the process of creating idle instances for processing the target tasks can be entered, and the instance task table can be updated.

[0081] It should be noted that the target task enters the task master table and can exist in the form of table async_task. Figure 2 The inference_container_job in can be used to indicate updating the instance task table.

[0082] As an optional implementation manner, after detecting the task busy parameter of each instance in the K instances, the method further includes:

[0083] Determine M instances in the candidate instance set except the first instance, where M is a positive integer less than K;

[0084] The M instances are deleted in descending order of the identification information.

[0085] Deleting the M instances means deleting the containers corresponding to the M instances, which can also be called shrinking.

[0086] In an implementation manner of the present application, when an instance in a candidate instance set is determined and the instance in the candidate instance set is in a non-busy state, M instances can be deleted in order of identification information from large to small, that is, resources can be scaled down in descending order of identification information. In this way, it can be ensured that idle resources are preferentially reduced without affecting the processing of target business, thereby saving computing resources.

[0087] That is to say: the busy state mechanism of the instance is introduced in the implementation mode of the present application, and the busy state of the instance is determined by comparing the instance task busy parameter with the preset value, so as to realize the orderly scaling of resources. If the instance is not busy (that is, when the task busy parameter is the utilization rate of the computing resource, the utilization rate of the computing resource is less than the preset value), these instances can be scaled down sequentially in descending order of the instance name (that is, the identification information).

[0088] In addition, the implementation of the present application can be expanded or reduced according to the busy parameters of the instance tasks, so it can be flexibly adjusted as business needs change. When the business peak comes, it can be quickly expanded; when the business demand decreases, it can be reduced in time to save resources.

[0089] As an optional implementation manner, deleting the M instances in descending order of the identification information includes:

[0090] Detecting the length of time that the M instances are in an idle state;

[0091] When the duration of the M instances being in the idle state exceeds a preset duration, the M instances are deleted in descending order of the identification information.

[0092] Among them, the specific length of the preset duration is not limited here, and the duration of the M instances being in the idle state can be detected by setting a scheduled task corresponding to a distributed task scheduling framework XXL-JOB (i.e., Adistributed taskscheduling framework) for each instance to detect the duration of each instance being in the idle state.

[0093] In an implementation manner of the present application, when the time that M instances are in an idle state exceeds a preset time, the M instances are deleted in order of identification information from large to small. In this way, the accuracy of deleting the M instances can be guaranteed, and the phenomenon that the M instances are idle due to accidental factors and then the M instances are mistakenly deleted can be prevented.

[0094] That is, in the implementation mode of the present application, the instance can be expanded or reduced in an orderly manner and the instance can be quickly scheduled to process tasks based on the number of tasks currently being executed by the instance, the parallelism of a single instance, and the length of time the instance is in an idle state.

[0095] It should be noted that, in order to more fully illustrate the embodiments of the present application, see Figure 3 , Figure 3 A complete embodiment is provided to illustrate the above embodiment. For specific steps, please refer to Figure 3 , Figure 3 The idle time in it can be understood as the length of time in the idle state, the allowed idle time can be understood as the preset length of time, killing the instance can be understood as deleting the instance, the minimum number of instances can be understood as the preset minimum number of instances, and retaining the instance means not deleting the instance.

[0096] For detailed steps on how to expand and shrink an instance, see Figure 3 As shown, specifically, Figure 3As shown, the survival of the instance can be judged. When the number of instances is greater than the preset minimum value of instance existence, the idle instances can be traversed in descending order (i.e., from large to small) according to pod_name (i.e., identification information). On the basis of obtaining the idle instances, it is judged whether the idle time of the idle instance (i.e., the length of time in the idle state) is greater than the allowed idle time (i.e., the preset length of time). When it is greater than the allowed idle time, the idle instance can be killed (i.e., the idle instance is deleted).

[0097] It should be noted that when the number of instances is less than the preset minimum number of instances, it can be determined whether there is a quota of idle instances that can be created. When there is a quota of idle instances that can be created and the mirroring status is ON, an idle instance can be created and the instance table can be updated.

[0098] See also Figure 4 , Figure 4 4 is a structural diagram of a service processing device provided in an embodiment of the present application. The service processing device 400 includes:

[0099] The detection module 401 is used to detect a task busy parameter of each of the K instances when a target request is received, where the task busy parameter is used to indicate the usage of computing resources of the corresponding instance, the target request is used to request processing of a target business, the identification information corresponding to each of the K instances is different, and the K instances are distributed in ascending order according to the numbers included in the identification information, and K is an integer greater than 1;

[0100] A first determination module 402 is used to determine the instances whose task busyness parameters are less than a preset value among the K instances, and obtain a set of candidate instances;

[0101] The processing module 403 is configured to determine a first instance from the candidate instance set according to identification information of the instances included in the candidate instance set, and use the first instance to process the target service.

[0102] As an optional implementation, the processing module 403 includes:

[0103] A first determining submodule, configured to determine the instance whose identification information includes the smallest number in the candidate instance set as the first instance;

[0104] The first processing submodule is configured to process the target business using the first instance.

[0105] As an optional implementation, the task busy parameter is the number of tasks currently being executed by the corresponding instance, and the detection module 401 is further used to detect the number of tasks currently being executed by each instance in the K instances when the target request is received;

[0106] The first determination module 402 is further configured to determine an instance in which the number of tasks currently being executed is less than the preset value among the K instances, and obtain a set of candidate instances.

[0107] As an optional implementation, the detection module 401 includes:

[0108] A first detection submodule is used for detecting, when receiving the target request, whether the threads corresponding to the target request for processing exceed the target value of the thread pool, where the threads corresponding to the target request are the threads corresponding to the K instances;

[0109] The second detection submodule is used to detect the number of tasks currently being executed by each instance in the K instances when the number of threads corresponding to processing the target request is less than the target value.

[0110] As an optional implementation manner, the identification information is an instance name, and the instance name corresponds to the instance address one by one;

[0111] The processing module 403 includes:

[0112] A second determining submodule, configured to determine an instance address of the first instance according to the instance name of the first instance;

[0113] The second processing submodule is configured to obtain the first instance through the instance address of the first instance, and use the first instance to process the target business.

[0114] As an optional implementation manner, the service processing device 400 further includes:

[0115] A second determining module, configured to determine M instances in the candidate instance set except the first instance, where M is a positive integer less than K;

[0116] The deleting module is used to delete the M instances in order of the identification information from large to small.

[0117] As an optional implementation, the deletion module includes:

[0118] A third detection submodule, used to detect the length of time that the M instances are in an idle state;

[0119] The deleting submodule is used to delete the M instances in descending order of the identification information when the duration of the M instances being in an idle state exceeds a preset duration.

[0120] The service processing device 400 can implement the embodiment of the present application Figures 1 to 3 The various processes of the method embodiment and the same beneficial effects are achieved, and to avoid repetition, they are not described again here.

[0121] The present application also provides an electronic device. Figure 5 , the electronic device may include a processor 501, a memory 502, and a program 5021 stored in the memory 502 and executable on the processor 501. When the program 5021 is executed by the processor 501, Figure 1 Any steps in the corresponding method embodiments and achieving the same beneficial effects will not be repeated here.

[0122] A person skilled in the art can understand that all or part of the steps of implementing the above-mentioned embodiment method can be completed by hardware related to program instructions, and the program can be stored in a readable medium. The present application also provides a readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the above-mentioned Figure 1 Any steps in the corresponding method embodiments can achieve the same technical effect and will not be described again here to avoid repetition.

[0123] The storage medium may be a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0124] The present application also provides a computer program product, including computer instructions, which can achieve the above-mentioned Figure 1 Any steps in the corresponding method embodiments can achieve the same technical effect and will not be described again here to avoid repetition.

[0125] The above is a preferred implementation of the embodiment of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles described in the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.

Claims

1. A business processing method, characterized in that: include: In the case of receiving a target request, detecting a task busy parameter of each of the K instances, wherein the task busy parameter is used to indicate the usage of computing resources of the corresponding instance, the target request is used to request processing of a target business, the identification information corresponding to each of the K instances is different, and the K instances are distributed in ascending order according to the numbers included in the identification information, and K is an integer greater than 1; Determine an instance whose task busyness parameter is less than a preset value among the K instances, and obtain a set of candidate instances; According to identification information of instances included in the candidate instance set, a first instance is determined from the candidate instance set, and the target service is processed using the first instance.

2. The method according to claim 1, characterized in that The determining a first instance from the candidate instance set according to the identification information of the instance included in the candidate instance set, and using the first instance to process the target service includes: Determine the instance with the smallest number included in the identification information in the candidate instance set as the first instance; The target service is processed using the first instance.

3. The method according to claim 1, characterized in that The task busy parameter is the number of tasks currently being executed by the corresponding instance. When receiving the target request, detecting the task busy parameter of each instance in the K instances includes: Upon receiving the target request, detecting the number of tasks currently being executed by each of the K instances; The determining of the instances whose task busyness parameters are less than a preset value among the K instances to obtain a set of candidate instances includes: Determine an instance in which the number of tasks currently being executed is less than the preset value among the K instances, and obtain a set of candidate instances.

4. The method according to claim 3, characterized in that Upon receiving the target request, detecting the number of tasks currently being executed by each of the K instances includes: When receiving the target request, detecting whether the threads corresponding to the target request exceed the target value of the thread pool, the threads corresponding to the target request being the threads corresponding to the K instances; When the number of threads corresponding to processing the target request is less than the target value, the number of tasks currently being executed by each of the K instances is detected.

5. The method according to claim 1, characterized in that The identification information is an instance name, and the instance name corresponds to the instance address one by one; The using the first instance to process the target service includes: Determine an instance address of the first instance according to the instance name of the first instance; The first instance is obtained through the instance address of the first instance, and the target business is processed by using the first instance.

6. The method according to any one of claims 1 to 5, characterized in that After detecting the task busy parameter of each of the K instances, the method further includes: Determine M instances in the candidate instance set except the first instance, where M is a positive integer less than K; The M instances are deleted in descending order of the identification information.

7. The method according to claim 6, characterized in that The deleting the M instances in descending order of the identification information includes: Detecting the length of time that the M instances are in an idle state; When the duration of the M instances being in the idle state exceeds a preset duration, the M instances are deleted in descending order of the identification information.

8. A service processing device, characterized in that: include: A detection module, configured to detect a task busy parameter of each of the K instances when a target request is received, wherein the task busy parameter is used to indicate usage of computing resources of the corresponding instance, the target request is used to request processing of a target business, the identification information corresponding to each of the K instances is different, and the K instances are distributed in ascending order according to the numbers included in the identification information, and K is an integer greater than 1; A first determination module is used to determine the instances whose task busyness parameters are less than a preset value among the K instances, and obtain a set of candidate instances; The processing module is used to determine a first instance from the candidate instance set according to identification information of the instances included in the candidate instance set, and use the first instance to process the target business.

9. An electronic device, comprising: A memory, a processor, and a program stored in the memory and executable on the processor; wherein the processor is used to read the program in the memory to implement the steps in the business processing method as described in any one of claims 1 to 7.

10. A readable storage medium for storing a program, characterized in that: When the program is executed by a processor, the steps in the business processing method according to any one of claims 1 to 7 are implemented.

11. A computer program product, characterized in that The method comprises computer instructions, which, when executed by a processor, implement the steps in the business processing method according to any one of claims 1 to 7.