Resource control method and device, electronic device, and computer-readable storage medium

By obtaining and counting the blocking status of container tasks in Kubernetes, resource expansion is only performed when the preset blocking number threshold is reached, which solves the jitter problem caused by frequent expansion and contraction of resources and ensures that resources are operating at full capacity and services are stable.

CN114153609BActive Publication Date: 2024-10-11CHINA TELECOM CORP LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111446629.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-30
Publication Date
2024-10-11
Estimated Expiration
2041-11-30

AI Technical Summary

Technical Problem

The horizontal automatic scaling mechanism based on Kubernetes in the existing technology leads to frequent expansion and contraction of resources, causing jitter problems.

Method used

By obtaining multiple tasks of the preset service, the target tasks that are blocked are determined and their number is counted. When the number of target tasks reaches the preset blocked number threshold, resource expansion is performed to avoid improper resource expansion and contraction operations.

Benefits of technology

It effectively avoids the jitter caused by frequent resource expansion and contraction, ensures that resources are operating at full capacity, and supports the normal operation of preset services.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114153609B_ABST
    Figure CN114153609B_ABST
Patent Text Reader

Abstract

The embodiment of the present application discloses a resource control method and device, an electronic device, and a computer-readable storage medium, the method comprising: obtaining multiple tasks corresponding to a preset service, wherein the preset service represents a service whose execution cycle is less than a preset cycle threshold and the number of all tasks included is greater than a preset task number threshold; then, determining a target task that is blocked from the multiple tasks, and counting the number of target tasks; then, if the statistical result indicates that the number of target tasks reaches a preset blocking number threshold, performing a resource expansion operation. The technical solution of the embodiment of the present application greatly optimizes the resource control solution and avoids the problem of jitter caused by frequent resource expansion and contraction operations.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a resource control method, a resource control device, an electronic device, and a computer-readable storage medium. Background Art

[0002] With the development of cloud computing and artificial intelligence, container technology has been used more and more widely. In the cloud computing environment, containers need to be deployed on a large scale, and corresponding cluster management solutions have emerged. Among them, the container-based cluster management platform (Kubernetes) provides container applications with many functions such as service registration, load balancing, service deployment and operation, resource expansion and reduction, and resource scheduling.

[0003] At present, the related technology is to achieve resource expansion and contraction by using the horizontal automatic expansion and contraction mechanism (HorizontalPod Autoscaler, HPA) in kubernetes. Specifically, it is to obtain the utilization rate of the resource pool and compare it with the upper and lower usage thresholds of the corresponding resource parameters. If the utilization rate of the resource pool is greater than the preset upper utilization threshold of the corresponding resource parameter, the resource expansion operation is performed. If the utilization rate of the resource pool is less than the preset lower utilization threshold of the corresponding resource parameter, the resource contraction operation is performed. However, this method will cause jitter due to frequent resource expansion and contraction operations.

[0004] Therefore, how to optimize the resource control scheme is an urgent problem to be solved. Summary of the invention

[0005] To solve the above technical problems, the embodiments of the present application provide a resource control method and device, an electronic device, and a computer-readable storage medium, thereby optimizing the resource control solution at least to a certain extent.

[0006] According to one aspect of an embodiment of the present application, a resource control method is provided, which is applied to a container-based cluster management platform, and the method includes: obtaining multiple tasks corresponding to a preset service; wherein the preset service represents a service whose execution period is less than a preset period threshold and the number of all tasks included is greater than a preset task number threshold; determining a blocked target task from the multiple tasks, and counting the number of the target tasks; if the statistical result indicates that the number of the target tasks reaches a preset blocking number threshold, performing a resource expansion operation.

[0007] According to one aspect of an embodiment of the present application, a resource control device is provided, which is configured on a container-based cluster management platform, and the device includes: an acquisition module, configured to acquire multiple tasks corresponding to a preset service; wherein the preset service represents a service whose execution period is less than a preset period threshold and the number of all tasks included is greater than a preset task number threshold; a determination and statistics module, configured to determine a blocked target task from the multiple tasks and count the number of the target tasks; and an expansion module, configured to perform a resource expansion operation if the statistical result indicates that the number of the target tasks has reached a preset blocking number threshold.

[0008] In one embodiment of the present application, based on the aforementioned scheme, the resource control device also includes: a determination module, configured to determine whether the utilization rate of the resource pool is less than a preset utilization rate threshold based on the horizontal automatic scaling mechanism if the statistical result indicates that the number of the target tasks has not reached the preset blocking number threshold; a reduction module, configured to perform a resource reduction operation if it is determined based on the horizontal automatic scaling mechanism that the utilization rate of the resource pool is less than the preset utilization rate threshold; wherein the resource parameters corresponding to the resource pool include at least one of a memory and a central processing unit.

[0009] In one embodiment of the present application, based on the aforementioned scheme, the determination and statistics module includes: a first monitoring unit, configured to monitor the execution status of multiple tasks within the execution time period of the preset service; a first determination unit, configured to determine, from the multiple tasks, tasks whose execution duration is greater than a preset duration threshold, so as to use the tasks whose execution duration is greater than the preset duration threshold as target tasks where blocking occurs.

[0010] In one embodiment of the present application, based on the aforementioned scheme, the determination and statistics module includes: a second monitoring unit, configured to monitor the execution status of multiple tasks within the execution time period of the preset service; a second determination unit, configured to determine, from the multiple tasks, the tasks that have not been completed within the execution time period of the preset service, so as to use the unfinished tasks as the target tasks where blocking occurs.

[0011] In one embodiment of the present application, based on the aforementioned scheme, the first monitoring unit is specifically configured to monitor each task of the preset service and record the execution start time of each task if the execution time of the preset service arrives; the first determination unit is specifically configured to determine the execution duration of each task according to the execution start time and the current time of each task; and according to the execution time of each task, determine the tasks whose execution duration is greater than the preset duration threshold from multiple tasks.

[0012] In one embodiment of the present application, based on the aforementioned scheme, the expansion module includes: a first computing unit, configured to perform a quotient operation on the target number of tasks and the number of tasks executed by a single instance to obtain a first number of instances; and an expansion unit, configured to perform resource expansion operations based on the first number of instances.

[0013] In one embodiment of the present application, based on the aforementioned scheme, the scaling-down module includes: a second computing unit, configured to perform a quotient operation on the number of all tasks of the preset service and the number of tasks executed by a single instance to obtain a second number of instances; and a scaling-down unit, configured to perform a resource scaling operation based on the second number of instances.

[0014] In one embodiment of the present application, based on the aforementioned solution, the preset service includes a collection service for collecting network operation data, wherein the network operation data includes at least one of alarm data, performance data, configuration data and log data.

[0015] According to one aspect of an embodiment of the present application, there is provided an electronic device, comprising: one or more processors; a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the electronic device implements the resource control method as described above.

[0016] According to one aspect of an embodiment of the present application, a computer-readable storage medium is provided, on which computer-readable instructions are stored. When the computer-readable instructions are executed by a processor of a computer, the computer executes the resource control method as described above.

[0017] According to one aspect of an embodiment of the present application, a computer program product is provided, including computer instructions, which implement the resource control method as described above when executed by a processor.

[0018] In the technical solution provided in the embodiment of the present application, by obtaining multiple tasks corresponding to a preset service, wherein the preset service represents a service whose execution cycle is less than a preset cycle threshold and the number of all tasks included is greater than a preset task number threshold; then, determining the target task that is blocked from the multiple tasks, and counting the number of target tasks; then, if the statistical result indicates that the number of target tasks reaches the preset blocking number threshold, the resource expansion operation is performed. That is, in the technical solution provided in the embodiment of the present application, when the number of target tasks that are blocked included in the preset service is counted to reach the preset blocking number threshold, the resource expansion operation is performed, instead of when the utilization rate of the resource pool is greater than the preset utilization rate upper threshold of the corresponding resource parameter, the resource expansion operation is performed, so that the resources can be fully loaded, thereby avoiding the problem of jitter caused by frequent resource expansion and contraction operations, and only when the number of target tasks that are blocked reaches the preset blocking number threshold, the resource expansion operation is performed, so that the resources are sufficient to bear the task volume within the preset service execution time period to support the normal operation of the preset service.

[0019] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] The drawings herein are incorporated into the specification and constitute a part of the specification, showing embodiments consistent with the present application, and together with the specification, are used to explain the principles of the present application. Obviously, the drawings described below are only some embodiments of the present application, and for those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative work. In the drawings:

[0021] Figure 1 is a schematic diagram of an exemplary implementation environment to which the technical solution of the embodiments of the present application can be applied;

[0022] Figure 2 is a flow chart of a resource control method shown in an exemplary embodiment of the present application;

[0023] Figure 3 yes Figure 2 A flowchart of step S220 in the illustrated embodiment in an exemplary embodiment;

[0024] Figure 4 yes Figure 2 A flowchart of step S220 in the illustrated embodiment in an exemplary embodiment;

[0025] Figure 5 yes Figure 2 A flowchart of step S220 in the illustrated embodiment in an exemplary embodiment;

[0026] Figure 6 yes Figure 2 A flowchart of step S230 in the illustrated embodiment in an exemplary embodiment;

[0027] Figure 7 is a flow chart of a resource control method shown in an exemplary embodiment of the present application;

[0028] Figure 8 yes Figure 7 A flowchart of step S720 in the illustrated embodiment in an exemplary embodiment;

[0029] Fig. 9 is a flow chart of a resource control method shown in an exemplary embodiment of the present application;

[0030] Fig.10 is a flow chart of a resource control method shown in an exemplary embodiment of the present application;

[0031] Fig.11 is a schematic diagram of the structure of a resource control device shown in an exemplary embodiment of the present application;

[0032] Fig.12 It is a structural diagram of a computer system suitable for implementing an electronic device of an embodiment of the present application. DETAILED DESCRIPTION

[0033] Here, exemplary embodiments will be described in detail, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are only examples of devices and methods consistent with some aspects of the present application as detailed in the attached claims.

[0034] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities may be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.

[0035] The flowcharts shown in the accompanying drawings are only exemplary and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps can be decomposed, and some operations / steps can be combined or partially combined, so the actual execution order may change according to actual conditions.

[0036] It should also be noted that the "multiple" mentioned in this application refers to two or more than two. "And / or" describes the association relationship of the associated objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship.

[0037] Before introducing the technical solutions of the embodiments of the present application, the nouns and terms involved in the embodiments of the present application are explained first. The nouns and terms involved in the embodiments of the present application are subject to the following interpretations.

[0038] Kubernetes: Kubernetes is widely used in container cluster management systems. Kubernetes is an open source containerized application management engine for managing multiple hosts in a cloud platform. Kubernetes cluster (also known as container cluster), referred to as k8s cluster, is an abbreviation of "ubernete" with 8 characters instead of 8. Kubernetes supports automated deployment, large-scale scalability, and application container management. When deploying an application in a production environment, it is usually necessary to deploy multiple instances of the application to load balance application requests. In Kubernetes, multiple containers can be created, each of which runs an application instance, and then the built-in load balancing strategy is used to manage, discover, and access this group of application instances, and these details do not require the operation and maintenance personnel to perform complex manual configuration and processing. Kubernetes has the feature of horizontal automatic expansion. Usually, the monitoring of Kubernetes clusters is mainly the monitoring and elastic scaling of business-type pods and other resources, which relies on the monitoring data provided by the monitoring components. The monitoring component of the kubernetes cluster is one of its core components. It can monitor various resources in the kubernetes cluster (such as pod, node, deployment, etc.). The monitoring items include CPU, memory, traffic, health status, disk usage, etc. The monitoring data can be used as the basic data of other components to provide decision support for other components.

[0039] Pod: Pod refers to the application load in the kubernetes cluster. Pod runs on the node. Pod consists of one or more containers, such as the container created by the Docker container engine. They share container storage, network and container operation configuration items. The containers in the Pod are scheduled at the same time and have a common operating environment.

[0040] In the related technology, the expansion and contraction of resources is realized by using the HPA in kubernetes. Specifically, the resource pool resource parameters such as the central processing unit (CPU) and memory usage are obtained, and compared with the corresponding resource parameter usage upper and lower thresholds (where the CPU usage is compared with the corresponding CPU preset usage upper threshold, and the memory usage is compared with the corresponding memory preset usage upper threshold). If the resource pool usage is greater than the corresponding resource parameter preset usage upper threshold, the resource is expanded. If the resource pool usage is less than the corresponding resource parameter preset usage lower threshold, the resource is contracted. However, this method will cause jitter due to frequent resource expansion and contraction operations.

[0041] Based on this, the embodiments of the present application provide a resource control method and device, an electronic device, and a computer-readable storage medium, which can solve the problem of jitter caused by frequent resource expansion and contraction operations and optimize the resource control solution.

[0042] See also Figure 1 , Figure 1 1 is a schematic diagram of an exemplary implementation environment of the present application, wherein the implementation environment includes a terminal device 110 and a server 120, and the terminal device 110 and the server 120 communicate with each other via a wired or wireless network.

[0043] It should be understood that Figure 1 The number of terminal devices 110 and servers 120 in the embodiment is only for illustration. Any number of terminal devices 110 and servers 120 may be provided according to actual needs.

[0044] Among them, the terminal device 110 can be any electronic device with a user input interface, including but not limited to smart phones, tablets, laptops, computers, etc., wherein the user input interface includes but is not limited to a touch screen, keyboard, physical buttons, audio pickup device, etc.

[0045] Among them, server 120 can be a server that provides various services. It can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers. It can also be a cloud server that provides cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network) and basic cloud computing services such as big data and artificial intelligence platforms. This is not restricted here.

[0046] In some embodiments of the present application, the resource control method can be executed by the server 120, and accordingly, the resource control device is configured in the server 120 corresponding to kubernetes. The server 120 can obtain multiple tasks corresponding to a preset service, wherein the preset service represents a service whose execution cycle is less than a preset cycle threshold and the number of all tasks included is greater than a preset task number threshold; then, determine the target task that is blocked from the multiple tasks, and count the number of target tasks; then, if the statistical result indicates that the number of target tasks reaches the preset blocking number threshold, perform a resource expansion operation.

[0047] In some embodiments of the present application, the terminal device 110 may also have similar functions to the server 120, so as to execute the resource control method provided in the embodiments of the present application.

[0048] The following is a detailed description of various implementation details of the technical solution of the embodiment of the present application:

[0049] See also Figure 2 , Figure 2 is a flow chart of a resource control method according to an embodiment of the present application. The method can be applied to Figure 1 In the implementation environment shown, and by Figure 1 The server 120 in the implementation environment shown is executed. Figure 2 As shown, the resource control method at least includes steps S210 to S230, which are described in detail as follows:

[0050] Step S210, obtaining multiple tasks corresponding to a preset service; wherein the preset service represents a service whose execution period is less than a preset period threshold and the number of all tasks included is greater than a preset task number threshold.

[0051] In the embodiment of the present application, the preset service refers to a service whose execution period is less than a preset period threshold and the number of all tasks included is greater than a preset task number threshold.

[0052] The execution cycle refers to the execution cycle of the preset service; for example, the preset service is executed every 60 minutes. The execution time period of the preset service is mentioned below, and the two need to be distinguished here. The execution time period of the preset service refers to the time required for the preset service to be executed; for example, the preset service takes 5 minutes to execute once.

[0053] It should be clear that the execution period of the preset service is less than the preset period threshold, which indicates that the execution of the preset service is relatively frequent or intensive, and the preset service will often face resource expansion and contraction; therefore, in the embodiment of the present application, it is necessary to perform resource control on this type of preset service. In actual applications, the preset period threshold can be flexibly set according to the specific application scenario.

[0054] Among them, when the preset service is executed, it will be divided into multiple tasks, and then instances will be allocated to multiple tasks. It can be understood that the instance can refer to pod in kubernetes.

[0055] It should be clear that the number of all tasks included in the preset service is greater than the preset task number threshold, which indicates that the task load of the preset service is large, and the preset service will often face resource expansion and contraction; therefore, in the embodiment of the present application, resource control is required for this type of preset service. In actual applications, the preset task number threshold can be flexibly set according to the specific application scenario.

[0056] It should be noted that since the embodiment of the present application controls resources by counting the number of blocked target tasks, task blocking may be involved. Therefore, the preset service in the embodiment of the present application is a service that can tolerate a certain number of task blocking to a certain extent.

[0057] In one embodiment of the present application, the preset service includes but is not limited to a collection service for collecting network operation data, wherein the network operation data includes at least one of alarm data, performance data, configuration data, and log data.

[0058] That is, in the optional embodiment, the preset service may be a collection service, specifically, a collection service corresponding to the 5G core network collection service. Since the execution cycle of the collection service is relatively frequent or intensive, and the number of all tasks included in the collection service is also relatively large; therefore, the collection service can be used as an example of a preset service. In practical applications, the preset service can be determined according to the specific application scenario, as long as it belongs to the category of relatively frequent or intensive execution cycles and a large number of all tasks included. It can be understood that, generally, services with relatively frequent or intensive execution cycles also contain a large number of all tasks. Of course, in special cases, only one of the conditions may be met, such as only belonging to the category of relatively frequent or intensive execution cycles, or only belonging to the category of a large number of all tasks included.

[0059] In one embodiment of the present application, a preset service corresponds to a task pool, wherein the task pool contains all tasks corresponding to the preset service; therefore, in an optional embodiment, multiple tasks corresponding to the preset service can be obtained from the task pool corresponding to the preset service, so that multiple tasks corresponding to the preset service can be obtained simply and conveniently.

[0060] Step S220 , determining a blocked target task from the multiple tasks, and counting the number of the target tasks.

[0061] In the embodiment of the present application, after obtaining multiple tasks corresponding to the preset service, the blocked task can be determined from the multiple tasks, the blocked task can be used as the target task, and the number of target tasks can be counted.

[0062] In one embodiment of the present application, see Figure 3 The process of determining the blocked target task from the multiple tasks in step S220 may include steps S310 to S320, which are described in detail as follows:

[0063] Step S310, monitoring the execution status of multiple tasks within the execution time period of the preset service;

[0064] Step S320 , determining a task whose execution time is longer than a preset time threshold from the multiple tasks, and taking the task whose execution time is longer than the preset time threshold as a target task where blocking occurs.

[0065] That is, in an optional embodiment, the execution status of multiple tasks within the execution time period of a preset service can be monitored, wherein the monitored execution status of the multiple tasks includes the execution duration of the tasks, and then based on the execution duration of the tasks, the tasks whose execution duration is greater than the preset duration threshold are determined from the multiple tasks. At this time, the tasks whose execution duration is greater than the preset duration threshold are determined to be the target tasks where blocking occurs.

[0066] In an optional embodiment, the process of monitoring the execution status of multiple tasks within the execution time period of the preset service in step S310 may include the following steps:

[0067] If the execution time of the preset service arrives, each task of the preset service is monitored and the execution start time of each task is recorded;

[0068] Accordingly, in an optional embodiment, the process of determining the task whose execution time is longer than the preset time threshold from the multiple tasks in step S320 may include the following steps:

[0069] According to the execution start time and current time of each task, the execution time of each task is determined respectively;

[0070] According to the execution time of each task, a task whose execution time is greater than a preset time threshold is determined from the multiple tasks.

[0071] That is, in an optional embodiment, when an execution cycle of a preset service arrives, each task of the preset service can be monitored, and when each task is monitored to start execution, the start time of each task can be recorded respectively. Afterwards, after a period of time, the execution duration of each task can be determined based on the start time of each task and the current time. Afterwards, based on the execution time of each task, tasks with execution times greater than the preset time threshold are determined from multiple tasks.

[0072] For example, suppose that the preset service 1 includes 5 tasks, and the execution status of multiple tasks monitored during the execution time period of the preset service is shown in Table 1 below, and the execution time of tasks 11 and 12 is greater than the preset time threshold; therefore, at this time, tasks 11 and 12 can be determined as blocked tasks from the 5 tasks 11, 12, 13, 14, and 15 included in the preset service 1, that is, tasks 11 and 12 are target tasks. In actual applications, the preset time threshold can be flexibly set according to the specific application scenario.

[0073] Preset Service 1 Execution start time Current moment Execution time Task 11 T11 T T-T11 Task 12 T12 T T-T12 Task 13 T13 T T-T13 Task 14 T14 T T-T14 Task 15 T15 T T-T15

[0074] Table 1

[0075] In one embodiment of the present application, see Figure 4 The process of determining the blocked target task from the multiple tasks in step S220 may include steps S410 to S420, which are described in detail as follows:

[0076] Step S410, monitoring the execution status of multiple tasks within the execution time period of the preset service;

[0077] Step S420 , determining unfinished tasks within a preset service execution time period from the plurality of tasks, and taking the unfinished tasks as blocked target tasks.

[0078] That is, in an optional embodiment, the execution status of multiple tasks within the execution time period of a preset service can be monitored, wherein the monitored execution status of the multiple tasks includes whether the task execution is completed / successful, and then based on the tasks that are not completed / failed, the tasks that are not completed / failed within the execution time period of the preset service are determined from the multiple tasks. At this time, the tasks that are not completed / failed are the target tasks that are blocked.

[0079] For example, assume that the preset service 2 includes 5 tasks, and the execution status of multiple tasks monitored during the execution time period of the preset service is shown in Table 2 below. It can be seen that tasks 23 and 24 are not completed; therefore, at this time, tasks 23 and 24 can be determined as blocked tasks from the 5 tasks 21, 22, 23, 24, and 25 included in the preset service 2, that is, tasks 23 and 24 are target tasks.

[0080] Preset Service 2 Implementation Task 21 Execution completed Task 22 Execution completed Task 23 Execution not completed Task 24 Execution not completed Task 25 Execution completed

[0081] Table 2

[0082] In one embodiment of the present application, see Figure 5 The process of determining the blocked target task from the multiple tasks in step S220 may include steps S510 to S520, which are described in detail as follows:

[0083] Step S510, monitoring the execution status of multiple tasks within the execution time period of the preset service;

[0084] Step S520, determine from multiple tasks the tasks whose execution time is longer than the preset time threshold, and determine from multiple tasks the tasks that are not completed within the execution time period of the preset service, so that the tasks whose execution time is longer than the preset time threshold and the tasks that are not completed within the execution time period of the preset service are collectively regarded as target tasks where blocking occurs.

[0085] That is, in an optional embodiment, tasks whose execution duration is greater than a preset duration threshold are determined from multiple tasks, and unfinished tasks are executed within the execution time period of a preset service. Tasks screened out from these two directions are used as target tasks where blocking occurs, which is more in line with scenario requirements.

[0086] For example, assume that the preset service 3 includes 5 tasks, and the execution status of multiple tasks monitored during the execution time period of the preset service is shown in Table 3 below. At the same time, assume that the execution time of tasks 31 and 32 is greater than the preset time threshold, and it can be seen from Table 3 that tasks 34 and 35 are not completed; therefore, at this time, it can be determined from the 5 tasks 31, 32, 33, 34, 35 included in the preset service 3 that tasks 31, 32, 34, 35 are blocked tasks, that is, tasks 31, 32, 34, 35 are target tasks.

[0087] Preset Service 3 Is the execution completed? Execution time Task 31 Execution completed T-T31 Task 32 Execution completed T-T32 Task 33 Execution completed T-T33 Task 34 Execution not completed T-T34 Task 35 Execution not completed T-T35

[0088] Table 3

[0089] It is worth noting that the above examples are three methods of determining a blocked target task from multiple tasks. In actual applications, they can be adjusted according to specific application scenarios, as long as the method can determine a blocked target task from multiple tasks.

[0090] Step S230: If the statistical result indicates that the number of target tasks reaches a preset blocking number threshold, a resource expansion operation is performed.

[0091] In the embodiment of the present application, after determining the target task with blockage from multiple tasks and counting the number of target tasks, the resource control operation can be performed according to the statistical result; wherein, if the statistical result indicates that the number of target tasks reaches the preset blocking number threshold, the resource expansion operation can be performed at this time. That is, in the embodiment of the present application, the resource expansion is performed only when the number of target tasks with blockage included in the preset service reaches the preset blocking number threshold, instead of performing the resource expansion operation when the utilization rate of the resource pool is greater than the preset utilization rate upper threshold of the corresponding resource parameter, so that the resources can operate at full capacity, thereby avoiding the jitter problem caused by frequent resource expansion and contraction operations.

[0092] In one embodiment of the present application, see Figure 6 The process of performing the resource expansion operation in step S230 may include steps S610 to S620, which are described in detail as follows:

[0093] Step S610, performing a quotient operation on the target task quantity and the task quantity executed by a single instance to obtain a first instance quantity;

[0094] Step S620: perform a resource expansion operation according to the first instance quantity.

[0095] That is, in an optional embodiment, the target task quantity and the task quantity executed by a single instance can be divided to obtain the first instance quantity, and then the resource expansion operation is performed according to the first instance quantity. That is, the first instance quantity obtained is the instance quantity corresponding to the expansion operation; therefore, the resource expansion operation is performed according to the first instance quantity, so that the target task can be executed, which is sufficient to support the normal operation of the preset service, and will not cause excessive or insufficient expansion due to arbitrary resource expansion operations.

[0096] Specifically, the first instance quantity can be obtained by the following formula:

[0097]

[0098] Optionally, if there is a target task, the total number of instances required for the preset service to run can also be calculated; specifically, the total number of instances required for the preset service to run can be obtained by the following formula:

[0099]

[0100] In one embodiment of the present application, see Figure 7 The resource control method may further include steps S710 to S720, which are described in detail as follows:

[0101] Step S710: if the statistical result indicates that the number of target tasks does not reach the preset blocking number threshold, then determine whether the utilization rate of the resource pool is less than the preset utilization rate threshold based on the horizontal automatic expansion mechanism;

[0102] Step S720: If it is determined based on the horizontal automatic expansion and contraction mechanism that the utilization rate of the resource pool is less than a preset utilization rate threshold, a resource reduction operation is performed; wherein the resource parameters corresponding to the resource pool include at least one of a memory and a central processing unit.

[0103] That is, in an optional embodiment, if the statistical result indicates that the number of target tasks has not reached the preset blocking number threshold, then the utilization rate of the resource pool is determined to be less than the preset utilization rate threshold based on the horizontal automatic scaling mechanism; wherein, if the utilization rate of the resource pool is determined to be less than the preset utilization rate threshold based on the horizontal automatic scaling mechanism, then the resource can be scaled down at this time. That is, in the embodiment of the present application, when the utilization rate of the resource pool is less than the preset utilization rate lower threshold, the resource is scaled down.

[0104] Among them, in an optional embodiment, the resource parameters corresponding to the resource pool include but are not limited to memory and central processing unit; optionally, the resource parameters corresponding to the resource pool include one or more of memory and central processing unit.

[0105] In one embodiment of the present application, see Figure 8 The process of performing the resource scaling operation in step S720 may include steps S810 to S820, which are described in detail as follows:

[0106] Step S810, performing a quotient operation on the number of all tasks of the preset service and the number of tasks executed by a single instance to obtain a second number of instances;

[0107] Step S820: Scale down resources according to the second instance quantity.

[0108] That is, in an optional embodiment, the number of all tasks of the preset service and the number of tasks executed by a single instance can be divided to obtain the second number of instances, and then the resource reduction operation is performed according to the second number of instances. That is, the obtained second number of instances is the number of instances corresponding to the reduction operation; therefore, the resource reduction operation is performed according to the second number of instances, so that a reasonable number of instances can be recovered, and while ensuring the normal operation of the preset service, idle resources can be recovered for other services.

[0109] Among them, in an optional embodiment, the resource scaling operation according to the second instance quantity is performed after the execution time period of the preset service, so as to ensure the normal operation of the preset service and avoid the situation where the preset service cannot run normally due to the resource scaling operation performed in advance.

[0110] Specifically, the number of the second instance can be obtained by the following formula:

[0111]

[0112] Optionally, if there is no target task, the total number of instances required for the preset service to run may also be calculated; specifically, the total number of instances required for the preset service to run may be obtained by the following formula:

[0113]

[0114] In the embodiment of the present application, resource expansion is performed only when the number of blocked target tasks included in the preset service reaches the preset blocking number threshold, instead of performing resource expansion when the utilization rate of the resource pool is greater than the preset utilization rate upper threshold of the corresponding resource parameter. In this way, the resources can operate at full capacity, thereby avoiding the jitter problem caused by frequent resource expansion and contraction operations, and resource expansion is performed only when the number of blocked target tasks reaches the preset blocking number threshold, so that the resources are sufficient to bear the task volume within the preset service execution time period to support the normal operation of the preset service.

[0115] The specific application scenarios of the embodiments of the present application are described in detail below:

[0116] See also Fig. 9 , Fig. 9 1 is a flow chart of a resource control method according to an embodiment of the present application. In the embodiment of the present application, the preset service is a collection service as an example. Fig. 9 As shown, the resource control method at least includes steps S910 to S970, which are described in detail as follows:

[0117] Step S910: Acquire multiple collection tasks corresponding to the collection service from a collection task pool corresponding to the collection service.

[0118] Optionally, the specific implementation process of step S910 may refer to the technical solution of the aforementioned embodiment.

[0119] Step S920: monitor the execution status of multiple collection tasks within the execution time period of the collection service.

[0120] Optionally, in an embodiment of the present application, a collection task monitoring module may monitor the execution status of multiple collection tasks of the collection service within an execution time period; wherein, in an embodiment of the present application, the collection task monitoring module monitors the execution status of multiple collection tasks of the collection service within the execution time period, including the execution duration of the collection task and whether the collection task is completed / successfully executed.

[0121] For example, assume that eight collection tasks 11, 12, 13, 14, 15, 16, 17, and 18 included in collection service 1 are obtained from the collection task pool corresponding to the collection service; therefore, it is necessary to monitor the execution status of collection tasks 11, 12, 13, 14, 15, 16, 17, and 18 during the execution time period of the collection service, specifically, to monitor the execution duration of the collection tasks and whether the collection tasks are completed / successfully executed.

[0122] Step S930, determining from multiple collection tasks the collection tasks whose execution time is longer than the preset time threshold, and determining from multiple collection tasks the collection tasks that are not completed within the execution time period of the collection service, so that the collection tasks whose execution time is longer than the preset time threshold and the collection tasks that are not completed within the execution time period of the collection service are collectively regarded as target collection tasks where obstruction occurs.

[0123] In the embodiment of the present application, screening is performed simultaneously from two directions: the execution time of the collection task and whether the collection task is completed within the execution time period of the collection service, so as to determine the blocked target collection task from multiple collection tasks.

[0124] Continuing with the above example, further, assume that among the 8 collection tasks included in collection service 1, although collection tasks 11 and 12 are completed within the execution time period, their execution time is greater than the preset time threshold, and collection tasks 13, 14, and 15 are not completed within the execution time period; therefore, from the 8 collection tasks 11, 12, 13, 14, 15, 16, 17, and 18 included in collection service 1, collection tasks 11, 12, 13, 14, and 15 are determined to be blocked collection tasks, that is, collection tasks 11, 12, 13, 14, and 15 are target collection tasks.

[0125] Step S940, counting the number of target acquisition tasks.

[0126] Continuing with the above example, further statistics show that the number of target acquisition tasks is 5.

[0127] Step S950: If the statistical result indicates that the number of target acquisition tasks reaches a preset blocking number threshold, a resource expansion operation is performed.

[0128] Following the above example, further, assuming that the preset blocking number threshold is 5, the statistical result indicates that the number of target acquisition tasks has reached the preset blocking number threshold, and a resource expansion operation is required. Optionally, performing a resource expansion operation may specifically include taking the quotient of the target acquisition task number and the number of acquisition tasks executed by a single instance to obtain a first instance number, and then performing a resource expansion operation based on the first instance number.

[0129] Step S960: If the statistical result indicates that the number of target acquisition tasks does not reach the preset blocking number threshold, it is determined based on the horizontal automatic expansion mechanism whether the utilization rate of the resource pool is less than the preset utilization rate threshold.

[0130] Optionally, the specific implementation process of step S960 may refer to the technical solution of the aforementioned embodiment.

[0131] Step S970: If it is determined based on the horizontal automatic expansion and contraction mechanism that the utilization rate of the resource pool is less than a preset utilization rate threshold, a resource reduction operation is performed.

[0132] Optionally, performing the resource scaling operation may specifically include taking the quotient of the number of all collection tasks of the collection service and the number of collection tasks executed by a single instance to obtain a second number of instances, and then performing the resource scaling operation according to the second number of instances.

[0133] See also Fig.10 , Fig.10 1 is a flow chart of a resource control method shown in an embodiment of the present application. In the embodiment of the present application, the preset service is still taken as an example for description, such as Fig.10 As shown, the resource control method at least includes steps S1010 to S1040, which are described in detail as follows:

[0134] Step S1010: A collection task monitoring module corresponding to a collection service obtains a plurality of collection tasks corresponding to the collection service from a collection task pool, and monitors the execution status of the plurality of collection tasks.

[0135] The collection service can determine whether the multiple collection tasks are blocked according to the execution status of the multiple collection tasks monitored.

[0136] Step S1020, determine the blocking status of the collection tasks; if the number of blocked collection tasks reaches a preset blocking number threshold, execute step S1030, if the number of blocked collection tasks does not reach the preset blocking number threshold, execute step S1040.

[0137] Optionally, the specific implementation process of step S1020 may refer to the technical solution of the aforementioned embodiment.

[0138] Step S1030, performing resource expansion operations.

[0139] Optionally, the specific implementation process of step S1030 may refer to the technical solution of the aforementioned embodiment.

[0140] Step S1040: If the CPU and memory usage rates are lower than the preset lower usage thresholds, a resource reduction operation is performed.

[0141] Optionally, the specific implementation process of step S1040 may refer to the technical solution of the aforementioned embodiment.

[0142] In the embodiment of the present application, when the number of blocked target collection tasks included in the collection service reaches a preset blocking number threshold, the resource expansion operation is performed; when the number of blocked target collection tasks included in the collection service does not reach the preset blocking number threshold, and the utilization rate of the resource pool is determined to be less than the preset utilization rate threshold based on the horizontal automatic expansion and contraction mechanism, the resource reduction operation is performed; this avoids the problem of jitter caused by frequent resource expansion and contraction operations, and optimizes the resource expansion and contraction plan to a great extent.

[0143] Fig.11 FIG. 1 is a block diagram of a resource control device according to an embodiment of the present application. Fig.11 As shown, the device comprises:

[0144] The acquisition module 1110 is configured to acquire multiple tasks corresponding to a preset service; wherein the preset service represents a service whose execution period is less than a preset period threshold and the number of all tasks included is greater than a preset task number threshold;

[0145] A determination and statistics module 1120 is configured to determine a target task that is blocked from a plurality of tasks and to count the number of the target tasks;

[0146] The expansion module 1130 is configured to perform a resource expansion operation if the statistical result indicates that the number of target tasks reaches a preset blocking number threshold.

[0147] In one embodiment of the present application, the device may further include:

[0148] A determination module configured to determine whether a utilization rate of a resource pool is less than a preset utilization rate threshold based on a horizontal automatic expansion and contraction mechanism if the statistical result indicates that the number of target tasks does not reach a preset blocking number threshold;

[0149] The capacity reduction module is configured to perform a resource reduction operation if it is determined based on the horizontal automatic expansion and contraction mechanism that the utilization rate of the resource pool is less than a preset utilization rate threshold; wherein the resource parameters corresponding to the resource pool include at least one of a memory and a central processing unit.

[0150] In one embodiment of the present application, the determination and statistics module 1120 includes:

[0151] A first monitoring unit, configured to monitor the execution status of multiple tasks within a preset service execution time period;

[0152] The first determining unit is configured to determine, from a plurality of tasks, a task whose execution time is longer than a preset time threshold, so as to use the task whose execution time is longer than the preset time threshold as a target task where blocking occurs.

[0153] In one embodiment of the present application, the determination and statistics module 1120 includes:

[0154] A second monitoring unit is configured to monitor the execution status of multiple tasks within a preset service execution time period;

[0155] The second determining unit is configured to determine, from the plurality of tasks, unfinished tasks within a preset service execution time period, so as to use the unfinished tasks as blocked target tasks.

[0156] In one embodiment of the present application,

[0157] The first monitoring unit is specifically configured to monitor each task of the preset service if the execution time of the preset service arrives, and record the execution start time of each task;

[0158] The first determination unit is specifically configured to determine the execution time of each task according to the execution start time and current time of each task; and determine the tasks whose execution time is greater than a preset time threshold from multiple tasks according to the execution time of each task.

[0159] In one embodiment of the present application, the capacity expansion module 1130 includes:

[0160] A first computing unit is configured to perform a quotient operation on the target task quantity and the task quantity executed by a single instance to obtain a first instance quantity;

[0161] The capacity expansion unit is configured to perform a capacity expansion operation of resources according to the first instance quantity.

[0162] In one embodiment of the present application, the capacity reduction module includes:

[0163] The second computing unit is configured to perform a quotient operation on the number of all tasks of the preset service and the number of tasks executed by a single instance to obtain a second number of instances;

[0164] The scaling-in unit is configured to perform a scaling-down operation on resources according to the second instance quantity.

[0165] In one embodiment of the present application, the preset service includes a collection service for collecting network operation data, wherein the network operation data includes at least one of alarm data, performance data, configuration data, and log data.

[0166] It should be noted that the resource control device provided in the above embodiment and the resource control method provided in the above embodiment belong to the same concept, wherein the specific manner in which each module and unit performs operations has been described in detail in the method embodiment and will not be repeated here.

[0167] An embodiment of the present application also provides an electronic device, comprising: one or more processors; a storage device for storing one or more programs, when the one or more programs are executed by one or more processors, the electronic device implements the resource control method provided in the aforementioned embodiments.

[0168] Fig.12 A schematic diagram of the structure of a computer system suitable for implementing an electronic device of an embodiment of the present application is shown.

[0169] It should be noted that Fig.12 The computer system 1200 of the electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0170] like Fig.12 As shown, the computer system 1200 includes a central processing unit (CPU) 1201, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 1202 or the program loaded from the storage part 1208 to the random access memory (RAM) 1203, such as executing the method in the above embodiment. In the RAM 1203, various programs and data required for system operation are also stored. The CPU 1201, the ROM 1202 and the RAM 1203 are connected to each other through the bus 1204. The input / output (I / O) interface 1205 is also connected to the bus 1204.

[0171] The following components are connected to the I / O interface 1205: an input section 1206 including a keyboard, a mouse, etc.; an output section 1207 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 1208 including a hard disk, etc.; and a communication section 1209 including a network interface card such as a LAN (Local Area Network) card, a modem, etc. The communication section 1209 performs communication processing via a network such as the Internet. A drive 1210 is also connected to the I / O interface 1205 as needed. A removable medium 1211, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 1210 as needed so that a computer program read therefrom is installed into the storage section 1208 as needed.

[0172] In particular, according to an embodiment of the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a computer program for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication section 1209, and / or installed from a removable medium 1211. When the computer program is executed by a central processing unit (CPU) 1201, various functions defined in the system of the present application are executed.

[0173] It should be noted that the computer-readable medium shown in the embodiment of the present application can be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium can be, for example, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media can include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable storage medium can be any tangible medium containing or storing a program, which can be used by an instruction execution system, device or device or used in combination with it. In the present application, a computer-readable signal medium can include a data signal propagated in a baseband or as a part of a carrier wave, wherein a computer-readable computer program is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate, or transmit programs for use by or in conjunction with an instruction execution system, apparatus, or device. The computer program contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.

[0174] The flowchart and block diagram in the accompanying drawings illustrate the possible architecture, functions and operations of the system, method and computer program product according to various embodiments of the present application. Wherein, each box in the flowchart or block diagram can represent a module, a program segment, or a part of the code, and the above-mentioned module, program segment, or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, and the combination of boxes in the block diagram or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0175] The units involved in the embodiments described in this application may be implemented by software or hardware, and the units described may also be set in a processor. The names of these units do not, in some cases, constitute limitations on the units themselves.

[0176] Another aspect of the present application also provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the resource control method as described above is implemented. The computer-readable storage medium may be included in the electronic device described in the above embodiment, or may exist independently without being assembled into the electronic device.

[0177] Another aspect of the present application also provides a computer program product or a computer program, which includes a computer instruction stored in a computer-readable storage medium. A processor of a computer device reads the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the computer device executes the resource control method provided in each of the above embodiments.

[0178] The above content is only a preferred exemplary embodiment of the present application and is not intended to limit the implementation scheme of the present application. A person skilled in the art can easily make corresponding changes or modifications based on the main concept and spirit of the present application. Therefore, the scope of protection of the present application shall be based on the scope of protection required by the claims.

Claims

1. A resource control method, It is characterized in that Applied to a container-based cluster management platform, the method includes: Acquire multiple tasks corresponding to a preset service; wherein the preset service represents a service whose execution period is less than a preset period threshold and the number of all tasks included is greater than a preset task number threshold; Determine a target task where blocking occurs from the multiple tasks, and count the number of the target tasks; If the statistical result indicates that the number of the target tasks reaches a preset blocking number threshold, a resource expansion operation is performed.

2. The method according to claim 1, It is characterized in that The method further comprises: If the statistical result indicates that the number of the target tasks does not reach the preset blocking number threshold, determining whether the utilization rate of the resource pool is less than the preset utilization rate threshold based on the horizontal automatic expansion mechanism; If it is determined based on the horizontal automatic expansion and contraction mechanism that the utilization rate of the resource pool is less than the preset utilization rate threshold, a resource reduction operation is performed; wherein the resource parameters corresponding to the resource pool include at least one of a memory and a central processing unit.

3. The method according to claim 1, It is characterized in that The step of determining a target task where a blockage occurs from among the plurality of tasks comprises: Monitoring the execution status of multiple tasks within the execution time period of the preset service, determining tasks whose execution time is longer than a preset time threshold from the multiple tasks, and taking the tasks whose execution time is longer than the preset time threshold as target tasks where blocking occurs; and / or, The execution status of multiple tasks within the execution time period of the preset service is monitored, and unfinished tasks within the execution time period of the preset service are determined from the multiple tasks, so as to use the unfinished tasks as the target tasks that are blocked.

4. The method according to claim 3, It is characterized in that The monitoring of the execution of multiple tasks within the execution time period of the preset service includes: If the execution time of the preset service arrives, monitor each task of the preset service and record the execution start time of each task; Determining the task whose execution time is longer than a preset time threshold from the multiple tasks includes: According to the execution start time and current time of each task, the execution time of each task is determined respectively; According to the execution time of each task, a task whose execution time is greater than a preset time threshold is determined from the multiple tasks.

5. The method according to any one of claims 1 to 4, It is characterized in that The resource expansion operation includes: Taking the quotient of the target number of tasks and the number of tasks executed by a single instance, to obtain a first number of instances; The resource capacity expansion operation is performed according to the number of the first instances.

6. The method according to any one of claims 2 to 4, It is characterized in that The resource scaling operation includes: Taking the quotient of the number of all tasks of the preset service and the number of tasks executed by a single instance, to obtain a second number of instances; The resource capacity is reduced according to the number of the second instances.

7. The method according to any one of claims 1 to 4, It is characterized in that The preset service includes a collection service for collecting network operation data, wherein the network operation data includes at least one of alarm data, performance data, configuration data and log data.

8. A resource control device, It is characterized in that Configured on a container-based cluster management platform, the device includes: An acquisition module configured to acquire multiple tasks corresponding to a preset service; wherein the preset service represents a service whose execution period is less than a preset period threshold and the number of all tasks included is greater than a preset task number threshold; A determination and statistics module, configured to determine a target task where a blockage occurs from the plurality of tasks, and to count the number of the target tasks; The capacity expansion module is configured to perform a capacity expansion operation of resources if the statistical result indicates that the number of the target tasks reaches a preset blocking number threshold.

9. An electronic device, It is characterized in that include: one or more processors; A storage device for storing one or more programs, which, when executed by the one or more processors, enables the electronic device to implement the resource control method as described in any one of claims 1 to 7.

10. A computer readable medium having a computer program stored thereon, It is characterized in that When the computer program is executed by a processor, the resource control method according to any one of claims 1 to 7 is implemented.