A container scheduling method and scheduler
By obtaining the current data of the container and using the detection model to determine its busyness, and adjusting the container group, the problem of uneven resource allocation in the existing technology is solved, and more reasonable resource allocation and service quality improvement are achieved.
Patent Information
- Application Number
- CN202011594780.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-12-29
- Publication Date
- 2024-10-18
- Estimated Expiration
- 2040-12-29
AI Technical Summary
In the existing technology, container scheduling based on business may lead to uneven distribution of service cluster resources and waste of resources.
By obtaining the current data of the container, using the trained detection model to determine the working status of the container, measuring its busyness, and adjusting the containers in the container group according to the busyness, the resources of the service cluster can be reasonably allocated.
It achieves more reasonable resource allocation, avoids downtime caused by excessive container pressure, and improves service quality.
Smart Images

Figure CN113760496B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a container scheduling method and a scheduler. Background Art
[0002] In order to meet the growing needs of service callers, service providers deploy services in a service cluster consisting of multiple containers. At the same time, in order to make rational use of each container and improve service quality, service providers divide containers into different container groups and schedule containers based on the grouping results.
[0003] In the prior art, a service provider usually schedules each container according to the services provided, for example, service group 1 and service group 2.
[0004] However, scheduling containers based on business may lead to improper resource allocation of the service cluster and waste of resources. Summary of the invention
[0005] In view of this, an embodiment of the present invention provides a container scheduling method and a scheduler, which can reasonably allocate resources of a service cluster.
[0006] In a first aspect, an embodiment of the present invention provides a container scheduling method, including:
[0007] Get the current data of the container in the sliding time window from the service provider;
[0008] Determine the working state of the container according to the current data of the container and the trained detection model; wherein the working state of the container is used to measure the busyness of the container;
[0009] adjusting the containers in the container group according to the working status of the container;
[0010] The grouping result is provided to the service provider, so that the service provider schedules the container according to the grouping result.
[0011] Optionally,
[0012] Further including:
[0013] Obtaining historical data of the container;
[0014] Collecting statistics on the historical data of the container according to a specified period to obtain metadata;
[0015] extracting business features and hardware features from the metadata;
[0016] Generate training samples according to the service characteristics and the hardware characteristics;
[0017] The detection model is trained according to the training samples.
[0018] Optionally,
[0019] The business characteristics include: any one or more of the average number of item queries, the average query depth of requests, and the total number of requests; wherein the average query depth of requests is determined by the input parameter quantity and input parameter type.
[0020] Optionally,
[0021] The hardware features include: any one or more of the number of times the CPU utilization exceeds a first threshold, the number of times the memory utilization exceeds a second threshold, the number of times the disk utilization exceeds a third threshold, the number of times the network inflow rate exceeds a fourth threshold, and the number of times the load value exceeds a fifth threshold.
[0022] Optionally,
[0023] The step of adjusting the containers in the container group according to the working status of the container includes:
[0024] Determining the busyness of the container group according to the working status of the container;
[0025] Determining a working state of the container group according to a busyness of the container group;
[0026] The containers in the container group are adjusted according to the working status of the container group.
[0027] Optionally,
[0028] The working status of the container includes: busy, normal and idle;
[0029] The determining the busyness of the container group according to the working state of the container includes:
[0030] The busyness of the container group is calculated according to the total number of containers of the container group and the number of busy containers.
[0031] Optionally,
[0032] The working status of the container group includes: busy, normal and idle;
[0033] The step of adjusting the containers in the container group according to the working state of the container group includes:
[0034] Calculating the allocation quota of the busy container group according to the number of busy containers in the busy container group;
[0035] Calculate the allocation quota of the idle container group according to the number of idle containers in the idle container group;
[0036] The containers in the busy container group and the idle container group are adjusted according to the allocation quota of the busy container group and the allocation quota of the idle container group.
[0037] Optionally,
[0038] The adjusting the containers in the busy container group and the idle container group according to the allocation quota of the busy container group and the allocation quota of the idle container group includes:
[0039] Calculating the sum of the allocation quotas of each of the idle container groups;
[0040] Calculate the number of containers allocated to each of the busy container groups according to the number of the busy container groups and the sum of the allocation quotas of each of the idle container groups;
[0041] According to the number of containers allocated to each of the busy container groups, containers in each of the idle container groups are allocated to each of the busy container groups.
[0042] Optionally,
[0043] The adjusting the containers in the busy container group and the idle container group according to the allocation quota of the busy container group and the allocation quota of the idle container group includes:
[0044] Arrange the busy container groups in descending order of busyness to obtain the priority of the busy container groups;
[0045] Arrange the idle container groups in descending order according to the allocation quota to obtain the priority of the idle container groups;
[0046] The containers in the busy container group and the idle container group are adjusted according to the priority and allocation quota of each busy container group and the priority and allocation quota of each idle container group.
[0047] Optionally,
[0048] The current data includes: any one or more of request timestamp, container name, item query quantity, request query depth, millisecond request quantity, CPU utilization, memory utilization, network inflow rate, disk utilization and load value; wherein the request query depth is determined by the input parameter quantity and input parameter type.
[0049] In a second aspect, an embodiment of the present invention provides a scheduler, including:
[0050] An acquisition module, configured to acquire current data of a container in a sliding time window from a service provider;
[0051] A determination module, configured to determine the working state of the container according to the current data of the container and the trained detection model; wherein the working state of the container is used to measure the busyness of the container;
[0052] The adjustment module is configured to adjust the containers in the container group according to the working status of the container; and provide the grouping result to the service provider so that the service provider schedules the container according to the grouping result.
[0053] In a third aspect, an embodiment of the present invention provides an electronic device, including:
[0054] one or more processors;
[0055] a storage device for storing one or more programs,
[0056] When the one or more programs are executed by the one or more processors, the one or more processors implement the method described in any of the above embodiments.
[0057] In a fourth aspect, an embodiment of the present invention provides a computer-readable medium having a computer program stored thereon, wherein the program, when executed by a processor, implements the method described in any of the above embodiments.
[0058] One embodiment of the above invention has the following advantages or beneficial effects: determining the busyness of the container based on the current data of the container, and adjusting the containers in each container group based on the busyness. Since the busyness of the container is taken into consideration, the embodiment of the present invention can more reasonably allocate the resources of the service cluster to avoid the situation where a certain container is overstressed and crashes. At the same time, the embodiment of the present invention uses a model prediction method to determine the working state of the container, which can more accurately measure the busyness of the container, and then more reasonably schedule the container.
[0059] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with the specific implementation manner. BRIEF DESCRIPTION OF THE DRAWINGS
[0060] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention.
[0061] Figure 1 is a flow chart of a container scheduling method provided by an embodiment of the present invention;
[0062] Figure 2 is a flow chart of a container scheduling method provided by another embodiment of the present invention;
[0063] Figure 3 is a schematic diagram of a grouping result provided by an embodiment of the present invention;
[0064] Figure 4 is a schematic diagram of a scheduler provided by an embodiment of the present invention;
[0065] Figure 5 is a schematic diagram of a service cluster dynamic adjustment system provided by an embodiment of the present invention;
[0066] Figure 6 is a schematic diagram of a service cluster dynamic adjustment method provided by an embodiment of the present invention;
[0067] Figure 7 It is a schematic diagram of the structure of a computer system of a terminal device or a server suitable for implementing an embodiment of the present invention. DETAILED DESCRIPTION
[0068] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.
[0069] Grouping containers by business may lead to uneven allocation of container resources in the service cluster, resulting in resource waste. For example, more containers are used for businesses with less traffic, while fewer containers are used for businesses with more traffic.
[0070] In view of this, if Figure 1 As shown, an embodiment of the present invention provides a container scheduling method, including:
[0071] Step 101: Obtain current data of the container in the sliding time window from the service provider.
[0072] This method is applied to the scheduler. The service provider collects the current data of the container through the pre-set tracking points. Specifically, the service provider can collect various data indicators of the container in the sliding time window based on Flink. Flink is an open source stream processing framework, the core of which is a distributed stream data flow engine written in Java and Scala. Flink executes any stream data program in a data-parallel and pipelined manner. Flink's pipeline runtime system can execute batch and stream processing programs.
[0073] The width of the sliding time window can be set according to different services. As the sliding time window moves, the current data collected is different. In order to distinguish it from the sliding time window corresponding to the historical data, the embodiment of the present invention is recorded as the first sliding time window.
[0074] The scheduler obtains the current data collected from the service provider.
[0075] Current data may include:
[0076] (1) Data entered by the service caller, such as the item quantity to be queried;
[0077] During the interaction, the service provider will respond to the service caller's request based on the service caller's input. Therefore, the service caller's input greatly affects the service provider's processing. For example, when the number of items to be queried is 1, the complexity is O(1), and when the number of items to be queried is 100, the complexity is O(100). The two types of input put different pressures on the service provider.
[0078] (2) Data returned by the service provider, such as the requested query depth;
[0079] The service provider performs queries according to the input parameters of the service caller, and the query depth can be different each time. For example, service caller A queries the basic information of the item; service caller B queries the basic information and image information of the item, as well as data such as item-related extended attributes. Compared with service caller A, service caller B corresponds to a deeper request query depth, and the service provider needs to return deeper data to service caller B. In actual application scenarios, the request query depth can be determined by the input parameter quantity and input parameter type. For example, the more input parameters, the deeper the request query depth.
[0080] (3) Traffic data, e.g., millisecond-level request volume;
[0081] In the embodiment of the present invention, daily traffic data and maximum peak traffic data may be counted.
[0082] (4) Hardware information, such as CPU utilization, memory utilization, network inflow rate, disk utilization, and load value.
[0083] Step 102: Determine the working state of the container according to the current data of the container and the trained detection model; wherein the working state of the container is used to measure the busyness of the container.
[0084] In an embodiment of the present invention, the working status of a container may be divided in different ways. For example, in one scenario, the working status of a container includes: busy, idle, and normal; in another scenario, the working status of a container includes: level 1 busy, level 2 busy, level 2 busy, and level 4 busy.
[0085] The embodiments of the present invention can more accurately determine the working status of the container through machine learning, thereby making the container deployment more reasonable. In actual application scenarios, the container score can also be calculated based on the current data of the container, and the working status of the container can be determined based on the container score. For example, the sum of the scores of various data such as CPU utilization and memory utilization is determined as the container score, and the working status of the container is determined based on the numerical range of the container score.
[0086] Step 103: Adjust the containers in the container group according to the working status of the containers.
[0087] The embodiment of the present invention can adjust the containers in the container group to avoid excessive containers with high busyness in the container group. The containers in the container group are adjusted to obtain a grouping result.
[0088] Step 104: Providing the grouping result to the service provider, so that the service provider schedules the container according to the grouping result.
[0089] The busyness of the container is determined based on the current data of the container, and the containers in each container group are adjusted based on the busyness. Since the busyness of the container is taken into consideration, the embodiment of the present invention can allocate the resources of the service cluster more reasonably, avoiding the situation where a certain container is overstressed and crashes. At the same time, the embodiment of the present invention uses a model prediction method to determine the working state of the container, which can more accurately measure the busyness of the container, and then schedule the container more reasonably.
[0090] In one embodiment of the present invention, in order to avoid occupying the resources of the service provider and improve the service quality, the grouping result is sent to the configuration center so that the service provider obtains the grouping result from the configuration center.
[0091] In one embodiment of the present invention, the method further comprises:
[0092] Get historical data of the container;
[0093] Collect statistics on the historical data of the container according to the specified period to obtain metadata;
[0094] Extract business features and hardware features from metadata;
[0095] Generate training samples based on business characteristics and hardware characteristics;
[0096] Train the detection model based on the training samples.
[0097] Similar to the current data, the embodiment of the present invention can obtain the historical data of the container in the second sliding time window. In order to ensure the consistency of the training process and the prediction process and improve the prediction accuracy, the width of the second sliding time window is equal to the width of the first sliding time window.
[0098] If the collection time of historical data is before the current data collection time, you can directly extract features from the historical data and generate training samples based on the extracted features. You can also first count the historical data and extract features from the metadata obtained by the statistics. Considering that the amount of historical data is large and there is millisecond-level data, in order to increase the generation speed of training samples, you can count the historical data based on a specified period. For example, with a period of 1 second, merge the millisecond-level requests into the second-level requests.
[0099] In the embodiment of the present invention, the labels of the training samples may be determined based on manual experience, for example, 0 represents busy, 1 represents normal, and 2 represents idle.
[0100] In the embodiment of the present invention, the business characteristics may include any one or more of the average number of item queries, the average query depth of requests, and the total number of requests.
[0101] The requested average query depth is the average value of the requested query depths.
[0102] Hardware characteristics may include: any one or more of the number of times the CPU utilization exceeds a first threshold, the number of times the memory utilization exceeds a second threshold, the number of times the disk utilization exceeds a third threshold, the number of times the network inflow rate exceeds a fourth threshold, and the number of times the load value exceeds a fifth threshold.
[0103] In different application scenarios, the first threshold, the second threshold, the third threshold, and the fourth threshold can vary. Taking CPU utilization as an example, if it exceeds the first threshold, it means that the CPU utilization is too high. The higher the number of times the CPU utilization exceeds the first threshold, the greater the pressure on the container in terms of CPU utilization. Therefore, this hardware feature can reflect the working status of the container from the dimension of CPU utilization.
[0104] The detection model may be a decision tree model. In actual application scenarios, training samples may also be generated based only on business features or hardware features, which will not be described in detail here.
[0105] The embodiment of the present invention trains a detection model based on business characteristics and hardware characteristics, so that the trained detection model can take business characteristics and hardware characteristics into consideration during the prediction process, thereby making the working status of the determined container more accurate and resource allocation more balanced.
[0106] In the process of training the detection model, a cross-validation method can also be used to optimize the hyperparameters of the detection model, for example, ten-fold cross-validation.
[0107] In one embodiment of the present invention, adjusting containers in a container group according to a working state of the container includes:
[0108] Determine how busy the container group is based on the working status of the container;
[0109] Determine the working status of the container group based on how busy the container group is;
[0110] Adjust the containers in the container group according to the working status of the container group.
[0111] Similar to containers, the working status of a container group can also be divided into different situations. For example, the working status of a container group includes: busy, normal, and idle. Container groups with busy and idle working status need to be adjusted, while container groups with normal working status do not need to be adjusted.
[0112] The embodiment of the present invention adjusts the containers in the container group according to the working status of the container group, thereby preventing the container group from being too idle or too busy and allocating resources more reasonably.
[0113] In actual application scenarios, you can also adjust the containers in the container group directly according to the busyness of the container group without first determining the working status of the container group.
[0114] In one embodiment of the present invention, if the working status of the container includes busy, normal, and idle, determining the busyness of the container group according to the working status of the container includes:
[0115] The busyness of the container group is calculated based on the total number of containers in the container group and the number of busy containers.
[0116] The busyness of a container group may be the ratio of the number of busy containers in the container group to the total number of containers in the container group. The busyness of the container group can be measured more accurately through this ratio, so that resource allocation is more balanced.
[0117] In one embodiment of the present invention, the working status of the container group includes: busy, normal and idle;
[0118] Adjust the containers in the container group according to the working status of the container group, including:
[0119] Calculate the allocation quota of the busy container group according to the number of busy containers in the busy container group;
[0120] Calculate the allocation quota of the idle container group according to the number of idle containers in the idle container group;
[0121] The containers in the busy container group and the idle container group are adjusted according to the allocation quota of the busy container group and the allocation quota of the idle container group.
[0122] The allocation quota of a busy container group can be the number of busy containers in the busy container group, or the product of the number of busy containers in the busy container group and the busy coefficient. Similarly, the allocation quota of an idle container group can be the number of idle containers in the idle container group, or the product of the number of idle containers in the idle container group and the idle coefficient. The calculation methods of the allocation quota of a busy container group and the allocation quota of an idle container group are not limited to these two.
[0123] In the process of allocating containers, the embodiment of the present invention considers both the number of idle containers in the idle container group and the number of busy containers in the busy container group, so that the allocation is more reasonable and the load of the service cluster is more balanced.
[0124] The embodiment of the present invention provides at least two adjustment methods:
[0125] Method 1: Fair Scheduling
[0126] According to the allocation quota of the busy container group and the allocation quota of the idle container group, adjust the containers in the busy container group and the idle container group, including:
[0127] Calculate the sum of the allocation quotas of each idle container group;
[0128] The number of containers allocated to each busy container group is calculated based on the number of busy container groups and the sum of the allocation quotas of each idle container group.
[0129] According to the number of containers allocated to each busy container group, the containers in each idle container group are allocated to each busy container group.
[0130] Through the embodiment of the present invention, the allocation quota or container quantity obtained by each busy container group is the same. This adjustment method is highly efficient and is suitable for daily adjustments in non-promotional scenarios.
[0131] Method 2: Priority Scheduling
[0132] According to the allocation quota of the busy container group and the allocation quota of the idle container group, adjust the containers in the busy container group and the idle container group, including:
[0133] Arrange each busy container group in descending order of busyness to obtain the priority of each busy container group;
[0134] Arrange each idle container group in descending order according to the allocation quota to obtain the priority of each idle container group;
[0135] According to the priority and allocation quota of each busy container group and the priority and allocation quota of each idle container group, the containers in the busy container group and the idle container group are adjusted.
[0136] The busy containers and idle containers in front have higher priorities and will first meet the needs of the busy container groups with higher priorities. The allocation quota of a busy container group can be met by the allocation quotas of multiple different idle container groups, and the allocation quota of an idle container group can meet the allocation quotas of multiple different busy container groups.
[0137] like Figure 2 As shown, an embodiment of the present invention provides a container scheduling method, including:
[0138] Step 201: Obtain current data of each container within the sliding time window from the service provider.
[0139] The current data includes: request timestamp, container name, item query quantity, request query depth, millisecond request volume, CPU utilization, memory utilization, network inflow rate, disk utilization, and load value.
[0140] The request timestamp is in milliseconds, and the container name consists of the container group name and the container IP address. The width of the sliding time window can be set according to different services. The embodiment of the present invention adopts 300 seconds. As the sliding time window moves, the current data collected is different. The embodiment of the present invention only takes one sliding time window as an example for explanation.
[0141] A piece of data collected by the embodiment of the present invention is shown in Table 1.
[0142] Table 1
[0143]
[0144] Step 202: collect statistics on the current data of the container according to a specified period to obtain metadata.
[0145] Aggregate the current data collected in the sliding time window to form metadata. Specifically, according to the container name, merge the millisecond-level historical data into second-level metadata. Among them, the millisecond-level request volume is merged in a summation manner, and other indicators, such as request query depth, are merged in an expected value manner.
[0146] For example, another piece of data collected by the embodiment of the present invention is shown in Table 2.
[0147] Table 2
[0148]
[0149] T1 and T2 are data collected at different times in the same second. The current data of the second is counted, and the metadata of the container (S1-1.1.1.1) is obtained as shown in Table 3.
[0150] Table 3
[0151]
[0152]
[0153] Step 203: extracting service features and hardware features from the metadata.
[0154] The extracted business features include: average number of item queries, average query depth of requests, and total number of requests.
[0155] Average number of item queries: The number of items queried by the service caller at a time affects the throughput and response time of the container per unit time, and reflects the busyness of the container.
[0156] Calculation method: Count the average number of item queries in the container within the sliding time window, that is, the average number of item queries per second.
[0157] Average query depth of requests: Service providers provide different types and quantities of related queries based on different business lines, which are specifically reflected by the number and type of input parameters of the call. For example, service caller A needs to query the basic information of the product; service caller B needs to query the basic information of the product and the product's image information, as well as related extended attributes. Different types of input parameter forms correspond to different query depths, and the query depth can affect the busyness of the container.
[0158] Calculation method: Count the average query depth of container requests within the sliding time window, that is, the average query depth of requests per second.
[0159] Total number of requests: The number of requests that a cluster container can process per unit time is limited. The total number of requests can also reflect how busy the container is.
[0160] Calculation method: Count the total number of requests received by the container within the sliding time window.
[0161] The extracted hardware features include:
[0162] CPU high utilization times: counts the number of times the container's CPU utilization exceeds threshold A within the sliding time window;
[0163] High memory utilization times: counts the number of times the container's memory utilization exceeds threshold B within the sliding time window;
[0164] High disk utilization times: counts the number of times the container's disk utilization exceeds threshold C within the sliding time window;
[0165] High-rate network inflow times: counts the number of times the network inflow rate of a container exceeds the threshold D within the sliding time window;
[0166] High load times: counts the number of times the container load value exceeds the threshold E within the sliding time window.
[0167] Step 204: Generate prediction samples based on business characteristics and hardware characteristics.
[0168] Step 205: Input the predicted sample into the trained detection model to obtain the working status of the container.
[0169] The detection model used in the embodiment of the present invention is a decision tree model based on Xgboost. In other scenarios, a decision tree model based on LightGBM may also be used.
[0170] Through the trained detection model, it is possible to determine whether the working status of the container is busy, normal, or idle.
[0171] Step 206: Calculate the busyness of the container group according to the total number of containers in the container group and the number of busy containers.
[0172]
[0173] Step 207: Determine the working state of the container group according to the busyness of the container group.
[0174] When the busyness of the container group is above 70%, the working state of the container group is busy; when the busyness of the container group is between 30% and 70%, the working state of the container group is normal; when the busyness of the container group is below 30%, the working state of the container group is idle.
[0175] Among them, the busy state indicates that support is needed and containers will be deployed from other groups to the busy container group; the normal state indicates that no scheduling is performed; the idle state indicates that some resources can be deployed to the busy container group.
[0176] Step 208: Calculate the allocation quota of the busy container group according to the number of busy containers in the busy container group.
[0177] The allocation quota of a busy container group = the number of busy containers in the busy container group × the busy coefficient; the busy coefficient can be dynamically configured according to business needs and is between 0 and 1.
[0178] Step 209: Calculate the allocation quota of the idle container group according to the number of idle containers in the idle container group.
[0179] The allocation quota of the idle container group = the number of idle containers in the idle container group × the idle coefficient; wherein the idle coefficient can be dynamically configured according to business needs and is between 0 and 1.
[0180] Table 4
[0181] Container Group Container quantity Busyness Working status Allocation quota A 100 75% busy 38 B 150 20% idle 40 C 80 86% busy 43 D 110 25% idle 36
[0182] The scheduling quota obtained in the embodiment of the present invention is shown in Table 4.
[0183] Step 210: Arrange each busy container group in descending order of busyness to obtain the priority of each busy container group.
[0184] The priorities of the busy container group are C and A.
[0185] Step 211: Arrange each idle container group in descending order according to the allocation quota to obtain the priority of each idle container group.
[0186] The priorities of the idle container group are B and D. Step 210 and step 211 may be performed in parallel, or step 211 may be performed first. Step 208 is similar to step 209 and will not be described in detail here.
[0187] Step 212: adjusting the containers in the busy container group and the idle container group according to the priority and allocation quota of each busy container group and the priority and allocation quota of each idle container group.
[0188] Prioritize the needs of C. The allocation quota of C is 43, and the allocation quota of B is 40. 40 containers are allocated from B to C, and 3 containers are allocated from D to C, so as to meet all the needs of C. 33 containers are allocated from D to A, so as to meet part of the needs of A. The grouping results before and after the adjustment are as follows: Figure 3 As shown, after adjustment, the number of containers in A, B, C, and D are 133, 110, 123, and 74, respectively.
[0189] Step 213: Send the grouping result to the configuration center, so that the service provider obtains the grouping result from the configuration center and schedules the container according to the grouping result.
[0190] The embodiment of the present invention analyzes the current data and reasonably allocates resources to make the traffic of each instance of the service provider as even as possible, reduce the possibility of service downtime due to grouping problems, and provide high availability of services. At the same time, the server resources are reasonably evaluated to avoid wasting server costs.
[0191] like Figure 4 As shown, an embodiment of the present invention provides a scheduler, including:
[0192] An acquisition module 401 is configured to acquire current data of a container in a sliding time window from a service provider;
[0193] The determination module 402 is configured to determine the working state of the container according to the current data of the container and the trained detection model; wherein the working state of the container is used to measure the busyness of the container;
[0194] The adjustment module 403 is configured to adjust the containers in the container group according to the working status of the container; and provide the grouping result to the service provider so that the service provider schedules the container according to the grouping result.
[0195] In one embodiment of the present invention, the determination module 402 is configured to obtain historical data of the container; perform statistics on the historical data of the container according to a specified period to obtain metadata; extract business features and hardware features from the metadata; generate training samples based on the business features and the hardware features; and train the detection model based on the training samples.
[0196] In one embodiment of the present invention, the business characteristics include: any one or more of the average number of item queries, the average query depth of requests, and the total number of requests; wherein the average query depth of requests is determined by the input parameter quantity and the input parameter type.
[0197] In one embodiment of the present invention, the hardware characteristics include: any one or more of the number of times the CPU utilization exceeds a first threshold, the number of times the memory utilization exceeds a second threshold, the number of times the disk utilization exceeds a third threshold, the number of times the network inflow rate exceeds a fourth threshold, and the number of times the load value exceeds a fifth threshold.
[0198] In one embodiment of the present invention, the adjustment module 403 is configured to determine the busyness of the container group according to the working state of the container; determine the working state of the container group according to the busyness of the container group; and adjust the containers in the container group according to the working state of the container group.
[0199] In one embodiment of the present invention, the working status of the container includes: busy, normal and idle; the adjustment module 403 is configured to calculate the busyness of the container group according to the total number of containers of the container group and the number of busy containers.
[0200] In one embodiment of the present invention, the working state of the container group includes: busy, normal and idle; the adjustment module 403 is configured to calculate the allocation quota of the busy container group according to the number of busy containers in the busy container group; calculate the allocation quota of the idle container group according to the number of idle containers in the idle container group; and adjust the containers in the busy container group and the idle container group according to the allocation quota of the busy container group and the allocation quota of the idle container group.
[0201] In one embodiment of the present invention, the adjustment module 403 is configured to calculate the sum of the allocation quotas of each of the idle container groups; calculate the number of containers allocated to each of the busy container groups according to the number of the busy container groups and the sum of the allocation quotas of each of the idle container groups; and allocate containers in each of the idle container groups to each of the busy container groups according to the number of containers allocated to each of the busy container groups.
[0202] In one embodiment of the present invention, the adjustment module 403 is configured to arrange the busy container groups in descending order according to the busyness to obtain the priority of each busy container group; arrange the idle container groups in descending order according to the allocation quota to obtain the priority of each idle container group; and adjust the containers in the busy container group and the idle container group according to the priority and allocation quota of each busy container group and the priority and allocation quota of each idle container group.
[0203] In one embodiment of the present invention, the current data includes: any one or more of request timestamp, container name, item query quantity, request query depth, millisecond request volume, CPU utilization, memory utilization, network inflow rate, disk utilization and load value; wherein the request query depth is determined by the input parameter quantity and input parameter type.
[0204] like Figure 5 As shown, an embodiment of the present invention provides a service cluster dynamic adjustment system, including: a service provider 501, a scheduler 502 and a configuration center 503.
[0205] like Figure 6 As shown, based on the above-mentioned service cluster dynamic adjustment system, an embodiment of the present invention provides a service cluster dynamic adjustment method, including:
[0206] Step 601: The scheduler obtains the current data of the container from the service provider.
[0207] The process of the scheduler determining the grouping result has been described in detail in the above embodiments and will not be repeated here.
[0208] Step 602: The scheduler determines the working state of the container according to the current data of the container; wherein the working state of the container is used to measure the busyness of the container.
[0209] Step 603: The scheduler adjusts the containers in the container group according to the working status of the containers.
[0210] Step 604: The scheduler sends the grouping result to the configuration center.
[0211] The scheduler converts the grouping results into JSON or XML format and pushes them to the configuration center. For example:
[0212]
[0213] The configuration center can be duc, tpconfig, dbconfig, etc.
[0214] Step 605: The service provider obtains the grouping result from the configuration center and modifies the currently published container grouping according to the grouping result.
[0215] For example, there are 200 containers in the online cluster, of which 50 containers carry large traffic and have high overall utilization, and are located in Group A; the other 150 containers have relatively smooth traffic and are located in Group B. Group A has an overall CPU utilization of 67% and a traffic of 30w / s; Group B has an overall CPU utilization of 20% and a traffic of 9w / s. After dynamic adjustment, 90 containers in Group B supported Group A by adjusting the grouping, and the overall CPU utilization of Group A and Group B reached 35%.
[0216] In an embodiment of the present invention, the service provider can collect the current data of the online container, the scheduler can adjust the container grouping according to the current data, and send the grouping result to the configuration center, and the service provider can dynamically adjust the service cluster according to the grouping result of the configuration center. The embodiment of the present invention can dynamically adjust the service cluster according to the current data of the container, balance the load of each container group, and avoid the container downtime due to excessive pressure.
[0217] An embodiment of the present invention provides an electronic device, characterized in that it includes:
[0218] one or more processors;
[0219] a storage device for storing one or more programs,
[0220] When the one or more programs are executed by the one or more processors, the one or more processors implement the method described in any of the above embodiments.
[0221] An embodiment of the present invention provides a computer-readable medium having a computer program stored thereon, wherein the program, when executed by a processor, implements the method described in any of the above embodiments.
[0222] Reference below Figure 7 , which shows a schematic diagram of the structure of a computer system 700 of a terminal device suitable for implementing an embodiment of the present invention. Figure 7 The terminal 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 invention.
[0223] like Figure 7As shown, the computer system 700 includes a central processing unit (CPU) 701, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 702 or a program loaded from a storage part 708 into a random access memory (RAM) 703. In the RAM 703, various programs and data required for the operation of the system 700 are also stored. The CPU 701, the ROM 702, and the RAM 703 are connected to each other via a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.
[0224] The following components are connected to the I / O interface 705: an input section 706 including a keyboard, a mouse, etc.; an output section 707 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 708 including a hard disk, etc.; and a communication section 709 including a network interface card such as a LAN card, a modem, etc. The communication section 709 performs communication processing via a network such as the Internet. A drive 710 is also connected to the I / O interface 705 as needed. A removable medium 711, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 710 as needed, so that a computer program read therefrom is installed into the storage section 708 as needed.
[0225] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 709, and / or installed from the removable medium 711. When the computer program is executed by the central processing unit (CPU) 701, the above-mentioned functions defined in the system of the present invention are executed.
[0226] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, 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 may 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 or 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 invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal 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 a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0227] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a 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 flow chart, and the combination of the boxes in the block diagram or flow chart 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.
[0228] The modules involved in the embodiments of the present invention may be implemented in software or hardware. The modules described may also be set in a processor. For example, they may be described as: a processor includes a sending module, an acquisition module, a determination module, and a first processing module. The names of these modules do not, in some cases, constitute limitations on the modules themselves. For example, the sending module may also be described as a "module for sending a picture acquisition request to the connected server."
[0229] As another aspect, the present invention further provides a computer-readable medium, which may be included in the device described in the above embodiment; or may exist independently without being assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the device includes:
[0230] Get the current data of the container;
[0231] Determine the working state of the container according to the current data of the container; wherein the working state of the container is used to measure the busyness of the container;
[0232] The containers in the container group are adjusted according to the working status of the container.
[0233] According to the technical solution of the embodiment of the present invention, the busyness of the container is determined according to the current data of the container, and the containers in each container group are adjusted based on the busyness. Since the busyness of the container is taken into consideration, the embodiment of the present invention can allocate the resources of the service cluster more reasonably, avoiding the situation where a container is overstressed and crashes.
[0234] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A container scheduling method, characterized in that: include: Get the current data of the container in the sliding time window from the service provider; Determine the working state of the container according to the current data of the container and the trained detection model; wherein the working state of the container is used to measure the busyness of the container; According to the working status of the container, adjusting the containers in the container group; specifically comprising: determining the busyness of the container group according to the working status of the container; determining the working status of the container group according to the busyness of the container group, the working status of the container group including: busy, normal and idle; calculating the allocation quota of the busy container group according to the number of busy containers in the busy container group; calculating the allocation quota of the idle container group according to the number of idle containers in the idle container group; arranging each of the busy container groups in order of busyness from high to low to obtain the priority of each of the busy container groups; arranging each of the idle container groups in order of allocation quota from high to low to obtain the priority of each of the idle container groups; adjusting the containers in the busy container group and the idle container group according to the priority and allocation quota of each of the busy container groups and the priority and allocation quota of each of the idle container groups; The grouping result is provided to a service provider, so that the service provider schedules the container according to the grouping result.
2. The method according to claim 1, characterized in that Further including: Obtaining historical data of the container; Collecting statistics on the historical data of the container according to a specified period to obtain metadata; extracting business features and hardware features from the metadata; Generate training samples according to the service characteristics and the hardware characteristics; The detection model is trained according to the training samples.
3. The method according to claim 2, characterized in that The business characteristics include: any one or more of the average number of item queries, the average query depth of requests, and the total number of requests; wherein the average query depth of requests is determined by the number of input parameters and the type of input parameters; and / or, The hardware features include: any one or more of the number of times the CPU utilization exceeds a first threshold, the number of times the memory utilization exceeds a second threshold, the number of times the disk utilization exceeds a third threshold, the number of times the network inflow rate exceeds a fourth threshold, and the number of times the load value exceeds a fifth threshold.
4. The method according to claim 1, characterized in that The determining the busyness of the container group according to the working state of the container further includes: The busyness of the container group is calculated according to the total number of containers of the container group and the number of busy containers.
5. The method according to claim 1, characterized in that The adjusting the containers in the busy container group and the idle container group according to the allocation quota of the busy container group and the allocation quota of the idle container group also includes: Calculating the sum of the allocation quotas of each of the idle container groups; Calculate the number of containers allocated to each of the busy container groups according to the number of the busy container groups and the sum of the allocation quotas of each of the idle container groups; According to the number of containers allocated to each of the busy container groups, containers in each of the idle container groups are allocated to each of the busy container groups.
6. The method according to any one of claims 1 to 5, characterized in that: The current data includes: any one or more of request timestamp, container name, item query quantity, request query depth, millisecond request quantity, CPU utilization, memory utilization, network inflow rate, disk utilization and load value; wherein the request query depth is determined by the input parameter quantity and input parameter type.
7. A scheduler, characterized in that: include: An acquisition module, configured to acquire current data of a container in a sliding time window from a service provider; A determination module, configured to determine the working state of the container according to the current data of the container and the trained detection model; wherein the working state of the container is used to measure the busyness of the container; The adjustment module is configured to adjust the containers in the container group according to the working status of the container; provide the grouping result to the service provider so that the service provider schedules the container according to the grouping result; specifically used to: determine the busyness of the container group according to the working status of the container; determine the working status of the container group according to the busyness of the container group, and the working status of the container group includes: busy, normal and idle; calculate the allocation quota of the busy container group according to the number of busy containers in the busy container group; calculate the allocation quota of the idle container group according to the number of idle containers in the idle container group; arrange each of the busy container groups in order from high to low busyness to obtain the priority of each of the busy container groups; arrange each of the idle container groups in order from high to low allocation quota to obtain the priority of each of the idle container groups; adjust the containers in the busy container group and the idle container group according to the priority and allocation quota of each busy container group and the priority and allocation quota of each idle container group.
8. An electronic device, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 6.
9. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Resource supply method oriented to Web application host platform
CN102130938A
Task scheduling method and device
CN105868222A
Docker cloud platform based dynamic-priority-queue-feedback load-balanced resource scheduling method
CN106790726A
Elastic resource scheduling method and system of streaming data processing system in container cloud environment
CN107193652A
Shunting method, shunting device, electronic equipment and readable storage medium
CN108667873A
