Resource-based allocation / processing method and electronic device
By building a preset resource pool and scheduling resources according to the status of the virtual machine, the problem of coordination between virtual machines and acceleration resources is solved, and efficient resource utilization and efficiency improvement are achieved.
Patent Information
- Application Number
- CN202011625613.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-12-31
- Publication Date
- 2025-01-21
- Estimated Expiration
- 2040-12-31
AI Technical Summary
Virtual machines cannot coordinate with limited acceleration resources when using acceleration resources, resulting in waste of resources and inefficiency.
By building a preset resource pool, resources are reasonably scheduled according to the actual status of the virtual machine, including obtaining the virtual machine's request information, selecting the corresponding resources to mount on the virtual machine, and uninstalling and putting the resources back when the virtual machine status changes.
It effectively prevents the waste of accelerated resources, improves the efficiency of information processing, and ensures the rational utilization of resources.
Smart Images

Figure CN112631784B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of information processing and device control, and in particular to a resource-based allocation / processing method and electronic device. Background Art
[0002] In the field of computer-based information processing, especially in the field of cloud services, the server needs to use acceleration resources to provide acceleration services for virtual machines. The acceleration resources can be physical devices such as accelerators (cards) and FPGA cards, while virtual machines refer to complete computer systems with complete hardware system functions and running in a specific environment that are simulated by software. However, when virtual machines use acceleration resources, they cannot coordinate with limited acceleration resources, resulting in the inability to reasonably schedule limited and precious acceleration resources, thereby causing a waste of system resources. Summary of the invention
[0003] The purpose of the embodiments of the present application is to provide a resource-based allocation / processing method and electronic device, which can reasonably schedule limited and precious resources according to the actual state of the virtual machine, thereby preventing the waste of system resources, especially acceleration resources, and effectively improving the efficiency of information processing.
[0004] The embodiment of the present application adopts the following technical solution: a resource allocation / processing method, comprising:
[0005] Acquire request information sent by a virtual machine in a first state, wherein the request information is information requesting to call a resource;
[0006] Based on the request information, select a corresponding resource from a preset resource pool, and mount the selected resource to the virtual machine, wherein the preset resource pool includes at least one resource;
[0007] When the virtual machine is in the second state, the resources mounted on the virtual machine are uninstalled and returned to the preset resource pool, wherein the power consumption of the virtual machine in the first state is greater than the power consumption in the second state.
[0008] Optionally, the request information includes tag information of the virtual machine, the tag information is information that the virtual machine declares to occupy the resource, and the selecting corresponding resources from a preset resource pool based on the request information and mounting the selected resources to the virtual machine includes:
[0009] Selecting the resource from the preset resource pool based on the statistical information of the resources in the preset resource pool, the marking information and / or the current mounting statistical information of the virtual machine;
[0010] The selected resource is mounted on the virtual machine.
[0011] Optionally, the virtual machine has a corresponding weight, and the method further includes:
[0012] When the virtual machine has a first weight, based on the tag information of the virtual machine, maintaining the resource mounted on the virtual machine;
[0013] Correspondingly, when the virtual machine is in the second state, the resources mounted on the virtual machine are uninstalled and returned to the preset resource pool, including:
[0014] When the virtual machine has the second weight and the virtual machine with the second weight is in the second state, the resources mounted on the virtual machine are uninstalled and returned to the preset resource pool.
[0015] Optionally, the method further includes establishing the preset resource pool, which includes:
[0016] Acquire the resource in at least one server, wherein the resource has a corresponding type parameter;
[0017] Based on the type parameter of the resource and the location information of the resource on the server, the resource in the server is added to the preset resource pool.
[0018] Optionally, the request information includes a request type parameter and a request quantity parameter, and the selecting corresponding resources from a preset resource pool based on the request information and mounting the selected resources to the virtual machine includes:
[0019] Selecting corresponding resources from the preset resource pool based on the request type parameter and the request quantity parameter;
[0020] Mount the selected resources to the virtual machine.
[0021] Optionally, the method further includes initializing the preset resource pool, including:
[0022] The resources are classified based on the type parameters of the resources and the location information of the resources on the server.
[0023] Optionally, the method further includes:
[0024] When creating the virtual machine, tag information of the virtual machine is generated to declare information about the resources to be occupied by the virtual machine, wherein the resources include acceleration resources, and the types of the acceleration resources include at least one of the following: a GPU accelerator and an FPGA card.
[0025] The present application also provides an electronic device, including:
[0026] An acquisition module is configured to: acquire request information sent by a virtual machine in a first state, wherein the request information is information requesting to call a resource;
[0027] A processing module, configured to select a corresponding resource from a preset resource pool based on the request information, and mount the selected resource to the virtual machine, wherein the preset resource pool includes at least one resource;
[0028] When the virtual machine is in the second state, the resources mounted on the virtual machine are uninstalled and returned to the preset resource pool, wherein the power consumption of the virtual machine in the first state is greater than the power consumption in the second state.
[0029] Optionally, the request information includes tag information of the virtual machine, where the tag information is information that the virtual machine declares to occupy the resource, and the processing module is further configured to:
[0030] Selecting the resource from the preset resource pool based on the statistical information of the resources in the preset resource pool, the marking information and / or the current mounting statistical information of the virtual machine;
[0031] The selected resource is mounted on the virtual machine.
[0032] Optionally, the virtual machine has a corresponding weight, and the processing module is further configured to:
[0033] When the virtual machine has a first weight, based on the tag information of the virtual machine, maintaining the resource mounted on the virtual machine;
[0034] When the virtual machine has the second weight and the virtual machine with the second weight is in the second state, the resources mounted on the virtual machine are uninstalled and returned to the preset resource pool.
[0035] The method in the embodiment of the present application constructs a preset resource pool, so that based on the preset resource pool, limited and precious resources can be reasonably scheduled according to the actual status of the virtual machine, thereby preventing the waste of resources, especially acceleration resources, due to unlimited occupation, and effectively improving the efficiency of utilizing resources for data processing. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] Figure 1 A flowchart of a resource allocation / processing method according to an embodiment of the present application;
[0037] Figure 2 For the embodiments of this application Figure 1 A flowchart of an embodiment of step S2;
[0038] Figure 3 A flowchart of a specific embodiment of the resource allocation / processing method of the embodiment of the present application;
[0039] Figure 4 This is a structural block diagram of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0040] Various aspects and features of the present application are described herein with reference to the accompanying drawings.
[0041] It should be understood that various modifications may be made to the embodiments of the present application. Therefore, the above description should not be considered as limiting, but only as an example of the embodiments. Other modifications within the scope and spirit of the present application will occur to those skilled in the art.
[0042] The accompanying drawings, which are incorporated in and constitute a part of the specification, illustrate embodiments of the present application and, together with the general description of the present application given above and the detailed description of the embodiments given below, serve to explain the principles of the present application.
[0043] These and other characteristics of the present application will become apparent from the following description of a preferred form of embodiment given as a non-limiting example with reference to the accompanying drawings.
[0044] It should also be understood that although the present application has been described with reference to some specific examples, those skilled in the art will be able to readily implement many other equivalent forms of the present application.
[0045] The above and other aspects, features and advantages of the present application will become more apparent in view of the following detailed description when taken in conjunction with the accompanying drawings.
[0046] Specific embodiments of the present application are described hereinafter with reference to the accompanying drawings; however, it should be understood that the embodiments applied for are merely examples of the present application, which may be implemented in a variety of ways. Well-known and / or repeated functions and structures are not described in detail to avoid unnecessary or redundant details that obscure the present application. Therefore, the specific structural and functional details applied for herein are not intended to be limiting, but merely serve as a basis and representative basis for the claims to teach those skilled in the art to use the present application in a variety of ways with substantially any suitable detailed structure.
[0047] This specification may use the phrases "in one embodiment," "in another embodiment," "in yet another embodiment," or "in other embodiments," all of which may refer to one or more of the same or different embodiments according to the present application.
[0048] Figure 1 A flowchart of a resource allocation / processing method according to an embodiment of the present application;
[0049] A resource allocation / processing method in an embodiment of the present application can be applied to electronic devices on a cloud platform, such as Figure 1 As shown, the method comprises the following steps:
[0050] S1, obtaining request information sent by a virtual machine in a first state, wherein the request information is information for requesting to call a resource.
[0051] A virtual machine can be a complete computer system that has complete hardware system functions and runs in a specific environment, which is simulated by software. It can be a virtual system; it can also correspond to a client, which can process data through the virtual machine.
[0052] The first state of the virtual machine may be its working state, or the virtual machine startup state, etc., wherein each component may be in normal operation, so that the virtual machine can send request information to the electronic device in the cloud platform to request to call a resource. The resource may be a physical resource, a resource capable of processing data, including an acceleration resource and / or a computing resource, etc. The acceleration resource may be a resource for processing graphic calculations or network data. In one embodiment, the virtual machine sends a request information to the cloud platform to request to call the acceleration resource, and the electronic device in the cloud platform obtains the request information.
[0053] S2. Based on the request information, select corresponding resources from a preset resource pool, and mount the selected resources to the virtual machine, wherein the preset resource pool includes at least one resource.
[0054] After receiving the request information, the electronic device in the cloud platform can select the resource corresponding to the request information from the preset resource pool, for example, according to the type and quantity of the resource requested by the request information, so as to meet the use requirements of the virtual machine. After selecting the resource, the selected resource can be mounted on the virtual machine, so that the virtual machine can use the resource mounted thereon in a timely and efficient manner when it actually needs to use the resource to process data.
[0055] In addition, in this embodiment, the preset resource pool corresponds to multiple virtual machines, that is, multiple virtual machines can obtain resources in the preset resource pool, and the preset resource pool includes at least one resource. The preset resource pool can be pre-constructed, and the logical storage of resources therein can be stored based on the relevant information of each resource, such as type information, tag information, etc., so as to avoid logical confusion of resources in the preset resource pool.
[0056] S3, when the virtual machine is in the second state, uninstalling the resources mounted on the virtual machine and returning them to the preset resource pool, wherein the power consumption of the virtual machine in the first state is greater than the power consumption in the second state.
[0057] Specifically, the power consumption of the second state of the virtual machine is less than the power consumption of the first state. The second state may include the virtual machine being powered off, idle, etc. In the second state, the virtual machine does not need to use, or does not immediately need to use, its own mounted resources. In this embodiment, when the virtual machine is in the second state, the resources mounted on the virtual machine can be uninstalled and put back into the preset resource pool. The number of available resources in the preset resource pool is increased, so that other virtual machines that need to use resources can immediately obtain resources from the preset resource pool.
[0058] The method in the embodiment of the present application constructs a preset resource pool, so that based on the preset resource pool, limited and precious resources can be reasonably scheduled according to the actual status of the virtual machine, thereby preventing the waste of resources, especially acceleration resources, due to unlimited occupation, and effectively improving the efficiency of utilizing resources for data processing.
[0059] In one embodiment of the present application, the request information includes tag information of the virtual machine, the tag information is information of the virtual machine declaring the resource to be occupied, and based on the request information, the corresponding resource is selected from the preset resource pool, and the selected resource is mounted on the virtual machine, such as Figure 2 As shown, including:
[0060] S21, selecting the resource from the preset resource pool based on the statistical information of the resources in the preset resource pool, the marking information and / or the current mounting statistical information of the virtual machine.
[0061] S22: Mount the selected resource on the virtual machine.
[0062] The tag information is the information of the virtual machine declaring the resources to be occupied. For example, when a virtual machine is created, it can declare the information of the resources it needs to occupy. The declaration is the resource information that the virtual machine needs to use, that is, the declared resource information can meet its own needs. Although it has been declared, the declared resources may not be used immediately. The currently mounted resources of the virtual machine are also changing, and the number and type of currently mounted resources may not be consistent with the declared occupied resources.
[0063] In addition, the usage scenarios of the resource allocation / processing method may not be exactly the same, and the quantity and type of resources in the preset resource pool may not be the same. Even in the same usage scenario, the quantity and type of resources may vary.
[0064] Therefore, in this application, the resource demand can be comprehensively analyzed and judged based on at least one of the following: statistical information, tag information and current mounting statistical information of the virtual machine in the preset resource pool. Thus, the demand for the virtual machine, including the current demand, can be accurately judged in general. And then the resources that are compatible with the virtual machine can be accurately selected from the preset resource pool and mounted on the virtual machine. For example, the virtual machine declares to occupy 10 acceleration resources (such as accelerators for processing images, and FPGA cards for processing network data), and the virtual machine has already mounted 2 in the current situation. The number of resources in the preset resource pool is 20 to meet its needs, but the virtual machine only needs 6 in the current situation. At this time, 4 more resources can be selected from the preset resource pool and mounted for the virtual machine to meet the current 6 resources required, and it is not necessary to immediately mount the 10 resources it declared.
[0065] In one embodiment of the present application, the virtual machines have corresponding weights, and the method further includes the following steps:
[0066] When the virtual machine has a first weight, based on the tag information of the virtual machine, maintaining the resource mounted on the virtual machine;
[0067] Correspondingly, when the virtual machine is in the second state, the resources mounted on the virtual machine are uninstalled and returned to the preset resource pool, including:
[0068] When the virtual machine has the second weight and the virtual machine with the second weight is in the second state, the resources mounted on the virtual machine are uninstalled and returned to the preset resource pool.
[0069] Specifically, a virtual machine has a corresponding weight, and the higher the weight, the higher the priority of the resource usage of the virtual machine, and the lower the weight, the higher the priority of the resource usage of the virtual machine. In this embodiment, the first weight is greater than the second weight, so in this application, the resource usage of the virtual machine with the first weight can be satisfied as much as possible, the number and / or type of resources declared by the virtual machine to be occupied can be satisfied as much as possible, and the resources mounted on the virtual machine can be maintained.
[0070] For the virtual machine with the second weight, it indicates that the task processed by the virtual machine is not very important. Therefore, in order to save resources, when the virtual machine is in the second state, such as the business idle state or the shutdown state, the resources mounted on the virtual machine can be uninstalled and put back into the preset resource pool to enrich the resources in the preset resource pool.
[0071] For example, teachers need to use their own clients when teaching students. The clients correspond to their own virtual machines. The first virtual machine corresponding to the teacher has a first weight, and the second virtual machines corresponding to multiple students have a second weight. At this time, the needs of the first virtual machine can be met first, and the acceleration resources mounted on the first virtual machine are maintained based on the tag information of the first virtual machine. For the second virtual machine, its declared resource needs may not be met first. Therefore, when the second virtual machine is in an idle state, the resources mounted on the second virtual machine can be uninstalled and returned to the preset resource pool, thereby achieving flexible processing and use of resources.
[0072] In one embodiment of the present application, the method further includes establishing the preset resource pool, wherein: Figure 3 As shown, including:
[0073] S4, obtaining the resource in at least one server, wherein the resource has a corresponding type parameter;
[0074] The resources in the preset resource pool can be obtained from one or more servers, that is, the resources can be set in the same server or in different servers. When establishing a preset resource pool, resources from one or more servers can be added to the preset resource pool. Resources have corresponding type parameters, which characterize the type of the resource.
[0075] S5, based on the type parameter of the resource and the location information of the resource on the server, adding the resource in the server to the preset resource pool.
[0076] The location information indicates the location of the server where the resource is located, such as the first resource is set on the first server, and the second resource is set on the second server. This embodiment can add resources to the preset resource pool based on the type parameters of the resources and the location information of the resources on the server. For example, in order to make the preset resource pool have the first type of resources, the first resource of the first type can be selected from the first server to the preset resource pool; in order to make the preset resource pool have the second type of resources, the second resource of the second type can be selected from the second server to the preset resource pool, etc. In this way, the constructed preset resource pool has the required resources of rich types.
[0077] In one embodiment of the present application, the request information includes a request type parameter and a request quantity parameter, and the method of selecting corresponding resources from a preset resource pool based on the request information and mounting the selected resources to the virtual machine includes the following steps:
[0078] Selecting corresponding resources from the preset resource pool based on the request type parameter and the request quantity parameter;
[0079] Mount the selected resources to the virtual machine.
[0080] Specifically, the request information includes a request type parameter and a request quantity parameter. The request type parameter can characterize the type of resources requested by the virtual machine, such as an accelerator for processing images or an FPGA card for processing network information; the request data volume parameter can characterize the number of resources requested by the virtual machine. The virtual machine also needs to request the type of resources while requesting the number of resources. The server needs to meet not only the quantity requirements but also the type requirements of the virtual machine's request. Therefore, in this embodiment, based on the request type parameter and request quantity parameter of the virtual machine, the corresponding resources can be selected from the preset resource pool, and the selected resources can be mounted on the virtual machine that issued the request information to meet the various needs of the virtual machine, thereby meeting the needs of the virtual machine in technical details.
[0081] In one embodiment of the present application, the method further includes initializing the preset resource pool, including:
[0082] The resources are classified based on the type parameters of the resources and the location information of the resources on the server.
[0083] Specifically, classifying resources can be to logically organize resources, including organizing them according to resource type parameters and location information of the resources on a certain server. For example, all resources on a first server are classified and integrated according to type, resources of the first type are associated together, and resources of the second type are associated together, and when calling, they can be quickly selected according to different type parameters.
[0084] In one embodiment of the present application, the method further comprises the following steps:
[0085] When creating the virtual machine, tag information of the virtual machine is generated to declare information about the resources to be occupied by the virtual machine, wherein the resources include acceleration resources, and the types of the acceleration resources include at least one of the following: a GPU accelerator and an FPGA card.
[0086] Specifically, the marking information is information about the resources to be occupied by the virtual machine. In this embodiment, the virtual machine generates corresponding marking information when it is created to declare the information about the resources to be occupied by the virtual machine. Of course, even if the resources are declared, they will not be occupied immediately or exclusively. When resources are needed, resources that are suitable for their status can be obtained through the preset resource pool. Resources include acceleration resources, and the types of acceleration resources include at least one of the following: GPU accelerator and FPGA card. GPU (Graphics Processing Unit) accelerator can process images, while FPGA card (Field Programmable Gate Array, field editable logic gate array chip) can process network information or other data.
[0087] The present application also provides an electronic device, such as Figure 4 As shown, including:
[0088] The acquisition module is configured to: acquire request information sent by a virtual machine in a first state, wherein the request information is information requesting to call a resource.
[0089] Specifically, a virtual machine can be a complete computer system with complete hardware system functions and running in a specific environment, which is simulated by software. It can be a virtual system; it can also correspond to a client, and the client can process data through the virtual machine.
[0090] The first state of the virtual machine may be its working state, or the virtual machine startup state, etc., wherein each component may be in normal operation, so that the virtual machine can send a request message to the electronic device in the cloud platform to request to call a resource. The resource may be a physical resource, a resource capable of processing data, including an acceleration resource and / or a computing resource, etc. The acceleration resource may be a resource for processing graphic calculations or network data. In one embodiment, the virtual machine sends a request message to the cloud platform to request to call the acceleration resource, and the acquisition module of the electronic device in the cloud platform acquires the request message.
[0091] A processing module, configured to select a corresponding resource from a preset resource pool based on the request information, and mount the selected resource to the virtual machine, wherein the preset resource pool includes at least one resource;
[0092] When the virtual machine is in the second state, the resources mounted on the virtual machine are uninstalled and returned to the preset resource pool, wherein the power consumption of the virtual machine in the first state is greater than the power consumption in the second state.
[0093] Specifically, after receiving the request information, the processing module can select resources corresponding to the request information from the preset resource pool, for example, according to the type and quantity of the resources requested by the request information, so as to meet the use requirements of the virtual machine. After selecting the resources, the processing module can mount the selected resources on the virtual machine, so that the virtual machine can use the resources mounted thereon in a timely and efficient manner when it actually needs to use the resources to process data.
[0094] In addition, in this embodiment, the preset resource pool corresponds to multiple virtual machines, that is, multiple virtual machines can obtain resources in the preset resource pool, and the preset resource pool includes at least one resource. The preset resource pool can be pre-constructed, and the logical storage of resources therein can be stored based on the relevant information of each resource, such as type information, tag information, etc., so as to avoid logical confusion of resources in the preset resource pool.
[0095] The power consumption of the second state of the virtual machine is less than the power consumption of the first state. The second state may include the virtual machine being powered off, idle, etc. In the second state, the virtual machine does not need to use, or does not immediately need to use its own mounted resources. In this embodiment, the processing module can, when the virtual machine is in the second state, uninstall the resources mounted on the virtual machine and put them back into the preset resource pool. This increases the number of available resources in the preset resource pool, so that other virtual machines that need to use resources can immediately obtain resources from the preset resource pool.
[0096] The electronic device in the embodiment of the present application can reasonably schedule limited and precious resources based on the preset resource pool and the actual state of the virtual machine, thereby preventing the waste of resources, especially acceleration resources, due to unlimited occupation, and effectively improving the efficiency of utilizing resources for data processing.
[0097] The request information includes the tag information of the virtual machine, and the tag information is information that the virtual machine declares to occupy the resource, and the processing module is further configured to:
[0098] Selecting the resource from the preset resource pool based on the statistical information of the resources in the preset resource pool, the marking information and / or the current mounting statistical information of the virtual machine;
[0099] The selected resource is mounted on the virtual machine.
[0100] In one embodiment of the present application, the marking information is information about resources to be occupied by the virtual machine, such as when the virtual machine is created, it can declare information about the resources it needs to occupy. The declaration is the resource information that the virtual machine needs to use, that is, the declared resource information can meet its own needs. Although it has been declared, the declared resources may not be used immediately. The currently mounted resources of the virtual machine are also changing, and the number and type of currently mounted resources may not be consistent with the declared occupied resources.
[0101] In addition, the usage scenarios of the resource allocation / processing method may not be exactly the same, and the quantity and type of resources in the preset resource pool may not be the same. Even in the same usage scenario, the quantity and type of resources may vary.
[0102] Therefore, the processing module in the present application can comprehensively analyze and judge the resource demand based on at least one of the following: statistical information, tag information and current mounting statistical information of the virtual machine in the preset resource pool. Thus, the demand for the virtual machine, including the current demand, can be accurately judged in general. Then the processing module can accurately select resources that are compatible with the virtual machine from the preset resource pool and mount them on the virtual machine. For example, the virtual machine declares that it occupies 10 acceleration resources (such as accelerators for processing images, and FPGA cards for processing network data), and the virtual machine has already mounted 2 in the current situation. The number of resources in the preset resource pool is 20 to meet its needs, but the virtual machine only needs 6 in the current situation. At this time, 4 more resources can be selected from the preset resource pool and mounted for the virtual machine to meet the current 6 required resources, and it is not necessary to immediately mount the 10 resources it declared.
[0103] In one embodiment of the present application, the virtual machines have corresponding weights, and the processing module is further configured to:
[0104] When the virtual machine has a first weight, based on the tag information of the virtual machine, maintaining the resource mounted on the virtual machine;
[0105] When the virtual machine has the second weight and the virtual machine with the second weight is in the second state, the resources mounted on the virtual machine are uninstalled and returned to the preset resource pool.
[0106] Specifically, a virtual machine has a corresponding weight, and the higher the weight, the higher the priority of the resource usage of the virtual machine, and the lower the weight, the higher the priority of the resource usage of the virtual machine. In this embodiment, the first weight is greater than the second weight, so the processing module in this application can try to satisfy the resource usage of the virtual machine with the first weight, try to satisfy the number and / or type of resources to be occupied by the virtual machine, and maintain the resources mounted on the virtual machine.
[0107] For the virtual machine with the second weight, it indicates that the task processed by the virtual machine is not very important. Therefore, in order to save resources, when the virtual machine is in the second state, such as the business idle state or the shutdown state, the processing module can uninstall the resources mounted on the virtual machine and put them back to the preset resource pool to enrich the resources in the preset resource pool.
[0108] For example, teachers need to use their own clients when teaching students, and the clients correspond to their own virtual machines. The first virtual machine corresponding to the teacher has a first weight, and the second virtual machines corresponding to multiple students have a second weight. At this time, the needs of the first virtual machine can be met first, and the processing module maintains the acceleration resources mounted on the first virtual machine based on the tag information of the first virtual machine; for the second virtual machine, its declared resource needs may not be met first. Therefore, when the second virtual machine is in an idle state, the processing module can uninstall the resources mounted on the second virtual machine and put them back to the preset resource pool, thereby achieving flexible processing and use of resources.
[0109] In one embodiment of the present application, the electronic device further includes a construction module, wherein the construction module is configured to establish the preset resource pool, wherein the specific configuration is:
[0110] Acquire the resource in at least one server, wherein the resource has a corresponding type parameter;
[0111] Based on the type parameter of the resource and the location information of the resource on the server, the resource in the server is added to the preset resource pool.
[0112] In one embodiment of the present application, the request information includes a request type parameter and a request quantity parameter, and the processing module is further configured as follows:
[0113] Selecting corresponding resources from the preset resource pool based on the request type parameter and the request quantity parameter;
[0114] Mount the selected resources to the virtual machine.
[0115] In one embodiment of the present application, the electronic device further includes an initialization module, wherein the initialization module is configured to initialize the preset resource pool, including:
[0116] The resources are classified based on the type parameters of the resources and the location information of the resources on the server.
[0117] In one embodiment of the present application, the processing module is further configured as follows:
[0118] When creating the virtual machine, tag information of the virtual machine is generated to declare information about the resources to be occupied by the virtual machine, wherein the resources include acceleration resources, and the types of the acceleration resources include at least one of the following: a GPU accelerator and an FPGA card.
[0119] The above embodiments are only exemplary embodiments of the present application and are not intended to limit the present application. The protection scope of the present application is defined by the claims. Those skilled in the art may make various modifications or equivalent substitutions to the present application within the essence and protection scope of the present application, and such modifications or equivalent substitutions shall also be deemed to fall within the protection scope of the present application.
Claims
1. A resource allocation / processing method, comprising: Acquire request information sent by a virtual machine in a first state, wherein the request information is information requesting to call a resource; Based on the request information, select a corresponding resource from a preset resource pool, and mount the selected resource to the virtual machine, wherein the preset resource pool includes at least one resource; When the virtual machine is in the second state, the resources mounted on the virtual machine are uninstalled and returned to the preset resource pool, wherein the power consumption of the virtual machine in the first state is greater than the power consumption in the second state; wherein, The request information includes tag information of the virtual machine, the tag information is information of the virtual machine declaring the resource to be occupied, and the selecting corresponding resources from a preset resource pool based on the request information and mounting the selected resources to the virtual machine includes: Selecting the resource from the preset resource pool based on the statistical information of the resources in the preset resource pool, the marking information and / or the current mounting statistical information of the virtual machine; The selected resource is mounted on the virtual machine.
2. The method according to claim 1, wherein the virtual machines have corresponding weights, and the method further comprises: When the virtual machine has a first weight, based on the tag information of the virtual machine, maintaining the resource mounted on the virtual machine; Correspondingly, when the virtual machine is in the second state, the resources mounted on the virtual machine are uninstalled and returned to the preset resource pool, including: When the virtual machine has the second weight and the virtual machine with the second weight is in the second state, the resources mounted on the virtual machine are uninstalled and returned to the preset resource pool.
3. The method according to claim 1, further comprising establishing the preset resource pool, comprising: Acquire the resource in at least one server, wherein the resource has a corresponding type parameter; Based on the type parameter of the resource and the location information of the resource on the server, the resource in the server is added to the preset resource pool.
4. According to the method of claim 3, the request information includes a request type parameter and a request quantity parameter, and the selecting corresponding resources from a preset resource pool based on the request information and mounting the selected resources to the virtual machine comprises: Selecting corresponding resources from the preset resource pool based on the request type parameter and the request quantity parameter; Mount the selected resources to the virtual machine.
5. The method according to claim 1, further comprising initializing the preset resource pool, comprising: The resources are classified based on the type parameters of the resources and the location information of the resources on the server.
6. The method according to claim 2, further comprising: When creating the virtual machine, tag information of the virtual machine is generated to declare information about the resources to be occupied by the virtual machine, wherein the resources include acceleration resources, and the types of the acceleration resources include at least one of the following: a GPU accelerator and an FPGA card.
7. An electronic device comprising: An acquisition module is configured to: acquire request information sent by a virtual machine in a first state, wherein the request information is information requesting to call a resource; A processing module, configured to select a corresponding resource from a preset resource pool based on the request information, and mount the selected resource to the virtual machine, wherein the preset resource pool includes at least one resource; When the virtual machine is in the second state, the resources mounted on the virtual machine are uninstalled and returned to the preset resource pool, wherein the power consumption of the virtual machine in the first state is greater than the power consumption in the second state; wherein, The request information includes the tag information of the virtual machine, and the tag information is information that the virtual machine declares to occupy the resource, and the processing module is configured as follows: Selecting the resource from the preset resource pool based on the statistical information of the resources in the preset resource pool, the marking information and / or the current mounting statistical information of the virtual machine; The selected resource is mounted on the virtual machine.
8. The electronic device according to claim 7, wherein the virtual machines have corresponding weights, and the processing module is further configured to: When the virtual machine has a first weight, based on the tag information of the virtual machine, maintaining the resource mounted on the virtual machine; When the virtual machine has the second weight and the virtual machine with the second weight is in the second state, the resources mounted on the virtual machine are uninstalled and returned to the preset resource pool.
Citation Information
Patent Citations
Shared virtualized resource management method and shared virtualized resource management device under shared virtualized resource pool environment
CN104331375A