CPU resource adjusting method and device, server and storage medium

By dynamically adjusting the CPU resources of the virtual machine, the problem of the inability to flexibly adjust CPU resources during the operation of the virtual machine in the existing technology is solved, and the performance of the virtual machine and the resource utilization rate are improved.

CN119883588APending Publication Date: 2025-04-25CHINA UNITED NETWORK COMM GRP CO LTD +2
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202311393667.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-10-25
Publication Date
2025-04-25

AI Technical Summary

Technical Problem

The existing technology cannot flexibly adjust its available CPU resources during the operation of a virtual machine, resulting in resource squeezing and preempting, affecting the performance of the virtual machine.

Method used

By obtaining CPU resource adjustment requests, calling the resource management interface of the virtual machine management application, dynamically adjusting the virtual machine's CPU resources, real-time restrictions and dynamic adjustments are achieved.

Benefits of technology

It realizes real-time limiting and dynamic adjustment of the CPU resources that can be used during the operation of the virtual machine, solves the problems of resource squeezing and preemption, and improves the performance and resource utilization of the virtual machine.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119883588A_ABST
    Figure CN119883588A_ABST
Patent Text Reader

Abstract

The invention provides a CPU resource adjusting method and device, a server and a storage medium. The method comprises the steps of obtaining a CPU resource adjustment request, wherein the CPU resource adjustment request comprises a virtual machine identifier and a to-be-adjusted CPU resource parameter; and calling a resource management interface of a virtual machine management application according to the to-be-adjusted CPU resource parameter, so that the virtual machine management application adjusts the CPU resource of the virtual machine corresponding to the virtual machine identifier according to the to-be-adjusted CPU resource parameter. According to the method, the technical problem that available CPU resources of the virtual machine cannot be flexibly adjusted in the prior art is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of cloud computing technology, and in particular to a method, device, server and storage medium for adjusting CPU resources. Background Art

[0002] As the cloud computing market continues to grow, data centers that serve as cloud infrastructure continue to emerge, but at the same time, the central processing unit (CPU) resource utilization of most data centers is very low, resulting in a large waste of resources. In order to improve resource utilization, the CPU resources of physical machines in data centers are often over-processed, that is, resources that exceed the actual number of CPUs of physical machines are provided to virtual machines. However, since the CPU resource usage required by virtual machines to run services is uncontrollable, if some virtual machines occupy a large amount of CPU resources at the same time, resource squeezing and preemption will occur, causing the performance of other virtual machines to degrade or even become unavailable.

[0003] The prior art limits the CPU resources that a virtual machine can occupy by setting its CPU resource utilization when creating the virtual machine. However, this method of limiting CPU resources is only effective when the virtual machine is created and cannot be changed during the operation of the virtual machine, so it is impossible to flexibly adjust the CPU resources that the virtual machine can use. Summary of the invention

[0004] The present application provides a method, device, server and storage medium for adjusting CPU resources, so as to solve the technical problem that the prior art cannot flexibly adjust the CPU resources available to the virtual machine.

[0005] In a first aspect, the present application provides a method for adjusting CPU resources, comprising: obtaining a CPU resource adjustment request, the CPU resource adjustment request including a virtual machine identifier and CPU resource parameters to be adjusted; based on the CPU resource parameters to be adjusted, calling a resource management interface of a virtual machine management application, so that the virtual machine management application adjusts the CPU resources of the virtual machine corresponding to the virtual machine identifier based on the CPU resource parameters to be adjusted.

[0006] Optionally, in the method as described above, after obtaining the CPU resource adjustment request, the method further includes: updating the task state of the virtual machine corresponding to the virtual machine identifier according to the CPU resource adjustment request.

[0007] Optionally, in the method as described above, updating the task state of the virtual machine corresponding to the virtual machine identifier includes: updating the task state of the virtual machine corresponding to the virtual machine identifier through a service interface process.

[0008] Optionally, in the method described above, after obtaining the CPU resource adjustment request, the method further includes: storing the CPU resource parameters to be adjusted in a database.

[0009] Optionally, in the method as described above, storing the CPU resource parameters to be adjusted in a database includes: storing the CPU resource parameters to be adjusted in a database through a service control process.

[0010] Optionally, in the method as described above, storing the CPU resource parameters to be adjusted in a database includes: creating a virtual machine object model, and saving the CPU resource parameters to be adjusted in the virtual machine object model, so as to save the CPU resource parameters to be adjusted in a database table of the database.

[0011] Optionally, in the method as described above, calling the resource management interface of the virtual machine management application includes: calling the resource management interface of the virtual machine management application through a service computing process.

[0012] In a second aspect, the present application provides a CPU resource adjustment device, comprising: an acquisition module, used to obtain a CPU resource adjustment request, the CPU resource adjustment request including a virtual machine identifier and CPU resource parameters to be adjusted; a processing module, used to call a resource management interface of a virtual machine management application according to the CPU resource parameters to be adjusted, so that the virtual machine management application adjusts the CPU resources of the virtual machine corresponding to the virtual machine identifier according to the CPU resource parameters to be adjusted.

[0013] In a third aspect, the present application provides a server, comprising: a processor, and a memory communicatively connected to the processor; the memory stores computer-executable instructions; the processor executes the computer-executable instructions stored in the memory to implement the CPU resource adjustment method as described in the first aspect.

[0014] In a fourth aspect, the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are executed by a processor, they are used to implement the CPU resource adjustment method as described in the first aspect.

[0015] The present application provides a method, device, server and storage medium for adjusting CPU resources. The method includes obtaining a CPU resource adjustment request, the CPU resource adjustment request includes a virtual machine identifier and a CPU resource parameter to be adjusted; according to the CPU resource parameter to be adjusted, calling a resource management interface of a virtual machine management application, so that the virtual machine management application adjusts the CPU resources of the virtual machine corresponding to the virtual machine identifier according to the CPU resource parameter to be adjusted. Compared with the prior art, which can only set the CPU resource utilization rate of a virtual machine when creating it to limit the CPU resources that can be occupied by the virtual machine, the present application obtains a CPU resource adjustment request sent by the user end, and according to the CPU resource parameter to be adjusted in the CPU resource adjustment request, calls a resource management interface of a virtual machine management application, so that the virtual machine management application adjusts the CPU resources of the virtual machine. It realizes real-time limitation and dynamic adjustment of the CPU resources available to the virtual machine during its operation. It solves the technical problem that the prior art cannot flexibly adjust the available CPU resources of the virtual machine. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0017] Figure 1a This is a schematic diagram of the structure of the cloud computing management platform;

[0018] Figure 1b A flowchart of a method for limiting the CPU resources available to a virtual machine in the prior art;

[0019] Figure 2 A flowchart of a first embodiment of a method for adjusting CPU resources provided in an embodiment of the present application;

[0020] Figure 3 A flowchart of a second embodiment of a method for adjusting CPU resources provided in an embodiment of the present application;

[0021] Figure 4 A flowchart of a third embodiment of a method for adjusting CPU resources provided in an embodiment of the present application;

[0022] Figure 5 A schematic diagram of the structure of an embodiment of a CPU resource adjustment device provided in an embodiment of the present application;

[0023] Figure 6 A schematic diagram of the structure of a server embodiment provided in an embodiment of the present application.

[0024] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION

[0025] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.

[0026] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards, and provide corresponding operation entrances for users to choose to authorize or refuse.

[0027] As the cloud computing market continues to grow, data centers that serve as cloud infrastructure continue to emerge, but at the same time, the CPU resource utilization of most data centers is very low, resulting in a large waste of resources. In order to improve resource utilization, the CPU resources of physical machines in data centers are often over-processed, that is, resources that exceed the actual number of CPUs of physical machines are provided to virtual machines. However, since the CPU resource usage required by virtual machines to run services is uncontrollable, if some virtual machines occupy a large amount of CPU resources at the same time, resource squeeze and preemption will occur, causing the performance of other virtual machines to degrade or even become unavailable.

[0028] The prior art limits the CPU resources that a virtual machine can occupy by setting its CPU resource utilization when creating the virtual machine. For example, the configuration of CPU resource limitation can be added in the extended attribute setting extra_spec of the virtual machine hardware template flavor.

[0029] The specific application scenario of this application is cloud computing management platform. Figure 1a This is a schematic diagram of the structure of the cloud computing management platform. Figure 1aAs shown, the cloud computing management platform includes a user terminal 11, a server terminal 12 and a virtual machine management application 13. Exemplarily, the cloud computing management platform may be openstack, the user terminal 11 may be novaclient, the server terminal 12 may be nova, and the virtual machine management application 13 may be libvirt.

[0030] Figure 1b FIG. 1 is a flow chart of a method for limiting the CPU resources available to a virtual machine in the prior art. Figure 1b As shown, the server 12 obtains the request for creating a virtual machine sent by the user 11, creates a virtual machine hardware template flavor according to the CPU, memory and other specifications required by the virtual machine; configures parameters for limiting the virtual machine's CPU resource occupation in the extended attribute setting extra_spec of the virtual machine hardware template flavor, such as the sharing weight cpu_shares, the maximum bandwidth cpu_quota and the execution interval cpu_period; uses the creation of the virtual machine hardware template flavor to send a command to create a virtual machine to the server 12; the server 12 parses the extended attribute setting extra_spec of the virtual machine hardware template flavor, and saves the parameters for limiting the virtual machine's CPU resource occupation in the cputune parameter; the server 12 writes the cputune parameter into the extensible markup language xml required for creating the virtual machine; the virtual machine management application 13 uses the xml containing the cputune parameter to create the virtual machine.

[0031] However, this method of limiting CPU resources only takes effect when the virtual machine is created and cannot be changed while the virtual machine is running. Therefore, it is impossible to flexibly adjust the CPU resources available to the virtual machine.

[0032] Based on the above technical problems, the technical concept of the present application is: how to limit and dynamically adjust the CPU resources available to the virtual machine in real time during its operation, so as to flexibly adjust the CPU resources available to the virtual machine.

[0033] The method for adjusting CPU resources provided in this application is intended to solve the above technical problems in the prior art.

[0034] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.

[0035] Figure 2 A flowchart of a CPU resource adjustment method embodiment 1 provided in the present application is shown in FIG. Figure 2, the method comprises the following steps:

[0036] Step S201: Obtain a CPU resource adjustment request, where the CPU resource adjustment request includes a virtual machine identifier and CPU resource parameters to be adjusted.

[0037] In this embodiment, the server may be nova, and the server nova may obtain the CPU resource adjustment request sent by the user. For example, the user may send the CPU resource adjustment request to the server nova through a command line. The command line may be, for example, nova cpusched-update <id name>set <key> = <value>,in, <id name>It is the unique ID of the virtual machine (Identity document, referred to as ID) or the name of the virtual machine; <key>is the CPU resource parameter to be adjusted; <value>is the limit value of the CPU resource parameter. For example, the user end may define an instruction interface for limiting the use of CPU resources by the virtual machine, combine and encapsulate the request content to form an HTTP request, and send it to the server end.

[0038] The CPU resource adjustment request may include a virtual machine identifier and a CPU resource parameter to be adjusted. Exemplarily, the virtual machine identifier may be an ID of the virtual machine or a name of the virtual machine. The CPU resource parameter to be adjusted may be a sharing weight cpu_shares, an execution interval vcpu_period of a vcpu, a maximum bandwidth vcpu_quota of a vcpu, an execution interval emulator_period of a qemu process, a maximum bandwidth emulator_quota of a qemu process, an execution interval iothread_period of an IO, a maximum bandwidth iothread_quota of an IO, an execution interval global_period of a CPU, and a maximum bandwidth global_quota of a CPU.

[0039] Step S202: calling a resource management interface of a virtual machine management application according to the CPU resource parameter to be adjusted, so that the virtual machine management application adjusts the CPU resource of the virtual machine corresponding to the virtual machine identifier according to the CPU resource parameter to be adjusted.

[0040] In this embodiment, the virtual machine management application may be libvirt, and the resource management interface of the virtual machine management application may be virDomainGetSchedulerParametersFlags. The server nova calls the resource management interface of the virtual machine management application according to the CPU resource parameters to be adjusted, and passes the CPU resource parameters to be adjusted to the virtual machine management application libvirt.

[0041] The virtual machine management application libvirt adjusts the CPU resources of the virtual machine corresponding to the virtual machine identifier according to the CPU resource parameters to be adjusted. In this way, the CPU resources occupied by the virtual machine can be controlled, for example, the CPU utilization rate of the virtual machine is controlled to 50%.

[0042] In this embodiment, a CPU resource adjustment request is obtained, and the CPU resource adjustment request includes a virtual machine identifier and a CPU resource parameter to be adjusted; according to the CPU resource parameter to be adjusted, the resource management interface of the virtual machine management application is called, so that the virtual machine management application adjusts the CPU resources of the virtual machine corresponding to the virtual machine identifier according to the CPU resource parameter to be adjusted. Compared with the prior art, which can only set the CPU resource utilization rate of a virtual machine when creating a virtual machine to limit the CPU resources that can be occupied by the virtual machine, the present application obtains the CPU resource adjustment request sent by the user end, and according to the CPU resource parameter to be adjusted in the CPU resource adjustment request, calls the resource management interface of the virtual machine management application, so that the virtual machine management application adjusts the CPU resources of the virtual machine. Real-time limitation and dynamic adjustment of the CPU resources available to the virtual machine are achieved during its operation. The technical problem that the prior art cannot flexibly adjust the available CPU resources of the virtual machine is solved.

[0043] Figure 3 A flowchart of a CPU resource adjustment method embodiment 2 provided in the present application is shown in FIG. Figure 3 , the method comprises the following steps:

[0044] Step S301: Obtain a CPU resource adjustment request, where the CPU resource adjustment request includes a virtual machine identifier and CPU resource parameters to be adjusted.

[0045] In this embodiment, the server may be nova, and the server nova may obtain the CPU resource adjustment request sent by the user. For example, the user may send the CPU resource adjustment request to the server nova through a command line. The command line may be, for example, nova cpusched-update <id name>set <key> = <value>,in, <id name>It is the unique ID of the virtual machine (Identity document, referred to as ID) or the name of the virtual machine; <key>is the CPU resource parameter to be adjusted; <value>is the limit value of the CPU resource parameter. For example, the user end may define an instruction interface for limiting the use of CPU resources by the virtual machine, combine and encapsulate the request content to form an HTTP request, and send it to the server end.

[0046] The CPU resource adjustment request may include a virtual machine identifier and a CPU resource parameter to be adjusted. Exemplarily, the virtual machine identifier may be an ID of the virtual machine or a name of the virtual machine. The CPU resource parameter to be adjusted may be a sharing weight cpu_shares, an execution interval vcpu_period of a vcpu, a maximum bandwidth vcpu_quota of a vcpu, an execution interval emulator_period of a qemu process, a maximum bandwidth emulator_quota of a qemu process, an execution interval iothread_period of an IO, a maximum bandwidth iothread_quota of an IO, an execution interval global_period of a CPU, and a maximum bandwidth global_quota of a CPU.

[0047] Step S302: According to the CPU resource adjustment request, the task state of the virtual machine corresponding to the virtual machine identifier is updated.

[0048] In this embodiment, after obtaining the CPU resource adjustment request, the server nova can update the task state of the virtual machine corresponding to the virtual machine identifier according to the CPU resource adjustment request. Exemplarily, the initial task state of the virtual machine can be "no task state". After obtaining the CPU resource adjustment request sent by the user end, the server nova can update the task state of the virtual machine to "CPU update state". In this way, when troubleshooting problems in the operation of the virtual machine in the future, it can be determined what task state the virtual machine was in when the problem occurred, which helps to determine and solve the problem as soon as possible.

[0049] Specifically, the server nova can update the task status of the virtual machine corresponding to the virtual machine identifier through the service interface process. Exemplarily, the service interface process can be nova api. Nova api is the portal of the server nova, which can monitor and capture the CPU resource adjustment request sent by the user end. Exemplarily, the CPU resource adjustment request sent by the user end can be an HTTP request. The server nova can receive the CPU resource adjustment request sent by the user end through the service interface process nova api, and according to the virtual machine identifier in the CPU resource adjustment request, update the task status of the virtual machine corresponding to the virtual machine identifier through the service interface process nova api.

[0050] Step S303: According to the CPU resource parameters to be adjusted, the resource management interface of the virtual machine management application is called through the service computing process, so that the virtual machine management application adjusts the CPU resources of the virtual machine corresponding to the virtual machine identifier according to the CPU resource parameters to be adjusted.

[0051] In this embodiment, the virtual machine management application may be libvirt, and the resource management interface of the virtual machine management application may be virDomainGetSchedulerParametersFlags. The server nova calls the resource management interface of the virtual machine management application according to the CPU resource parameters to be adjusted, and passes the CPU resource parameters to be adjusted to the virtual machine management application libvirt.

[0052] Specifically, the server nova can call the resource management interface of the virtual machine management application through the service computing process. Exemplarily, the service computing process can be nova compute. The server nova can call the resource management interface of the virtual machine management application through the service computing process novacompute, and pass the CPU resource parameters to be adjusted to the virtual machine management application libvirt.

[0053] The virtual machine management application libvirt adjusts the CPU resources of the virtual machine corresponding to the virtual machine identifier according to the CPU resource parameters to be adjusted. In this way, the CPU resources occupied by the virtual machine can be controlled, for example, the CPU utilization rate of the virtual machine is controlled to 50%.

[0054] In this embodiment, the server updates the task state of the virtual machine corresponding to the virtual machine identifier according to the CPU resource adjustment request. Thus, on the basis of achieving real-time restriction and dynamic adjustment of the CPU resources available to the virtual machine during its operation, when troubleshooting problems in the operation of the virtual machine in the future, it can be determined what task state the virtual machine was in when the problem occurred, which helps to identify and solve the problem as soon as possible.

[0055] Figure 4 A flowchart of a CPU resource adjustment method embodiment 3 provided in the present application is shown in FIG. Figure 4 , the method comprises the following steps:

[0056] Step S401: Obtain a CPU resource adjustment request, where the CPU resource adjustment request includes a virtual machine identifier and CPU resource parameters to be adjusted.

[0057] In this embodiment, the server may be nova, and the server nova may obtain the CPU resource adjustment request sent by the user. For example, the user may send the CPU resource adjustment request to the server nova through a command line. The command line may be, for example, nova cpusched-update <id name>set <key> = <value>,in, <id name>It is the unique ID of the virtual machine (Identity document, referred to as ID) or the name of the virtual machine; <key>is the CPU resource parameter to be adjusted; <value>is the limit value of the CPU resource parameter. For example, the user end may define an instruction interface for limiting the use of CPU resources by the virtual machine, combine and encapsulate the request content to form an HTTP request, and send it to the server end.

[0058] The CPU resource adjustment request may include a virtual machine identifier and a CPU resource parameter to be adjusted. Exemplarily, the virtual machine identifier may be an ID of the virtual machine or a name of the virtual machine. The CPU resource parameter to be adjusted may be a sharing weight cpu_shares, an execution interval vcpu_period of a vcpu, a maximum bandwidth vcpu_quota of a vcpu, an execution interval emulator_period of a qemu process, a maximum bandwidth emulator_quota of a qemu process, an execution interval iothread_period of an IO, a maximum bandwidth iothread_quota of an IO, an execution interval global_period of a CPU, and a maximum bandwidth global_quota of a CPU.

[0059] Step S402: According to the CPU resource adjustment request, the task state of the virtual machine corresponding to the virtual machine identifier is updated.

[0060] In this embodiment, after obtaining the CPU resource adjustment request, the server nova can update the task state of the virtual machine corresponding to the virtual machine identifier according to the CPU resource adjustment request. Exemplarily, the initial task state of the virtual machine can be "no task state". After obtaining the CPU resource adjustment request sent by the user end, the server nova can update the task state of the virtual machine to "CPU update state". In this way, when troubleshooting problems in the operation of the virtual machine in the future, it can be determined what task state the virtual machine was in when the problem occurred, which helps to determine and solve the problem as soon as possible.

[0061] Specifically, the server nova can update the task status of the virtual machine corresponding to the virtual machine identifier through the service interface process. Exemplarily, the service interface process can be nova api. Nova api is the portal of the server nova, which can monitor and capture the CPU resource adjustment request sent by the user end. Exemplarily, the CPU resource adjustment request sent by the user end can be an HTTP request. The server nova can receive the CPU resource adjustment request sent by the user end through the service interface process nova api, and according to the virtual machine identifier in the CPU resource adjustment request, update the task status of the virtual machine corresponding to the virtual machine identifier through the service interface process nova api.

[0062] Step S403: storing the CPU resource parameter to be adjusted in a database.

[0063] In this embodiment, after obtaining the CPU resource adjustment request, the server nova can store the CPU resource parameters to be adjusted in the CPU resource adjustment request in the database. The database saves the CPU resource parameters to be adjusted, so that the server can configure the virtual machine according to the CPU resource parameters in the database when the virtual machine is shut down and restarted to maintain the state before the virtual machine is restarted. Exemplarily, the database can save the CPU resource parameters to be adjusted through the database table instance_cpusched_info.

[0064] Specifically, the server nova can store the CPU resource parameter to be adjusted in the database through the service control process. Exemplarily, the service control process can be nova conductor. After obtaining the CPU resource adjustment request, the server nova can store the CPU resource parameter to be adjusted in the database through the service control process nova conductor.

[0065] Specifically, the server nova can create a virtual machine object model, and save the CPU resource parameter to be adjusted in the virtual machine object model, so as to save the CPU resource parameter to be adjusted in a database table of the database. Exemplarily, the virtual machine object model cpusched_info can be defined to save the CPU resource parameter to be adjusted, corresponding to the information in the database table, so that the server nova saves the CPU resource parameter to be adjusted in the database table of the database through the virtual machine object model function.

[0066] Step S404: according to the CPU resource parameters to be adjusted, the resource management interface of the virtual machine management application is called through the service computing process, so that the virtual machine management application adjusts the CPU resources of the virtual machine corresponding to the virtual machine identifier according to the CPU resource parameters to be adjusted.

[0067] In this embodiment, the virtual machine management application may be libvirt, and the resource management interface of the virtual machine management application may be virDomainGetSchedulerParametersFlags. The server nova calls the resource management interface of the virtual machine management application according to the CPU resource parameters to be adjusted, and passes the CPU resource parameters to be adjusted to the virtual machine management application libvirt.

[0068] Specifically, the server nova can call the resource management interface of the virtual machine management application through the service computing process. Exemplarily, the service computing process can be nova compute. The server nova can call the resource management interface of the virtual machine management application through the service computing process novacompute, and pass the CPU resource parameters to be adjusted to the virtual machine management application libvirt.

[0069] The virtual machine management application libvirt adjusts the CPU resources of the virtual machine corresponding to the virtual machine identifier according to the CPU resource parameters to be adjusted. In this way, the CPU resources occupied by the virtual machine can be controlled, for example, the CPU utilization rate of the virtual machine is controlled to 50%.

[0070] In this embodiment, after obtaining the CPU resource adjustment request, the server can store the CPU resource parameters to be adjusted in the CPU resource adjustment request in the database. Thus, when the virtual machine is shut down and restarted, the virtual machine can be configured according to the CPU resource parameters in the database to maintain the state of the virtual machine before restarting.

[0071] Figure 5 A schematic diagram of a CPU resource adjustment device embodiment provided in the present application. Figure 5 As shown, the CPU resource adjustment device 50 includes an acquisition module 51 and a processing module 52. The acquisition module 51 is used to obtain a CPU resource adjustment request, and the CPU resource adjustment request includes a virtual machine identifier and a CPU resource parameter to be adjusted. The processing module 52 is used to call a resource management interface of a virtual machine management application according to the CPU resource parameter to be adjusted, so that the virtual machine management application adjusts the CPU resource of the virtual machine corresponding to the virtual machine identifier according to the CPU resource parameter to be adjusted.

[0072] The CPU resource adjustment device provided in the embodiment of the present application can execute the technical solution shown in the above method embodiment, and its implementation principle and beneficial effects are similar, which will not be repeated here.

[0073] In a possible implementation, the processing module 52 is further configured to update the task state of the virtual machine corresponding to the virtual machine identifier according to the CPU resource adjustment request after obtaining the CPU resource adjustment request.

[0074] In a possible implementation, the processing module 52 is specifically configured to update the task state of the virtual machine corresponding to the virtual machine identifier through a service interface process.

[0075] The CPU resource adjustment device provided in the embodiment of the present application can execute the technical solution shown in the above method embodiment, and its implementation principle and beneficial effects are similar, which will not be repeated here.

[0076] In a possible implementation, the processing module 52 is further configured to store the CPU resource parameter to be adjusted in a database after obtaining the CPU resource adjustment request.

[0077] In a possible implementation, the processing module 52 is specifically configured to store the CPU resource parameter to be adjusted in a database through a service control process.

[0078] In a possible implementation, the processing module 52 is specifically used to create a virtual machine object model, and save the CPU resource parameter to be adjusted in the virtual machine object model, so as to save the CPU resource parameter to be adjusted in a database table of the database.

[0079] The CPU resource adjustment device provided in the embodiment of the present application can execute the technical solution shown in the above method embodiment, and its implementation principle and beneficial effects are similar, which will not be repeated here.

[0080] In a possible implementation, the processing module 52 is specifically configured to call a resource management interface of a virtual machine management application through a service computing process.

[0081] The CPU resource adjustment device provided in the embodiment of the present application can execute the technical solution shown in the above method embodiment, and its implementation principle and beneficial effects are similar, which will not be repeated here.

[0082] Figure 6 A schematic diagram of the structure of a server embodiment provided in the present application embodiment. Figure 6 As shown, the server 60 includes: a processor 61, a memory 62 communicatively connected to the processor 61, and a communication interface 63; wherein the memory 62 stores computer-executable instructions; the processor 61 executes the computer-executable instructions stored in the memory 62 to implement the technical solution in any of the aforementioned method embodiments.

[0083] Optionally, the memory 62 may be independent or integrated with the processor 61 .

[0084] Optionally, when the memory 62 is a device independent of the processor 61, the server 60 may further include: a bus 64 for connecting the above devices.

[0085] The server is used to execute the technical solution in any of the aforementioned method embodiments, and its implementation principle and technical effect are similar and will not be repeated here.

[0086] The present application also provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, which are used to implement the aforementioned Figures 2 to 4 The technical solution in any method embodiment.

[0087] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described order of actions, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily required by the present application.

[0088] It should be further noted that, although the various steps in the flowchart are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless there is a clear description in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a portion of the steps in the flowchart may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these sub-steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a portion of the sub-steps or stages of other steps.

[0089] It should be understood that the above-mentioned device embodiments are only illustrative, and the device of the present application can also be implemented in other ways. For example, the division of units / modules in the above-mentioned embodiments is only a logical function division, and there may be other division methods in actual implementation. For example, multiple units, modules or components can be combined, or can be integrated into another system, or some features can be ignored or not executed.

[0090] In addition, unless otherwise specified, each functional unit / module in each embodiment of the present application may be integrated into one unit / module, each unit / module may exist physically separately, or two or more units / modules may be integrated together. The above-mentioned integrated unit / module may be implemented in the form of hardware or in the form of a software program module.

[0091] If the integrated unit / module is implemented in the form of hardware, the hardware may be a digital circuit, an analog circuit, etc. The physical implementation of the hardware structure includes but is not limited to transistors, memristors, etc. If not specifically stated, the processor may be any appropriate hardware processor, such as a CPU, a GPU, an FPGA, a DSP, an ASIC, etc. If not specifically stated, the storage unit may be any appropriate magnetic storage medium or magneto-optical storage medium, such as a resistive random access memory RRAM (Resistive Random Access Memory), a dynamic random access memory DRAM (Dynamic Random Access Memory), a static random access memory SRAM (Static Random-Access Memory), an enhanced dynamic random access memory EDRAM (Enhanced Dynamic Random Access Memory), a high-bandwidth memory HBM (High-Bandwidth Memory), a hybrid memory cube HMC (Hybrid Memory Cube), etc.

[0092] If the integrated unit / module is implemented in the form of a software program module and sold or used as an independent product, it can be stored in a computer-readable memory. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art or all or part of the technical solution, can be embodied in the form of a software product, which is stored in a memory and includes several instructions for a computer device (which can be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the various embodiments of the present application. The aforementioned memory includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, disk or optical disk and other media that can store program codes.

[0093] In the above embodiments, the description of each embodiment has its own emphasis. For parts not described in detail in a certain embodiment, please refer to the relevant description of other embodiments. The technical features of the above embodiments can be combined arbitrarily. In order to make the description concise, all possible combinations of the technical features in the above embodiments are not described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0094] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any modification, use or adaptation of the present application, which follows the general principles of the present application and includes common knowledge or customary techniques in the art that are not disclosed in the present application. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present application are indicated by the following claims.

[0095] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.< / value> < / key> < / id> < / value> < / key> < / id> < / value> < / key> < / id> < / value> < / key> < / id> < / value> < / key> < / id> < / value> < / key> < / id>

Claims

1. A method for adjusting CPU resources, characterized in that: include: Obtaining a CPU resource adjustment request, where the CPU resource adjustment request includes a virtual machine identifier and a CPU resource parameter to be adjusted; According to the CPU resource parameters to be adjusted, a resource management interface of a virtual machine management application is called, so that the virtual machine management application adjusts the CPU resource of the virtual machine corresponding to the virtual machine identifier according to the CPU resource parameters to be adjusted.

2. The method for adjusting CPU resources according to claim 1, characterized in that: After obtaining the CPU resource adjustment request, the method further includes: According to the CPU resource adjustment request, the task state of the virtual machine corresponding to the virtual machine identifier is updated.

3. The method for adjusting CPU resources according to claim 2, characterized in that: The updating of the task status of the virtual machine corresponding to the virtual machine identifier includes: The task status of the virtual machine corresponding to the virtual machine identifier is updated through the service interface process.

4. The method for adjusting CPU resources according to claim 1, characterized in that: After obtaining the CPU resource adjustment request, the method further includes: The CPU resource parameters to be adjusted are stored in a database.

5. The method for adjusting CPU resources according to claim 4, characterized in that: The step of storing the CPU resource parameter to be adjusted in a database includes: The CPU resource parameters to be adjusted are stored in a database through a service control process.

6. The method for adjusting CPU resources according to claim 4 or 5, characterized in that: The step of storing the CPU resource parameter to be adjusted in a database includes: A virtual machine object model is created, and the CPU resource parameter to be adjusted is saved in the virtual machine object model, so as to save the CPU resource parameter to be adjusted in a database table of a database.

7. The method for adjusting CPU resources according to claim 1, characterized in that: The calling of the resource management interface of the virtual machine management application includes: The resource management interface of the virtual machine management application is called through the service computing process.

8. A CPU resource adjustment device, characterized in that: include: An acquisition module, configured to acquire a CPU resource adjustment request, wherein the CPU resource adjustment request includes a virtual machine identifier and a CPU resource parameter to be adjusted; The processing module is used to call the resource management interface of the virtual machine management application according to the CPU resource parameters to be adjusted, so that the virtual machine management application adjusts the CPU resources of the virtual machine corresponding to the virtual machine identifier according to the CPU resource parameters to be adjusted.

9. A server, characterized in that: include: A processor, and a memory communicatively connected to the processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory to implement the CPU resource adjustment method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, which are used to implement the CPU resource adjustment method according to any one of claims 1 to 7 when executed by a processor.

Citation Information

Patent Citations

  • CPU and memory online adjustment method and device and virtual electronic equipment

    CN111414236A

  • Method, device and equipment for adjusting CPU core number of virtual machine, and medium

    CN112256383A

  • Openstack virtual machine CPU and memory hot plug implementation method

    CN112286638A

  • Virtual machine specification increment adjustment method, equipment and medium

    CN116820679A