Resource processing method and device
By dynamically decoupling and recoupling processing resources between virtual instances and hosts, the problem of underutilization of virtual machine memory resources is solved, and the utilization rate and efficiency of resources are improved.
Patent Information
- Application Number
- CN202010763488.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-07-31
- Publication Date
- 2025-01-03
- Estimated Expiration
- 2040-07-31
AI Technical Summary
In cloud services, memory resources allocated by virtual machines are underutilized, resulting in memory waste and low utilization, especially when the virtual machine actually uses less memory than allocated memory when processing data.
By dynamically decoupling and recoupling processing resources between the virtual instance and the host, unused processing resources are recycled according to preset conditions, such as freeing the processing resources from the virtual instance and when the data is not used or the number of usages reaches a threshold and Retrieve the host to be assigned to other virtual instances for use.
It improves the utilization rate of processing resources, reduces memory waste, ensures efficient allocation and utilization of resources, and can dynamically adjust resource allocation according to actual needs.
Smart Images

Figure CN114064194B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of Internet, and in particular to a resource processing method and device. Background Art
[0002] Currently, cloud service providers can provide virtual services to a wide range of users. For example, cloud service providers can configure host machines and create virtual machines on the host machines. A wide range of users can rent the virtual machines created by the cloud service providers for use.
[0003] When multiple virtual machines are created on a host machine, the host machine can statically allocate processing resources, such as memory, to each virtual machine in advance. For example, a user who rents a virtual machine can submit a request to the host machine to inform the user of the size of memory that the rented virtual machine needs to use, and then the host machine allocates memory of that size to the virtual machine.
[0004] However, in some scenarios, when a virtual machine processes user data, the memory it actually uses is often less than the memory allocated by the host to the virtual machine it rents. This will cause a portion of the memory allocated to the virtual machine to remain unused for a long time, resulting in memory waste and low memory utilization. Summary of the invention
[0005] In order to improve resource utilization, the present application shows a resource processing method and device.
[0006] In a first aspect, the present application shows a resource processing method, which is applied to a virtual instance, and the method comprises:
[0007] When the data coupled to the first processing resource meets a preset condition, decoupling the data from at least part of the first processing resource, the first processing resource comprising a processing resource allocated by the host machine to the virtual instance;
[0008] decoupling the at least a portion of the processing resources from the virtual instance on the virtual instance;
[0009] A first notification message is sent to the host machine, where the first notification message is used to notify the virtual instance that at least part of the processing resources have been decoupled from the virtual instance, so as to reclaim at least part of the processing resources from the virtual instance.
[0010] In an optional implementation, the processing resources include at least storage resources, computing resources, and communication resources.
[0011] In an optional implementation, the method further includes:
[0012] Back up said data.
[0013] In an optional implementation, backing up the data includes:
[0014] compressing the data to obtain compressed data;
[0015] Re-coupling processing resources of the first processing resources other than the at least a portion of the processing resources to the compressed data.
[0016] In an optional implementation, decoupling at least part of the processing resources from the virtual instance on the virtual instance includes:
[0017] In a page table maintained by the virtual instance, the resource identifiers of at least part of the processing resources are deleted, and the page table is used to store the resource identifiers of the processing resources allocated by the host machine to the virtual instance.
[0018] In an optional implementation, the method further includes:
[0019] receiving a second notification message sent by the host machine, where the second notification message is used to notify the host machine that a second processing resource has been allocated to the virtual instance;
[0020] The second processing resource is coupled to the virtual instance on the virtual instance according to the second notification message.
[0021] In an optional implementation, coupling the second processing resource with the virtual instance on the virtual instance according to the second notification message includes:
[0022] The resource identifier of the second processing resource is stored in a page table maintained by the virtual instance, and the page table is used to store the resource identifier of the processing resource allocated by the host machine to the virtual instance.
[0023] In an optional implementation, the method further includes:
[0024] Determining whether the data is preset data;
[0025] In the case where the data is preset data, the step of decoupling the data from at least part of the first processing resources is performed.
[0026] In an optional implementation, the method further includes:
[0027] If the data has not been used within a preset time period, determining that the data meets the preset condition;
[0028] or,
[0029] When the number of times the data is used reaches a preset number of times, determining that the data meets the preset condition;
[0030] or,
[0031] In the case that the third processing resource is coupled with data identical to the data, it is determined that the data coupled with the first processing resource meets the preset condition, and the third processing resource includes processing resources in the host machine other than the first processing resource.
[0032] In an optional implementation, after decoupling the data from at least part of the first processing resources, the method further includes:
[0033] A correspondence between the data identifier of the data and the resource identifier of the third processing resource is stored in the virtual instance.
[0034] In a second aspect, the present application shows a resource processing method, which is applied to a host machine, and the method includes:
[0035] receiving a first notification message sent by a virtual instance running on the host machine, the first notification message being used to notify the virtual instance that at least part of first processing resources has been decoupled from the virtual instance, the first processing resources comprising processing resources allocated by the host machine to the virtual instance;
[0036] According to the first notification message, at least part of the processing resources are decoupled from the virtual instance on the host machine to reclaim at least part of the processing resources from the virtual instance.
[0037] In an optional implementation, decoupling at least part of the processing resources from the virtual instance on the host machine according to the first notification message includes:
[0038] In the correspondence between the resource identifiers of the processing resources and the instance identifiers of the virtual instances maintained by the host machine, the corresponding table entries including the resource identifiers of at least part of the processing resources and the instance identifiers of the virtual instances are deleted.
[0039] In an optional implementation, the method further includes:
[0040] In case that a second processing resource needs to be allocated to the virtual instance, coupling the second processing resource with the virtual instance on the host machine;
[0041] A second notification message is sent to the virtual instance, where the second notification message is used to notify the host machine that a second processing resource has been allocated to the virtual instance.
[0042] In an optional implementation, coupling the second processing resource with the virtual instance on the host machine includes:
[0043] In the correspondence relationship between the resource identifier of the processing resource and the instance identifier of the virtual instance maintained by the host machine, a correspondence table entry including the second processing resource and the instance identifier of the virtual instance is stored.
[0044] In a third aspect, the present application shows a resource processing device, which is applied to a virtual instance, and the device includes:
[0045] A first decoupling module, configured to decouple the data coupled to the first processing resource from at least part of the first processing resource when the data meets a preset condition, wherein the first processing resource includes a processing resource allocated by a host machine to the virtual instance;
[0046] A second decoupling module, configured to decouple at least part of the processing resources from the virtual instance on the virtual instance;
[0047] The first sending module is used to send a first notification message to the host machine, wherein the first notification message is used to notify the virtual instance that at least part of the processing resources have been decoupled from the virtual instance to recover at least part of the processing resources from the virtual instance.
[0048] In an optional implementation, the processing resources include at least storage resources, computing resources, and communication resources.
[0049] In an optional implementation, the device further includes:
[0050] A backup module is used to back up the data.
[0051] In an optional implementation, the backup module includes:
[0052] A compression unit, used for compressing the data to obtain compressed data;
[0053] A coupling unit is used to recouple the processing resources other than the at least part of the processing resources in the first processing resources with the compressed data.
[0054] In an optional implementation, the second decoupling module is specifically used to: delete the resource identifier of at least part of the processing resources in a page table maintained by the virtual instance, and the page table is used to store the resource identifier of the processing resources allocated by the host machine to the virtual instance.
[0055] In an optional implementation, the device further includes:
[0056] A first receiving module, configured to receive a second notification message sent by the host machine, wherein the second notification message is used to notify the host machine that a second processing resource has been allocated to the virtual instance;
[0057] The first coupling module is configured to couple the second processing resource with the virtual instance on the virtual instance according to the second notification message.
[0058] In an optional implementation, the first coupling module is specifically used to: store the resource identifier of the second processing resource in a page table maintained by the virtual instance, and the page table is used to store the resource identifier of the processing resource allocated by the host machine to the virtual instance.
[0059] In an optional implementation, the device further includes:
[0060] A first determination module, used to determine whether the data is preset data;
[0061] The first decoupling module is further used for: when the data is preset data, decoupling the data from at least part of the first processing resources.
[0062] In an optional implementation, the device further includes:
[0063] A second determination module, configured to determine that the data meets the preset condition if the data has not been used within a preset time period;
[0064] or,
[0065] A third determination module, configured to determine that the data meets the preset condition when the number of times the data has been used reaches a preset number of times;
[0066] or,
[0067] The fourth determination module is used to determine that the data coupled to the first processing resource meets the preset condition when the third processing resource is coupled with data identical to the data, and the third processing resource includes processing resources in the host machine other than the first processing resource.
[0068] In an optional implementation, the device further includes:
[0069] A storage module is used to store the correspondence between the data identifier of the data and the resource identifier of the third processing resource in the virtual instance.
[0070] In a fourth aspect, the present application shows a resource processing device, which is applied to a host machine, and the device includes:
[0071] A second receiving module is used to receive a first notification message sent by the virtual instance running on the host machine, wherein the first notification message is used to notify the virtual instance that at least part of the first processing resources has been decoupled from the virtual instance, and the first processing resources include the processing resources allocated by the host machine to the virtual instance;
[0072] A third decoupling module is used to decouple at least part of the processing resources from the virtual instance on the host machine according to the first notification message, so as to reclaim at least part of the processing resources from the virtual instance.
[0073] In an optional implementation, the third decoupling module is specifically used to: delete the corresponding table entries including the resource identifier of at least part of the processing resources and the instance identifier of the virtual instance in the correspondence between the resource identifier of the processing resources and the instance identifier of the virtual instance maintained by the host machine.
[0074] In an optional implementation, the device further includes:
[0075] A second coupling module, configured to couple the second processing resource with the virtual instance on the host machine when it is necessary to allocate the second processing resource to the virtual instance;
[0076] The second sending module is used to send a second notification message to the virtual instance, where the second notification message is used to notify the host machine that a second processing resource has been allocated to the virtual instance.
[0077] In an optional implementation, the second coupling module is specifically used to: store a corresponding table entry including the second processing resource and the instance identifier of the virtual instance in the correspondence relationship between the resource identifier of the processing resource and the instance identifier of the virtual instance maintained by the host machine.
[0078] In a fifth aspect, the present application shows an electronic device, the electronic device comprising:
[0079] Processor; and
[0080] A memory having executable codes stored thereon, which, when executed, enables the processor to execute the resource processing method as described in the first aspect.
[0081] In a sixth aspect, the present application illustrates one or more machine-readable media on which executable codes are stored. When the executable codes are executed, the processor executes the resource processing method as described in the first aspect.
[0082] In a seventh aspect, the present application provides an electronic device, the electronic device comprising:
[0083] Processor; and
[0084] A memory having executable code stored thereon, which, when the executable code is executed, enables the processor to execute the resource processing method as described in the second aspect.
[0085] In an eighth aspect, the present application illustrates one or more machine-readable media on which executable codes are stored. When the executable codes are executed, the processor executes the resource processing method as described in the second aspect.
[0086] Compared with the prior art, the embodiments of the present application have the following advantages:
[0087] In the present application, when the data coupled to the first processing resource meets the preset conditions, the virtual instance decouples the data from at least part of the processing resources in the first processing resource, thereby releasing at least part of the processing resources, so that at least part of the processing resources are in an idle state. The first processing resource includes the processing resources allocated by the host machine to the virtual instance, and then at least part of the processing resources in the first processing resource are decoupled from the virtual instance on the virtual instance, so that at least part of the processing resources are released from the virtual machine from the perspective of the virtual instance, that is, the virtual instance is no longer coupled with at least part of the processing resources, and then a first notification message can be sent to the host machine, and the first notification message is used to notify the virtual instance that at least part of the processing resources in the first processing resource have been decoupled from the virtual instance. The host machine receives the first notification message, and then can decouple at least part of the processing resources in the first processing resource from the virtual instance on the host machine according to the first notification message, so as to recover at least part of the processing resources in the first processing resource from the virtual instance, so that the host machine can autonomously control at least part of the processing resources, for example, at least part of the processing resources can be allocated to the required virtual instance for use.
[0088] Through the present application, processing resources temporarily not used by a virtual instance can be recycled to a host machine, and the host machine can then allocate the recycled processing resources to other virtual instances that need to use the processing resources, thereby improving the utilization of the processing resources. BRIEF DESCRIPTION OF THE DRAWINGS
[0089] Figure 1 It is a schematic diagram of a scenario shown in an exemplary embodiment of the present application.
[0090] Figure 2 It is a schematic diagram of a scenario shown in an exemplary embodiment of the present application.
[0091] Figure 3 It is a flowchart of a resource processing method shown in an exemplary embodiment of the present application.
[0092] Figure 4It is a flowchart of a resource processing method shown in an exemplary embodiment of the present application.
[0093] Figure 5 It is a flowchart of a resource processing method shown in an exemplary embodiment of the present application.
[0094] Figure 6 It is a structural block diagram of a resource processing device shown in an exemplary embodiment of the present application.
[0095] Figure 7 It is a structural block diagram of a resource processing device shown in an exemplary embodiment of the present application.
[0096] Figure 8 It is a schematic diagram of the structure of a device provided in one embodiment of the present application. DETAILED DESCRIPTION
[0097] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, the present application is further described in detail below in conjunction with the accompanying drawings and specific implementation methods.
[0098] Reference Figure 1 , shows a schematic diagram of a scenario of the present application, the scenario includes a host machine, the host machine includes a physical machine, etc., multiple virtual machines are created in the host machine, each of the virtual machines can be allocated to a user for use, in one example, different virtual machines can be allocated to different users for use, and in another example, a user can also use at least two virtual machines at the same time.
[0099] In one embodiment, an application program or other data may be executed on the virtual machine.
[0100] In another embodiment, a virtual device can be created on a virtual machine. For example, it can be a virtual device in a cloud-native scenario. The virtual device has its own operating system, such as a Windows operating system, an Android operating system, an IOS operating system, and a Linux operating system, etc. In this way, applications or other data can be run independently in the virtual device.
[0101] Virtual devices include containers and functions. Containers may include ECI (Elastic Container Instance), etc. Functions include FC (Function Compute), etc., which are used to run code snippets.
[0102] In the present application, a virtual machine created on a host machine, and virtual devices such as containers or functions created on the virtual machine can be regarded as virtual instances.
[0103] In this application, Function Compute is a fully managed computing service that has a basic architecture for running code.
[0104] In one case, users do not need to care about the basic architecture of the host machine. Users only need to write core code snippets or applications related to their services. Function Compute will prepare the basic architecture for running code snippets or applications for users, and run their code snippets or applications in a flexible and reliable manner.
[0105] Function Compute can also provide functions such as log query, performance monitoring, and alarm.
[0106] With the help of Function Compute, users can quickly build any type of applications and services without having to manage and maintain the host machine.
[0107] See also Figure 2 , taking an example to illustrate the scenario, the host machine includes a user space and a kernel space, and the kernel space of the host machine manages the processing resources of the host machine.
[0108] A virtual instance can be created in the user space of the host machine. The virtual instance has a user space and a kernel space. The user can interact with the user space of the virtual instance. For example, the user space of the virtual instance transmits data that the user needs the virtual instance to process to the virtual instance.
[0109] The kernel space of the virtual instance has management logic for managing the processing resources allocated by the host to the virtual instance, for example, receiving the processing resources allocated by the host to the virtual instance, recording the processing resources allocated by the host to the virtual instance, releasing the processing resources allocated by the host to the virtual instance, coupling the processing resources with the data in the user space of the virtual instance, and decoupling the processing resources from the data in the user space of the virtual instance.
[0110] After the virtual instance obtains the data that the user requires the virtual instance to process based on the user space of the virtual instance, the virtual instance may process the data based on the processing resources managed in the kernel space of the virtual instance.
[0111] Reference Figure 3 , showing a schematic diagram of a resource processing method of the present application, the method is applied to Figure 1 or Figure 2 In the scenario shown, the method may include:
[0112] In step S101, when data coupled to a first processing resource meets a preset condition, the virtual instance decouples the data from at least part of the first processing resource, where the first processing resource includes processing resources allocated by the host machine to the virtual instance;
[0113] In this application, a virtual instance includes Figure 1 The scenario shown is a virtual machine created on a host machine, or a virtual device such as a container or function computing created on the virtual machine.
[0114] The data may include applications and code snippets, and of course, may also include output data generated by running the applications or code snippets.
[0115] In the present application, the host machine includes a variety of processing resources, for example, including storage resources, computing resources, and communication resources.
[0116] Storage resources include persistent storage space, such as a hard disk or a magnetic disk, and may also include cache space, such as a memory or a flash memory.
[0117] Computing resources may include resources such as a CPU (Central Processing Unit) and a GPU (Graphics Processing Unit) for computing data.
[0118] Communication resources include bandwidth, communication interfaces, and IP (Internet Protocol) addresses, etc., which are used to transmit data.
[0119] In the present application, the host machine allocates a first processing resource to the virtual instance. The first processing resource can be coupled with data, for example, the virtual instance can use the first processing resource to carry data and process the carried data based on the first processing resource.
[0120] The first processing resource coupling the data may be understood as: the virtual instance is processing the data based on the first processing resource.
[0121] For example, a virtual instance may compute data based on computing resources, wherein the virtual instance may allocate at least part of the computing resources allocated by the host machine to the data, so that at least part of the computing resources can be used to compute the data for a period of time.
[0122] For another example, a virtual instance may store data based on storage resources, wherein the virtual instance may allocate at least part of the storage resources allocated by the host to the data, so that at least part of the storage resources can be used to store the data for a period of time.
[0123] For another example, a virtual instance can transmit data to the outside based on communication resources, wherein the virtual instance can allocate at least part of the communication resources allocated by the host to the data, so that at least part of the communication resources can be used to transmit the data to the outside for a period of time.
[0124] Among them, the virtual instance decouples the data from at least part of the first processing resources, which can be understood as: the virtual instance no longer processes the data based on at least part of the first processing resources, so as to release at least part of the first processing resources as idle processing resources.
[0125] For example, in one example, assuming that the virtual instance stores the data based on the first storage resource allocated to it by the host machine, it means that the first storage resource carries the data, that is, the first storage resource is coupled with the data.
[0126] If the data is deleted from the first storage resource, the first storage resource no longer stores the data. In this way, the first storage resource is released as an idle storage resource, which means that the first storage resource is decoupled from the data and can be used to store other data afterwards.
[0127] However, in this example, after the data is deleted from the first storage resource, the data may no longer exist in the virtual instance. If the virtual instance needs to use the data based on the needs of the service it hosts, but the data no longer exists in the virtual instance, the virtual instance will not be able to obtain the data and will therefore be unable to use the data, affecting the normal operation of the service hosted by the virtual instance.
[0128] Therefore, in order to avoid this situation, in another embodiment of the present application, the virtual instance may back up the data before decoupling the data from at least part of the first processing resources.
[0129] For example, in one embodiment, if the first processing resource is a cache space in a storage resource, the virtual instance can store the data in a persistent storage space allocated by the host machine to the virtual instance, so that when the virtual instance needs to use the data later, the virtual instance can retrieve the data from the persistent storage space and use it. In this case, the virtual instance decouples the data from all processing resources in the first processing resource.
[0130] Alternatively, in another embodiment, if the first processing resource is a cache space in a storage resource, the virtual instance may also compress the data to obtain compressed data, and then recouple the processing resources other than at least part of the first processing resource with the compressed data, for example, storing the compressed data in the processing resources other than at least part of the first processing resource.
[0131] The compressed data occupies less space than the uncompressed data, so the compressed data can be used to replace a portion of the data stored in a portion of the storage resources in the first processing resource, thereby coupling the compressed data with the portion of the storage resources, and then deleting another portion of the data stored in another portion of the storage resources, thereby decoupling the other portion of the storage resources from the other portion of the data. In this case, the virtual instance decouples the data from a portion of the processing resources in the first processing resource.
[0132] In one embodiment of the present application, if the data has not been used within a preset time period, it can be determined that the data meets the preset condition.
[0133] Among them, if the data has not been used within a preset time period, it often means that the virtual instance may no longer need to use the data, or in other words, the data will not be needed for a period of time thereafter. In this way, the data will not affect the services carried by the virtual instance for at least a period of time, so that it can be decoupled from the processing resources to release the processing resources. Therefore, in this case, it can be determined that the data meets the preset conditions.
[0134] The preset time period can be set according to actual conditions, and this application does not limit this.
[0135] Alternatively, in another embodiment of the present application, when the number of times the data is used reaches a preset number of times, it can be determined that the data meets the preset conditions.
[0136] Sometimes, a piece of data may be used a limited number of times by a virtual instance. For example, the virtual instance carries a certain service, and certain data is needed in the process of executing the service, but the number of times the data is usually used is limited. After the virtual instance has used the data a certain number of times reaching the actual upper limit, the data will no longer be used. Therefore, when the number of times the data has been used reaches a preset number of times, it can be determined that the data meets the preset conditions.
[0137] The preset number of times can be set according to the actual situation of the data and the service using the data, and this application does not limit this.
[0138] Alternatively, in another embodiment of the present application, sometimes, the processing resources in the host machine are repeatedly coupled to the same data. For example, in addition to the first processing resource being coupled to the data, other processing resources in the host machine may also be coupled to the data at the same time. In this case, the virtual instance can not only retrieve the data coupled to the first processing resource, but also retrieve the data coupled to other processing resources at the same time.
[0139] For example, in one example, assuming that the first processing resource is a first storage resource, such as a memory, the data is stored in memory A, and at the same time, the data is also stored in memory B in the host machine. In this case, the virtual instance can obtain the data not only from memory A, but also from memory B.
[0140] In this way, when other processing resources in the host machine are also coupled with the data at the same time, there is no need to use the first processing resource to repeatedly couple the data. Therefore, the first processing resource can be decoupled from the data to release the first processing resource. Therefore, when the first processing resource is coupled with the data and when the third processing resource is coupled with the same data as the data, it can be determined that the data coupled by the first processing resource meets the preset conditions.
[0141] The third processing resource includes processing resources in the host machine except the first processing resource.
[0142] For example, in one embodiment, the third processing resource includes: processing resources allocated by the host machine to other virtual instances created on the host machine other than the virtual instance; or, includes: processing resources allocated by the host machine to the virtual instance, and the third processing resource is different from the first processing resource.
[0143] Furthermore, in order to facilitate the virtual instance to retrieve the data later, after decoupling the data from at least part of the processing resources in the first processing resource, the correspondence between the data identifier of the data and the resource identifier of the third processing resource can also be stored in the virtual instance. In this way, when the virtual instance needs to retrieve the data according to the data identifier later, the virtual instance can retrieve the same data as the data from the third processing resource according to the resource identifier of the third processing resource based on the correspondence.
[0144] Furthermore, there are many kinds of data that can be coupled to the processing resources allocated to the virtual instance, such as system data of the virtual instance's operating system, temporary data and intermediate data generated when the virtual instance processes data, etc. Some data can be decoupled from the processing resources by the virtual instance, but there are some data that usually cannot be decoupled from the processing resources by the virtual instance, otherwise it will affect the normal operation of the services carried by the virtual instance.
[0145] The technicians can count in advance the characteristics of the data that can be decoupled from the processing resources by the virtual instance, for example, the type of data, the time when the data is generated, and the way the data is generated.
[0146] The type of data can be obtained by the suffix of the data. For example, the system data of the operating system of the virtual instance is of several specific data types, and the data of this data type cannot be decoupled from the processing resources by the virtual instance.
[0147] During a period of time after the operating system of a virtual instance is just started, the data running on the operating system of the virtual instance is often data required by the operating system. After this period of time, other service data may be run by the virtual instance. Therefore, the data running during a period of time after the operating system is just started cannot be decoupled from the processing resources by the virtual instance, otherwise it will affect the normal operation of the services carried by the virtual instance.
[0148] In this way, when the data coupled to the first processing resource meets the preset conditions, it can be determined whether the data is preset data. When the data is preset data, step S101 is executed again: the data is decoupled from at least part of the processing resources in the first processing resource, thereby avoiding deletion of important data, and further avoiding affecting the normal operation of the service carried by the virtual instance due to deletion of important data.
[0149] When determining whether the data is preset data, in one method, it can be determined whether the data type of the data is one of the specific data types mentioned above. If the data type of the data is not one of the specific data types mentioned above, it can be determined that the data is preset data.
[0150] Alternatively, in another way, it can be determined whether the data is generated within a period of time just after the operating system of the virtual instance is started. If the data is generated not within a period of time just after the operating system of the virtual instance is started, but after the period of time after the operating system of the virtual instance is started, it can be determined that the data is preset data.
[0151] The length of this period of time can be set according to actual conditions, and this application does not impose any restrictions on this.
[0152] In step S102, the virtual instance decouples at least part of the first processing resources from the virtual instance on the virtual instance;
[0153] In the present application, the host machine may allocate processing resources to the virtual instance in advance, for example, according to an allocation request sent by the virtual instance to the host machine requesting the allocation of processing resources, to allocate processing resources to the virtual instance, or, when it is detected that the virtual instance is insufficient, to actively allocate processing resources to the virtual instance.
[0154] For example, when the host machine needs to allocate a second processing resource to the virtual instance, the host machine can couple the second processing resource with the virtual instance on the host machine; then send a second notification message to the virtual instance, the second notification message is used to notify the host machine that the second processing resource has been allocated to the virtual instance.
[0155] The virtual instance receives the second notification message sent by the host machine. Based on the second notification message, the virtual instance can learn that the host machine has allocated the second processing resource to the virtual instance, and the second processing resource can be used by the virtual instance itself. Therefore, the virtual instance can couple the second processing resource with the virtual instance on the virtual instance based on the second notification message, thereby recording that the second processing resource can be used by itself.
[0156] The host machine may maintain a correspondence between a resource identifier of a processing resource and an instance identifier of a virtual instance, and for any corresponding table entry in the correspondence, the processing resource corresponding to the resource identifier included in the corresponding table entry is allocated by the host machine to the virtual instance corresponding to the instance identifier in the corresponding table entry. The same is true for each other corresponding table entry in the correspondence.
[0157] In this way, when the second processing resource is coupled with the virtual instance on the host machine, specifically, a corresponding table entry including the resource identifier of the second processing resource and the instance identifier of the virtual instance can be stored in the correspondence between the resource identifier of the processing resource and the instance identifier of the virtual instance maintained by the host machine.
[0158] The virtual instance may maintain a page table, and the page table is used to store resource identifiers of processing resources allocated by the host machine to the virtual instance.
[0159] Thus, when the virtual instance needs to couple a certain processing resource with the virtual instance on the virtual instance, the virtual instance can store the resource identifier of the processing resource in the page table maintained by the virtual instance. Accordingly, when the virtual instance needs to decouple a certain processing resource from the virtual instance on the virtual instance, the virtual instance can delete the resource identifier of the processing resource in the page table maintained by the virtual instance.
[0160] Therefore, when the second processing resource is coupled to the virtual instance on the virtual instance according to the second notification message, the virtual instance can store the resource identifier of the second processing resource in the page table maintained by the virtual instance. In this way, it can be achieved that from the perspective of the virtual instance, the second processing resource can be recorded for its own use.
[0161] Accordingly, when at least part of the processing resources are decoupled from the virtual instance on the virtual instance, the virtual instance can delete the resource identifier of at least part of the processing resources in the page table maintained by the virtual instance. In this way, it is possible to record from the perspective of the virtual instance that the virtual instance has released at least part of the processing resources and that at least part of the processing resources are no longer used by itself.
[0162] In addition, in another embodiment of the present application, at least part of the processing resources can be decoupled from the virtual instance on the virtual instance by means of virtio-balloon (semi-virtualized memory balloon driver), virtio-mem (semi-virtualized memory driver) or hypercall.
[0163] In step S103, the virtual instance sends a first notification message to the host machine, where the first notification message is used to notify the virtual instance that at least part of the first processing resources has been decoupled from the virtual instance.
[0164] In the present application, one of the reasons why the virtual instance decouples at least part of the first processing resources from itself is that the virtual instance can at least temporarily not use at least part of the first processing resources to process the data, and temporarily not using at least part of the first processing resources to process the data does not affect the normal operation of the service carried by the virtual instance. In addition, it is also to enable the host machine to allocate at least part of the first processing resources to other virtual instances for use, so as to improve the utilization of processing resources.
[0165] In order for the host machine to allocate at least part of the first processing resources to other virtual instances, the virtual instance needs to inform the host machine that at least part of the first processing resources has been decoupled from the virtual instance.
[0166] In order to enable the virtual instance to inform the host machine that the virtual instance has decoupled at least part of the first processing resources from the virtual instance, the virtual instance can generate a first notification message, which is used to notify the virtual instance that at least part of the first processing resources have been decoupled from the virtual instance, and then send the first notification message to the host machine.
[0167] The virtual instance and the host machine can exchange data based on the virtio transmission protocol.
[0168] For example, the virtual instance may send a first notification message to the host machine based on the virtio transport protocol.
[0169] In step S104, the host machine receives a first notification message sent by the virtual instance running on the host machine;
[0170] For example, the host machine may receive the first notification message sent by the virtual instance based on the virtio transmission protocol.
[0171] In step S105, the host machine decouples at least part of the first processing resources from the virtual instance on the host machine according to the first notification message, so as to reclaim at least part of the first processing resources from the virtual instance.
[0172] Based on the first notification message, the host machine can learn that the virtual instance has decoupled at least part of the first processing resources from the virtual instance, that is, at least part of the first processing resources have been released by the virtual instance as idle processing resources. The host machine can then independently control at least part of the first processing resources. For example, at least part of the first processing resources can be allocated to other virtual instances for use.
[0173] Therefore, the host machine can decouple at least part of the first processing resources from the virtual instance on the host machine, thereby recording that at least part of the first processing resources are released as idle processing resources, and further recording that the host machine can autonomously control at least part of the first processing resources.
[0174] Among them, when at least part of the first processing resources are decoupled from the virtual instance on the host machine, the corresponding table entries including the resource identifier of at least part of the first processing resources and the instance identifier of the virtual instance can be deleted in the correspondence between the resource identifier of the processing resource and the instance identifier of the virtual instance maintained by the host machine.
[0175] In the present application, when the data coupled to the first processing resource meets the preset conditions, the virtual instance decouples the data from at least part of the processing resources in the first processing resource, thereby releasing at least part of the processing resources, so that at least part of the processing resources are in an idle state. The first processing resource includes the processing resources allocated by the host machine to the virtual instance, and then at least part of the processing resources in the first processing resource are decoupled from the virtual instance on the virtual instance, so that at least part of the processing resources are released from the virtual machine from the perspective of the virtual instance, that is, the virtual instance is no longer coupled with at least part of the processing resources, and then a first notification message can be sent to the host machine, and the first notification message is used to notify the virtual instance that at least part of the processing resources in the first processing resource have been decoupled from the virtual instance. The host machine receives the first notification message, and then can decouple at least part of the processing resources in the first processing resource from the virtual instance on the host machine according to the first notification message, so as to recover at least part of the processing resources in the first processing resource from the virtual instance, so that the host machine can autonomously control at least part of the processing resources, for example, at least part of the processing resources can be allocated to the required virtual instance for use.
[0176] Through the present application, processing resources temporarily not used by a virtual instance can be recycled to a host machine, and the host machine can then allocate the recycled processing resources to other virtual instances that need to use the processing resources, thereby improving the utilization of the processing resources.
[0177] Reference Figure 4 , showing a schematic diagram of a resource processing method of the present application, the method is applied to Figure 1 or Figure 2 In the virtual example in the scenario shown, the method may include:
[0178] In step S201, when data coupled to a first processing resource meets a preset condition, the data is decoupled from at least part of the first processing resource, the first processing resource including the processing resource allocated by the host machine to the virtual instance;
[0179] In step S202, at least part of the processing resources are decoupled from the virtual instance on the virtual instance;
[0180] In step S203, a first notification message is sent to the host machine, where the first notification message is used to notify the virtual instance that at least part of the processing resources have been decoupled from the virtual instance, so as to reclaim at least part of the processing resources from the virtual instance.
[0181] In an optional implementation, the processing resources include at least storage resources, computing resources, and communication resources.
[0182] In an optional implementation, the method further includes:
[0183] Back up said data.
[0184] In an optional implementation, backing up the data includes:
[0185] compressing the data to obtain compressed data;
[0186] Re-coupling processing resources of the first processing resources other than the at least a portion of the processing resources to the compressed data.
[0187] In an optional implementation, decoupling at least part of the processing resources from the virtual instance on the virtual instance includes:
[0188] In a page table maintained by the virtual instance, the resource identifiers of at least part of the processing resources are deleted, and the page table is used to store the resource identifiers of the processing resources allocated by the host machine to the virtual instance.
[0189] In an optional implementation, the method further includes:
[0190] receiving a second notification message sent by the host machine, where the second notification message is used to notify the host machine that a second processing resource has been allocated to the virtual instance;
[0191] The second processing resource is coupled to the virtual instance on the virtual instance according to the second notification message.
[0192] In an optional implementation, coupling the second processing resource with the virtual instance on the virtual instance according to the second notification message includes:
[0193] The resource identifier of the second processing resource is stored in a page table maintained by the virtual instance, and the page table is used to store the resource identifier of the processing resource allocated by the host machine to the virtual instance.
[0194] In an optional implementation, the method further includes:
[0195] Determining whether the data is preset data;
[0196] In the case where the data is preset data, the step of decoupling the data from at least part of the first processing resources is performed.
[0197] In an optional implementation, the method further includes:
[0198] If the data has not been used within a preset time period, determining that the data meets the preset condition;
[0199] or,
[0200] When the number of times the data is used reaches a preset number of times, determining that the data meets the preset condition;
[0201] or,
[0202] In the case that the third processing resource is coupled with data identical to the data, it is determined that the data coupled with the first processing resource meets the preset condition, and the third processing resource includes processing resources in the host machine other than the first processing resource.
[0203] In an optional implementation, after decoupling the data from at least part of the first processing resources, the method further includes:
[0204] A correspondence between the data identifier of the data and the resource identifier of the third processing resource is stored in the virtual instance.
[0205] In the present application, when the data coupled to the first processing resource meets the preset conditions, the virtual instance decouples the data from at least part of the processing resources in the first processing resource, thereby releasing at least part of the processing resources, so that at least part of the processing resources are in an idle state. The first processing resource includes the processing resources allocated by the host machine to the virtual instance, and then at least part of the processing resources in the first processing resource are decoupled from the virtual instance on the virtual instance, so that at least part of the processing resources are released from the virtual machine from the perspective of the virtual instance, that is, the virtual instance is no longer coupled with at least part of the processing resources, and then a first notification message can be sent to the host machine, and the first notification message is used to notify the virtual instance that at least part of the processing resources in the first processing resource have been decoupled from the virtual instance. The host machine receives the first notification message, and then can decouple at least part of the processing resources in the first processing resource from the virtual instance on the host machine according to the first notification message, so as to recover at least part of the processing resources in the first processing resource from the virtual instance, so that the host machine can autonomously control at least part of the processing resources, for example, at least part of the processing resources can be allocated to the required virtual instance for use.
[0206] Through the present application, processing resources temporarily not used by a virtual instance can be recycled to a host machine, and the host machine can then allocate the recycled processing resources to other virtual instances that need to use the processing resources, thereby improving the utilization of the processing resources.
[0207] Reference Figure 5 , showing a schematic diagram of a resource processing method of the present application, the method is applied to Figure 1 or Figure 2In the host machine in the scenario shown, the method may include:
[0208] In step S301, a first notification message sent by a virtual instance running on the host is received, wherein the first notification message is used to notify the virtual instance that at least part of first processing resources has been decoupled from the virtual instance, wherein the first processing resources include processing resources allocated by the host to the virtual instance;
[0209] In step S302, according to the first notification message, at least part of the processing resources are decoupled from the virtual instance on the host machine to reclaim at least part of the processing resources from the virtual instance.
[0210] In an optional implementation, decoupling at least part of the processing resources from the virtual instance on the host machine according to the first notification message includes:
[0211] In the correspondence between the resource identifiers of the processing resources and the instance identifiers of the virtual instances maintained by the host machine, the corresponding table entries including the resource identifiers of at least part of the processing resources and the instance identifiers of the virtual instances are deleted.
[0212] In an optional implementation, the method further includes:
[0213] In case that a second processing resource needs to be allocated to the virtual instance, coupling the second processing resource with the virtual instance on the host machine;
[0214] A second notification message is sent to the virtual instance, where the second notification message is used to notify the host machine that a second processing resource has been allocated to the virtual instance.
[0215] In an optional implementation, coupling the second processing resource with the virtual instance on the host machine includes:
[0216] In the correspondence relationship between the resource identifier of the processing resource and the instance identifier of the virtual instance maintained by the host machine, a correspondence table entry including the second processing resource and the instance identifier of the virtual instance is stored.
[0217] In the present application, when the data coupled to the first processing resource meets the preset conditions, the virtual instance decouples the data from at least part of the processing resources in the first processing resource, thereby releasing at least part of the processing resources, so that at least part of the processing resources are in an idle state. The first processing resource includes the processing resources allocated by the host machine to the virtual instance, and then at least part of the processing resources in the first processing resource are decoupled from the virtual instance on the virtual instance, so that at least part of the processing resources are released from the virtual machine from the perspective of the virtual instance, that is, the virtual instance is no longer coupled with at least part of the processing resources, and then a first notification message can be sent to the host machine, and the first notification message is used to notify the virtual instance that at least part of the processing resources in the first processing resource have been decoupled from the virtual instance. The host machine receives the first notification message, and then can decouple at least part of the processing resources in the first processing resource from the virtual instance on the host machine according to the first notification message, so as to recover at least part of the processing resources in the first processing resource from the virtual instance, so that the host machine can autonomously control at least part of the processing resources, for example, at least part of the processing resources can be allocated to the required virtual instance for use.
[0218] Through the present application, processing resources temporarily not used by a virtual instance can be recycled to a host machine, and the host machine can then allocate the recycled processing resources to other virtual instances that need to use the processing resources, thereby improving the utilization of the processing resources.
[0219] Reference Figure 6 , shows a structural block diagram of an embodiment of a resource processing device of the present application, the device is applied to Figure 1 or Figure 2 The virtual instance in the scene shown may specifically include the following modules:
[0220] A first decoupling module 401, configured to decouple the data coupled to the first processing resource from at least part of the first processing resource when the data meets a preset condition, wherein the first processing resource includes the processing resource allocated by the host machine to the virtual instance;
[0221] A second decoupling module 402, configured to decouple at least part of the processing resources from the virtual instance on the virtual instance;
[0222] The first sending module 403 is used to send a first notification message to the host machine, wherein the first notification message is used to notify the virtual instance that at least part of the processing resources have been decoupled from the virtual instance to recover at least part of the processing resources from the virtual instance.
[0223] In an optional implementation, the processing resources include at least storage resources, computing resources, and communication resources.
[0224] In an optional implementation, the device further includes:
[0225] A backup module is used to back up the data.
[0226] In an optional implementation, the backup module includes:
[0227] A compression unit, used for compressing the data to obtain compressed data;
[0228] A coupling unit is used to recouple the processing resources other than the at least part of the processing resources in the first processing resources with the compressed data.
[0229] In an optional implementation, the second decoupling module is specifically used to: delete the resource identifier of at least part of the processing resources in a page table maintained by the virtual instance, and the page table is used to store the resource identifier of the processing resources allocated by the host machine to the virtual instance.
[0230] In an optional implementation, the device further includes:
[0231] A first receiving module, configured to receive a second notification message sent by the host machine, wherein the second notification message is used to notify the host machine that a second processing resource has been allocated to the virtual instance;
[0232] The first coupling module is configured to couple the second processing resource with the virtual instance on the virtual instance according to the second notification message.
[0233] In an optional implementation, the first coupling module is specifically used to: store the resource identifier of the second processing resource in a page table maintained by the virtual instance, and the page table is used to store the resource identifier of the processing resource allocated by the host machine to the virtual instance.
[0234] In an optional implementation, the device further includes:
[0235] A first determination module, used to determine whether the data is preset data;
[0236] The first decoupling module is further used for: when the data is preset data, decoupling the data from at least part of the first processing resources.
[0237] In an optional implementation, the device further includes:
[0238] A second determination module, configured to determine that the data meets the preset condition if the data has not been used within a preset time period;
[0239] or,
[0240] A third determination module, configured to determine that the data meets the preset condition when the number of times the data has been used reaches a preset number of times;
[0241] or,
[0242] The fourth determination module is used to determine that the data coupled to the first processing resource meets the preset condition when the third processing resource is coupled with data identical to the data, and the third processing resource includes processing resources in the host machine other than the first processing resource.
[0243] In an optional implementation, the device further includes:
[0244] A storage module is used to store the correspondence between the data identifier of the data and the resource identifier of the third processing resource in the virtual instance.
[0245] In the present application, when the data coupled to the first processing resource meets the preset conditions, the virtual instance decouples the data from at least part of the processing resources in the first processing resource, thereby releasing at least part of the processing resources, so that at least part of the processing resources are in an idle state. The first processing resource includes the processing resources allocated by the host machine to the virtual instance, and then at least part of the processing resources in the first processing resource are decoupled from the virtual instance on the virtual instance, so that at least part of the processing resources are released from the virtual machine from the perspective of the virtual instance, that is, the virtual instance is no longer coupled with at least part of the processing resources, and then a first notification message can be sent to the host machine, and the first notification message is used to notify the virtual instance that at least part of the processing resources in the first processing resource have been decoupled from the virtual instance. The host machine receives the first notification message, and then can decouple at least part of the processing resources in the first processing resource from the virtual instance on the host machine according to the first notification message, so as to recover at least part of the processing resources in the first processing resource from the virtual instance, so that the host machine can autonomously control at least part of the processing resources, for example, at least part of the processing resources can be allocated to the required virtual instance for use.
[0246] Through the present application, processing resources temporarily not used by a virtual instance can be recycled to a host machine, and the host machine can then allocate the recycled processing resources to other virtual instances that need to use the processing resources, thereby improving the utilization of the processing resources.
[0247] Reference Figure 7 , shows a structural block diagram of an embodiment of a resource processing device of the present application, the device is applied to Figure 1 or Figure 2 The host machine in the scenario shown may specifically include the following modules:
[0248] A second receiving module 501 is used to receive a first notification message sent by the virtual instance running on the host machine, wherein the first notification message is used to notify the virtual instance that at least part of the first processing resources has been decoupled from the virtual instance, and the first processing resources include the processing resources allocated by the host machine to the virtual instance;
[0249] The third decoupling module 502 is used to decouple the at least part of the processing resources from the virtual instance on the host machine according to the first notification message, so as to reclaim the at least part of the processing resources from the virtual instance.
[0250] In an optional implementation, the third decoupling module is specifically used to: delete the corresponding table entries including the resource identifier of at least part of the processing resources and the instance identifier of the virtual instance in the correspondence between the resource identifier of the processing resources and the instance identifier of the virtual instance maintained by the host machine.
[0251] In an optional implementation, the device further includes:
[0252] A second coupling module, configured to couple the second processing resource with the virtual instance on the host machine when it is necessary to allocate the second processing resource to the virtual instance;
[0253] The second sending module is used to send a second notification message to the virtual instance, where the second notification message is used to notify the host machine that a second processing resource has been allocated to the virtual instance.
[0254] In an optional implementation, the second coupling module is specifically used to: store a corresponding table entry including the second processing resource and the instance identifier of the virtual instance in the correspondence relationship between the resource identifier of the processing resource and the instance identifier of the virtual instance maintained by the host machine.
[0255] In the present application, when the data coupled to the first processing resource meets the preset conditions, the virtual instance decouples the data from at least part of the processing resources in the first processing resource, thereby releasing at least part of the processing resources, so that at least part of the processing resources are in an idle state. The first processing resource includes the processing resources allocated by the host machine to the virtual instance, and then at least part of the processing resources in the first processing resource are decoupled from the virtual instance on the virtual instance, so that at least part of the processing resources are released from the virtual machine from the perspective of the virtual instance, that is, the virtual instance is no longer coupled with at least part of the processing resources, and then a first notification message can be sent to the host machine, and the first notification message is used to notify the virtual instance that at least part of the processing resources in the first processing resource have been decoupled from the virtual instance. The host machine receives the first notification message, and then can decouple at least part of the processing resources in the first processing resource from the virtual instance on the host machine according to the first notification message, so as to recover at least part of the processing resources in the first processing resource from the virtual instance, so that the host machine can autonomously control at least part of the processing resources, for example, at least part of the processing resources can be allocated to the required virtual instance for use.
[0256] Through the present application, processing resources temporarily not used by a virtual instance can be recycled to a host machine, and the host machine can then allocate the recycled processing resources to other virtual instances that need to use the processing resources, thereby improving the utilization of the processing resources.
[0257] The embodiment of the present application also provides a non-volatile readable storage medium, which stores one or more modules (programs). When the one or more modules are applied to a device, the device can execute instructions (instructions) of each method step in the embodiment of the present application.
[0258] The present application embodiment provides one or more machine-readable media on which instructions are stored, and when executed by one or more processors, the electronic device executes one or more of the methods described in the above embodiments. In the present application embodiment, the electronic device includes a server, a gateway, a sub-device, etc., and the sub-device is an Internet of Things device or other device.
[0259] The embodiments of the present disclosure may be implemented as an apparatus configured as desired using any appropriate hardware, firmware, software, or any combination thereof, and the apparatus may include electronic devices such as servers (clusters), terminal devices such as IoT devices, and the like.
[0260] Figure 8 An exemplary apparatus 1300 that can be used to implement various embodiments described in this application is schematically shown.
[0261] For one embodiment, Figure 8An exemplary apparatus 1300 is shown having one or more processors 1302, a control module (chip set) 1304 coupled to at least one of the (one or more) processors 1302, a memory 1306 coupled to the control module 1304, a non-volatile memory (NVM) / storage device 1308 coupled to the control module 1304, one or more input / output devices 1310 coupled to the control module 1304, and a network interface 1312 coupled to the control module 1306.
[0262] The processor 1302 may include one or more single-core or multi-core processors, and the processor 1302 may include any combination of general-purpose processors or special-purpose processors (such as graphics processors, application processors, baseband processors, etc.). In some embodiments, the device 1300 can be used as a server device such as a gateway described in the embodiments of the present application.
[0263] In some embodiments, the device 1300 may include one or more computer-readable media (e.g., memory 1306 or NVM / storage device 1308) having instructions 1314 and one or more processors 1302 configured to execute the instructions 1314 in combination with the one or more computer-readable media to implement a module to perform the actions described in the present disclosure.
[0264] For one embodiment, the control module 1304 may include any suitable interface controller to provide any suitable interface to at least one of the processor(s) 1302 and / or any suitable device or component in communication with the control module 1304 .
[0265] The control module 1304 may include a memory controller module to provide an interface to the memory 1306. The memory controller module may be a hardware module, a software module, and / or a firmware module.
[0266] The memory 1306 may be used, for example, to load and store data and / or instructions 1314 for the device 1300. For one embodiment, the memory 1306 may include any suitable volatile memory, such as a suitable DRAM. In some embodiments, the memory 1306 may include double data rate type four synchronous dynamic random access memory (DDR4 SDRAM).
[0267] For one embodiment, control module 1304 may include one or more input / output controllers to provide an interface to NVM / storage device 1308 and input / output device(s) 1310 .
[0268] For example, NVM / storage 1308 may be used to store data and / or instructions 1314. NVM / storage 1308 may include any suitable non-volatile memory (e.g., flash memory) and / or may include any suitable non-volatile storage device(s) (e.g., one or more hard disk drives (HDDs), one or more compact disk (CD) drives, and / or one or more digital versatile disk (DVD) drives).
[0269] NVM / storage device 1308 may include storage resources that are physically part of the device on which apparatus 1300 is installed, or it may be accessible to the device without being part of the device. For example, NVM / storage device 1308 may be accessed via input / output device(s) 1310 over a network.
[0270] (One or more) input / output devices 1310 may provide an interface for the apparatus 1300 to communicate with any other appropriate device, and the input / output device 1310 may include a communication component, a phonetic component, a sensor component, etc. The network interface 1312 may provide an interface for the apparatus 1300 to communicate through one or more networks, and the apparatus 1300 may wirelessly communicate with one or more components of a wireless network according to any of one or more wireless network standards and / or protocols, for example, accessing a wireless network based on a communication standard, such as WiFi, 2G, 3G, 4G, 5G, etc., or a combination thereof for wireless communication.
[0271] For one embodiment, at least one of the processor(s) 1302 may be packaged together with the logic of one or more controllers (e.g., a memory controller module) of the control module 1304. For one embodiment, at least one of the processor(s) 1302 may be packaged together with the logic of one or more controllers of the control module 1304 to form a system-in-package (SiP). For one embodiment, at least one of the processor(s) 1302 may be integrated on the same die with the logic of one or more controllers of the control module 1304. For one embodiment, at least one of the processor(s) 1302 may be integrated on the same die with the logic of one or more controllers of the control module 1304 to form a system-on-chip (SoC).
[0272] In various embodiments, the device 1300 may be, but is not limited to, a terminal device such as a server, a desktop computing device, or a mobile computing device (e.g., a laptop computing device, a handheld computing device, a tablet computer, a netbook, etc.). In various embodiments, the device 1300 may have more or fewer components and / or a different architecture. For example, in some embodiments, the device 1300 includes one or more cameras, a keyboard, a liquid crystal display (LCD) screen (including a touch screen display), a non-volatile memory port, multiple antennas, a graphics chip, an application-specific integrated circuit (ASIC), and a speaker.
[0273] An embodiment of the present application provides an electronic device, comprising: one or more processors; and one or more machine-readable media having instructions stored thereon, which, when executed by the one or more processors, enable the electronic device to perform one or more resource processing methods as described in the present application.
[0274] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0275] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0276] The embodiments of the present application are described with reference to the flowcharts and / or block diagrams of the methods, terminal devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0277] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0278] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable terminal device to implement the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0279] Although the preferred embodiments of the present application have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present application.
[0280] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.
[0281] The resource processing method and device provided by the present application are introduced in detail above. The principle and implementation mode of the present application are explained by using specific examples in this article. The description of the above embodiments is only used to help understand the method of the present application and its core idea. At the same time, for those skilled in the art, according to the idea of the present application, there will be changes in the specific implementation mode and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A resource processing method, characterized in that: Applied to a virtual instance, the method comprises: When the data coupled to the first processing resource meets a preset condition, decoupling the data from at least part of the first processing resource, the first processing resource comprising a processing resource allocated by the host machine to the virtual instance; decoupling the at least a portion of the processing resources from the virtual instance on the virtual instance; Sending a first notification message to the host machine, wherein the first notification message is used to notify the virtual instance that at least part of the processing resources have been decoupled from the virtual instance, so as to reclaim at least part of the processing resources from the virtual instance; The method comprises: If the data has not been used within a preset time period, determining that the data meets the preset condition; or, When the number of times the data is used reaches a preset number of times, determining that the data meets the preset condition; or, In the case that the third processing resource is coupled with data identical to the data, it is determined that the data coupled with the first processing resource meets the preset condition, and the third processing resource includes processing resources in the host machine other than the first processing resource.
2. The method according to claim 1, characterized in that Processing resources include at least storage resources, computing resources, and communication resources.
3. The method according to claim 1, characterized in that: The method further comprises: Back up said data.
4. The method according to claim 3, characterized in that The backing up of the data includes: compressing the data to obtain compressed data; Re-coupling processing resources of the first processing resources other than the at least a portion of the processing resources to the compressed data.
5. The method according to claim 1, characterized in that: The decoupling of at least part of the processing resources from the virtual instance on the virtual instance comprises: In a page table maintained by the virtual instance, the resource identifiers of at least part of the processing resources are deleted, and the page table is used to store the resource identifiers of the processing resources allocated by the host machine to the virtual instance.
6. The method according to claim 1, characterized in that The method further comprises: receiving a second notification message sent by the host machine, where the second notification message is used to notify the host machine that a second processing resource has been allocated to the virtual instance; The second processing resource is coupled to the virtual instance on the virtual instance according to the second notification message.
7. The method according to claim 6, characterized in that The coupling the second processing resource with the virtual instance on the virtual instance according to the second notification message comprises: The resource identifier of the second processing resource is stored in a page table maintained by the virtual instance, and the page table is used to store the resource identifier of the processing resource allocated by the host machine to the virtual instance.
8. The method according to claim 1, characterized in that The method further comprises: Determining whether the data is preset data; In the case where the data is preset data, the step of decoupling the data from at least part of the first processing resources is performed.
9. The method according to claim 1, characterized in that: After decoupling the data from at least part of the first processing resources, the method further includes: A correspondence between the data identifier of the data and the resource identifier of the third processing resource is stored in the virtual instance.
10. A resource processing method, characterized in that: Applied to a host machine, the method includes: receiving a first notification message sent by a virtual instance running on the host machine, the first notification message being used to notify the virtual instance that at least part of first processing resources has been decoupled from the virtual instance, the first processing resources comprising processing resources allocated by the host machine to the virtual instance; According to the first notification message, decoupling at least part of the processing resources from the virtual instance on the host machine to reclaim at least part of the processing resources from the virtual instance; The first notification message is sent to the host machine after the virtual instance decouples the data from at least part of the first processing resources when the data coupled to the first processing resource meets a preset condition; The data coupled to the first processing resource meets the preset conditions including: the data has not been used within a preset time period, or the data has been used a preset number of times, or the third processing resource is coupled with data identical to the data, and the third processing resource includes processing resources in the host machine other than the first processing resource.
11. The method according to claim 10, characterized in that The decoupling, on the host machine according to the first notification message, at least part of the processing resources from the virtual instance comprises: In the correspondence between the resource identifiers of the processing resources and the instance identifiers of the virtual instances maintained by the host machine, the corresponding table entries including the resource identifiers of at least part of the processing resources and the instance identifiers of the virtual instances are deleted.
12. The method according to claim 10, characterized in that The method further comprises: In case that a second processing resource needs to be allocated to the virtual instance, coupling the second processing resource with the virtual instance on the host machine; A second notification message is sent to the virtual instance, where the second notification message is used to notify the host machine that a second processing resource has been allocated to the virtual instance.
13. The method according to claim 12, characterized in that The coupling of the second processing resource with the virtual instance on the host machine includes: In the correspondence relationship between the resource identifier of the processing resource and the instance identifier of the virtual instance maintained by the host machine, a correspondence table entry including the second processing resource and the instance identifier of the virtual instance is stored.
14. A resource processing device, characterized in that: Applied to a virtual instance, the device comprises: A first decoupling module, configured to decouple the data coupled to the first processing resource from at least part of the first processing resource when the data meets a preset condition, wherein the first processing resource includes a processing resource allocated by a host machine to the virtual instance; A second decoupling module, configured to decouple at least part of the processing resources from the virtual instance on the virtual instance; a first sending module, configured to send a first notification message to the host machine, wherein the first notification message is used to notify the virtual instance that at least part of the processing resources have been decoupled from the virtual instance, so as to reclaim at least part of the processing resources from the virtual instance; The device also includes: A second determination module, configured to determine that the data meets the preset condition if the data has not been used within a preset time period; or, A third determination module, configured to determine that the data meets the preset condition when the number of times the data has been used reaches a preset number of times; or, The fourth determination module is used to determine that the data coupled to the first processing resource meets the preset condition when the third processing resource is coupled with data identical to the data, and the third processing resource includes processing resources in the host machine other than the first processing resource.
15. The device according to claim 14, characterized in that Processing resources include at least storage resources, computing resources, and communication resources.
16. The device according to claim 14, characterized in that The device also includes: The backup module is used to back up the data.
17. The device according to claim 16, characterized in that The backup module comprises: A compression unit, used for compressing the data to obtain compressed data; A coupling unit is used to recouple the processing resources other than the at least part of the processing resources in the first processing resources with the compressed data.
18. The device according to claim 14, characterized in that The second decoupling module is specifically used to delete the resource identifier of at least part of the processing resources in the page table maintained by the virtual instance, and the page table is used to store the resource identifier of the processing resources allocated by the host machine to the virtual instance.
19. The device according to claim 14, characterized in that The device also includes: A first receiving module, configured to receive a second notification message sent by the host machine, wherein the second notification message is used to notify the host machine that a second processing resource has been allocated to the virtual instance; The first coupling module is configured to couple the second processing resource with the virtual instance on the virtual instance according to the second notification message.
20. The device according to claim 19, characterized in that The first coupling module is specifically used to store the resource identifier of the second processing resource in a page table maintained by the virtual instance, and the page table is used to store the resource identifier of the processing resource allocated by the host machine to the virtual instance.
21. The device according to claim 14, characterized in that The device also includes: A first determination module, used to determine whether the data is preset data; The first decoupling module is further used for: when the data is preset data, decoupling the data from at least part of the first processing resources.
22. The device according to claim 14, characterized in that The device also includes: A storage module is used to store the correspondence between the data identifier of the data and the resource identifier of the third processing resource in the virtual instance.
23. A resource processing device, characterized in that: Applied to a host machine, the device comprises: A second receiving module is used to receive a first notification message sent by the virtual instance running on the host machine, wherein the first notification message is used to notify the virtual instance that at least part of the first processing resources has been decoupled from the virtual instance, and the first processing resources include the processing resources allocated by the host machine to the virtual instance; a third decoupling module, configured to decouple at least part of the processing resources from the virtual instance on the host machine according to the first notification message, so as to reclaim at least part of the processing resources from the virtual instance; The first notification message is sent to the host machine after the virtual instance decouples the data from at least part of the first processing resources when the data coupled to the first processing resource meets a preset condition; The data coupled to the first processing resource meets the preset conditions including: the data has not been used within a preset time period, or the data has been used a preset number of times, or the third processing resource is coupled with data identical to the data, and the third processing resource includes processing resources in the host machine other than the first processing resource.
24. The device according to claim 23, characterized in that The third decoupling module is specifically used to delete the corresponding table entries including the resource identifier of at least part of the processing resources and the instance identifier of the virtual instance in the correspondence relationship between the resource identifier of the processing resources and the instance identifier of the virtual instance maintained by the host machine.
25. The device according to claim 23, characterized in that The device also includes: A second coupling module, configured to couple the second processing resource with the virtual instance on the host machine when it is necessary to allocate the second processing resource to the virtual instance; The second sending module is used to send a second notification message to the virtual instance, where the second notification message is used to notify the host machine that a second processing resource has been allocated to the virtual instance.
26. The device according to claim 25, characterized in that The second coupling module is specifically used to store a corresponding table entry including the second processing resource and the instance identifier of the virtual instance in the corresponding relationship between the resource identifier of the processing resource and the instance identifier of the virtual instance maintained by the host machine.
27. An electronic device, characterized in that: The electronic device comprises: Processor; and A memory having executable codes stored thereon, which, when executed, causes the processor to execute the resource processing method according to any one of claims 1 to 9.
28. One or more machine-readable media having executable codes stored thereon, which, when executed, cause a processor to execute the resource processing method according to any one of claims 1 to 9.
29. An electronic device, characterized in that: The electronic device comprises: Processor; and A memory having executable codes stored thereon, which, when executed, enables the processor to execute the resource processing method according to any one of claims 10 to 13.
30. One or more machine-readable media having executable codes stored thereon, which, when executed, enable a processor to execute the resource processing method according to any one of claims 10 to 13.
Citation Information
Patent Citations
Storage resource recycling method under cloud environment, sharing storage system and cloud service system
CN107800806A
