Container resource configuration methods, apparatus and electronic devices
Patent Information
- Application Number
- CN202310097312.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-07
- Publication Date
- 2026-09-01
- Estimated Expiration
- 2043-02-07
AI Technical Summary
[0004]目前的容器物理资源配置存在资源浪费的问题
[0021] According to a fifth aspect of this disclosure, a computer program product is provided, the computer program product comprising: a computer program stored in a readable storage medium, wherein at least one processor of an electronic device can read the computer program from the readable storage medium, and the at least one processor executes the computer program to cause the electronic device to perform the method described in the first aspect.
Smart Images

Figure CN116069506B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the fields of cloud computing and container deployment in the field of computer technology, and in particular to a container resource configuration method, apparatus and electronic device. Background Technology
[0002] Cloud-native is a software development methodology used to build, test, and deploy services in dynamic environments such as public, private, or hybrid clouds. Containerization is a key technology for implementing cloud-native architectures, allowing developers to build cloud-native services.
[0003] Containerization allows containers to have the same physical resource configuration. Deploying services using containers can improve deployment efficiency. The physical resource configuration of a container determines the physical resources of the host machine that the service within the container can use.
[0004] The current configuration of physical resources for containers suffers from resource waste. Summary of the Invention
[0005] This disclosure provides a container resource configuration method, apparatus, and electronic device.
[0006] According to a first aspect of this disclosure, a container resource configuration method is provided, the method comprising:
[0007] Obtain peak concurrent access information for the preset service;
[0008] Based on the peak concurrent access information, multiple test pressures are generated, and the container is subjected to gradient stress testing using these multiple test pressures.
[0009] Resource status information and service performance information of the container are collected at each test pressure during gradient pressure testing; the resource status information includes physical resource usage information.
[0010] In response to the detection that the gradient stress test meets the preset termination condition, the target physical resource configuration of the container that matches the concurrent access peak information is determined based on the resource status information and service performance information corresponding to each test stress.
[0011] According to a second aspect of this disclosure, a container resource configuration apparatus is provided, the apparatus comprising:
[0012] The acquisition unit is used to acquire peak concurrent access information for a preset service;
[0013] The testing unit is used to generate multiple test pressures based on the concurrent access peak information, and to perform gradient stress tests on the container using multiple test pressures.
[0014] The acquisition unit is used to acquire resource status information and service performance information of the container corresponding to each test pressure during gradient pressure testing of the container; the resource status information includes physical resource usage information.
[0015] The determining unit is configured to, in response to the detection that the gradient pressure test meets the preset termination condition, determine the target physical resource configuration of the container that matches the concurrent access peak information based on the resource status information and the service performance information corresponding to each test pressure.
[0016] According to a third aspect of this disclosure, an electronic device is provided, comprising:
[0017] At least one processor; and
[0018] A memory communicatively connected to the at least one processor; wherein,
[0019] The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method provided in the first aspect.
[0020] According to a fourth aspect of this disclosure, a non-transitory computer-readable storage medium is provided storing computer instructions, wherein the computer instructions are used to cause the computer to perform the method provided in the first aspect.
[0021] According to a fifth aspect of this disclosure, a computer program product is provided, the computer program product comprising: a computer program stored in a readable storage medium, wherein at least one processor of an electronic device can read the computer program from the readable storage medium, and the at least one processor executes the computer program to cause the electronic device to perform the method described in the first aspect.
[0022] According to the scheme disclosed herein, the concurrent access peak information of a preset service is obtained; multiple test pressures are generated based on the service peak information, and gradient stress tests are performed on the container using the multiple test pressures; resource status information and service performance information of the container corresponding to each test pressure are collected respectively when the container is subjected to gradient stress testing; the resource status information includes physical resource usage information; in response to detecting that the gradient stress test meets a preset termination condition, the target physical resource configuration of the container matching the concurrent access peak information is determined based on the resource status information and service performance information corresponding to each test pressure. This scheme can automatically generate multiple test pressures based on the service peak information of a preset service to perform gradient stress tests on the container, and determine the target physical resource configuration of the container matching the service peak information based on the resource status information and service performance information of the container corresponding to each test pressure. The resource configuration of the container obtained based on the above scheme can achieve optimization of service performance and resource consumption, reduce resource consumption while ensuring better service performance, improve the problem of container resource waste, and improve the overall resource utilization rate of multiple containers based on the above target physical resource configuration.
[0023] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this disclosure, nor is it intended to limit the scope of this disclosure. Other features of this disclosure will become readily apparent from the following description. Attached Figure Description
[0024] The accompanying drawings are provided to better understand this solution and do not constitute a limitation of this disclosure. Wherein:
[0025] Figure 1 This is a schematic diagram based on the first embodiment of the present disclosure;
[0026] Figure 2 yes Figure 1 The illustrated embodiment shows a schematic sub-step of performing a gradient pressure test on the container using a test pressure that matches the first proportion.
[0027] Figure 3 This is a schematic diagram according to the second embodiment of the present disclosure;
[0028] Figure 4 yes Figure 3 An illustrative sub-step of step 305 in the illustrated embodiment;
[0029] Figure 5 This is a schematic diagram according to the third embodiment of the present disclosure;
[0030] Figure 6 This is a schematic diagram according to the fourth embodiment of the present disclosure;
[0031] Figure 7This is a schematic diagram according to the fifth embodiment of the present disclosure;
[0032] Figure 8 This is a schematic block diagram of an example electronic device that can be used to implement embodiments of the present disclosure. Detailed Implementation
[0033] The exemplary embodiments of this disclosure are described below with reference to the accompanying drawings, including various details of the embodiments to aid understanding, and should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of this disclosure. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.
[0034] Containers provide a lightweight, immutable infrastructure for service packaging and deployment. By packaging services, configuration file libraries, and dependencies into container images, developers can deploy services across environments with minimal or no modifications. This ensures consistency in runtime environments for services deployed using containers across different settings.
[0035] Containerization allows for a unified container specification (physical resource configuration), effectively improving application deployment efficiency while maintaining isolation. Container specifications can include the consumption of physical resources such as CPU, memory, grid, and disk.
[0036] Both over- and under-configuration of container physical resources can lead to resource waste. Over-configuration results in wasted resources. Under-configuration causes container compression, impacting the quality of service provided. Furthermore, under-configuration leads to an excessive number of containers, resulting in overall resource waste.
[0037] When containerizing services, initial container specifications need to be set. Currently, these specifications are typically set manually. Specifically, offline testing can be conducted manually, followed by analysis of the test data to determine the container specifications. This manual testing and analysis process is cumbersome and costly. In practice, due to cost considerations, the testing granularity is often coarse, resulting in a mismatch between the physical resource configuration of the containers obtained after manual analysis and the actual required physical resource configuration, leading to low accuracy in container resource configuration. Furthermore, because of the low accuracy in configuring resources for individual containers, the total resource consumption of containers configured to meet service requirements is high, resulting in resource waste.
[0038] Furthermore, after service deployment, due to container performance degradation or changes in service access volume, it is necessary to dynamically adjust the physical resource configuration and number of containers based on their physical resource usage. Current technologies for adjusting containers either modify the physical resource configuration of a single container or adjust the number of containers. These adjustments, lacking support from the relationship between traffic, service performance, and container physical resource configuration, are prone to resource waste.
[0039] It is evident that the container-based services provided by these technologies suffer from resource waste.
[0040] This disclosure provides a container resource configuration method, apparatus, and electronic device, which are applied in fields such as cloud computing and container deployment in computer technology, in order to improve the problem of resource waste caused by the deployment of container-based services.
[0041] Please refer to Figure 1 , Figure 1 This is a schematic diagram of the first embodiment of the present disclosure, as shown below. Figure 1 As shown, the container resource configuration method provided in this embodiment includes:
[0042] S101. Obtain the peak concurrent access information of the preset service.
[0043] The default services mentioned here can include any service deployed in a containerized manner. These default services can be various services provided to users, such as cloud computing or query services. These default services can be applications or components of applications.
[0044] The execution entity in this embodiment can be a server, such as a server that can containerize and deploy preset services.
[0045] The peak concurrent access information here may include the number of simultaneous accesses to the aforementioned preset service.
[0046] In some embodiments, the aforementioned preset service may be a service initially deployed based on a container. The peak concurrent access information indicated here can be determined based on historical access data of the preset service. For example, the peak concurrent access can be determined based on historical access data corresponding to a preset service that is not deployed based on a container or a similar service. When deploying the aforementioned preset service based on a container, the peak concurrent access determined in the above manner can be used as the simulated peak concurrent access for the preset service to be deployed based on a container. In some application scenarios, the aforementioned peak concurrent access information can be determined and set manually. In these application scenarios, the format of the traffic data request used for stress testing can also be manually input so that the execution entity can generate stress test data corresponding to the format of the traffic data request. The format of the traffic data request here may include, for example, terminal type, Uniform Resource Locator (URL), etc.
[0047] In some embodiments, the aforementioned preset service may be a service already deployed on a cloud server based on containers, and these services run within containers. In these embodiments, access data over multiple traffic periods can be collected through data acquisition to determine the actual peak concurrent access of the container-deployed preset service. In these embodiments, the form of traffic data requests for stress testing can also be determined using the aforementioned access data, and stress test data corresponding to the form of the aforementioned traffic data requests can be generated.
[0048] S102. Generate multiple test pressures based on the peak information of concurrent access, and perform gradient stress tests on the container using multiple test pressures.
[0049] You can obtain the maximum number of concurrent accesses that a single container used to deploy the above-mentioned preset services can handle.
[0050] In some application scenarios, the above-mentioned generation of multiple test loads based on concurrent access peak information includes: in response to determining that the concurrent access peak indicated by the concurrent access peak information is less than the maximum number of concurrent accesses that a single container can handle, generating multiple test loads based on the concurrent access peak.
[0051] That is, when the maximum number of concurrent accesses is greater than the peak number of concurrent accesses, the pressure range can be determined based on the peak number of concurrent accesses, and multiple test pressures can be generated at preset intervals within the pressure range.
[0052] In these application scenarios, a first pressure range can be determined based on the peak concurrent service speeds, and multiple first test pressures can be determined within the first pressure range.
[0053] The lower limit R1 of the first pressure range here can be a preset low number of concurrent accesses (the preset low number of concurrent accesses, such as 0, 1, etc.), and the upper limit R2 can be the sum of the peak concurrent access P1 and the first preset margin ΔR1 (for example, P1+ΔR1).
[0054] The aforementioned first preset interval can be manually input or automatically set by the aforementioned execution entity.
[0055] For example, R1 can be 0 QPS, and the peak concurrent access can be 300 QPS. Therefore, ΔR1 can be 10 QPS, and R2 can be 310 QPS. The first pressure range is [0, 310] QPS, and the first preset interval can be 5 QPS. The execution entity can generate test pressures of 0, 5, 10, 15, ..., 310 QPS within the first pressure range according to the first preset interval. Here, QPS (Query Per Second) is a metric for measuring throughput.
[0056] In some application scenarios, the above-mentioned generation of multiple test loads based on peak concurrent access information includes: in response to determining that the peak concurrent access is greater than the maximum number of concurrent accesses, generating multiple test loads based on the maximum number of concurrent accesses.
[0057] That is, when the maximum number of concurrent accesses is less than the peak number of concurrent accesses, a second pressure range can be generated based on the maximum number of concurrent accesses, and multiple test pressures can be generated within the second pressure range at a second preset interval.
[0058] The lower limit R3 of the second pressure range here can be a preset low number of concurrent accesses (the preset low number of concurrent accesses, such as 0, 1, etc.), and the upper limit R4 can be the sum of the maximum number of concurrent accesses P2 and the second preset margin ΔR2 (for example, P2+ΔR2).
[0059] The aforementioned second preset interval can be manually input or automatically set by the aforementioned executing entity.
[0060] For example, R3 can be 0 QPS, the maximum concurrent access count can be 40, and the second preset interval can be 5 QPS. It can be determined that R4 can be 45 QPS, and the second stress interval is [0, 45] QPS. The various stress tests mentioned above can be 0, 5, 10, 15, ..., 45 QPS, etc.
[0061] In both application scenarios described above, gradient stress tests can be performed on the container used to deploy the preset service in ascending order of test pressure. During each stress test, the test pressure can be used to test the container for a preset duration, such as 10 seconds, 20 seconds, etc.
[0062] If only the peak concurrent access count is used to determine multiple test loads for container stress testing, the intervals between automatically generated test loads may be large when the peak is high (i.e., the test granularity is coarse). When performing gradient stress testing on containers, this coarse-grained testing may prevent finding the optimal container resource configuration, resulting in low accuracy in container resource configuration and wasting the overall resources of the multiple containers deployed to match the peak concurrent access count. Conversely, if only the maximum concurrent access count is used to determine multiple test loads, when the peak concurrent access count is lower than the maximum concurrent access count, the physical resource margin used by the containers deploying the service is large, resulting in resource waste.
[0063] When obtaining the peak concurrent access information of the preset service, the maximum number of concurrent accesses that a single container used to deploy the service can handle is also obtained, and it is determined whether the peak concurrent access information indicates that it is greater than the maximum number of concurrent accesses. If the peak concurrent access is greater than the maximum number of concurrent accesses, a second stress test interval is determined based on the maximum number of concurrent accesses. Within the second stress test interval, multiple test pressures are determined according to a second preset interval, and gradient stress tests are performed on the container based on these multiple test pressures. If the peak concurrent access is less than the maximum number of concurrent accesses, a first stress test interval is generated based on the peak concurrent access. Within the first stress test interval, multiple test pressures are generated according to a first preset interval, and gradient stress tests are performed on the container based on these multiple test pressures. Compared to the methods described above, which only use the peak concurrent access to set multiple test pressures or only use the maximum number of concurrent accesses to set multiple test pressures for gradient stress testing of containers, these gradient stress testing methods in application scenarios help to obtain more accurate physical resources of the container, thereby reducing the overall resource consumption of the container required to meet the peak concurrent access, and helping to reduce resource waste.
[0064] S103. Collect the resource status information and service performance information of the container corresponding to each test pressure when performing gradient pressure test on the container; the resource status information includes the usage information of physical resources.
[0065] The aforementioned execution entity can use the container to provide corresponding interfaces to automatically collect information on physical resource usage when stress testing the container using test pressure.
[0066] For each test stress, the container resource status information here may include information about the container's use of the host machine's physical resources when the container is tested using that test stress.
[0067] The physical resources here include at least one of the following: processor (e.g., central processing unit (CPU)), memory, network, and disk.
[0068] Specifically, the information regarding the container's use of the host machine's physical resources may include, for example, processor utilization, memory utilization, disk utilization, the amount of data sent and received through the network interface, and disk usage.
[0069] The service performance information here includes at least one of the following: service success rate, service latency, and service exception information.
[0070] Specifically, for each test load, the service success rate corresponding to that test load can be obtained as follows: the ratio of the number of responses to the preset service obtained during the duration of the test load to the total number of accesses sent to the container during that duration. The service latency corresponding to the test load includes the average latency determined based on the latency corresponding to each of the above responses.
[0071] S104. In response to the detection that the gradient pressure test meets the preset termination condition, based on the resource status information and service performance information corresponding to each test pressure, determine the target physical resource configuration of the container that matches the peak concurrent access information.
[0072] In some application scenarios, the above-mentioned preset termination conditions include: when the service success rate is lower than the preset success rate threshold during the gradient stress test of the container.
[0073] In these application scenarios, when the service success rate falls below the preset success rate threshold, it indicates that the single preset service instance deployed based on containers can no longer provide the corresponding services to users normally. At this point, subsequent gradient stress tests can be stopped.
[0074] In other application scenarios, the above-mentioned preset termination conditions include: all test stresses have been completed.
[0075] It should also be noted that if a service or container anomaly is encountered during gradient stress testing of a container, the gradient stress test must be stopped. After the service or container recovers, the gradient stress test should be re-executed starting from the minimum test pressure.
[0076] In this embodiment, peak concurrent access information of a preset service is obtained; multiple test pressures are generated based on the peak concurrent access information, and gradient stress tests are performed on the container using these test pressures; resource status information and service performance information of the container corresponding to each test pressure are collected during the gradient stress test; the resource status information includes physical resource usage information; in response to the detection that the gradient stress test meets a preset termination condition, the target physical resource configuration of the container matching the peak concurrent access information is determined based on the resource status information and service performance information corresponding to each test pressure. This solution can automatically generate multiple test pressures based on the peak service information of a preset service to perform gradient stress tests on the container, and determine the target physical resource configuration of the container matching the peak service information based on the resource status information and service performance information of the container corresponding to each test pressure. The resource configuration of the container obtained based on the above solution can achieve optimization of service performance and resource consumption, reducing resource waste while ensuring better service performance, and improving the overall resource utilization of multiple containers based on the above target physical resource configuration.
[0077] In some instances, step S102 above includes: performing a gradient stress test on the container using a test pressure that matches the first percentage of write access requests in the concurrent access peak information.
[0078] In some application environments, if the first percentage is 0, meaning that the peak concurrent access information only includes read access requests and no write access requests, then in these application scenarios, read access requests only involve the default service itself. Therefore, it is not necessary to build other environments. For each test load, a read test corresponding to that test load is generated based on the form of the read access request traffic data, and the above container is tested under that test load.
[0079] In other application environments, if the first proportion is small (e.g., greater than 0, less than or equal to a preset proportion threshold), write access requests can be ignored. For each test load, a read test corresponding to that test load can still be generated using the traffic data requests of the read access requests corresponding to that test load, and the above containers can be tested under that test load.
[0080] In other application scenarios, if the first request accounts for a large proportion and write access requests cannot be ignored, corresponding write tests need to be set up in the test stress test.
[0081] In these embodiments, when performing gradient stress tests on containers using multiple test pressures, the test pressure is matched with the first proportion of write access requests in the peak concurrent access information, thereby making the test results of the containers consistent with the actual scenario and helping to improve the accuracy of determining container resource configuration based on stress test results.
[0082] In some embodiments, such as Figure 2 As shown, the gradient pressure test performed on the container using a test pressure matching the first proportion includes the following illustrative sub-steps:
[0083] S1021. In response to the fact that the first proportion of write access requests included in the acquired concurrent access peak information is greater than a preset proportion threshold, multiple test pressures including write tests and read tests are generated, wherein the proportion of write tests in each test pressure is the first proportion.
[0084] S1022. Construct a simulation environment for receiving written data and establish an information exchange channel between the container and the simulation environment.
[0085] S1023. For the write test in each test stress, use the write test to access the preset service in the container, and instruct the preset service in the container to use the above information interaction channel to perform a write operation matching the write test to the simulation environment.
[0086] In these embodiments, the aforementioned peak concurrent access information can be the peak concurrent access information determined based on historical access data of preset services or similar services deployed in other non-containerized ways before the preset service is deployed based on containers.
[0087] In these embodiments, the peak concurrent access information may include write access requests and read access requests. The preset percentage threshold here can be 20%, 30%, etc., and the above preset percentage threshold can be set according to the specific application scenario, and is not limited here.
[0088] For read access requests, the read access may not involve other services. For write access requests, write access requests usually involve other services. In order to simulate the traffic data corresponding to the peak concurrent access during stress testing and avoid the situation where the container resource configuration cannot meet the real demand due to the discrepancy between gradient stress testing and real conditions, if the proportion of write access requests in the peak concurrent access is greater than a preset proportion threshold, it can be considered that the proportion of write access requests cannot be ignored. It is necessary to simulate the information interaction between this preset service and other services involved in the write access request to simulate a more realistic traffic generated by the write access request.
[0089] The aforementioned execution entity can construct the simulation environment on itself, on the host machine of the container deploying the pre-defined service, or on other electronic devices that have established a communication connection with the aforementioned host machine. This simulation environment may include other services involved in the write access request, as well as the environment required for the operation of other services.
[0090] In these embodiments, when a high percentage of write access requests are among the peak concurrent accesses, when performing gradient stress testing on the container, it is necessary to simulate a corresponding percentage of write test access requests and use a constructed simulation environment for handling write access requests to perform corresponding stress tests on the container. This ensures that the container resource configuration determined by the gradient stress test matches the real environment and improves the accuracy of the container resource configuration.
[0091] Please refer to Figure 3 , Figure 3 This is a schematic diagram of the second embodiment of the present disclosure, as shown below. Figure 3 As shown, the container resource configuration method provided in this embodiment includes:
[0092] S301. Obtain the peak concurrent access information of the preset service.
[0093] S302. Generate multiple test pressures based on the peak information of concurrent access, and perform gradient stress tests on the container using multiple test pressures.
[0094] S303. Collect the resource status information and service performance information of the container corresponding to each test pressure when performing gradient pressure test on the container; the resource status information includes the usage information of physical resources.
[0095] For specific implementation details of steps S301 to S303 above, please refer to [reference needed]. Figure 1 The description of the illustrated embodiments is omitted here.
[0096] S304. In response to detecting that the gradient pressure test meets the preset termination condition, determine multiple candidate test pressures from multiple test pressures whose corresponding service performance information meets the first preset condition.
[0097] S305. Determine the target resource configuration of the container based on the physical resource occupancy indicated by the resource status information corresponding to multiple candidate test pressures.
[0098] In this embodiment, a first preset condition can be set in advance. After the gradient stress test is completed, it can be determined from the service performance information corresponding to each test stress which service performance meets the above-mentioned first preset condition.
[0099] In some embodiments, the first preset condition includes at least one of the following: the success rate of the response obtained during the test stress test is greater than a preset success rate threshold; the average response latency corresponding to the test stress is less than or equal to a preset latency threshold.
[0100] In these embodiments, for each test stress, service performance information during the test stress period can be collected.
[0101] It should be noted that if a service anomaly occurs during gradient stress testing, the gradient stress test can be restarted from the minimum test load after the service is restored. Such service anomalies can include service restarts, communication failures, etc.
[0102] The preset success rate thresholds mentioned above can be, for example, 95% or 98%. These thresholds can be set according to the specific application scenario. In some application scenarios, the preset success rate thresholds can be set manually.
[0103] For any given test load, the success rate of receiving a response to that test load can be defined as the ratio between the number of responses received from the container deploying the predefined service and the number of access requests sent to that container corresponding to that test load. Illustratively, if N access requests are sent to the container and M responses are received, then the success rate of the container providing the service is M / N.
[0104] For any given test load, when testing the aforementioned container using that test load, multiple responses can be obtained. For any access request within that test load, the response latency (T2-T1) can be determined based on the time T1 when the access request was sent and the time T2 when the corresponding response from the container was received. Then, the average response latency for that test load is determined based on the response latencies of the multiple access requests corresponding to that test load.
[0105] In some application scenarios, the aforementioned preset delay threshold can be the preset duration of stress testing for that test pressure.
[0106] It should be understood that the above first preset condition can be selected and used according to the specific application scenario.
[0107] In these embodiments, using the first preset condition described above can enable the container-based pre-deployed service to meet the user's service performance requirements.
[0108] For a test stress that meets the first preset condition, that test stress is considered a candidate test stress. In this way, multiple candidate test stresses can be identified.
[0109] For multiple candidate test loads, the physical resource usage of each candidate test load is determined based on its resource status information. Then, the target resource configuration of the container is determined based on the physical resource usage of each test load.
[0110] The target resource allocation here includes processor usage, memory usage, network usage, and / or disk usage.
[0111] In this embodiment, the target physical resource configuration is determined based on the resource status information corresponding to each candidate test pressure that meets the first preset condition. This ensures that when the preset service running in the container with the target physical resource configuration provides services to the user, the service performance can meet the user's needs.
[0112] In some embodiments, such as Figure 4 As shown, step S305 above includes the following sub-steps:
[0113] S3051. Determine the target candidate test pressure with the minimum preset physical resource consumption from multiple candidate test pressures based on resource status information; wherein, the preset physical resources include: processor or memory.
[0114] S3052. Determine the target physical resource configuration based on the physical resource usage corresponding to the target candidate test pressure.
[0115] The default physical resources here include processors or memory.
[0116] In some application scenarios, the aforementioned preset physical resources may include the processor. That is, in these application scenarios, minimizing the physical resource usage of the processor is the priority.
[0117] In these application scenarios, processor utilization information, such as processor utilization rate, can be determined from the resource status information corresponding to multiple candidate test pressures. The candidate test pressure with the lowest processor utilization rate is then selected as the target candidate test pressure.
[0118] The target physical resource configuration can be determined based on the physical resource usage of each hardware component corresponding to the target candidate test pressure.
[0119] For example, if the host machine has k1 processors and the processor utilization rate corresponding to the target candidate test pressure is 30%, it can be determined that the processors in the target physical resource configuration are 30% × k1 processors.
[0120] If the host machine has 2kGB of memory and the target candidate stress test corresponds to 30% memory usage, it can be determined that the memory in the target physical resource configuration is 30% × 2kGB.
[0121] In addition, the target network I / O bandwidth and target disk size of the container can be determined based on information such as the network I / O data volume and disk usage corresponding to the target candidate stress test.
[0122] It should be noted that the hardware resources in the above target physical resource configuration represent the maximum physical resource limit that the container can use.
[0123] In these application scenarios, by prioritizing the minimization of processor usage to determine the target physical resource configuration of the container, the container-deployed service can ensure that processor resource usage is low when there are peak concurrent accesses in the actual use scenario.
[0124] In some application scenarios, the aforementioned preset physical resources may include the processor. That is, in these application scenarios, minimizing the physical resource usage of the processor is the priority.
[0125] In some application scenarios, the aforementioned preset physical resources may include memory. That is, in these application scenarios, minimizing the physical resource usage of memory is the priority.
[0126] In these application scenarios, memory usage information, such as memory utilization rate, can be determined from the resource status information corresponding to multiple candidate test pressures. The candidate test pressure with the lowest memory usage is then selected as the target candidate test pressure.
[0127] The target physical resource configuration can be determined based on the physical resource usage of each hardware component corresponding to the target candidate test pressure.
[0128] In these application scenarios, by prioritizing the minimization of memory usage to determine the target physical resource configuration of the container, the container-deployed service can ensure that memory resource usage is low when there are peak concurrent accesses in the actual use scenario.
[0129] In some embodiments, the preset latency threshold in the first preset condition includes a first preset latency threshold corresponding to a throughput-sensitive service; or a second preset latency threshold corresponding to a latency-sensitive service; wherein the first preset latency threshold is greater than the second preset latency threshold.
[0130] As an illustrative example, the first preset latency threshold could be, for example, 15 seconds, and the second preset latency threshold could be 10 seconds. In other words, the second preset latency threshold requires a smaller average response latency.
[0131] In addition, the default services can be further divided into throughput-sensitive services and latency-sensitive services.
[0132] For throughput-sensitive services, the highest throughput can be pursued with a more lenient latency baseline.
[0133] For latency-sensitive services, the optimal goal is to achieve the strictest latency requirements.
[0134] In these embodiments, by setting different types of preset delay thresholds, the above scheme can be adapted to application scenarios with different requirements.
[0135] In some application scenarios, the preset latency threshold in the first preset condition mentioned above can be the first preset latency threshold corresponding to throughput-sensitive services.
[0136] In these application scenarios, the test pressure that meets the first preset condition can be identified as the candidate test pressure, and then the target physical resource configuration of the container can be determined according to the sub-steps S3051 and S3052.
[0137] In one example, the preset physical resource in sub-step S3051 is a processor. In this example, the target candidate test pressure with the lowest processor usage is determined from multiple candidate test pressures, and the target physical resource configuration is determined based on the physical resource usage corresponding to the target candidate test pressure.
[0138] In this example, multiple containers are deployed based on the target physical resource configuration described above, providing services with superior performance while consuming minimal processor resources and achieving high data throughput.
[0139] In one example, the preset physical resource in sub-step S3051 is memory. In this example, the target candidate test pressure with the lowest memory usage is determined from multiple candidate test pressures, and the target physical resource configuration is determined based on the physical resource usage corresponding to the target candidate test pressure.
[0140] In this example, multiple containers are deployed based on the target physical resource configuration described above, providing services with superior performance while consuming minimal memory resources and achieving high data throughput.
[0141] In some application scenarios, the preset latency threshold in the first preset condition can be a second preset latency threshold corresponding to a latency-sensitive service.
[0142] In these application scenarios, the test pressure that meets the first preset condition can be identified as the candidate test pressure, and then the target physical resource configuration of the container can be determined according to the sub-steps S3051 and S3052.
[0143] In one example, the preset physical resource in sub-step S3051 is a processor. In this example, the target candidate test pressure with the lowest processor usage is determined from multiple candidate test pressures, and the target physical resource configuration is determined based on the physical resource usage corresponding to the target candidate test pressure.
[0144] In this example, deploying multiple containers based on the target physical resource configuration described above can provide a large data throughput while consuming relatively small amounts of processor resources and providing optimal latency.
[0145] In one example, the preset physical resource in sub-step S3051 is memory. In this example, the target candidate test pressure with the lowest memory usage is determined from multiple candidate test pressures, and the target physical resource configuration is determined based on the physical resource usage corresponding to the target candidate test pressure.
[0146] In this example, deploying multiple containers based on the target physical resource configuration described above can provide a large data throughput while consuming relatively little memory resources and providing optimal latency.
[0147] exist Figure 1 or Figure 3 In some embodiments of the provided container resource configuration method, the container resource configuration method further includes the following steps:
[0148] First, generate multiple containers that match the peak concurrent access information, where each container has a target physical resource configuration.
[0149] Secondly, deploy pre-defined services in each container.
[0150] In these embodiments, the aforementioned preset service may be a service that is being deployed for the first time using a container.
[0151] exist Figure 1 Step S104 of the illustrated embodiment or Figure 3 After determining the target resource configuration of the container in step S305 of the illustrated embodiment, the number of containers can be determined based on the target candidate test pressure corresponding to the target resource configuration and the concurrent access peak indicated by the concurrent access peak information.
[0152] As an illustration, if the peak concurrent access is P3 and the target candidate test pressure is P4, the number of containers can be the value obtained by rounding up P3 / P4.
[0153] In these embodiments, the entity executing the container resource configuration method can deploy the aforementioned number of containers on at least one host machine, and copy the application and runtime environment corresponding to the preset service into the aforementioned number of containers, thereby generating multiple instances of the preset service.
[0154] In these embodiments, using the aforementioned target resource configuration to set up multiple containers for deploying preset services can reduce the overall physical resources used by the containers while providing better performance. This reduces resource waste.
[0155] Please refer to Figure 5 , Figure 5 This is a schematic diagram of the third embodiment of the present disclosure, as shown below. Figure 5 As shown, the container resource configuration method provided in this embodiment includes:
[0156] S501. Obtain the peak concurrent access information of the preset service.
[0157] S502. Generate multiple test pressures based on the peak information of concurrent access, and perform gradient stress tests on the container using multiple test pressures.
[0158] S503. Collect resource status information and service performance information of the container corresponding to each test pressure during gradient pressure testing; the resource status information includes the usage information of physical resources.
[0159] S504. In response to the detection that the gradient pressure test meets the preset termination condition, the target physical resource configuration of the container that matches the concurrent access peak information is determined based on the resource status information and service performance information corresponding to each test pressure.
[0160] In this embodiment, the preset service is a historical container-based deployment service. The specific implementation of steps S501 to S504 can be found in [reference needed]. Figure 1 The description of the illustrated embodiments is omitted here.
[0161] S505. Based on the peak concurrent access information and the target physical resource configuration, adjust the historical physical resource configuration and / or the number of containers.
[0162] For pre-defined services deployed historically based on containers, the physical resource configuration of the containers deploying the pre-defined services can be adjusted according to the target physical resource configuration determined in steps S501 to S504 above. For example, the historical physical resources of containers that have deployed pre-defined services can be increased or decreased.
[0163] In some application scenarios, when containers degrade or the peak concurrent access to pre-defined services increases, it is necessary to increase the physical resources of the aforementioned containers.
[0164] In some application scenarios, the historical physical resource configuration of a container is relatively large compared to the target physical resource configuration determined based on the above steps S501 to S504, which can reduce the physical resources of the container.
[0165] In these application scenarios, if the number of containers determined based on the peak concurrency access information matches the number of containers deployed in the past, the number of containers does not need to be adjusted; only the historical physical resources of the containers need to be adjusted.
[0166] In other application scenarios, the target physical resources determined in steps S501-S504 match the historical physical resources, but the preset services based on the historical container deployment cannot meet the peak concurrent access requirements, necessitating an increase in the number of containers. In these scenarios, the target number of containers can be determined based on the peak concurrent access and the test pressure corresponding to the target physical resources. Containers with the target resource configuration are then generated until the total number of containers matches the target number. The aforementioned preset services are then deployed in these newly generated containers.
[0167] In some embodiments, step S505 above includes the following sub-steps:
[0168] First, based on the peak concurrent access information and the test pressure corresponding to the target physical resource configuration, determine the target number of containers used to deploy the preset services.
[0169] Secondly, in response to the mismatch between the historical physical resource configuration and the target physical resource configuration of the container, and the mismatch between the target number and the historical number of containers, the order of adjusting the historical physical resource configuration and the number of containers is determined according to the rule of increasing first and then decreasing.
[0170] Finally, the physical resources of the containers are adjusted sequentially to match the target physical resources, and the number of containers is adjusted to match the target number.
[0171] In these embodiments, the physical resource configuration of the container does not match the target physical resource configuration, and the target number of containers does not match the historical number. It is necessary to determine whether to adjust the physical resources of the container first or adjust the number of containers first.
[0172] The increase here refers to an increase in the number of containers, or an increase in container resources.
[0173] The reduction here refers to a reduction in the number of containers, or a reduction in container resources.
[0174] The above-mentioned "increase then decrease" means that if the physical resources of a single container need to be increased while the total number of containers needs to be decreased, then the physical resources of each container are first increased to match the target physical resources, and then the number of containers is decreased to the target number. If the total number of containers needs to be increased while the physical resources of a single container need to be decreased, then the number of containers is first increased to bring the total number of containers to the target number, and then the physical resources of each container are decreased to the target physical resources.
[0175] After determining that the historical and target physical resource configurations of containers do not match, and that the target and historical quantities of containers do not match, we determine whether the physical resources of a single container should be increased or decreased, and whether the total number of containers should be increased or decreased. Then, we determine the order of adjustment of physical resources and container quantities according to the rule of increasing first and then decreasing.
[0176] For example, if it is determined that physical resources need to be increased and the total number of containers needs to be reduced, the above order is: first increase the physical resources of individual containers, and then adjust the total number of containers.
[0177] For example, if it is determined that physical resources need to be reduced and the total number of containers needs to be increased, then the above order is: first increase the number of containers, then reduce the physical resources of the containers.
[0178] In some application scenarios, if it is necessary to increase the number of containers and increase the physical resources of containers at the same time, one can be added first, and then the other can be added.
[0179] In these embodiments, the physical resources of the containers and the number of containers are adjusted according to the adjustment order determined by the above-mentioned rule of increasing first and then decreasing, so that the corresponding services can still be provided to the users during the above adjustment process.
[0180] In this embodiment, if it is necessary to adjust the container resources or the number of containers for a previously container-based pre-defined service, adjusting the number of containers and / or container resources can ensure that the adjusted number of containers and / or container physical resources can meet the peak demand for concurrent access while minimizing the total resource consumption.
[0181] Figure 6 This is a schematic diagram based on the fourth embodiment of the present disclosure, as shown below. Figure 6 As shown, the container resource configuration device 600 provided in this embodiment includes: an acquisition unit 601, a testing unit 602, a collection unit 603, and a determination unit 604. Wherein:
[0182] The acquisition unit 601 is used to acquire the peak concurrent access information of the preset service;
[0183] Test unit 602 is used to generate multiple test pressures based on the peak information of concurrent access, and to perform gradient stress tests on the container using multiple test pressures;
[0184] The acquisition unit 603 is used to acquire resource status information and service performance information of the container corresponding to each test pressure during gradient pressure testing of the container; the resource status information includes the usage information of physical resources.
[0185] The determination unit 604 is used to determine the target physical resource configuration of the container that matches the concurrent access peak information in response to the detection that the gradient pressure test meets the preset termination condition, based on the resource status information and service performance information corresponding to each test pressure.
[0186] In some embodiments, the test unit 602 further includes a first test pressure determination module 6021 and a second test pressure determination module 6022, wherein,
[0187] The first test pressure determination module 6021 is used for:
[0188] In response to the determination that the peak concurrent access information indicates that the peak concurrent access is less than the maximum number of concurrent accesses that a single container can handle, multiple test stresses are generated based on the peak concurrent access.
[0189] The second test pressure determination module 6022 is used for:
[0190] In response to the determination that the peak concurrent access exceeds the maximum concurrent access count, multiple test loads are generated based on the maximum concurrent access count.
[0191] In some embodiments, the physical source usage information includes at least one of the following: processor, memory, network, and disk usage information;
[0192] Service performance information includes at least one of the following: service success rate, service latency, and service anomaly information.
[0193] In some embodiments, the test unit 602 further includes a third test pressure determination module 6023, which is used for:
[0194] Based on the first proportion of write access requests in the peak concurrent access information, perform gradient stress testing on the container using test pressure that matches the first proportion.
[0195] In some embodiments, the third test pressure determination module 6023 is further configured to:
[0196] In response to the first proportion being greater than a preset proportion threshold, multiple test loads including write tests and read tests are generated, wherein the proportion of write tests in each test load matches the first proportion;
[0197] Construct a simulation environment for receiving written data and establish an information exchange channel between the container and the simulation environment;
[0198] For the write test in each test stress, the write test accesses the preset service in the container and instructs the preset service in the container to perform write operations to the simulation environment through the information interaction channel.
[0199] In some embodiments, the determining unit 604 includes a candidate test stress determining module 6041 and a resource configuration determining module 6042, wherein...
[0200] The candidate test stress determination module 6041 is used to: determine multiple candidate test stresses from multiple test stresses whose corresponding service performance information meets the first preset condition;
[0201] The resource configuration determination module 6042 is used to determine the target resource configuration of the container based on the physical resource occupancy indicated by the resource status information corresponding to multiple candidate test pressures.
[0202] In some embodiments, the first preset condition includes at least one of the following:
[0203] The success rate of obtaining a response under test pressure is greater than the preset success rate threshold;
[0204] The average response time corresponding to the test pressure is less than or equal to the preset delay threshold.
[0205] In some embodiments, the resource configuration determination module is further configured to:
[0206] The target candidate test stress with the minimum preset physical resource consumption is determined from multiple candidate test stresses based on resource status information; the preset physical resources include: processor or memory;
[0207] The target physical resource configuration is determined based on the physical resource usage corresponding to the target candidate test pressure.
[0208] In some embodiments, the preset latency threshold includes: a first preset latency threshold corresponding to a throughput-sensitive service; or
[0209] A second preset latency threshold corresponding to a latency-sensitive service, wherein the first preset latency threshold is greater than the second preset latency threshold.
[0210] In some embodiments, the apparatus 600 further includes a container deployment unit 605, the container deployment unit 605 being configured to:
[0211] Generate multiple containers that match the peak concurrency access information, where each container has a target physical resource configuration;
[0212] Deploy pre-defined services in each container.
[0213] In some embodiments, the preset service is a service that has been deployed based on container history, and the apparatus further includes a container adjustment unit 606, which is configured to:
[0214] Based on peak concurrent access information and target physical resource configuration, adjust the historical physical resource configuration and / or number of containers.
[0215] In some embodiments, the container adjustment unit 606 further includes: a quantity determination module 6061, a sequence determination module 6062, and an adjustment module 6063. Wherein:
[0216] The quantity determination module 6061 is used to determine the target number of containers for deploying services based on the test pressure corresponding to the peak concurrent access information and the target physical resource configuration.
[0217] The sequence determination module 6062 is used to determine the order of adjusting the historical physical resource configuration of the container and adjusting the number of containers in response to the mismatch between the historical physical resource configuration and the target physical resource configuration of the container, and the mismatch between the target number and the historical number of containers, according to the rule of first increasing and then decreasing.
[0218] The adjustment module 6063 is used to adjust the physical resources of the containers sequentially to match the target physical resources, and to adjust the number of containers to match the target number.
[0219] Figure 7 This is a schematic diagram based on the fifth embodiment of the present disclosure, as shown below. Figure 7 As shown, the electronic device 700 in this embodiment may include a processor 701 and a memory 702.
[0220] Memory 702 is used to store programs. Memory 702 may include volatile memory, such as random-access memory (RAM), such as static random-access memory (SRAM), double data rate synchronous dynamic random-access memory (DDR SDRAM), etc.; memory may also include non-volatile memory, such as flash memory. Memory 702 is used to store computer programs (such as application programs, functional modules, etc. that implement the above methods), computer instructions, etc. The computer programs, computer instructions, etc., can be partitioned and stored in one or more memories 702. Furthermore, the computer programs, computer instructions, data, etc., can be accessed by processor 701.
[0221] The aforementioned computer programs and instructions can be stored in one or more partitions of memory 702. Furthermore, the aforementioned computer programs and instructions can be invoked by processor 701.
[0222] The processor 701 is configured to execute the computer program stored in the memory 702 to implement the various steps in the methods described in the above embodiments.
[0223] For details, please refer to the relevant descriptions in the preceding method embodiments.
[0224] The processor 701 and the memory 702 can be independent structures or integrated structures. When the processor 701 and the memory 702 are independent structures, the memory 702 and the processor 701 can be coupled together via bus 703.
[0225] The electronic device in this embodiment can execute the technical solution in the above method. Its specific implementation process and technical principle are the same, and will not be repeated here.
[0226] According to embodiments of this disclosure, this disclosure also provides an electronic device, a readable storage medium, and a computer program product.
[0227] According to embodiments of this disclosure, this disclosure also provides a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to cause a computer to execute the scheme provided in any of the above embodiments.
[0228] According to embodiments of this disclosure, this disclosure also provides a computer program product comprising: a computer program stored in a readable storage medium, at least one processor of an electronic device being able to read the computer program from the readable storage medium, and the at least one processor executing the computer program causing the electronic device to perform the scheme provided in any of the above embodiments.
[0229] Figure 8 A schematic block diagram of an example electronic device that can be used to implement embodiments of the present disclosure is shown. The electronic device 800 can be a terminal device or a server. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present disclosure described and / or claimed herein.
[0230] like Figure 8As shown, device 800 includes a computing unit 801, which can perform various appropriate actions and processes based on a computer program stored in read-only memory (ROM) 802 or a computer program loaded from storage unit 808 into random access memory (RAM) 803. RAM 803 may also store various programs and data required for the operation of device 800. The computing unit 801, ROM 802, and RAM 803 are interconnected via bus 804. Input / output (I / O) interface 805 is also connected to bus 804.
[0231] Multiple components in device 800 are connected to I / O interface 805, including: input unit 806, such as keyboard, mouse, etc.; output unit 807, such as various types of monitors, speakers, etc.; storage unit 808, such as disk, optical disk, etc.; and communication unit 809, such as network card, modem, wireless transceiver, etc. Communication unit 809 allows device 800 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0232] The computing unit 801 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 801 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 801 performs the various methods and processes described above, such as the electronic medical record generation operation processing. For example, in some embodiments, the electronic medical record generation operation processing may be implemented as a computer software program tangibly contained in a machine-readable medium, such as storage unit 808. In some embodiments, part or all of the computer program may be loaded and / or installed on device 800 via ROM 802 and / or communication unit 809. When the computer program is loaded into RAM 803 and executed by the computing unit 801, one or more steps of the electronic medical record generation operation processing described above may be performed. Alternatively, in other embodiments, the computing unit 801 may be configured to perform electronic medical record generation operations by any other suitable means (e.g., by means of firmware).
[0233] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0234] The program code used to implement the methods of this disclosure may be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing apparatus, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0235] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0236] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0237] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as a data server), or computing systems that include middleware components (e.g., an application server), or computing systems that include frontend components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with embodiments of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., a communication network). Examples of communication networks include local area networks (LANs), wide area networks (WANs), and the Internet.
[0238] Computer systems can include clients and servers. Clients and servers are generally geographically separated and typically interact via communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. A server can be a cloud server, also known as a cloud computing server or cloud host, a hosting product within the cloud computing service ecosystem, addressing the shortcomings of traditional physical hosts and VPS (Virtual Private Server, or simply "VPS") services, such as high management difficulty and weak business scalability. Servers can also be servers for distributed systems or servers incorporating blockchain technology.
[0239] It should be understood that the various forms of processes shown above can be used to reorder, add, or delete steps. For example, the steps described in this disclosure can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution disclosed in this disclosure can be achieved, and this is not limited herein.
[0240] The specific embodiments described above do not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure should be included within the scope of protection of this disclosure.
Claims
1. A container resource configuration method, comprising: Obtain peak concurrent access information for the preset service and the maximum number of concurrent accesses that a single container used to deploy the service can handle; Determine whether the peak concurrent access indicated by the concurrent access peak information is greater than the maximum number of concurrent accesses; When the peak concurrent access is less than the maximum concurrent access, multiple test pressures are generated based on the peak concurrent access. The multiple test pressures are generated based on a first pressure range, where the lower limit of the first pressure range is a preset low concurrent access number and the upper limit is the sum of the peak concurrent access and a first preset margin. Alternatively, when the peak concurrent access count exceeds the maximum concurrent access count, multiple test pressures are generated based on the maximum concurrent access count. These multiple test pressures are generated based on a second pressure range, where the lower limit of the second pressure range is a preset low concurrent access count, and the upper limit is the sum of the maximum concurrent access count and a second preset margin. The container was subjected to gradient pressure testing using multiple test pressures; Resource status information and service performance information of the container are collected at each test pressure during gradient pressure testing; the resource status information includes physical resource usage information. In response to the detection that the gradient stress test meets the preset termination condition, the target physical resource configuration of the container that matches the peak concurrent access information is determined based on the resource status information and the service performance information corresponding to each test pressure. The preset termination condition is that the service success rate is lower than the preset success rate threshold when the gradient stress test is performed on the container. The gradient pressure test performed on the container using multiple test pressures includes: Based on the first proportion of write access requests in the peak concurrent access information, a gradient stress test is performed on the container using test pressure matching the first proportion.
2. The method according to claim 1, characterized in that, The physical resource usage information includes at least one of the following: processor, memory, network, and disk usage information; The service performance information includes at least one of the following: service success rate, service latency, and service anomaly information.
3. The method according to claim 1, characterized in that, The step of performing gradient stress testing on the container using test pressure matching the first proportion of write access requests in the peak concurrent access information includes: In response to the first proportion being greater than a preset proportion threshold, multiple test pressures including write tests and read tests are generated, wherein the proportion of write tests in each test pressure matches the first proportion; Construct a simulation environment for receiving written data, and establish an information interaction channel between the container and the simulation environment; For the write test in each test stress, the write test is used to access the preset service in the container, and the preset service in the container is instructed to perform a write operation to the simulation environment using the information interaction channel.
4. The method according to claim 1, characterized in that, The step of determining the target physical resource configuration of the container that matches the peak concurrent access information based on the resource status information and service performance information corresponding to each test pressure includes: From the plurality of test pressures, determine a plurality of candidate test pressures whose corresponding service performance information meets the first preset condition; The target resource configuration of the container is determined based on the physical resource occupancy indicated by the resource status information corresponding to multiple candidate test pressures.
5. The method according to claim 4, characterized in that, The first preset condition includes at least one of the following: The success rate of obtaining a response under test pressure is greater than the preset success rate threshold; The average response time corresponding to the test pressure is less than or equal to the preset delay threshold.
6. The method according to claim 5, characterized in that, The determination of the target resource configuration of the container based on the physical resource occupancy indicated by the resource status information corresponding to multiple candidate test pressures includes: Based on the resource status information, a target candidate test pressure with the minimum preset physical resource consumption is determined from multiple candidate test pressures; wherein, the preset physical resources include: processor or memory; The target physical resource configuration is determined based on the physical resource usage corresponding to the target candidate test pressure.
7. The method according to claim 6, characterized in that, The preset delay threshold includes: The first preset latency threshold corresponding to throughput-sensitive services; or A second preset latency threshold corresponding to a latency-sensitive service, wherein the first preset latency threshold is greater than the second preset latency threshold.
8. The method according to any one of claims 1 to 7, characterized in that, The method further includes: Generate multiple containers that match the peak concurrency access information, wherein each container has the target physical resource configuration; Deploy the preset service in each container.
9. The method according to any one of claims 1 to 7, characterized in that, The preset service is a historical container-based service, and the method further includes: Based on the peak concurrent access information and the target physical resource configuration, the historical physical resource configuration and / or the number of containers are adjusted.
10. The method according to claim 9, characterized in that, The step of adjusting the historical physical resource configuration and / or the number of containers corresponding to the containers based on the peak concurrent access information and the target physical resource configuration includes: Based on the peak concurrent access information and the test pressure corresponding to the target physical resource configuration, determine the target number of containers used to deploy the service; In response to a mismatch between the historical physical resource configuration and the target physical resource configuration of the container, and between the target quantity and the historical quantity of the container, the order of adjusting the historical physical resource configuration and adjusting the quantity of the container is determined according to the rule of first increasing and then decreasing. Based on the stated order, the physical resources of the containers are adjusted sequentially to match the target physical resources, and the number of containers is adjusted to match the target number.
11. A container resource allocation device, comprising: The acquisition unit is used to acquire the peak concurrent access information of the preset service and the maximum number of concurrent accesses that a single container used to deploy the service can handle; The testing unit is used to determine whether the peak concurrent access indicated by the concurrent access peak information is greater than the maximum number of concurrent accesses; When the peak concurrent access is less than the maximum concurrent access, multiple test pressures are generated based on the peak concurrent access. The multiple test pressures are generated based on a first pressure range, where the lower limit of the first pressure range is a preset low concurrent access number and the upper limit is the sum of the peak concurrent access and a first preset margin. Alternatively, when the peak concurrent access count exceeds the maximum concurrent access count, multiple test pressures are generated based on the maximum concurrent access count. These multiple test pressures are generated based on a second pressure range, where the lower limit of the second pressure range is a preset low concurrent access count, and the upper limit is the sum of the maximum concurrent access count and a second preset margin. The container was subjected to gradient pressure testing using multiple test pressures; The acquisition unit is used to acquire resource status information and service performance information of the container corresponding to each test pressure during gradient pressure testing of the container; the resource status information includes physical resource usage information. The determining unit is configured to, in response to the detection that the gradient stress test meets the preset termination condition, determine the target physical resource configuration of the container that matches the concurrent access peak information based on the resource status information and the service performance information corresponding to each test pressure. The preset termination condition is that when the gradient stress test is performed on the container, the service success rate is lower than the preset success rate threshold. The testing unit further includes a third test pressure determination module, which is used for: Based on the first proportion of write access requests in the peak concurrent access information, a gradient stress test is performed on the container using test pressure matching the first proportion.
12. The apparatus according to claim 11, characterized in that, The physical resource usage information includes at least one of the following: processor, memory, network, and disk usage information; The service performance information includes at least one of the following: service success rate, service latency, and service anomaly information.
13. The apparatus according to claim 11, characterized in that, The third test pressure determination module is also used for: In response to the first proportion being greater than a preset proportion threshold, multiple test pressures including write tests and read tests are generated, wherein the proportion of write tests in each test pressure matches the first proportion; Construct a simulation environment for receiving written data, and establish an information interaction channel between the container and the simulation environment; For the write test in each test stress, the write test is used to access the preset service in the container, and the preset service in the container is instructed to perform a write operation to the simulation environment using the information interaction channel.
14. The apparatus according to claim 11, characterized in that, The determining unit includes a candidate test stress determining module and a resource allocation determining module, wherein, The candidate test pressure determination module is used to: determine from the plurality of test pressures a plurality of candidate test pressures whose corresponding service performance information satisfies a first preset condition; The resource configuration determination module is used to determine the target resource configuration of the container based on the physical resource occupancy indicated by the resource status information corresponding to multiple candidate test pressures.
15. The apparatus according to claim 14, characterized in that, The first preset condition includes at least one of the following: The success rate of obtaining a response under test pressure is greater than the preset success rate threshold; The average response time corresponding to the test pressure is less than or equal to the preset delay threshold.
16. The apparatus according to claim 15, characterized in that, The resource allocation determination module is also used for: Based on the resource status information, a target candidate test pressure with the minimum preset physical resource consumption is determined from multiple candidate test pressures; wherein, the preset physical resources include: processor or memory; The target physical resource configuration is determined based on the physical resource usage corresponding to the target candidate test pressure.
17. The apparatus according to claim 16, characterized in that, The preset latency threshold includes: a first preset latency threshold corresponding to throughput-sensitive services; or A second preset latency threshold corresponding to a latency-sensitive service, wherein the first preset latency threshold is greater than the second preset latency threshold.
18. The apparatus according to any one of claims 11-17, characterized in that, The apparatus further includes a container deployment unit, the container deployment unit being used for: Generate multiple containers that match the peak concurrency access information, wherein each container has the target physical resource configuration; Deploy the preset service in each container.
19. The apparatus according to any one of claims 11-17, characterized in that, The preset service is a service that has been deployed based on the container's history, and the device also includes a container adjustment unit, which is used to: Based on the peak concurrent access information and the target physical resource configuration, the historical physical resource configuration and / or the number of containers are adjusted.
20. The apparatus according to claim 19, characterized in that, The container adjustment unit includes a quantity determination module, a sequence determination module, and an adjustment module, wherein... The quantity determination module is used to determine the target number of containers for deploying the service based on the peak concurrent access information and the test pressure corresponding to the target physical resource configuration; The sequence determination module is used to determine the order of adjusting the historical physical resource configuration of the container and adjusting the number of containers in response to the mismatch between the historical physical resource configuration and the target physical resource configuration of the container, and the mismatch between the target number and the historical number of the container, according to the rule of first increasing and then decreasing. The adjustment module is used to adjust the physical resources of the containers sequentially to match the target physical resources, and to adjust the number of containers to match the target number.
21. An electronic device, comprising: At least one processor; as well as A memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor, which, when executed by the at least one processor, enables the at least one processor to perform the method of any one of claims 1-10.
22. A non-transitory computer-readable storage medium storing computer instructions, wherein, The computer instructions are used to cause the computer to perform the method according to any one of claims 1-10.
23. A computer program product comprising a computer program that, when executed by a processor, implements the steps of the method according to any one of claims 1-10.
Citation Information
Patent Citations
Method and device for resource allocation and computer readable storage medium
CN111522668A
Container resource demand determination method and device, server and storage medium
CN113971115A