Resource Processing Method and Storage Medium

By adjusting container resource allocation and placement decisions, the problem of low resource utilization in the function-as-a-service platform is solved, and efficient resource utilization and stability guarantee of function performance are achieved.

CN114741181BActive Publication Date: 2025-07-11ALIBABA (CHINA) CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210072247.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Priority Date
2022-01-18
Filing Date
2022-01-21
Publication Date
2025-07-11
Estimated Expiration
2042-01-21

AI Technical Summary

Technical Problem

In the function-as-a-service platform, the resource utilization rate of containers is low, and the existing technology has not been effectively solved.

Method used

By adjusting the resource allocation of containers, it reduces to the real usage part of each container, and makes placement decisions based on historical resources and function portrait data to ensure that the function performance remains unchanged.

Benefits of technology

It improves resource utilization, reduces operating costs, and ensures the performance stability of the function.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114741181B_ABST
    Figure CN114741181B_ABST
Patent Text Reader

Abstract

The present invention discloses a resource processing method and a storage medium. Among them, the method includes: obtaining a target container of a target function, where the target container is used to run the target function; obtaining the current resources already allocated to the target container; adjusting the current resources to the target resources of the target container, where the target resources are determined based on the target function; and running the target function in the target container based on the target resources. The present invention solves the technical problem of low resource utilization rate.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the fields of cloud computing and resource processing, and in particular, to a resource processing method and a storage medium. Background Art

[0002] Currently, when a Function as a Service (FaaS) platform provides computing services at the function granularity to users, during the life cycle of a container, the placement decision during creation only considers the resource requirements of a fixed size and does not consider the actual memory usage. For example, a container only uses 20% to 60% of the memory allocated to it, resulting in the technical problem of low resource utilization.

[0003] In view of the above problems, no effective solution has been proposed yet. Summary of the Invention

[0004] Embodiments of the present invention provide a resource processing method and a storage medium to at least solve the technical problem of low resource utilization.

[0005] According to an aspect of an embodiment of the present invention, there is provided a resource processing method, including: obtaining a target container of a target function, where the target container is used to run the target function; obtaining the current resources already allocated to the target container; adjusting the current resources to the target resources of the target container, where the target resources are determined based on the target function; and running the target function in the target container based on the target resources.

[0006] Optionally, adjusting the current resources to the target resources of the target container includes: in response to the target container not fully using the current resources, reducing the current resources to the target resources.

[0007] Optionally, the method further includes: obtaining the average historical resources used by the target function in a historical period, where the historical resources include the average historical resources; and determining the target resources based on the historical period and the average historical resources.

[0008] Optionally, the method further includes: obtaining portrait data of the target function, where the portrait data includes the maximum number of target containers allowed to be allocated to a virtual machine when the target container of the target function and the containers of other functions are co-located on the virtual machine; and determining the number of target containers allocated to the virtual machine based on the portrait data.

[0009] Optionally, the method further includes: monitoring the target container to obtain a first monitoring result; and in response to the first monitoring result indicating a performance degradation of the target function, performing a migration process or an isolation process on the target container.

[0010] According to another aspect of the embodiments of the present invention, a resource processing device is provided, including: a first acquisition unit configured to acquire a target container of a target function, where the target container is used to run the target function; a second acquisition unit configured to acquire the current resources already allocated to the target container; a first adjustment unit configured to adjust the current resources to the target resources of the target container, where the target resources are determined based on the target function; and a first operation unit configured to run the target function in the target container based on the target resources.

[0011] According to another aspect of the embodiments of the present invention, a resource processing device is provided from the virtual machine cluster side, including: a first determination unit configured to determine a target area where a virtual machine is located in the virtual machine cluster; a second determination unit configured to determine a target container of a target function based on the target area, where the target container of the target function is allowed to be allocated to the virtual machine and the target container is used to run the target function; a second adjustment unit configured to adjust the current resources already allocated to the target container to the target resources of the target container, where the target resources are determined based on the target function; and a second operation unit configured to run the target function in the target container based on the target resources.

[0012] The embodiments of the present invention further provide a computer-readable storage medium. The computer-readable storage medium includes a stored program, where when the program is run by a processor, it controls the device where the computer-readable storage medium is located to execute the resource processing method of the embodiments of the present invention.

[0013] The embodiments of the present invention further provide a processor. The processor is used to run a program, where when the program runs, it executes the resource processing method of the embodiments of the present invention.

[0014] The embodiments of the present invention further provide a resource processing system, which may include: a processor; and a memory connected to the processor and configured to provide instructions for the processor to perform the following processing steps: acquire a target container of a target function, where the target container is used to run the target function; acquire the current resources already allocated to the target container; adjust the current resources to the target resources of the target container, where the target resources are obtained based on the historical resources used by the target function in a historical period; and run the target function in the target container based on the target resources.

[0015] In an embodiment of the present invention, by adjusting the placement of containers and request routing, the target container of the objective function is obtained, where the target container is used to run the objective function; the current resources already allocated to the target container are obtained; the current resources are adjusted to the target resources of the target container, where the target resources are determined based on the objective function; and the objective function is run in the target container. That is to say, in this application, by reducing the memory allocation to the actually used part of each container of the function, the resource usage amount is reduced on the premise of ensuring the unchanged function performance, solving the technical problem of low resource utilization rate and achieving the technical effect of improving the resource utilization rate. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] The drawings described herein are used to provide a further understanding of the present invention, and constitute a part of this application. The illustrative embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation to the present invention. In the drawings:

[0017] Figure 1 is a hardware structure block diagram of a computer terminal (or mobile device) for implementing a resource processing method according to an embodiment of the present disclosure;

[0018] Figure 2 is a flowchart of a resource processing method according to an embodiment of the present disclosure;

[0019] Figure 3 is a flowchart of a resource processing method provided from the virtual machine cluster side according to an embodiment of the present disclosure;

[0020] Figure 4 is a schematic diagram of a system service process according to an embodiment of the present invention;

[0021] Figure 5 is a schematic diagram of the overall architecture of a new FaaS platform scheduling system according to an embodiment of the present disclosure;

[0022] Figure 6 is a schematic diagram of a resource processing device according to an embodiment of the present disclosure;

[0023] Figure 7 is a schematic diagram of a resource processing device provided from the virtual machine cluster side according to an embodiment of the present disclosure;

[0024] Figure 8 is a structure block diagram of a computer terminal according to an embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0025] To enable those skilled in the art to better understand the solution of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all of the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.

[0026] It should be noted that the terms "first", "second", etc. in the description and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and do not necessarily need to describe a specific order or sequence. It should be understood that such data can be interchanged under appropriate circumstances so that the embodiments of the present invention described here can be implemented in an order different from those illustrated or described here. In addition, the terms "comprising" and "having" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device comprising a series of steps or units does not necessarily need to be limited to those steps or units clearly listed, but may include other steps or units not clearly listed or inherent to these processes, methods, products or devices.

[0027] First, some nouns or terms that appear in the process of describing the embodiments of the present application are applicable to the following explanations:

[0028] Function as a Service (FaaS) platform is a form of cloud computing service. Users upload function code to the platform and trigger function execution by sending requests. The service provider needs to manage the code uploaded by users and create virtual machines and allocate containers for user functions when receiving requests.

[0029] Container is the carrier for running function code, which is used to provide isolated computing, network, storage and other resources. The same function shares a batch of containers, and different functions are isolated by containers.

[0030] Virtual Machine (VM) can refer to a virtual machine, which is the carrier of function instances. According to the resource specifications of containers, several containers can be created on each virtual machine, and multiple containers on one machine share the computing, network, storage and other resources of the machine.

[0031] Function Profile is a multi-dimensional index extracted according to the running characteristics of functions, such as Central Processing Unit (CPU), memory, network, latency, etc. It can be used to characterize the resource requirements and latency sensitivity of functions and serve as the input for scheduling decisions.

[0032] Resource Utilization, which is the proportion of the time taken for a function to execute to the total time of the machine resources. The higher the proportion, the higher the resource utilization.

[0033] Embodiment 1

[0034] According to an embodiment of the present invention, an embodiment of a method for resource processing is further provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. And although the logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in a different order than here.

[0035] The method embodiment provided by the first embodiment of this application can be executed in a mobile terminal, a computer terminal, or a similar computing device. Figure 1 A hardware structure block diagram of a computer terminal (or mobile device) for implementing an image processing method is shown. As Figure 1 shown, the computer terminal 10 (or mobile device 10) may include one or more processors 102 (the processors 102 are shown as 102a, 102b,..., 102n in the figure) (the processors 102 may include, but are not limited to, processing devices such as a microprocessor MCU or a programmable logic device FPGA), a memory 104 for storing data, and a transmission device 106 for communication functions. In addition, it may further include: a display, an input / output interface (I / O interface), a universal serial bus (USB) port (which may be included as one of the ports of the I / O interface), a network interface, a power supply, and / or a camera. Those of ordinary skill in the art can understand that Figure 1 the structure shown is only schematic and does not limit the structure of the above-mentioned electronic device. For example, the computer terminal 10 may further include more or fewer components than those Figure 1 shown, or have a different configuration from that Figure 1 shown.

[0036] It should be noted that the above one or more processors 102 and / or other data processing circuits are generally referred to as "data processing circuits" in this article. The data processing circuit can be embodied in whole or in part as software, hardware, firmware, or any arbitrary combination thereof. In addition, the data processing circuit can be a single independent processing module, or be incorporated in whole or in part into any one of the other elements in the computer terminal 10 (or mobile device). As involved in the embodiments of this application, the data processing circuit is a kind of processor control (such as the selection of a variable resistance terminal path connected to an interface).

[0037] The memory 104 can be used to store software programs and modules of application software, such as the program instruction / data storage device corresponding to the resource processing method in the embodiments of the present invention. The processor 102 executes various functional applications and data processing by running the software programs and modules stored in the memory 104, that is, implements the above-mentioned resource processing method. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memories, or other non-volatile solid-state memories. In some instances, the memory 104 may further include a memory remotely disposed relative to the processor 102, and these remote memories can be connected to the computer terminal 10 through a network. Examples of the above network include but are not limited to the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.

[0038] The transmission device 106 is used to receive or send data via a network. Specific examples of the above network may include a wireless network provided by a communication provider of the computer terminal 10. In one instance, the transmission device 106 includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices through a base station and thus communicate with the Internet. In one instance, the transmission device 106 can be a Radio Frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0039] The display can be, for example, a touch-screen liquid crystal display (LCD), and the liquid crystal display enables a user to interact with the user interface of the computer terminal 10 (or mobile device).

[0040] It should be noted here that in some alternative embodiments, the above Figure 1 shown computer device (or mobile device) may include hardware elements (including circuits), software elements (including computer code stored on a computer-readable medium), or a combination of both hardware elements and software elements. It should be pointed out that Figure 1 is only an example of a specific specific instance and is intended to show the types of components that may exist in the above computer device (or mobile device).

[0041] Under the above operating environment, the embodiments of the present disclosure provide a resource processing method.

[0042] Figure 2 is a flowchart of a resource processing method according to an embodiment of the present invention. As Figure 2 shown, the resource processing method may include the following steps:

[0043] Step S202, obtain a target container of a target function, where the target container is used to run the target function.

[0044] In the technical solution provided in step S202 of the present invention, in the FaaS platform, the target container of the target function can be obtained. The FaaS platform can provide users with computing services at the function granularity. Users upload function code to the platform. When users need to execute a function, the platform creates a container in the cluster and executes the user code therein. Preferably, the FaaS platform is a public cloud FaaS platform.

[0045] In this embodiment, the above-mentioned target container can be a carrier for running function code, which can provide isolated resources such as computing, network, and storage. Among them, the same function shares a batch of containers, and different functions are isolated by containers.

[0046] In this embodiment, the target function can be uploaded to the FaaS platform in the form of program code. The target function is implemented by sending a request during execution. When the service provider receives the request, it creates a virtual machine and allocates a container for the user function.

[0047] In this embodiment, optionally, when obtaining the target container of the target function, the portrait data of the target function can be obtained. The portrait data includes the maximum number of target containers that can be allocated to the virtual machine when the target container of the target function and the containers of other functions are co-located on the virtual machine; the number of target containers allocated to the virtual machine is determined based on the portrait data.

[0048] Step S204, obtain the current resources already allocated to the target container.

[0049] In the technical solution provided in step S204 of the present invention, after the user uploads the function code to the platform, the function execution is triggered by sending a request. When the request is received, a virtual machine is created and a container is allocated for the user function, and then the current memory already allocated to the container is obtained.

[0050] In this embodiment, the current resources can be resources such as memory, central processing unit, input / output, etc. provided for the user to execute the function code, which are not limited here.

[0051] Step S206, adjust the current resources to the target resources of the target container, where the target resources are determined based on the target function.

[0052] In the technical solution provided in step S206 of the present invention, the current resources can be adjusted to the target resources of the target container. For example, the target resources can be the memory actually used by each container. Since most containers do not fully use the allocated resources, an intuitive improvement is to reduce the memory allocation to the memory actually used by each container, which also constitutes the most basic idea of resource overcommitment.

[0053] For example, elaborating in detail with resources being memory, for each function, record its historical average memory usage u. Assume the configured running time size is c. The scheduler allocates [pu+(1-p)c] memory for it when creating a container, where p is an adjustable percentage used to set some buffer areas in memory. The operation and maintenance personnel can adjust the degree of resource overcommitment by adjusting the p value of each function.

[0054] In this embodiment, optionally, in response to the target container not fully using the current resources, reduce the current resources to the target resources.

[0055] In this embodiment, the target resources can be resources such as the actually used memory, central processing unit, and input / output of each container, without limitation here.

[0056] In this embodiment, the target resources can be obtained based on the historical resources used by the target function in the historical period, or can be a value of the target function that has a certain mapping relationship with the target resources.

[0057] Step S208, run the target function in the target container based on the target resources.

[0058] In the technical solution provided in step S208 of the present invention above, run the target function in the target container based on the target resources. For example, after reducing the memory allocation to the actually used memory of each container, the function code can be executed in the allocated container based on the actually used memory.

[0059] In this embodiment, optionally, monitor the target container to obtain a first monitoring result; in response to the first monitoring result indicating a performance degradation of the target function, perform migration processing or isolation processing on the target container. For example, when the performance of the target function deteriorates, the performance repair of the target function is mainly achieved through the migration or isolation of the container.

[0060] Through steps S202 to S208 of the present application above, obtain the target container of the target function, where the target container is used to run the target function; obtain the current resources already allocated to the target container; adjust the current resources to the target resources of the target container, where the target resources are obtained based on the historical resources used by the target function in the historical period; run the target function in the target container based on the target resources. That is to say, in the present application, by reducing the memory allocation to the actually used part of each container of the function, the resource usage amount is reduced on the premise of ensuring the function performance remains unchanged, solving the technical problem of low resource utilization rate and achieving the technical effect of improving the resource utilization rate.

[0061] The above method of this embodiment is further introduced below.

[0062] As an alternative implementation, in step S206, the method includes: in response to the target container not fully using the current resources, reducing the current resources to the target resources.

[0063] In this embodiment, the target resources can be the memory actually used by each container. Since most containers do not fully use the allocated resources, the memory allocation can be reduced to the memory actually used by each container.

[0064] In this embodiment, in response to the target container not fully using the current resources, reducing the current resources to the target resources. For example, when it is detected that the target container does not fully use the current resources, a signal for indicating this information is generated, and in response to this signal, the current resources are reduced to the actually used resources.

[0065] As an alternative implementation, after reducing the current resources to the target resources, the method further includes: based on the target resources, increasing the original number of target containers allocated to the virtual machine to the target number.

[0066] In this embodiment, based on the target resources, increasing the original number of target containers allocated to the virtual machine to the target number. For example, the resource improvement is mainly achieved by resource overcommitment. When placing containers, the memory allocated to each container is reduced, and the effect is that the number of containers allocated to each virtual machine becomes correspondingly larger, and the number of virtual machines required to serve the same number of containers is reduced, thereby saving the cost required for service operation.

[0067] As an alternative implementation, in step S206, the method further includes: obtaining the average historical resources used by the target function in the historical period, where the historical resources include the average historical resources; determining the target resources based on the historical period and the average historical resources.

[0068] For example, taking the resource as memory for detailed elaboration, for each function, record its historical average used memory u. Assume that the configured running time size is c. The scheduler allocates [pu+(1-p)c] memory for it when creating the container, where p is an adjustable percentage used to set some buffer areas in the memory. The operation and maintenance personnel can adjust the degree of resource overcommitment by adjusting the p value of each function.

[0069] In this embodiment, the historical period can be the running duration configured for the function, and the average historical resources can be the historical average used memory.

[0070] In this embodiment, determining the target resources based on the historical period and the average historical resources. For example, the scheduler allocates [pu+(1-p)c] memory for the container when creating it.

[0071] As an alternative implementation, the method further includes: obtaining target parameters of the target function, where the target parameters are used to determine the oversubscription degree of the target resource; determining the target resource based on the historical period and the average historical resources, including: determining the target resource based on the historical period, the average historical resources, and the target parameters.

[0072] In this embodiment, the target parameter can be an adjustable percentage used to set some buffer areas in the memory.

[0073] In this embodiment, determining the target resource based on the historical period and the average historical resources includes: determining the target resource based on the historical period, the average historical resources, and the target parameters. For example, when the scheduler creates a container, it allocates [(pu + (1 - p)c)] memory for it, where resource oversubscription can improve resource utilization.

[0074] As an alternative implementation, in step S201, the method further includes: obtaining portrait data of the target function, where the portrait data includes the maximum number of target containers that can be allocated to the virtual machine when the target container of the target function and the containers of other functions are co-located on the virtual machine; determining the number of target containers allocated to the virtual machine based on the portrait data.

[0075] In this embodiment, resource oversubscription can improve resource utilization, but at the same time it will cause the problem of function performance degradation. Therefore, we introduce a co-location portrait for functions. When the placer follows the co-location portrait to make placement decisions, the performance of the function can be guaranteed. Among them, when some requests need to create new containers, the placer can decide how to place them.

[0076] In this embodiment, the portrait data of the target function can be data that records the maximum number that can be placed when this function and another function are co-located on one machine.

[0077] In this embodiment, obtaining the portrait data of the target function, for example, to obtain the co-location portrait, the scheduler will try to place the containers of different functions on the same machine and adjust the number of containers to observe whether the performance is affected. The maximum number observed will be recorded in the co-location portrait.

[0078] In this embodiment, determining the number of target containers allocated to the virtual machine based on the portrait data, for example, the containers on the virtual machines in the cluster planning area will be placed according to the co-location portrait of the function, so the performance of the containers in the planning area is relatively stable.

[0079] As an alternative implementation, for obtaining the portrait data of the target function, the method includes: in response to the virtual machine being located in the first target area, obtaining the portrait data of the target function.

[0080] In this embodiment, the first target area may be a cluster planning area, and containers can be placed on virtual machines in the cluster planning area (Planned Zone) according to the portraits of functions.

[0081] In this embodiment, in response to the virtual machine being located in the first target area, portrait data of the target function is obtained. For example, when it is detected that the virtual machine is located in the cluster planning area, a signal representing this information is generated, and in response to this signal, the co-location portrait of each function is obtained.

[0082] As an alternative implementation, in step S208, the method further includes: monitoring the target container to obtain a first monitoring result; in response to the first monitoring result indicating a performance degradation of the target function, performing a migration process or an isolation process on the target container.

[0083] In this embodiment, containers in the cluster mixer are not placed according to portraits, so the performance of the containers requires additional monitoring and repair mechanisms for protection.

[0084] In this embodiment, the target container is monitored to obtain a first monitoring result. For example, the scheduler's monitoring of function performance is mainly based on the performance rules it formulates. The performance rules include the standards that the function request latency needs to meet within a period of time, such as the average latency or the tail latency being lower than a certain specific value. The monitor will continuously read the latency of the function in the past period of time and determine whether the corresponding performance rules are met.

[0085] In this embodiment, in response to the first monitoring result indicating a performance degradation of the target function, a migration process or an isolation process is performed on the target container. For example, when it is detected that the performance of the target function has decreased, a signal representing this information is generated, and in response to this signal, a migration process or an isolation process is performed on the target container.

[0086] As an alternative implementation, the method further includes: in response to the virtual machine allocated to the target container being located in the second target area, monitoring the target container to obtain a first monitoring result.

[0087] In this embodiment, the second target area may be a cluster mixing area, and the cluster mixing area can place containers of any function together and achieve the purpose of saving resources through resource overcommitment.

[0088] In this embodiment, the first monitoring result may be the performance of the target function.

[0089] In this embodiment, in response to the virtual machine allocated to the target container being located in the second target area, the target container is monitored to obtain a first monitoring result. For example, when it is detected that the container is located in the cluster mixing area, a signal is generated to represent this information, and in response to this signal, the container located in the cluster mixing area is monitored to obtain the performance result of the function.

[0090] As an alternative implementation, to monitor the target container to obtain a first monitoring result, the method includes: obtaining the latency duration for the target function to respond to the target request in the target container; in response to the latency duration being greater than the target duration, determining that the first monitoring result is used to indicate a performance degradation of the target function.

[0091] In this embodiment, the latency duration can be the average latency or the tail latency of function requests within a period of time being lower than a certain specific value.

[0092] For example, for the containers in the cluster mixer, the scheduler mainly monitors the function performance according to the performance rules it formulates. The performance rules include the standards that the function request latency needs to meet within a period of time, such as the average latency or the tail latency being lower than a certain specific value. The monitor will continuously read the latency of the function in the past period of time to determine whether the corresponding performance rules are satisfied.

[0093] As an alternative implementation, to perform a migration process on the target container, the method includes: migrating the target container from the original virtual machine to the target virtual machine, where the target virtual machine includes at least one of the following: a virtual machine with a usage rate lower than the target threshold, a virtual machine that has been allocated the same container as the target container, and a virtual machine in the third target area where the resources are not oversubscribed.

[0094] In this embodiment, the third target area can be the cluster control area, which is a non-oversubscribed environment and will be used as a benchmark for performance comparison and also as the ultimate way to improve performance.

[0095] For example, container migration can follow different rules. For example, migrating the container to the virtual machine with the lowest usage rate, or migrating it to a virtual machine with other identical containers. If migration cannot effectively alleviate and fix the performance problem, the control area in the cluster provides a series of virtual machines with non-oversubscribed resources, and migrating the container there can achieve an effect similar to isolation.

[0096] As an alternative implementation, after performing the migration process or isolation process on the target container, the method further includes: monitoring the target container after the migration process or isolation process to obtain a second monitoring result; in response to the second monitoring result being used to indicate a performance degradation of the target function, determining that the target function is in an abnormal state.

[0097] In this embodiment, the target container after migration processing or isolation processing is monitored to obtain a second monitoring result. For example, if the problem of performance degradation still cannot be solved after the migration processing or isolation processing of the target container.

[0098] In this embodiment, in response to the second monitoring result indicating a performance degradation of the target function, it is determined that the target function is in an abnormal state. For example, it is detected that the problem of performance degradation still cannot be solved after the migration processing or isolation processing of the target container, and a signal for indicating this information is generated. In response to this signal, it is explained that the problem originates from the function itself. For example, there is a problem with the third-party dependencies of the function.

[0099] Figure 3 It is a flowchart of a resource processing method provided from the virtual machine cluster side according to an embodiment of the present invention. As Figure 3 shown, the resource processing method may include the following steps:

[0100] Step S302, determining the target area where the virtual machine is located in the virtual machine cluster. In the technical solution provided in step S302 of the present invention above, the target area may include: a planned area, a mixed area, and a control area. Among them, containers can be placed on the virtual machines in the planned area (PlannedZone) according to the portrait of the function. In the mixed area (Mixed Zone), containers of any function can be placed together, and resource overcommitment is achieved to save resources. The control area (Control Zone) is a non-overcommitted environment, which will be used as a benchmark for performance comparison and also as the ultimate way to improve performance.

[0101] In this embodiment, the target area where the virtual machine is located in the virtual machine cluster can be determined. For example, it is determined that the virtual machine is in one of the planned area, the mixed area, and the control area.

[0102] Step S304, determining the target container of the target function based on the target area, where the target container of the target function is allowed to be allocated to the virtual machine, and the target container is used to run the target function.

[0103] In the technical solution provided in step S304 of the present invention above, the target container of the target function can be determined based on the target area. For example, containers can be placed on the virtual machines in the planned area according to the co-location portrait of the function. When the function performance degrades, if migration cannot effectively alleviate and repair the performance problem, the control area provides a series of virtual machines with non-overcommitted resources, and migrating the container there can achieve an effect similar to isolation.

[0104] In this embodiment, optionally, the target containers of the objective function that are allowed to be allocated to virtual machines include: in response to the virtual machine being located in the first target area, obtaining portrait data of the objective function, where the portrait data includes the maximum number of target containers that are allowed to be allocated to the virtual machine when the target containers of the objective function and the containers of other functions are co-located on the virtual machine.

[0105] For example, the first target area may be a cluster planning area. This portrait records the maximum number that can be placed when this function and another function are co-located on one machine. When the placer follows the co-location portrait to make placement decisions, the performance of the function can be guaranteed. To obtain the co-location portrait, the scheduler will attempt to place the containers of different functions on the same machine and adjust the number of containers to observe whether the performance is affected. The maximum number observed will be recorded in the co-location portrait. The virtual machines in the cluster planning area will be placed according to the co-location portrait of the function, so the performance of the containers in the planning area is relatively stable.

[0106] Step S306: Adjust the current resources already allocated to the target container to the target resources of the target container, where the target resources are determined based on the objective function.

[0107] In the technical solution provided in step S306 of the present invention above, the target resources are determined based on the objective function. For example, the target resources may be obtained based on the historical resources used by the objective function in a historical period, or may be a value of the objective function that has a certain mapping relationship with the target resources.

[0108] In this embodiment, the current resources already allocated to the target container can be adjusted to the target resources of the target container. For example, using the method of resource overcommitment, the current resources (such as memory) already allocated to the target container can be adjusted to the target resources of the target container.

[0109] In this embodiment, optionally, adjusting the current resources already allocated to the target container to the target resources of the target container includes: in response to the virtual machine to which the target container is allocated being located in the second target area, monitoring the target container to obtain a first monitoring result; in response to the first monitoring result indicating a decrease in the performance of the objective function, performing migration processing or isolation processing on the target container.

[0110] For example, the second target area can be a cluster mixing area. Containers in the cluster mixing area are not placed according to the portrait. Therefore, the performance of the containers requires additional monitoring and repair mechanisms to protect. The scheduler mainly monitors the function performance according to the performance rules it formulates. The performance rules include the standards that the function request latency needs to reach within a period of time, such as the average latency or the tail latency being lower than a certain specific value. The monitor will continuously read the latency of the function in the past period of time and determine whether the corresponding performance rules are met. When the function performance deteriorates, the performance repair is mainly completed through the migration or isolation of the containers.

[0111] In this embodiment, optionally, adjusting the currently allocated resources of the target container to the target resources of the target container further includes: migrating the target container from the original virtual machine to the target virtual machine, where the target virtual machine includes at least one of the following: a virtual machine with a utilization rate lower than the target threshold, a virtual machine that has been allocated the same container as the target container, and a virtual machine in the third target area where the resources are not oversubscribed.

[0112] For example, the third target area can be a cluster control area. Container migration can follow different rules. For example, migrating the container to the virtual machine with the lowest utilization rate, or migrating it to a virtual machine with other identical containers. If migration cannot effectively alleviate and repair the performance problem, the control area in the cluster provides a series of virtual machines with non-oversubscribed resources. After migrating the container there, an effect similar to isolation can be achieved.

[0113] Step S308, running the target function in the target container based on the target resources.

[0114] In the technical solution provided in step S308 of the present invention, the target function can be run in the target container based on the target resources. For example, after reducing the memory allocation to the actual used memory of each container, the function code can be executed in the allocated container based on the actual used memory.

[0115] In the embodiments of the present disclosure, resource improvement is mainly achieved by resource oversubscription. When placing containers, the memory allocated to each container is reduced. The effect is that the number of containers allocated to each virtual machine increases correspondingly, and the number of virtual machines required to serve the same number of containers decreases. At the same time, the performance of the functions is monitored in real time, and the containers with problems are alleviated or processed in a timely manner. Therefore, the performance of the functions is not affected by resource oversubscription, the resource utilization rate of the cluster can be improved, and the performance of the containers is protected from being affected, solving the technical problem of low resource utilization rate and achieving the technical effect of improving the resource utilization rate.

[0116] The preferred implementation manners of the above method of this embodiment are further introduced below.

[0117] The FaaS platform provides users with computing services at the function level. Users upload function code to the platform. When a user needs to execute a function, the platform creates a container in the cluster and executes the user code therein. During the service process, the platform faces two scheduling decisions:

[0118] 1) When creating a container, the platform needs to select a suitable location among the machines in the cluster. If the containers are too dispersed, it will lead to a decrease in machine utilization and increase the platform's operating costs; if they are too concentrated, it will cause interference between containers and affect the execution efficiency of user functions.

[0119] 2) Since a single user function may create multiple containers on different machines, the platform needs to decide the location of the container to be executed when an execution request is received.

[0120] Figure 4 is a schematic diagram of a system service process according to an embodiment of the present disclosure. As Figure 4 shown, the challenge of the FaaS platform resource scheduling problem stems from the high heterogeneity of service customers. If there is only a single function type, both container placement and request routing can be solved by simple algorithms.

[0121] First, the customers of the FaaS platform come from different industries and companies, and their function types are diverse, which gives rise to many problems faced by the scheduler. First, the resource requirements of different functions are different. Some functions continuously consume a large amount of CPU resources, some functions occupy a large amount of memory, and some functions use other resources such as input / output (I / O for short). How to combine different functions together and make full use of all the resources on each machine has become a difficult problem. Research shows that for a given set of machines and tasks with fixed resources, the algorithm for finding the placement combination has exponential complexity. Therefore, the FaaS platform requires an optimized, fast, and effective algorithm.

[0122] Second, the number of functions served by the platform is extremely large. With the rapid development and iteration of cloud computing and FaaS products, the number of functions has also increased at an extremely fast rate, which poses higher requirements for the scalability of the scheduling algorithm. When the number of functions is small, the number of combinations between functions is also relatively small, and simple methods such as traversal and enumeration are still feasible. However, as the number of functions increases, the scheduler cannot find a qualified combination through simple search. Therefore, this poses a challenge to the process optimization of functions.

[0123] Finally, different functions have different performance requirements. For some customers' functions, on the critical path of their functions, a decline in function performance will degrade the overall quality of their functions. Therefore, such functions have extremely high requirements for performance. For some customers' functions that belong to offline processing or asynchronous calls, the performance of the functions has no decisive impact on the customers' functions. Therefore, the requirements for function performance are relatively low. Currently, in the scheduling system, the performance of different functions is not distinguished. When problems occur in the system, it may affect all functions and have a negative impact on users who are sensitive to performance. In summary, the FaaS platform scheduler needs to adjust container placement and request routing to achieve efficient resource utilization without affecting function performance.

[0124] In the prior art, the scheduler of the FaaS platform is centered around simple linear search. In the container placement problem, each machine has different available resource quantities, and newly created containers have certain resource requirements. Therefore, the necessary condition for placement is that the available resources of the machine are greater than the container requirements. The existing scheduler scans the existing machines linearly according to this requirement and stops scanning when a machine that meets the conditions is found, and creates the corresponding container on the machine. When all machines do not meet the requirements, the platform will create new machines to expand the cluster.

[0125] When routing requests, the main strategy of the current scheduler is to route requests to the container that has executed the request most recently. The purpose of this strategy is to keep as many containers as possible in an idle state for as long as possible, so that they can be recycled earlier and resource utilization can be improved. In the specific implementation, the containers are sorted according to the most recently called time, and the scheduler linearly scans to find an idle container and then sends the request to that container.

[0126] There are mainly two problems with the existing solutions. One is the underutilization of resources, and the other is that function performance is easily interfered with. During the life cycle of a container, the placement decision at creation only considers the resource requirements of a fixed size and does not consider the actual memory usage; the residency mechanism before release means that there are idle CPU cycles. In most cases, a container only uses 20% to 60% of its allocated memory; in terms of CPU, 40% of the containers are idle for more than 10% of the time, and 25% of the sandboxes are idle for more than 50% of the time. When routing requests, the existing solutions only consider the most recent usage time of the container and do not consider other containers on the same machine. Therefore, there may be too many containers in the execution state on the same machine, resulting in competition for resources and a decline in container performance.

[0127] Figure 5 is a schematic diagram of the overall framework of a new FaaS platform scheduling system according to an embodiment of the present disclosure, as Figure 5As shown, the Scheduler is on the critical path of service requests, and the Watchdog runs in the background. Its workflow can be as follows:

[0128] 1) When some requests need to create new containers, the Placer decides how to place them;

[0129] 2) Most incoming requests are processed by the Router that selects containers for them. Each function has its own router. The Scheduler exposes a Remote Procedure Call interface that allows other components to update the states of the router and the Placer;

[0130] 3) If a function has a sufficient number of requests, the Profiler profiles its resource usage and function co-location;

[0131] 4) This profiling information is passed back to the Scheduler to update the corresponding placement policy;

[0132] 5) When the function latency deviates from the normal value, the Monitor will detect this decline;

[0133] 6) It initiates an RPC call to the Scheduler to start performance diagnosis or performance repair.

[0134] The virtual machine cluster is logically divided into three zones. Containers are placed on the virtual machines in the Planned Zone according to the profiling of the functions. The specific placement method will be described below. In the Mixed Zone, containers of any function are placed together, and resource overcommitment is achieved to save resources. The Monitor continuously observes and repairs the performance decline caused by resource overcommitment. The Control Zone is a non-overcommitted environment, which will be used as a benchmark for performance comparison and also as the ultimate way to improve performance.

[0135] Since most containers do not fully utilize the allocated resources, an intuitive improvement is to reduce the memory allocation to the actual used part of each container, which also constitutes the most basic idea of resource overcommitment. Specifically, for each function, we record its historical average used memory u. Assuming the configured running time size is c, the Scheduler allocates [pu+(1-p)c] memory for it when creating a container, where p is an adjustable percentage used to set some buffer areas in memory. The operation and maintenance personnel can adjust the degree of resource overcommitment by adjusting the p value of each function.

[0136] Resource oversubscription can improve resource utilization, but at the same time it will cause problems of function performance degradation. Therefore, we introduce the co-location portrait for functions. This portrait records the maximum number of colocations of this function with another function on one machine. When the placer follows the co-location portrait to make placement decisions, the performance of the function can be guaranteed. To obtain the co-location portrait, the scheduler will try to place containers of different functions on the same machine and adjust the number of containers to observe whether the performance is affected. The maximum number observed will be recorded in the co-location portrait. The virtual machines in the cluster planning area will be placed according to the co-location portrait of the function, so the performance of the containers in the planning area is relatively stable.

[0137] The containers in the cluster mixer are not placed according to the portrait, so the performance of the containers requires additional monitoring and repair mechanisms to protect. The scheduler mainly monitors the function performance according to the performance rules it formulates. The performance rules include the standards that the function request latency needs to meet within a period of time, such as the average latency or the tail latency being lower than a certain specific value. The monitor will continuously read the latency of the function in the past period of time and judge whether the corresponding performance rules are met.

[0138] When the function performance degrades, the performance repair is mainly achieved through container migration or isolation. Container migration can follow different rules, such as migrating the container to the virtual machine with the lowest utilization rate, or migrating it to the virtual machine with other identical containers. If migration cannot effectively alleviate and repair the performance problem, the control area in the cluster provides a series of virtual machines with no oversubscribed resources. After migrating the container there, an effect similar to isolation can be achieved. If isolation still cannot solve the problem of performance degradation, it means that the problem comes from the function itself, such as problems with the third-party dependencies of the function. Therefore, this problem has exceeded the scope that the service provider can solve.

[0139] The embodiment of the present invention designs a complete scheduling system for the public cloud FaaS platform, achieving the technical effect of effectively improving resource utilization and reducing operating costs compared with the existing system; by designing a method for co-locating portraits of different functions, the purpose of depicting the behaviors of different functions is realized, achieving the technical effect of effectively showing the relationship between function performance and resource allocation, enabling the scheduler to achieve a more resource-saving container placement; by inferring the reasons for function performance problems, on the basis of traditional performance monitoring, the technical effect of effectively identifying whether the performance reason comes from the system internal or the function itself can be achieved, so that the service provider can effectively classify and process; by providing performance guarantee for functions and using performance monitoring and performance repair mechanisms to ensure that functions have a unified performance in different environments, the technical effect of improving the service quality is achieved.

[0140] In the embodiments of the present disclosure, resource improvement is mainly achieved through resource oversubscription. When placing containers, the memory allocated to each container is reduced. As a result, the number of containers allocated to each virtual machine increases correspondingly, and the number of virtual machines required to serve the same number of containers decreases. At the same time, the performance of the function is monitored in real time, and problems occurring in the containers are alleviated or processed in a timely manner. Therefore, the performance of the function is not affected by resource oversubscription, the resource utilization rate of the cluster can be improved, and the performance of the containers is protected from being affected, solving the technical problem of low resource utilization rate and achieving the technical effect of improving the resource utilization rate.

[0141] Embodiment 2

[0142] According to an embodiment of the present invention, there is also provided a resource processing apparatus for implementing the above-mentioned Figure 2 resource processing method shown.

[0143] Figure 6 is a schematic diagram of a resource processing apparatus according to an embodiment of the present invention. As Figure 5 shown, the image processing apparatus 60 may include: a first acquisition unit 61, a second acquisition unit 62, a first adjustment unit 63, and a first operation unit 64.

[0144] The first acquisition unit 61 is configured to acquire a target container of a target function, where the target container is used to run the target function;

[0145] The second acquisition unit 62 is configured to acquire the current resources already allocated to the target container;

[0146] The first adjustment unit 63 is configured to adjust the current resources to the target resources of the target container, where the target resources are determined based on the target function;

[0147] The first operation unit 64 is configured to run the target function in the target container based on the target resources.

[0148] It should be noted here that the above-mentioned first acquisition unit 61, second acquisition unit 62, first adjustment unit 63, and first operation unit 64 correspond to steps S202 to S208 in Embodiment 1. The instances and application scenarios implemented by the four units and the corresponding steps are the same, but are not limited to the content disclosed in the above-mentioned Embodiment 1. It should be noted that the above units, as part of the apparatus, can run in the computer terminal 10 provided in Embodiment 1.

[0149] Optionally, the first acquisition unit 61 includes: a first acquisition module and a first determination module, where the first acquisition module may include: a first response module. Among them, the first acquisition module is used to acquire the portrait data of the target function, where the portrait data includes the maximum number of target containers that can be allocated to the virtual machine when the target container of the target function and the containers of other functions are co-located on the virtual machine; the first determination module is used to determine the number of target containers allocated to the virtual machine based on the portrait data; the first response module is used to acquire the portrait data of the target function in response to the virtual machine being located in the first target area.

[0150] Optionally, the first adjustment unit 63 includes: a second response module, where the second response module may include: a second response subunit. Among them, the second response module is used to reduce the current resources to the target resources in response to the target container not fully using the current resources; the second response subunit is used to increase the original number of target containers allocated to the virtual machine to the target number based on the target resources after reducing the current resources to the target resources.

[0151] Optionally, the first adjustment unit 63 further includes: a second acquisition module and a second determination module, where the second acquisition module may include: a second acquisition subunit, and the second determination module may include: a second determination subunit. Among them, the second acquisition module is used to acquire the average historical resources used by the target function in the historical period, where the historical resources include the average historical resources; the second determination module is used to determine the target resources based on the historical period and the average historical resources; the second acquisition subunit is used to acquire the target parameters of the target function, where the target parameters are used to determine the overselling degree of the target resources; the second determination subunit is used to determine the target resources based on the historical period and the average historical resources, including: determining the target resources based on the historical period, the average historical resources, and the target parameters.

[0152] Optionally, the first operation unit 64 includes: a monitoring module and a migration module. Among them, the monitoring module may include: a first monitoring subunit, a third acquisition subunit, and a third response subunit. The migration module may include: a migration subunit, a second monitoring subunit, and a fourth response subunit. Among them, the monitoring module is used to monitor the target container to obtain a first monitoring result; the migration module is used to, in response to the first monitoring result indicating a performance degradation of the target function, perform a migration process or an isolation process on the target container; the first monitoring subunit is used to, in response to the virtual machine allocated to the target container being located in the second target area, monitor the target container to obtain a first monitoring result; the third acquisition subunit is used to acquire the latency duration of the target function to respond to the target request in the target container; the third response subunit is used to, in response to the latency duration being greater than the target duration, determine that the first monitoring result indicates a performance degradation of the target function; the migration subunit is used to migrate the target container from the original virtual machine to the target virtual machine, where the target virtual machine includes at least one of the following: a virtual machine with a utilization rate lower than the target threshold, a virtual machine that has been allocated the same container as the target container, and a virtual machine in the third target area where the resources are not oversubscribed; the second monitoring subunit is used to monitor the target container after the migration process or the isolation process to obtain a second monitoring result; the fourth response subunit is used to, in response to the second monitoring result indicating a performance degradation of the target function, determine that the target function is in an abnormal state. In the above embodiments of the present disclosure, through the first acquisition unit 61, the target container of the target function is acquired, where the target container is used to run the target function; through the second acquisition unit 62, the current resources already allocated to the target container are acquired; through the first adjustment unit 63, the current resources are adjusted to the target resources of the target container, where the target resources are determined based on the target function; through the first operation unit 64, the target function is run in the target container based on the target resources. That is to say, in this application, by reducing the memory allocation to the actual used part of each container of the function, the resource usage amount is reduced on the premise of ensuring the function performance remains unchanged, solving the technical problem of low resource utilization rate and achieving the technical effect of improving the resource utilization rate.

[0153] Figure 7 is a schematic diagram of a resource processing device according to an embodiment of the present disclosure. As Figure 7 shown, the image processing device 70 may include: a first determination unit 71, a second determination unit 72, a second adjustment unit 73, and a second operation unit 74.

[0154] The first determination unit 71 is used to determine the target area where the virtual machine is located in the virtual machine cluster;

[0155] A second determination unit 72, configured to determine a target container of a target function based on a target area, where the target container of the target function is allowed to be allocated to a virtual machine, and the target container is used to run the target function;

[0156] A second adjustment unit 73, configured to adjust the current resources already allocated to the target container to the target resources of the target container, where the target resources are determined based on the target function;

[0157] A second operation unit 74, configured to run the target function in the target container based on the target resources.

[0158] It should be noted here that the above first determination unit 71, second determination unit 72, second adjustment unit 73, and second operation unit 74 correspond to steps S302 to S308 in Embodiment 1. The instances and application scenarios implemented by the four units and the corresponding steps are the same, but are not limited to the content disclosed in the above Embodiment 1. It should be noted that the above units, as part of the device, can run in the computer terminal 10 provided in Embodiment 1.

[0159] Embodiment 3

[0160] An embodiment of the present invention further provides a computer-readable storage medium. Optionally, in this embodiment, the above storage medium can be used to store the program code executed by the resource processing method provided in the above Embodiment 1.

[0161] Optionally, in this embodiment, the above storage medium can be located in any one of the computer terminals in the computer terminal group in the computer network, or in any one of the mobile terminals in the mobile terminal group.

[0162] Optionally, in this embodiment, the storage medium is set to store program code for performing the following steps: obtaining a target container of a target function, where the target container is used to run the target function; obtaining the current resources already allocated to the target container; adjusting the current resources to the target resources of the target container, where the target resources are determined based on the target function; running the target function in the target container based on the target resources.

[0163] Optionally, the computer-readable storage medium is further set to store program code for performing the following steps: in response to the target container not fully using the current resources, reducing the current resources to the target resources.

[0164] Optionally, the computer-readable storage medium is further set to store program code for performing the following steps: after reducing the current resources to the target resources, based on the target resources, increasing the original number of target containers allocated to the virtual machine to the target number.

[0165] Optionally, the computer-readable storage medium is further configured to store program code for performing the following steps: obtaining the average historical resources used by the target function in a historical period, where the historical resources include the average historical resources; determining the target resources based on the historical period and the average historical resources.

[0166] Optionally, the computer-readable storage medium is further configured to store program code for performing the following steps: obtaining the target parameters of the target function, where the target parameters are used to determine the oversubscription degree of the target resources; determining the target resources based on the historical period and the average historical resources, including: determining the target resources based on the historical period, the average historical resources, and the target parameters.

[0167] Optionally, the computer-readable storage medium is further configured to store program code for performing the following steps: obtaining the portrait data of the target function, where the portrait data includes the maximum number of target containers that can be allocated to a virtual machine when the target container of the target function and the containers of other functions are co-located on the virtual machine; determining the number of target containers allocated to the virtual machine based on the portrait data.

[0168] Optionally, the computer-readable storage medium is further configured to store program code for performing the following steps: obtaining the portrait data of the target function in response to the virtual machine being located in a first target area.

[0169] Optionally, the computer-readable storage medium is further configured to store program code for performing the following steps: monitoring the target container to obtain a first monitoring result; performing a migration process or an isolation process on the target container in response to the first monitoring result indicating a performance degradation of the target function.

[0170] Optionally, the computer-readable storage medium is further configured to store program code for performing the following steps: monitoring the target container to obtain a first monitoring result in response to the virtual machine to which the target container is allocated being located in a second target area.

[0171] Optionally, the computer-readable storage medium is further configured to store program code for performing the following steps: obtaining the latency duration for the target function to respond to a target request in the target container; determining that the first monitoring result indicates a performance degradation of the target function in response to the latency duration being greater than a target duration.

[0172] Optionally, the computer-readable storage medium is further configured to store program code for performing the following steps: migrating the target container from an original virtual machine to a target virtual machine, where the target virtual machine includes at least one of the following: a virtual machine with a usage rate lower than a target threshold, a virtual machine to which a container identical to the target container has been allocated, and a virtual machine in a third target area with non-oversubscribed resources.

[0173] Optionally, the computer-readable storage medium is further configured to store program code for performing the following steps: after performing migration processing or isolation processing on the target container, monitoring the target container after the migration processing or isolation processing to obtain a second monitoring result; in response to the second monitoring result indicating a performance degradation of the target function, determining that the target function is in an abnormal state.

[0174] As an alternative implementation, the storage medium can also be configured to store program code for performing the following steps: determining a target area where the virtual machine is located in the virtual machine cluster; determining a target container of the target function based on the target area, where the target container of the target function is allowed to be allocated to the virtual machine, and the target container is used to run the target function; adjusting the currently allocated resources of the target container to the target resources of the target container, where the target resources are determined based on the target function; running the target function in the target container based on the target resources.

[0175] An embodiment of the present invention further provides a resource processing system, which may include a computer terminal, and the computer terminal may be any one of the computer terminal devices in a computer terminal group. Optionally, in this embodiment, the above computer terminal may also be replaced with a terminal device such as a mobile terminal.

[0176] Optionally, in this embodiment, the above computer terminal may be located in at least one of multiple network devices in a computer network.

[0177] In this embodiment, the above computer terminal may execute the program code of the following steps in the resource processing method of the present disclosure embodiment: obtaining a target container of the target function, where the target container is used to run the target function; obtaining the currently allocated resources of the target container; adjusting the current resources to the target resources of the target container, where the target resources are determined; running the target function in the target container based on the target resources.

[0178] Optionally, Figure 8 is a structural block diagram of a computer terminal according to an embodiment of the present invention. As Figure 8 shown, the computer terminal A may include: one or more (only one is shown in the figure): a processor 802, a memory 804, and a transmission device 806.

[0179] Among them, the memory can be used to store software programs and modules, such as the program instructions / modules corresponding to the resource processing method and device in the embodiments of the present invention. The processor executes various functional applications and resource processing by running the software programs and modules stored in the memory, that is, implements the above-mentioned resource processing method. The memory may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memories. In some instances, the memory may further include a memory remotely provided with respect to the processor, and these remote memories can be connected to the computer terminal A through a network. Examples of the above network include but are not limited to the Internet, enterprise intranet, local area network, mobile communication network, and their combinations.

[0180] The processor can call the information and application programs stored in the memory through the transmission device to execute the following steps: obtain the target container of the target function, where the target container is used to run the target function; obtain the current resources already allocated to the target container; adjust the current resources to the target resources of the target container, where the target resources are determined based on the target function; run the target function in the target container based on the target resources.

[0181] Optionally, the above processor can also execute the program code of the following steps: in response to the target container not fully using the current resources, reduce the current resources to the target resources.

[0182] Optionally, the above processor can also execute the program code of the following steps: after reducing the current resources to the target resources, increase the original number of target containers allocated to the virtual machine to the target number based on the target resources.

[0183] Optionally, the above processor can also execute the program code of the following steps: obtain the average historical resources used by the target function in the historical period, where the historical resources include the average historical resources; determine the target resources based on the historical period and the average historical resources.

[0184] Optionally, the above processor can also execute the program code of the following steps: obtain the target parameters of the target function, where the target parameters are used to determine the overbooking degree of the target resources; determine the target resources based on the historical period and the average historical resources, including: determining the target resources based on the historical period, the average historical resources, and the target parameters.

[0185] Optionally, the above processor can also execute the program code of the following steps: obtain the portrait data of the target function, where the portrait data includes the maximum number of target containers allowed to be allocated to the virtual machine when the target container of the target function and the containers of other functions are co-located on the virtual machine; determine the number of target containers allocated to the virtual machine based on the portrait data.

[0186] Optionally, the above-mentioned processor may also execute the program code of the following steps: in response to the virtual machine being located in the first target area, obtain the portrait data of the target function.

[0187] Optionally, the above-mentioned processor may also execute the program code of the following steps: monitor the target container to obtain a first monitoring result; in response to the first monitoring result indicating a performance degradation of the target function, perform a migration process or an isolation process on the target container.

[0188] Optionally, the above-mentioned processor may also execute the program code of the following steps: in response to the virtual machine assigned to the target container being located in the second target area, monitor the target container to obtain a first monitoring result.

[0189] Optionally, the above-mentioned processor may also execute the program code of the following steps: obtain the latency duration for the target function to respond to the target request in the target container; in response to the latency duration being greater than the target duration, determine that the first monitoring result indicates a performance degradation of the target function.

[0190] Optionally, the above-mentioned processor may also execute the program code of the following steps: migrate the target container from the original virtual machine to the target virtual machine, where the target virtual machine includes at least one of the following: a virtual machine with a usage rate lower than the target threshold, a virtual machine that has been assigned the same container as the target container, and a virtual machine with non-overcommitted resources located in the third target area.

[0191] Optionally, the above-mentioned processor may also execute the program code of the following steps: after performing a migration process or an isolation process on the target container, monitor the target container after the migration process or the isolation process to obtain a second monitoring result; in response to the second monitoring result indicating a performance degradation of the target function, determine that the target function is in an abnormal state.

[0192] As an optional implementation manner, the processor may also call the information and application programs stored in the memory through the transmission device to execute the following steps: determine the target area where the virtual machine is located in the virtual machine cluster; determine the target container of the target function based on the target area, where the target container of the target function is allowed to be assigned to the virtual machine, and the target container is used to run the target function; adjust the current resources already assigned to the target container to the target resources of the target container, where the target resources are determined based on the target function; run the target function in the target container based on the target resources.

[0193] An embodiment of the present invention provides a resource processing solution. By obtaining a target container for a target function, where the target container is used to run the target function; obtaining the current resources already allocated to the target container; adjusting the current resources to the target resources of the target container, where the target resources are determined based on the target function; and running the target function in the target container based on the target resources. That is to say, in this application, by reducing the memory allocation to the actual used part of each container of the function, the resource usage amount is reduced on the premise of ensuring the unchanged performance of the function, solving the technical problem of low resource utilization rate and achieving the technical effect of improving the resource utilization rate.

[0194] Those of ordinary skill in the art can understand that Figure 8 the structure shown is only for illustration, and computer terminal A can also be a smart phone (such as an Android phone, an iOS phone, etc.), a tablet computer, a handheld computer, and a Mobile Internet Devices (MID), a PAD, and other terminal devices. Figure 8 It does not limit the structure of the above-mentioned computer terminal A. For example, computer terminal A may further include more or fewer components (such as a network interface, a display device, etc.) than those shown Figure 8 in the figure, or have a different configuration from that shown Figure 8 in the figure.

[0195] Those of ordinary skill in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing the relevant hardware of the terminal device through a program, and the program can be stored in a computer-readable storage medium. The storage medium may include: a flash drive, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disc, etc.

[0196] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.

[0197] In the above embodiments of the present invention, the descriptions of the various embodiments have their own focuses. For the parts not detailed in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0198] In several embodiments provided by this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are merely illustrative. For example, the division of the units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed couplings or direct couplings or communication connections to each other can be through some interfaces, and the indirect couplings or communication connections of units or modules can be in electrical or other forms.

[0199] The units described as separate components may or may not be physically separated. The components displayed as units may or may not be physical units, that is, they can be located in one place or distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0200] In addition, each functional unit in various embodiments of the present invention can be integrated into a processing unit, or each unit can exist physically alone, or two or more units can be integrated into one unit. The above-mentioned integrated units can be implemented in the form of hardware or in the form of software functional units.

[0201] If the above-mentioned integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in various embodiments of the present invention. The foregoing storage medium includes: USB flash drives, read-only memories (ROMs), random access memories (RAMs), mobile hard disks, magnetic disks, or optical discs and other various media that can store program codes.

[0202] The above are only the preferred embodiments of the present invention. It should be noted that for those of ordinary skill in the art, without departing from the principle of the present invention, several improvements and refinements can be made, and these improvements and refinements should also be regarded as the protection scope of the present invention.

Claims

1. A resource processing method, characterized in that, Including: Obtain a target container for a target function, where the target container is used to run the target function; Obtain the current resources already allocated to the target container; Adjust the current resources to the target resources of the target container, where the target resources are determined based on the target function, and the target function includes target parameters for determining the oversubscription degree of the target resources; Run the target function in the target container based on the target resources.

2. The method according to claim 1, wherein Adjusting the current resources to the target resources of the target container includes: In response to the target container not fully using the current resources, reducing the current resources to the target resources.

3. The method according to claim 2, wherein After reducing the current resources to the target resources, the method further includes: Based on the target resources, increasing the original number of the target containers allocated to the virtual machine to the target number.

4. The method according to claim 1, characterized in that The method further includes: Obtain the average historical resources used by the target function in a historical period, where the historical resources include the average historical resources; Determine the target resources based on the historical period and the average historical resources.

5. The method according to claim 4, wherein The method further includes: obtaining the target parameters of the target function; Determining the target resources based on the historical period and the average historical resources includes: determining the target resources based on the historical period, the average historical resources, and the target parameters.

6. The method according to claim 1, wherein The method further includes: Obtain the portrait data of the target function, where the portrait data includes the maximum number of the target containers that are allowed to be allocated to the virtual machine when the target container of the target function and the containers of other functions are co-located on the virtual machine; Determine the number of the target containers allocated to the virtual machine based on the portrait data.

7. The method according to claim 6, wherein Obtaining the portrait data of the target function includes: In response to the virtual machine being located in a first target area, obtain the portrait data of the target function.

8. The method according to claim 1, characterized in that The method further includes: Monitor the target container to obtain a first monitoring result; In response to the first monitoring result indicating a performance degradation of the target function, perform a migration process or an isolation process on the target container.

9. The method according to claim 8, characterized in that, The method further includes: In response to the virtual machine to which the target container is allocated being located in a second target area, monitor the target container to obtain the first monitoring result.

10. The method according to claim 8, characterized in that Monitoring the target container to obtain a first monitoring result includes: Obtain the latency duration for the target function to respond to a target request in the target container; In response to the latency duration being greater than a target duration, determine that the first monitoring result indicates a performance degradation of the target function.

11. The method according to claim 8, characterized in that, Performing a migration process on the target container includes: Migrate the target container from the original virtual machine to a target virtual machine, where the target virtual machine includes at least one of the following: a virtual machine with a usage rate lower than a target threshold, a virtual machine already allocated with a container identical to the target container, and a virtual machine with no oversubscription of resources located in a third target area.

12. The method according to claim 8, wherein After performing migration processing or isolation processing on the target container, the method further includes: Monitoring the target container after the migration processing or isolation processing to obtain a second monitoring result; In response to the second monitoring result indicating a performance degradation of the target function, determining that the target function is in an abnormal state.

13. A resource processing method, characterized in that, Including: Determining a target area where the virtual machine is located in the virtual machine cluster; Determining a target container of the target function based on the target area, where the target container of the target function is allowed to be allocated to the virtual machine, and the target container is used to run the target function; Adjusting the current resources already allocated to the target container to the target resources of the target container, where the target resources are determined based on the target function, and the target function includes target parameters for determining the oversubscription degree of the target resources; Running the target function in the target container based on the target resources.

14. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored program, where when the program is run by a processor, it controls the device where the computer-readable storage medium is located to execute the method according to any one of claims 1 to 13.

Citation Information

Patent Citations

  • Data processing method, device and equipment and storage medium

    CN111797314A