Resource allocation method and device
By using regulation nodes in Kubernetes to obtain the historical characteristics of management agent resource occupation, and automatically adjust resource allocation, the problem of mismatch in management agent resource allocation is solved, reducing resource waste and improving efficiency.
Patent Information
- Application Number
- CN202411975567.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-26
- Publication Date
- 2025-05-30
AI Technical Summary
In the container orchestration engine Kubernetes, the resource allocation of the management agent sidecar does not match, resulting in waste of resources.
By adjusting nodes, they can obtain the resource occupation history characteristics of the management agent and automatically adjust the resources allocated by the management agent to ensure that the resource allocation matches the required resources.
It effectively reduces resource waste and improves resource allocation efficiency and matching.
Smart Images

Figure CN120066761A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular, to a resource allocation method and apparatus. Background Art
[0002] When the container orchestration engine (Kubernetes, K8s TM ) adopts service mesh TM to manage inter-service communication, K8s TM deploys the management proxy sidecar in each minimum deployment unit Pod TM , and the sidecar TM is used to manage inter-service communication. The management proxy sidecar TM manages inter-service communication using the resource amount between the lower limit of resources (requests) and the upper limit of resources (limits).
[0003] In the above process, K8s TM sets fixed lower and upper limits of resource amounts for the management proxy sidecar TM . When the inter-service communication situation changes, there may be a situation where the resource amount required by the management proxy sidecar TM does not match the set resource amount, resulting in resource waste. Summary of the Invention
[0004] This application provides a resource allocation method and apparatus, which are used to solve the problem of resource waste caused by the mismatch between the resources allocated to the management proxy and the required resources when the resources required by the management proxy change.
[0005] In a first aspect, this application provides a resource allocation method. This method is applied to a resource allocation system, which includes an adjustment node and at least one working node. Each of the at least one working nodes deploys at least one pod. Each of the at least one pods deploys a management proxy for managing service traffic. The adjustment node of the resource allocation system is used to adjust the resources allocated to the management proxy. The method provided in the first aspect can be executed by the adjustment node, and the method includes: the adjustment node obtains the historical characteristics of the resources occupied by the management proxy. The historical characteristics are used to indicate the amount of computing resources and / or storage resources occupied by the management proxy during a specified historical period. The adjustment node determines the resource allocation value of the management proxy according to the historical characteristics. The resource allocation value is used to indicate the first computing resources and / or the first storage resources allocated to the management proxy. The adjustment node allocates resources to the management proxy according to the resource allocation value.
[0006] In the first aspect of the present application, compared with allocating fixed resources to the management agent, in the present application, the adjustment node automatically adjusts the resources allocated to the management agent according to the historical characteristics of the resources occupied by the management agent. In this way, when the amount of resources occupied by the management agent changes, the adjustment node can automatically change the resources allocated to the management agent according to the amount of resources occupied by the management agent, so that the resources allocated to the management agent match the resources required by the management agent, reducing resource waste.
[0007] In a possible implementation manner, the adjustment node determines the resource allocation value of the management agent according to the historical characteristics, including: the adjustment node determines the resource allocation value of the management agent according to the historical characteristics and / or the current resource allocation value. The current resource allocation value includes the current computing resources and the current storage resources allocated to the management agent. In this way, the adjustment node determines the resource allocation value according to the historical characteristics and / or the current resource allocation value, improving the matching degree between the resource allocation value and the required resources, and reducing the resource waste caused by the mismatch between the required resources and the resource allocation value.
[0008] In another possible implementation manner, the adjustment node determines the resource allocation value of the management agent according to the historical characteristics and / or the current resource allocation value, including: the adjustment node determines the first computing resources according to the amount of computing resources occupied indicated by the historical characteristics and / or the current computing resources. The adjustment node determines the first storage resources according to the amount of storage resources occupied indicated by the historical characteristics and / or the current storage resources. And the adjustment node determines the resource allocation value according to the first computing resources and / or the first storage resources.
[0009] In another possible implementation manner, the current computing resources include: the upper limit of computing resources and the lower limit of computing resources. The adjustment node determines the first computing resources according to the amount of computing resources occupied indicated by the historical characteristics and the current computing resources, including: the adjustment node obtains the minimum occupied amount of computing resources of the management agent in the specified historical time period according to the amount of computing resources occupied indicated by the historical characteristics. If the minimum occupied amount of computing resources is less than or equal to the first computing resource occupancy threshold, the adjustment node adjusts the lower limit of computing resources by using the minimum occupied amount of computing resources to obtain the adjusted lower limit of computing resources. And the adjustment node determines the first computing resources according to the upper limit of computing resources and the adjusted lower limit of computing resources. In this way, the adjustment node adjusts the lower limit of computing resources according to the minimum occupied amount of computing resources to obtain the adjusted lower limit of computing resources. Improving the matching degree between the lower limit of computing resources of the resource allocation value and the required lower limit of computing resources, and avoiding resource shortage affecting business processing.
[0010] In another possible implementation, the adjustment node adjusts the lower limit of computing resources by using the minimum occupancy of computing resources to obtain the adjusted lower limit of computing resources, including: the adjustment node obtains a first value according to the minimum occupancy of computing resources and the lower limit of computing resources. And the adjustment node obtains the adjusted lower limit of computing resources according to the first value and the first computing resource adjustment ratio. In this way, the calculation logic is simple, the adjusted lower limit of computing resources can be quickly obtained, and the efficiency of resource allocation is improved.
[0011] In another possible implementation, the current computing resources include: the upper limit of computing resources and the lower limit of computing resources. The adjustment node determines the first computing resource according to the occupancy of computing resources indicated by the historical feature and the current computing resources, including: obtaining the maximum occupancy of computing resources of the management agent in the specified historical time period according to the occupancy of computing resources indicated by the historical feature. If the maximum occupancy of computing resources is less than or equal to the second computing resource occupancy threshold, the adjustment node adjusts the upper limit of computing resources by using the maximum occupancy of computing resources to obtain the adjusted upper limit of computing resources. And determining the first computing resource according to the adjusted upper limit of computing resources and the lower limit of computing resources. In this way, the adjustment node adjusts the upper limit of computing resources according to the maximum occupancy of computing resources to obtain the adjusted upper limit of computing resources. The matching degree between the upper limit of computing resources of the resource allocation value and the required upper limit of computing resources is improved, and resource waste is avoided.
[0012] In another possible implementation, the adjustment node adjusts the upper limit of computing resources by using the maximum occupancy of computing resources to obtain the adjusted upper limit of computing resources, including: the adjustment node obtains a second value according to the maximum occupancy of computing resources and the upper limit of computing resources. And the adjustment node obtains the adjusted upper limit of computing resources according to the second value and the second computing resource adjustment ratio. In this way, the calculation logic is simple, the adjusted upper limit of computing resources can be quickly obtained, and the efficiency of resource allocation is improved.
[0013] In another possible implementation, the current storage resources include: the upper limit of storage resources and the lower limit of storage resources. The adjustment node determines the first storage resource according to the occupancy of storage resources indicated by the historical feature and the current storage resources, including: the adjustment node obtains the maximum occupancy of storage resources of the management agent in the specified historical time period according to the occupancy of storage resources indicated by the historical feature. If the ratio of the maximum occupancy of storage resources to the upper limit of storage resources is less than or equal to the storage resource ratio threshold, the adjustment node adjusts the upper limit of storage resources by using the storage resource adjustment ratio to obtain the adjusted upper limit of storage resources. And the adjustment node determines the first storage resource according to the adjusted upper limit of storage resources and the lower limit of storage resources. In this way, the adjustment node obtains the adjusted upper limit of storage resources according to the maximum occupancy of storage resources and the storage resource adjustment ratio. The matching degree between the first storage resource and the required storage resources is improved, and resource waste is avoided.
[0014] In another possible implementation, the resource allocation system further includes a Kubernetes cluster of container orchestration engines. The Kubernetes cluster of container orchestration engines deploys a first service, the first service is deployed in a first pod among at least one pod, and the management agent includes a first management agent deployed in the first pod.
[0015] In another possible implementation, the first service is also deployed in a second pod among at least one pod, and the management agent further includes a second management agent deployed in the second pod. In this way, when the first service is deployed in at least one pod, the resources allocated to at least one management agent corresponding to the at least one pod can be adjusted in batches, improving the resource allocation efficiency.
[0016] In another possible implementation, the computing resource is a processor and the storage resource is a memory.
[0017] In a second aspect, the present application provides a resource allocation device. The device includes various modules for executing the resource allocation method in the first aspect or any possible design of the first aspect.
[0018] In a third aspect, the present application provides a processor. The processor includes an interface circuit and a control circuit. The interface circuit is used to obtain the historical characteristics of the resources occupied by the management agent and cooperate with the control circuit to implement the operation steps of the method in the first aspect or any possible design in the first aspect.
[0019] In a fourth aspect, the present application provides a cluster of computing devices. The cluster of computing devices includes at least one computing device, and each computing device includes a processor and a memory. The processors of the at least one computing device are used to execute the instructions stored in the at least one memory, so that the cluster of computing devices executes the operation steps of the method described in the first aspect or any possible design of the first aspect.
[0020] In a fifth aspect, the present application provides a computer-readable storage medium. It includes: computer software instructions; when the computer software instructions run in a cluster of computing devices, the cluster of computing devices is caused to execute the operation steps of the method described in the first aspect or any possible implementation of the first aspect.
[0021] In a sixth aspect, the present application provides a computer program product. When the computer program product runs on a computer cluster, the cluster of computing devices is caused to execute the operation steps of the method described in the first aspect or any possible implementation of the first aspect.
[0022] For the beneficial effects of the second to sixth aspects above, reference may be made to the description of the first aspect or any implementation manner in the first aspect, which will not be elaborated here. Based on the implementation manners provided in the above aspects of the present application, further combinations can be made to provide more implementation manners. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] Figure 1 FIG. is a schematic structural diagram of a resource allocation system provided by the present application;
[0024] Figure 2 FIG. is a schematic structural diagram of a computing device provided by the present application;
[0025] Figure 3 FIG. is a schematic structural diagram of a chip provided by the present application;
[0026] Figure 4 FIG. is a schematic flow diagram of a resource allocation method provided by the present application;
[0027] Figure 5 FIG. is a schematic diagram of a resource allocation method provided by the present application;
[0028] Figure 6 FIG. is an example diagram of a resource allocation method provided by the present application;
[0029] Figure 7 FIG. is a schematic structural diagram of a resource allocation device provided by the present application;
[0030] Figure 8 FIG. is a schematic structural diagram of a computing device cluster provided by the present application;
[0031] Figure 9 FIG. is a schematic connection diagram between computing devices provided by the present application. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0032] The present application provides a resource allocation method. In this method, an adjustment node determines a resource allocation value for a management agent according to the historical characteristics of the resources occupied by the management agent, and allocates resources to the management agent based on the resource allocation value. Compared with allocating fixed resources to the management agent, in the present application, the adjustment node automatically adjusts the resources allocated to the management agent according to the historical characteristics of the resources occupied by the management agent. In this way, when the amount of resources occupied by the management agent changes, the adjustment node can automatically change the resources allocated to the management agent according to the amount of resources occupied by the management agent, so that the resources allocated to the management agent match the resources required by the management agent, reducing resource waste.
[0033] For the sake of clear and concise description of the following embodiments, a brief introduction to the related technologies is first given.
[0034] A container orchestration engine (Kubernetes, k8S) cluster is used to automate the deployment, scaling, and management of containerized applications. The K8s cluster includes: a master node for managing the status and configuration information of the k8s cluster and worker nodes for running container applications.
[0035] A service mesh is an infrastructure layer for managing inter-service communication. The service mesh can use the management proxy sidecar to manage inter-service communication.
[0036] When the service mesh uses the management proxy to manage the communication between services deployed in k8s, the management proxy uses the resources between the resource request lower limit (requests) and the resource request upper limit (limits) to achieve the above management. When the communication situation between services deployed in k8s changes, there may be a mismatch between the resources limited by the resource request lower limit (requests) and the resource request upper limit (limits) and the resources required for management, resulting in resource waste.
[0037] Based on this, the present application provides a resource allocation method, which can be applied to a resource allocation system. Figure 1 The following is a schematic architecture diagram of a resource allocation system provided by the present application, as Figure 1 shown, the resource allocation system 100 includes: at least one worker node and an adjustment node 120. Each worker node in the at least one worker node and the adjustment node 120 can communicate in a wired manner or in a wireless manner. The wired communication method can be: Ethernet, optical fiber, and various peripheral component interconnect express (PCIe) buses provided inside the resource allocation system 100 for connecting the at least one worker node and the adjustment node 120, etc. The wireless communication method can be: the Internet, wireless local area network (WLAN), and ultra-wideband (UWB) technology, etc.
[0038] Each of at least one working node deploys at least one pod, and each of the at least one pod includes at least one container and a management agent. A service is deployed in at least one container of the pod, and the management agent of the pod is used to manage the service traffic that interacts between the service deployed in the at least one container and other services. The working node may or may not have a physical entity, and the present application does not limit this. For example, when the working node has a physical entity, the working node may be an ordinary computing device, such as a server, a personal computer, a desktop computer, and so on. Another example is that when the working node does not have a physical entity, the working node may be a virtual machine (vm), a container (docker), and so on. The above management agent includes but is not limited to: sidecar. In some possible situations, the at least one working node may be deployed in a container orchestration engine Kubernetes cluster (hereinafter referred to as k8s cluster) 110 (such as Figure 1 as shown).
[0039] The adjustment node 120 obtains the historical characteristics of the resources occupied by the management agent, determines the resource allocation value of the management agent according to the historical characteristics, and allocates resources to the management agent based on the resource allocation value. Similarly, the adjustment node 120 may or may not have a physical entity, and the present application does not limit this. The adjustment node 120 may be a server, a personal computer, a desktop computer, a virtual machine (virtual machine, vm), a container (docker), and so on.
[0040] The above takes the at least one working node deployed in a k8s cluster 110 as an example to illustrate the resource allocation system 100. According to the actual application needs, the at least one working node may also be deployed in multiple k8s clusters 110, and the present application does not limit this. The following takes the at least one working node deployed in the k8s cluster 110, that is, the resource allocation system includes a k8s cluster 110 and an adjustment node 120 as an example to illustrate the resource allocation method provided by the present application.
[0041] The above adjustment node 120 and the working node of the k8s cluster 110 may be implemented by a computing device. The computing device may be a common computing device, such as a personal computer, a desktop computer, a mobile phone, a server, etc. Exemplarily, Figure 2 is a schematic structural diagram of a computing device provided by the present application, such as Figure 2As shown, the computing device 200 includes: a communication interface 214, a processor 211, and a memory 213. The communication interface 214 is used to communicate with devices located outside the computing device 200. For example, when the computing device 200 is used to implement the functions of the adjustment node 120, the computing device 200 realizes data interaction with the k8s cluster through the communication interface 214. Specifically: the computing device 200 obtains the historical characteristics of the resource occupancy of the management agent through the communication interface 214, the computing device 200 obtains a processing result (such as a resource allocation value, etc.) based on the obtained historical characteristics of the resource occupancy of the management agent, and feeds back the processing result through the communication interface 214. The communication interface 214 may be an input / output (I / O) interface.
[0042] The processor 211 is the computing core and control core of the computing device 200, and it may include: a central processing unit (CPU), an application specific integrated circuit, other general-purpose processors, a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. In practical applications, the computing device 200 may also include multiple processors. One or more processor cores may be included in the processor 211. An operating system and other software programs are installed in the processor 211, so that the processor 211 can realize access to the memory 213 and various peripheral component interconnect express (PCIe) devices.
[0043] The processor 211 is connected to the memory 213 via the bus 216. The bus 216 can be a double data rate (DDR) bus or other types of buses. The memory 213 is the main memory of the computing device 200. The memory 213 is usually used to store various running software in the operating system, etc. To improve the access speed of the processor 211, the memory 213 needs to have the advantage of fast access speed. In traditional computer devices, dynamic random access memory (DRAM) is usually used as the memory 213. In addition to DRAM, the memory 213 can also be other random access memories, such as static random access memory (SRAM), etc. Additionally, the memory 213 can also be read only memory (ROM). For read only memory, for example, it can be programmable read only memory (PROM), erasable programmable read only memory (EPROM), etc. The number and type of the memory 213 are not limited in this embodiment.
[0044] In some possible scenarios, in order to persistently store data (such as the historical characteristics of the resources occupied by the management agent), the computing device 200 may also be provided with a data storage system 215. The data storage system 215 can be located outside the computing device 200 (as Figure 2 shown), and exchanges data with the computing device 200 through a network. Optionally, the data storage system 215 can also be located inside the host. For example, the data storage system 215 exchanges data with the processor 211 via the bus 216. At this time, the data storage system 215 acts as a hard disk.
[0045] Exemplarily, Figure 2 the processor 211 in Figure 3 can be implemented by a chip, as Figure 3 shown in the structure diagram of a chip provided by this application. Exemplarily, the chip 300 includes a core 301, a CPU 302, a system buffer 303, an input / output (I / O) device 305, and a DDR 306.
[0046] Among them, the CPU 302 is used to receive tasks (such as compression tasks, decompression tasks, resource allocation tasks), and call the core 301 to execute the task. When there are multiple cores 301 in the chip 300, the CPU 302 is also used to undertake the scheduling task. For example, the CPU 302 can be implemented by an ARM processor, which has a small size and low power consumption, adopts a 32-bit reduced instruction set, and has simple and flexible addressing. Of course, in some embodiments, the CPU 302 can also be implemented by other processors.
[0047] The core 301 is used to provide the computing power required for resource allocation tasks, etc. In an alternative scenario, the core 301 includes a load / store unit (LSU), a cube calculation unit, a scalar calculation unit, a vector calculation unit, and a buffer. Among them, the LSU is used to load the data to be processed (such as the historical characteristics of the resources occupied by the management agent) and store the processed data, and can also be used for the read / write management of internal data in the core between different buffers, and to complete some format conversion operations. The cube calculation unit is used to provide the core computing power for matrix multiplication. The scalar calculation unit is a single instruction stream single data (SISD) processor, which processes only one piece of data (usually an integer or a floating point number) at the same time. The vector calculation unit, also known as an array processor, is a processor that can directly operate on a group of arrays or vectors for calculation. The number of buffers may be one or more. For example, the buffer mainly refers to the level 1 buffer (L1 buffer). The buffer is used to temporarily store some data that the core 301 needs to use repeatedly to reduce the read / write from the bus. In addition, the implementation of some data format conversion functions also requires the source data to be located in the buffer. The system buffer 303 mainly refers to the secondary buffer, which is used to temporarily store the input data, intermediate results or final results passing through the chip.
[0048] The DDR 306 is an off-chip memory, which can also be replaced by a high bandwidth memory (HBM) or other off-chip memories. The DDR 306 is located between the chip and the external memory, overcoming the access speed limit when the computing resources share the memory for reading and writing.
[0049] The I / O device 305 included in the chip 300 refers to the hardware for data transmission, and can also be understood as the device docked with the I / O interface. Common I / O devices 305 include network cards, printers, keyboards, mice, etc. All external memories can also be used as I / O devices 305, such as hard disks, floppy disks, optical discs, etc.
[0050] Note: In the original text, it says "34-bit reduced instruction set" which seems incorrect. It should be "32-bit reduced instruction set" as ARM processors are typically 32-bit. The translation has been corrected accordingly.The core 301, CPU 302, system buffer 303, I / O device 305, and DDR 306 are connected via a bus. The bus may include a path for transmitting information between the above components (such as CPU 302 and system buffer 303). In addition to the data bus, the bus may also include a power bus, a control bus, a status signal bus, etc. However, for the sake of clear illustration, the bus may be a PCIe bus, or an extended industry standard architecture (EISA) bus, a unified bus (Ubus or UB), a compute express link (CXL), a cache coherent interconnect for accelerators (CCIX), etc. For example, the core 301 may access these I / O devices 305 via the PCIe bus. The core 301 is connected to the system buffer 303 via the DDR bus. Here, different system buffers 303 may communicate with the core 301 using different data buses. Therefore, the DDR bus may also be replaced by other types of data buses, and the embodiments of the present application do not limit the type of the bus.
[0051] For example, after the CPU 302 loads the data to be processed for the resource allocation task (such as the historical characteristics of the resources occupied by the management agent) into the DDR 306, the LSU in the core 301 reads (loads) the data from the DDR 306 and processes the data to obtain a processing result (such as a resource allocation value). After obtaining the processing result, the LSU then loads (stores) the processing result into the DDR 306, and the network interface card feeds back the processing result.
[0052] It can be understood that the structures illustrated in the above embodiments do not constitute specific limitations on the resource allocation system, computing device, and chip. In other embodiments, the resource allocation system may include more or fewer components, and the computing device and chip may include more or fewer components than those illustrated, or combine certain components, or split certain components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
[0053] As described above in conjunction with Figures 1 to 3 the resource allocation system to which the resource allocation method is applied, and the computing device and chip that can be used to implement the adjustment node, working node, etc. have been described. Next, in conjunction with Figures 1 to 3 the content shown, the resource allocation method provided by the present application will be described in detail.
[0054] Figure 4The flowchart of a resource allocation method provided for this application. This resource allocation method can be applied to a resource allocation system, which can include an adjustment node and at least one working node. The resource allocation system can adopt Figure 1 the described architecture. For more descriptions of the resource allocation system, please refer to the relevant descriptions above Figures 1 to 3 , which will not be elaborated here.
[0055] Here, taking the resource allocation system having Figure 1 the described architecture as an example, the resource allocation method provided for this application will be described. This resource allocation method can be executed by the adjustment node. As Figure 4 shown, this method can include the following S410 to S430.
[0056] S410, the adjustment node obtains the historical characteristics of the resources occupied by the management agent.
[0057] Among them, the historical characteristics are used to indicate the occupation amounts of computing resources and storage resources by the management agent during a specified historical time period.
[0058] Computing resources can refer to components with data processing capabilities. For example, computing resources can include but are not limited to: processors, etc. When the computing resource is a processor, the occupation amount of the computing resource by the management agent can refer to the occupation amount of the processor by the management agent. The occupation amount of the processor can include but are not limited to: the number of occupied processors, the usage rate of the processor, etc. In some possible examples, the usage rate of the processor can also be referred to as the processor utilization rate.
[0059] In some possible situations, when the occupation amount of the processor is the number of occupied processors, the number of occupied processors can be obtained according to the usage rate of the processor by the management agent and the computing resources allocated to the pod corresponding to the management agent. For example, the usage rate of the processor by the management agent is 90%, and the computing resources allocated to the pod corresponding to the management agent are 1 core. In this case, the number of occupied processors by the management agent is 900 millicores (mcore, m).
[0060] Storage resources can refer to components with data storage capabilities. For example, storage resources can include but are not limited to: memory, etc. When the storage resource is memory, the occupation amount of the storage resource by the management agent can refer to the occupation amount of the memory by the management agent. The occupation amount of the memory can include but are not limited to: the memory occupation amount, the usage rate of the memory, etc. In some possible examples, the usage rate of the memory can also be referred to as the memory utilization rate.
[0061] The above text has described computing resources, the occupation of computing resources by the management agent, storage resources, and the occupation of storage resources by the management agent. Next, the method for the adjustment node to obtain the historical characteristics of the resources occupied by the management agent will be described.
[0062] In some possible scenarios, the adjustment node can periodically sample the processor occupation and memory occupation of the management agent at a specified sampling frequency within a specified historical period, obtaining multiple sampling results. The adjustment node obtains the historical characteristics of the management agent's occupation of the processor and memory based on the multiple sampling results. The specified sampling frequency and the specified historical period can be preset or set according to the actual application needs, and the present application does not limit this. In some possible scenarios, the specified historical period can also be referred to as the sampling period.
[0063] Exemplarily, the specified sampling frequency is to sample once every 30 seconds (s), and the specified historical period is 7 days (d). In this case, the adjustment node samples the processor usage rate and memory occupation of the management agent every 30s from the (d + 1)-th day to the (d + 7)-th day, obtaining multiple sampling results. Here, d is the end time of the previous sampling period. The adjustment node obtains the historical characteristics of the processor occupation based on the multiple sampling results of the processor usage rate, and obtains the historical characteristics of the memory occupation based on the multiple sampling results of the memory occupation.
[0064] In some possible scenarios, an indicator collection agent can be deployed on each worker node. The indicator collection agent on each worker node collects the occupation of the management agent resources corresponding to each pod in all pods deployed on that worker node. The indicator collection agent on each worker node sends the collected occupation of the management agent resources to the adjustment node. Correspondingly, the adjustment node receives the occupation of the management agent resources sent by the indicator collection agent of the worker node. The adjustment node can use multiple modules to process the occupation of the management agent resources to obtain the historical characteristics of the resources occupied by the management agent. And the adjustment node can also use its own storage resources to store the historical characteristics of the resources occupied by the management agent. For example, the adjustment node uses an application indicator processing module to process the received occupation of the management agent resources to obtain a processing result, and uses its own storage resources to store the historical characteristics of the resources occupied by the management agent.
[0065] S420. The adjustment node determines the resource allocation value of the management agent according to the historical characteristics.
[0066] Among them, the resource allocation value is used to indicate the first computing resources and the first storage resources allocated to the management agent.
[0067] The adjustment node can determine the resource allocation value of the management agent based on historical features in various ways. Below are examples of two possible ways.
[0068] Example a: The adjustment node directly determines the resource allocation value of the management agent according to historical features.
[0069] Depending on the content indicated by the resources occupied by the management agent, the ways for the adjustment node to directly determine the resource allocation value of the management agent according to historical features are different. The following will be described by cases.
[0070] Case 1: The resources occupied by the management agent refer to the computing resources occupied by the management agent.
[0071] In this case, the adjustment node can directly determine the first computing resource of the management agent according to the historical features of the computing resources occupied by the management agent. Taking the computing resource as the processor as an example, in this case, the adjustment node can determine the first computing resource of the management agent according to multiple sampling points of the processor utilization rate of the management agent sampled in a specified time period. The adjustment node can use various ways to determine the first computing resource according to multiple sampling points of the processor utilization rate. The above ways include but are not limited to: determining the first computing resource according to the mean value of multiple sampling points of the processor utilization rate, sorting multiple sampling points of the processor utilization rate in ascending or descending order, and determining the first computing resource according to the sampling points in the specified order, etc.
[0072] Case 2: The resources occupied by the management agent refer to the storage resources occupied by the management agent.
[0073] In this case, the adjustment node can directly determine the first storage resource of the management agent according to the historical features of the storage resources occupied by the management agent. Taking the storage resource as the memory as an example, in this case, the adjustment node can determine the first storage resource of the management agent according to multiple sampling points of the memory occupancy of the management agent sampled in a specified time period. The adjustment node can use various ways to determine the first storage resource according to multiple sampling points of the memory occupancy. Similarly, the above ways include but are not limited to: determining the first storage resource according to the mean value of multiple sampling points of the memory occupancy, sorting multiple sampling points of the memory occupancy in ascending or descending order, and determining the first memory occupancy resource according to the sampling points in the specified order, etc.
[0074] Case 3: The resources occupied by the management agent refer to the computing resources and storage resources occupied by the management agent.
[0075] In this case, the adjustment node can respectively use the methods described in Case 1 and Case 2 above to determine the first computing resource and the first storage resource. For relevant descriptions, please refer to the above, and will not be repeated here.
[0076] In Example b, the adjustment node determines the resource allocation value of the management agent based on historical features and the current resource allocation value.
[0077] The current resource allocation value may include the current computing resources and current storage resources allocated to the management agent. Similar to Example a, depending on what is indicated by the resources occupied by the management agent, the adjustment node may determine the resource allocation value of the management agent in different ways based on historical features and the current resource allocation value. When the resources occupied by the management agent refer to the computing resources occupied by the management agent, the adjustment node may determine the first computing resources based on the historical features of the computing resources occupied by the management agent and the current computing resources of the current resource allocation value, and determine the resource allocation value of the management agent based on the first computing resources. When the resources occupied by the management agent refer to the storage resources occupied by the management agent, the adjustment node may determine the first storage resources based on the historical features of the storage resources occupied by the management agent and the current storage resources of the current resource allocation value, and determine the resource allocation value of the management agent based on the first storage resources. When the resources occupied by the management agent refer to the computing resources and storage resources occupied by the management agent, the adjustment node may determine the first computing resources and the first storage resources based on the historical features of the computing resources occupied by the management agent, the historical features of the storage resources occupied by the management agent, the current computing resources of the current resource allocation value, and the current storage resources of the current resource allocation value, and determine the resource allocation value of the management agent based on the first computing resources and the first storage resources. For the specific process of the adjustment node determining the resource allocation value of the management agent based on historical features and the current resource allocation value, please refer to the relevant descriptions in S51 to S53 below and will not be elaborated here.
[0078] S430, the adjustment node allocates resources to the management agent according to the resource allocation value.
[0079] Depending on the content included in the resource allocation value, the process of the adjustment node allocating resources to the management agent is different, and the following will be described in different cases.
[0080] Case a, the resource allocation value includes the first computing resources.
[0081] In this case, the adjustment node may allocate computing resources to the management agent according to the first computing resources. The adjustment node may send a resource adjustment instruction for allocating the first computing resources to the management node of the k8s cluster, and the management node of the k8s cluster receives the resource adjustment instruction and allocates the first computing resources to the management agent in response to the resource adjustment instruction.
[0082] Case b, the resource allocation value includes the first storage resources.
[0083] Similarly, the adjustment node can allocate storage resources for the management agent according to the first storage resource. The adjustment node can send a resource adjustment instruction for allocating the first storage resource to the management node of the k8s cluster, and the management node of the k8s cluster receives the resource adjustment instruction and allocates the first storage resource to the management agent in response to the resource adjustment instruction.
[0084] In case c, the resource allocation value includes the first computing resource and the first storage resource.
[0085] In this case, the adjustment node can allocate the first computing resource and the first storage resource for the management agent in the manner described in case a and case b above. For the relevant content, please refer to the descriptions of case a and case b above, which will not be elaborated here.
[0086] In some possible cases, according to the number of pods in which the service is deployed, the above-mentioned management agent can refer to one management agent or multiple management agents.
[0087] For example, the service is deployed in one pod. In this case, the adjustment node can obtain the historical characteristics of the resources occupied by the management agent deployed in this pod, determine the resource allocation value according to the historical characteristics, and allocate resources to the management agent according to the resource allocation value. For example, the k8s cluster includes worker node 1, and worker node 1 includes at least one pod. The first service is deployed in the k8s cluster, and the first service is deployed in the first pod among at least one pod. In this case, the adjustment node can obtain the historical characteristics of the resources occupied by the management agent deployed in the first pod, determine the resource allocation value according to the historical characteristics, and allocate resources to the management agent according to the resource allocation value.
[0088] For another example, the service is deployed in multiple pods. In this case, the adjustment node can obtain the historical characteristics of the resources occupied by the management agent corresponding to each pod in the multiple pods, and obtain multiple historical characteristics of the multiple management agents. And the adjustment node determines the resource allocation values of the multiple management agents according to the multiple historical characteristics, and allocates resources to the multiple management agents according to the determined resource allocation values. According to the needs of actual applications, the multiple pods can be deployed on one working node of k8s, or can be deployed on multiple working nodes of k8s, which is not limited in this application. For example, the k8s cluster includes working node 1, and working node 1 includes at least one pod. The k8s cluster deploys a first service, and the first service is deployed in the first pod and the second pod of at least one pod. The first pod deploys a first management agent, and the second pod deploys a second management agent. In this case, the adjustment node obtains the first historical characteristic of the resources occupied by the first management agent and the second historical characteristic of the resources occupied by the second management agent, and determines the resource allocation values of the first management agent and the second management agent according to the first historical characteristic and the second historical characteristic, and allocates resources to the first management agent and the second management agent according to the resource allocation values.
[0089] The process in which the adjustment node determines the resource allocation value of the management agent according to the historical characteristics of the resources occupied by the management agent is described in detail above in combination with S410 to S430. The process in which the adjustment node determines the resource allocation value of the management agent according to the historical characteristics of the resources occupied by the management agent and the current resource allocation value is described below in combination with S51 to S53.
[0090] S51, the adjustment node determines the resource allocation value according to the historical characteristics of the computing resources occupied by the management agent and the current computing resources.
[0091] The current computing resources include the upper limit of computing resources and the lower limit of computing resources. The management agent uses the computing resources between the upper limit of computing resources and the lower limit of computing resources to manage the communication between services. The adjustment node can determine the first computing resources according to at least two of the historical characteristics of the computing resources occupied by the management agent, the upper limit of computing resources, and the lower limit of computing resources. According to the content used by the adjustment node to determine the first computing resources, the process of the adjustment node determining the first computing resources is also different, which is described below in different cases.
[0092] Case i, the adjustment node determines the first computing resources according to the historical characteristics of the computing resources occupied by the management agent and the lower limit of computing resources.
[0093] In this case, the adjustment node obtains the minimum computing resource occupancy of the management agent in the specified historical period according to the computing resource occupancy indicated by the historical features. If the minimum computing resource occupancy is less than or equal to the first computing resource occupancy threshold, the adjustment node adjusts the lower limit of the computing resource using the minimum computing resource occupancy to obtain the adjusted lower limit of the computing resource. The adjustment node determines the first computing resource according to the upper limit of the computing resource and the adjusted lower limit of the computing resource. The first computing resource occupancy threshold can be preset or set according to the needs of actual applications, and this application does not limit it. For example, the first computing resource occupancy threshold is set to 40%.
[0094] The adjustment node can obtain the adjusted lower limit of the computing resource in various ways. Exemplarily, the adjustment node can determine the adjusted lower limit of the computing resource according to the minimum computing resource occupancy and the lower limit of the computing resource. Specifically, the adjustment node obtains a first value according to the minimum computing resource occupancy and the lower limit of the computing resource. And the adjustment node obtains the adjusted lower limit of the computing resource according to the first value and the first computing resource adjustment ratio. The first computing resource adjustment ratio can be preset or set according to the needs of actual applications, and this application does not limit it. For example, the first computing resource adjustment ratio is set to 0.4. For example, the adjustment node can obtain a first value according to the product of the minimum computing resource occupancy and the lower limit of the computing resource. And the adjustment node obtains the adjusted lower limit of the computing resource according to the ratio of the first value to the first computing resource adjustment ratio.
[0095] The adjustment node can determine the minimum computing resource occupancy in various ways. Examples of several possible ways are given below.
[0096] Example 1: The adjustment node obtains multiple sampling points of the computing resource of the management agent in the specified historical period, sorts the multiple sampling points in descending or ascending order, and determines the sampling point in the specified order as the minimum computing resource occupancy.
[0097] Example 2: The adjustment node obtains multiple sampling points of the computing resource of the management agent in the specified historical period, and directly determines the minimum value among the multiple sampling points as the minimum computing resource occupancy.
[0098] Example 3: The adjustment node obtains multiple sampling points of the computing resource of the management agent in the specified historical period. The adjustment node sorts the multiple sampling points in descending or ascending order, obtains the average value of the multiple sampling points in the specified order, and determines the average value as the minimum computing resource occupancy.
[0099] The process of the adjustment node determining the first computing resource was described above. Below, taking the computing resource upper limit as 500m, the computing resource lower limit as 250m, the first computing resource adjustment ratio as 0.4, and the first computing resource occupancy threshold as 40% as an example, the process of the adjustment node determining the first computing resource will be exemplarily described.
[0100] The adjustment node obtains multiple sampling points of the computing resource by the management agent in a specified historical period, and determines the minimum computing resource occupancy P according to the multiple sampling points min . If P min ≤40%, the adjustment node obtains the product of the computing resource lower limit and the minimum computing resource occupancy P min and takes this product as the first value (250*P min ). And the adjustment node obtains the quotient of the first value and the first computing resource adjustment ratio (250*P min / 0.4) and takes this quotient as the adjusted computing resource lower limit. The adjustment node determines the first computing resource according to the computing resource upper limit (500) and the adjusted computing resource lower limit (250*P min / 0.4).
[0101] In case j, the adjustment node determines the first computing resource according to the historical characteristics of the management agent's occupancy of the computing resource and the computing resource upper limit.
[0102] In this case, the adjustment node obtains the maximum computing resource occupancy of the management agent in the specified historical period according to the occupancy of the computing resource indicated by the historical characteristics. If the maximum computing resource occupancy is less than or equal to the second computing resource occupancy threshold, the adjustment node adjusts the computing resource upper limit by using the maximum computing resource occupancy to obtain the adjusted computing resource upper limit. The adjustment node determines the first computing resource according to the adjusted computing resource upper limit and the computing resource upper limit. The second computing resource occupancy threshold can be preset or set according to the needs of actual applications, and the present application does not limit this. For example, the second computing resource occupancy threshold is set to 80%.
[0103] The adjustment node can obtain the adjusted upper limit of computing resources in various ways. Exemplarily, the adjustment node can determine the adjusted upper limit of computing resources according to the maximum occupancy of computing resources and the upper limit of computing resources. Specifically, the adjustment node obtains a second value according to the maximum occupancy of computing resources and the upper limit of computing resources. And the adjustment node obtains the adjusted upper limit of computing resources according to the second value and the second computing resource adjustment ratio. The second computing resource adjustment ratio can be preset or set according to the needs of actual applications, and the present application does not limit this. For example, the second computing resource adjustment ratio is set to 0.8. For example, the adjustment node can obtain a second value according to the product of the maximum occupancy of computing resources and the upper limit of computing resources. And the adjustment node obtains the adjusted upper limit of computing resources according to the ratio of the second value to the second computing resource adjustment ratio. Similarly, the adjustment node can determine the maximum occupancy of computing resources in various ways, such as determining the maximum occupancy of computing resources in the manner described in Examples 1 to 3 in the above-mentioned scenario i.
[0104] The process of another way for the adjustment node to determine the first computing resource is described above. Below, still taking the upper limit of computing resources as 500m, the lower limit of computing resources as 250m, the second computing resource adjustment ratio as 0.8, and the threshold of the second computing resource occupancy as 80% as an example, the process of the adjustment node determining the first computing resource is exemplarily described.
[0105] The adjustment node obtains multiple sampling points of the computing resources by the management agent in a specified historical period, and determines the maximum occupancy of computing resources P according to the multiple sampling points. max If P max ≤ 80%, then the adjustment node obtains the product of the upper limit of computing resources and the maximum occupancy of computing resources P max and takes this product as the second value (500 * P max ). And the adjustment node obtains the quotient of the second value and the second computing resource adjustment ratio (500 * P max / 0.8), and takes this quotient as the adjusted upper limit of computing resources. The adjustment node determines the first computing resource according to the adjusted upper limit of computing resources (500 * P max / 0.8) and the lower limit of computing resources (250).
[0106] In scenario k, the adjustment node determines the first computing resource according to the historical characteristics of the management agent's occupancy of computing resources, the lower limit of computing resources, and the upper limit of computing resources.
[0107] In this case, the adjustment node may determine the adjusted upper limit of computing resources in the manner described in case i based on the historical characteristics of the computing resources occupied by the management agent and the upper limit of computing resources, and determine the adjusted lower limit of computing resources in the manner described in case j based on the historical characteristics of the computing resources occupied by the management agent and the lower limit of computing resources, and determine the first computing resources based on the adjusted upper limit of computing resources and the adjusted lower limit of computing resources. For the process by which the adjustment node determines the adjusted upper limit of computing resources and the adjusted lower limit of computing resources, please refer to the relevant descriptions above and will not be elaborated here.
[0108] S52. The adjustment node determines a resource allocation value based on the historical characteristics of the storage resources occupied by the management agent and the current storage resources.
[0109] Specifically, the adjustment node obtains the maximum occupied amount of the storage resources of the management agent during the specified historical time period according to the occupied amount of the storage resources indicated by the historical characteristics. If the ratio of the maximum occupied amount of the storage resources to the upper limit of the storage resources is less than or equal to the storage resource ratio threshold, the adjustment node adjusts the upper limit of the storage resources by the storage resource adjustment ratio to obtain the adjusted upper limit of the storage resources. The adjustment node determines the first storage resources based on the adjusted upper limit of the storage resources and the lower limit of the storage resources. The storage resource ratio threshold and the storage resource adjustment ratio may be preset or set according to the needs of actual applications, and the present application does not limit this. For example, the storage resource ratio threshold is set to 80%, and the storage resource adjustment ratio is set to 0.8.
[0110] Exemplarily, the specified historical time period is 7 days, the sampling frequency is once every 30 seconds, the storage resources are memory, the upper limit of the storage resources is 128 mebibytes (Mi), the lower limit of the storage resources is 64 Mi, the storage resource ratio threshold is 80%, and the storage resource adjustment ratio is 0.8. In this case, the adjustment node obtains multiple sampling points of the memory occupied amount sampled within 7 days and selects the maximum value max among the multiple sampling points. If the maximum value max determined by the adjustment node is 100 Mi. Since the ratio of the maximum value max to the upper limit of the storage resources is 78% (100 / 128×100%) and is less than the storage resource ratio threshold (80%). The adjustment node adjusts the upper limit of the storage resources to 102.4 (128*0.8) Mi. And the adjustment node determines that the upper limit of the first storage resources is 102.4 Mi, and the lower limit of the first storage resources is 64 Mi.
[0111] S53. The adjustment node determines a resource allocation value based on the historical characteristics of the computing resources occupied by the management agent, the historical characteristics of the storage resources occupied by the management agent, the current computing resources, and the current storage resources.
[0112] In this case, the adjustment node can determine the first computing resource by using the method described in S51, determine the first storage resource by using the method described in S52, and determine the resource allocation value according to the first computing resource and the first storage resource. For the process of the adjustment node determining the first computing resource and the first storage resource, please refer to the relevant descriptions above and will not be elaborated here.
[0113] In the above, the resource allocation method provided by this application is described by taking the resource allocation system including one k8s cluster as an example. According to the needs of actual applications, the resource allocation system may further include multiple k8s clusters. In this case, the adjustment node can use the method described above to allocate resources to the management agents of each k8s cluster.
[0114] Figure 5 A schematic diagram of a resource allocation method provided by this application is as Figure 5 shown. The resource allocation system includes an adjustment node, k8s cluster 1 to k8s cluster n. Among them, k8s cluster 1 to k8s cluster n all include a management node and at least one worker node. Each of the above k8s clusters is deployed with at least one pod and a metric collection agent agent. Each of the at least one pod is deployed with a management agent. In this case, the resource allocation system can adopt the following process to implement the resource allocation process of the management agent. Specifically, the metric collection agent agent i obtains the occupation amounts of the computing resource and / or storage resource of each management agent in the management agent set i during the specified historical period, and sends the obtained occupation amounts of the computing resource and / or storage resource to the adjustment node. Among them, the metric collection agent agent i is the metric collection agent agent deployed on the worker node i. The management agent set i includes at least one management agent in at least one pod deployed on the worker node i, and one pod deploys one management agent. The worker node i is one of all the worker nodes included in k8s cluster 1 to k8s cluster n. The adjustment node receives the occupation amounts of the computing resource and / or storage resource sent by the metric collection agent agent i, determines the resource allocation value according to the above occupation amounts, and allocates resources to the management agents of k8s cluster 1 to k8s cluster n according to the resource allocation value.
[0115] In some possible cases, the adjustment node can implement the above resource allocation method by using multiple modules. Exemplarily, the adjustment node can implement the above resource allocation method by using an application metric processing module, an application portrait module, a regulator module, and a storage module. Figure 6 An example diagram of a resource allocation method provided by this application is as Figure 6As shown in the figure, the resource allocation system includes an adjustment node, k8s cluster 1, and k8s cluster 2. K8s cluster 1 includes management node 1, worker node 11, and worker node 12. Worker node 11 deploys pod11, pod12, and metric collection agent agent11. Pod11 deploys management agent 11, and pod12 deploys management agent 12. Worker node 12 deploys pod13, pod14, and metric collection agent agent12. Pod13 deploys management agent 13, and pod14 deploys management agent 14. K8s cluster 2 includes management node 2, worker node 21, and worker node 22. Worker node 21 deploys pod21, pod22, and metric collection agent agent21. Pod21 deploys management agent 21, and pod22 deploys management agent 22. Worker node 22 deploys pod23, pod24, and metric collection agent agent22. Pod23 deploys management agent 23, and pod24 deploys management agent 24.
[0116] Figure 6The resource allocation system shown can adopt the following process to allocate resources for management agents 11, 11, 21, and 22. Specifically, the metric collection agent agent11 obtains the occupancy amounts 1 of management agents 11 and 12 for computing resources and / or storage resources, and sends the obtained occupancy amounts 1 of computing resources and / or storage resources to the adjustment node. The metric collection agent agent12 obtains the occupancy amounts 2 of management agents 13 and 14 for computing resources and / or storage resources, and sends the obtained occupancy amounts 2 of computing resources and / or storage resources to the adjustment node. The metric collection agent agent21 obtains the occupancy amounts 3 of management agents 21 and 22 for computing resources and / or storage resources, and sends the obtained occupancy amounts 3 of computing resources and / or storage resources to the adjustment node. The metric collection agent agent22 obtains the occupancy amounts 4 of management agents 23 and 24 for computing resources and / or storage resources, and sends the obtained occupancy amounts 4 of computing resources and / or storage resources to the adjustment node. The adjustment node receives occupancy amounts 1 to 4, and uses the application metric processing module to process occupancy amounts 1 to 4, obtaining processing results 1 to 4. The application metric processing module sends processing results 1 to 4 to the storage module. The storage module receives and stores processing results 1 to 4. The application profiling module obtains the occupancy amounts of management agents 11, 11, 21, and 22 for computing resources and / or storage resources in a specified historical period from the storage module, and determines historical features 1 to 4 based on the obtained occupancy amounts. The application profiling module sends historical features 1 to 4 to the adjuster. The adjuster receives historical features 1 to 4, and determines resource allocation values 1 to 4. The adjuster generates a resource adjustment instruction based on resource allocation values 1 to 4, and sends the resource adjustment instruction to management node 1 and management node 2. Management node 1 and management node 2 receive the resource adjustment instruction, and allocate resources for management agents 11, 11, 21, and 22 based on the resource adjustment instruction.
[0117] In this application, the adjustment node automatically adjusts the resources allocated to the management agent according to the historical features of the resources occupied by the management agent. In this way, when the occupancy amount of the management agent for resources changes, the adjustment node can automatically change the resources allocated to the management agent according to the occupancy amount of the management agent for resources, making the resources allocated to the management agent match the resources required by the management agent, and reducing resource waste.
[0118] It can be understood that, in order to implement the functions in the above embodiments, the adjustment node includes the corresponding hardware structure and / or software module for executing each function. Those skilled in the art should easily realize that, combining the units and method steps of each example described in the embodiments disclosed in the present application, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a certain function is executed in the way of hardware or computer software driving hardware depends on the specific application scenario and design constraint conditions of the technical solution.
[0119] In the above, in combination with Figures 1 to 6 , the resource allocation method provided according to this embodiment is described in detail. Next, in combination with Figure 7 , the resource allocation device provided in this embodiment will be described. This resource allocation device can be used to implement the functions of the adjustment node in the above method embodiments, and thus can also achieve the beneficial effects possessed by the above method embodiments. In this embodiment, this resource allocation device can be the adjustment node 120 as shown in Figure 1 , or can also be a module (such as a chip) applied to a server.
[0120] Figure 7 FIG. Figure 7 shows a schematic structural diagram of a resource allocation device provided by the present application. As shown in Figure 7 , the resource allocation device 700 includes: a transceiver module 710 and a processing module 720. The transceiver module 710 is used to: obtain the historical characteristics of the resources occupied by the management agent; the historical characteristics are used to indicate the occupancy of computing resources and / or storage resources by the management agent in a specified historical time period. The processing module 720 is used to: determine the resource allocation value of the management agent according to the historical characteristics. The resource allocation value is used to indicate the first computing resources and / or the first storage resources allocated to the management agent. The processing module 720 is further used to: allocate resources to the management agent according to the resource allocation value.
[0121] In some possible situations, the processing module 720 is specifically used to: determine the resource allocation value of the management agent according to the historical characteristics and / or the current resource allocation value. The current resource allocation value includes the current computing resources and the current storage resources allocated to the management agent.
[0122] In some possible situations, the processing module 720 is specifically used to: determine the first computing resources according to the occupancy of computing resources indicated by the historical characteristics and / or the current computing resources. The processing module 720 is further specifically used to: determine the first storage resources according to the occupancy of storage resources indicated by the historical characteristics and / or the current storage resources. The processing module 720 is further specifically used to: determine the resource allocation value according to the first computing resources and / or the first storage resources.
[0123] In some possible scenarios, the current computing resources include: an upper limit of computing resources and a lower limit of computing resources. The processing module 720 is specifically configured to: obtain the minimum occupied amount of computing resources of the management agent in a specified historical time period according to the occupied amount of computing resources indicated by the historical features. If the minimum occupied amount of computing resources is less than or equal to the first computing resource occupancy threshold, the processing module 720 is further specifically configured to: adjust the lower limit of computing resources by using the minimum occupied amount of computing resources to obtain an adjusted lower limit of computing resources. The processing module 720 is further specifically configured to: determine the first computing resource according to the upper limit of computing resources and the adjusted lower limit of computing resources.
[0124] In some possible scenarios, the processing module 720 is specifically configured to: obtain a first value according to the minimum occupied amount of computing resources and the lower limit of computing resources. The processing module 720 is further specifically configured to: obtain an adjusted lower limit of computing resources according to the first value and the first computing resource adjustment ratio.
[0125] In some possible scenarios, the current computing resources include: an upper limit of computing resources and a lower limit of computing resources. The processing module 720 is specifically configured to: obtain the maximum occupied amount of computing resources of the management agent in a specified historical time period according to the occupied amount of computing resources indicated by the historical features. If the maximum occupied amount of computing resources is less than or equal to the second computing resource occupancy threshold, the processing module 720 is further specifically configured to: adjust the upper limit of computing resources by using the maximum occupied amount of computing resources to obtain an adjusted upper limit of computing resources. The processing module 720 is further specifically configured to: determine the first computing resource according to the adjusted upper limit of computing resources and the lower limit of computing resources.
[0126] In some possible scenarios, the processing module 720 is specifically configured to: obtain a second value according to the maximum occupied amount of computing resources and the upper limit of computing resources. The processing module 720 is further specifically configured to: obtain an adjusted upper limit of computing resources according to the second value and the second computing resource adjustment ratio.
[0127] In some possible scenarios, the current storage resources include: an upper limit of storage resources and a lower limit of storage resources. The processing module 720 is specifically configured to: obtain the maximum occupied amount of storage resources of the management agent in a specified historical time period according to the occupied amount of storage resources indicated by the historical features. If the ratio of the maximum occupied amount of storage resources to the upper limit of storage resources is less than or equal to the storage resource ratio threshold, the processing module 720 is further specifically configured to: adjust the upper limit of storage resources by using the storage resource adjustment ratio to obtain an adjusted upper limit of storage resources. The processing module 720 is further specifically configured to: determine the first storage resource according to the adjusted upper limit of storage resources and the lower limit of storage resources.
[0128] In some possible scenarios, a first service is deployed in a Kubernetes cluster, a container orchestration engine. The first service is deployed in a first pod among at least one pod. The management agent includes a first management agent deployed in the first pod.
[0129] In some possible scenarios, the first service is also deployed in a second pod among at least one pod. The management agent also includes a second management agent deployed in the second pod.
[0130] In some possible scenarios, the computing resource is a processor and the storage resource is a memory.
[0131] Specifically, for more descriptions of the transceiver module 710 and the processing module 720, please refer to the relevant descriptions of the resource allocation method above, which will not be elaborated here.
[0132] In the case where the resource allocation device 700 corresponds to performing the steps executed by the adjustment node in the resource allocation method described in the embodiments of the present application, the above and other operations and / or functions of each module in the resource allocation device 700 are respectively for implementing the method flow executed by the adjustment node in the foregoing drawings.
[0133] It should be noted that if the above resource allocation device 700 is implemented by software modules, for example, the software modules can be provided to users for use through a cloud service subscription model, and users can select different subscription levels according to their needs; for another example, the software modules can also provide enterprise-level customization services with professional domain customization, interface personalization, and extended functions according to the needs of users or enterprises.
[0134] In addition, the resource allocation device 700 provided in the present application can also be provided to users as a value-added service, and the present application does not limit this.
[0135] The resource allocation device in the embodiments of the present application can also be implemented by hardware. For example, the hardware refers to a computing device, a chip, or a processor. For the specific implementation manner of the computing device, reference can be made to Figure 2 the description, and for the specific implementation manner of the chip and the processor, reference can be made to Figure 3 the description, which will not be elaborated here.
[0136] The method steps in this embodiment can be implemented in a hardware manner or by a processor executing software instructions. The software instructions can be composed of corresponding software modules, and the software modules can be stored in a random access memory (RAM), flash memory, read-only memory (ROM), programmable ROM (PROM), erasable PROM (EPROM), electrically erasable PROM (EEPROM), register, hard disk, removable hard disk, CD-ROM, or any other form of storage medium well-known in the art. An exemplary storage medium is coupled to the processor so that the processor can read information from the storage medium and write information to the storage medium. Of course, the storage medium can also be a component of the processor. The processor and the storage medium can be located in an ASIC. In addition, the ASIC can be located in a computing device. Of course, the processor and the storage medium can also exist as discrete components in a network device or a terminal device.
[0137] The embodiment of the present application also provides a computing device cluster. The computing device cluster includes at least one computing device. In some embodiments, the computing device can also be a terminal device such as a desktop computer, a laptop computer, or a smart phone. The computing device cluster can be used to implement the function of the adjustment node in the above method embodiment.
[0138] As Figure 8 shown, Figure 8 FIG. is a schematic structural diagram of a computing device cluster provided by the present application. The computing device cluster includes at least one computing device 200. Instructions for executing a resource allocation method can be stored in the same manner in the memory 213 of one or more of the computing devices 200 in the computing device cluster.
[0139] In some possible implementation manners, partial instructions for executing a resource allocation method can also be stored separately in the memory 213 of one or more of the computing devices 200 in the computing device cluster. In other words, a combination of one or more computing devices 200 can jointly execute instructions for executing a resource allocation method.
[0140] It should be noted that the memories 213 in different computing devices 200 in the computing device cluster can store different instructions, respectively for executing partial functions of the adjustment node. That is, the instructions stored in the memories 213 of different computing devices 200 can implement the functions of one or more of the transceiver module 710 and the processing module 720.
[0141] In some possible implementations, one or more computing devices in a computing device cluster can be connected via a network. The network can be a wide area network or a local area network, etc. Figure 9 shows a possible implementation. As Figure 9 shown, Figure 9 This is a schematic diagram of the connection between computing devices provided by this application. Two computing devices 200A and 200B are connected via a network. Specifically, they are connected to the network through the communication interfaces in each computing device. In this type of possible implementation, the instructions stored in the memory 213 of the computing device 200A can implement the functions implemented by the transceiver module 710. At the same time, the instructions stored in the memory 213 of the computing device 200B can implement the functions implemented by the processing module 720.
[0142] The embodiments of this application also provide a computer program product containing instructions. The computer program product can be software or a program product containing instructions that can run on a computing device or be stored in any available medium. When the computer program product runs on at least one computing device, it causes at least one computing device to execute the resource allocation method.
[0143] The embodiments of this application also provide a computer-readable storage medium. The computer-readable storage medium can be any available medium that a computing device can store or a data storage device such as a data center containing one or more available media. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a magnetic tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive), etc. The computer-readable storage medium includes instructions that instruct the computing device to execute the resource allocation method.
[0144] This application also provides a chip. The chip includes an interface circuit and a control circuit. The interface circuit is used to obtain the historical characteristics of the resources occupied by the management agent, and the control circuit is used to implement the function of adjusting nodes in the resource allocation method.
[0145] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer programs or instructions. When the computer program or instructions are loaded and executed on a computer, the processes or functions described in the embodiments of the present application are executed in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, a network device, a user device, or other programmable devices. The computer program or instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer program or instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center in a wired or wireless manner. The computer-readable storage medium can be any available medium that can be accessed by a computer, or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium, such as a floppy disk, a hard disk, or a magnetic tape; it can also be an optical medium, such as a digital video disc (DVD); or it can be a semiconductor medium, such as a solid state drive (SSD).
[0146] As described above, the above are only specific embodiments of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art within the technical scope disclosed in the present application can easily think of various equivalent modifications or substitutions, and these modifications or substitutions should all be covered within the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.
Claims
1. A resource allocation method, characterized in that: The method is applied to a resource allocation system, the resource allocation system comprising a regulating node and at least one working node, each of the at least one working node is deployed with at least one pod, each of the at least one pod is deployed with a management agent for managing service traffic, the regulating node is used to adjust resources allocated to the management agent, the method is performed by the regulating node, and the method comprises: Acquire historical characteristics of resource occupation by the management agent; the historical characteristics are used to indicate the amount of computing resources and / or storage resources occupied by the management agent in a specified historical time period; Determine a resource allocation value of the management agent according to the historical feature; the resource allocation value is used to indicate a first computing resource and / or a first storage resource allocated to the management agent; Resources are allocated to the management agent according to the resource allocation value.
2. The method according to claim 1, characterized in that The determining of the resource allocation value of the management agent according to the historical characteristics comprises: The resource allocation value of the management agent is determined according to the historical characteristics and / or the current resource allocation value; the current resource allocation value includes the current computing resources and / or the current storage resources allocated to the management agent.
3. The method according to claim 2, characterized in that Determining the resource allocation value of the management agent according to the historical characteristics and / or the current resource allocation value includes: Determine the first computing resource according to the amount of computing resource occupied indicated by the historical feature and / or the current computing resource; Determine the first storage resource according to the amount of storage resource occupied indicated by the historical feature and / or the current storage resource; The resource allocation value is determined according to the first computing resource and / or the first storage resource.
4. The method according to claim 3, characterized in that The current computing resources include: an upper limit of computing resources and a lower limit of computing resources, The determining the first computing resource according to the amount of computing resource occupied by the historical characteristic and the current computing resource includes: According to the occupation of computing resources indicated by the historical characteristics, obtaining the minimum occupation of computing resources by the management agent in the specified historical time period; If the minimum computing resource occupancy is less than or equal to the first computing resource occupancy threshold, adjusting the computing resource lower limit using the minimum computing resource occupancy to obtain an adjusted computing resource lower limit; The first computing resource is determined according to the computing resource upper limit and the adjusted computing resource lower limit.
5. The method according to claim 4, characterized in that The step of adjusting the computing resource lower limit by using the minimum computing resource occupancy to obtain an adjusted computing resource lower limit includes: Obtaining a first value according to the minimum occupancy of the computing resources and the lower limit of the computing resources; The adjusted computing resource lower limit is obtained according to the first value and the first computing resource adjustment ratio.
6. The method according to any one of claims 3 to 5, characterized in that: The current computing resources include: an upper limit of computing resources and a lower limit of computing resources, The determining the first computing resource according to the amount of computing resource occupied by the historical characteristic and the current computing resource includes: According to the occupation of computing resources indicated by the historical characteristics, obtaining the maximum occupation of computing resources by the management agent in the specified historical time period; If the maximum computing resource occupancy is less than or equal to the second computing resource occupancy threshold, adjusting the computing resource upper limit using the maximum computing resource occupancy to obtain an adjusted computing resource upper limit; The first computing resource is determined according to the adjusted computing resource upper limit and the computing resource lower limit.
7. The method according to claim 6, characterized in that The step of adjusting the computing resource upper limit by using the maximum computing resource occupancy to obtain an adjusted computing resource upper limit includes: Obtaining a second value according to the maximum occupancy of the computing resources and the upper limit of the computing resources; The adjusted computing resource upper limit is obtained according to the second value and the second computing resource adjustment ratio.
8. The method according to any one of claims 3 to 7, characterized in that: The current storage resources include: an upper limit of storage resources and a lower limit of storage resources, Determining the first storage resource according to the amount of storage resource occupied by the historical feature and the current storage resource includes: According to the occupation of storage resources indicated by the historical characteristics, obtaining the maximum occupation of storage resources by the management agent in the specified historical time period; If the proportion of the maximum storage resource occupancy to the storage resource upper limit is less than or equal to the storage resource proportion threshold, the storage resource upper limit is adjusted using the storage resource adjustment ratio to obtain an adjusted storage resource upper limit; The first storage resource is determined according to the adjusted storage resource upper limit and storage resource lower limit.
9. The method according to any one of claims 1 to 8, characterized in that The resource allocation system also includes a container orchestration engine Kubernetes cluster, the container orchestration engine Kubernetes cluster is deployed with a first service, the first service is deployed in a first pod in the at least one pod, and the management agent includes a first management agent deployed in the first pod.
10. The method according to claim 9, characterized in that The first service is also deployed in a second pod in the at least one pod, and the management agent further includes a second management agent deployed in the second pod.
11. The method according to any one of claims 1 to 10, characterized in that The computing resource is a processor, and the storage resource is a memory.
12. A resource allocation device, characterized in that: The device comprises: The transceiver module is used to: obtain the historical characteristics of the resources occupied by the management agent; the historical characteristics are used to indicate the amount of computing resources and / or storage resources occupied by the management agent in a specified historical time period; A processing module, configured to: determine a resource allocation value of the management agent according to the historical feature; the resource allocation value is used to indicate a first computing resource and / or a first storage resource allocated to the management agent; The processing module is further configured to allocate resources to the management agent according to the resource allocation value.
13. A processor, characterized in that: The processor includes an interface circuit and a control circuit; the interface circuit is used to obtain historical characteristics of resources occupied by the management agent, and cooperate with the control circuit to execute the method described in any one of claims 1-11.
14. A computing device cluster, characterized in that: The computing device cluster includes at least one computing device, each computing device includes a processor and a memory; the processor of the at least one computing device is used to execute instructions stored in the memory of the at least one computing device, so that the computing device cluster executes the method as described in any one of claims 1-11.
15. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes computer instructions; when the computer instructions are executed in a computing device, the computing device executes the method according to any one of claims 1 to 11.
16. A computer program product, characterized in that When the computer program product is run in a computing device, the computing device executes the method according to any one of claims 1 to 11.