Search

CN-122019047-A - Processing method and device of virtual machine, electronic equipment, computer readable storage medium and computer program product

CN122019047ACN 122019047 ACN122019047 ACN 122019047ACN-122019047-A

Abstract

The application provides a processing method, a processing device, electronic equipment, a computer readable storage medium and a computer program product of a virtual machine; the method comprises the steps of obtaining a virtual machine resource pool, wherein the virtual machine resource pool is used for storing virtual machines created in a cloud, determining the consumption speed of the virtual machines in the virtual machine resource pool, determining the increase speed of the virtual machines in the virtual machine resource pool, determining an adjustment mode for the number of the virtual machines in the virtual machine resource pool according to the consumption speed of the virtual machines and the increase speed of the virtual machines, and adjusting the number of the virtual machines in the virtual machine resource pool by adopting the determined adjustment mode. By the method and the device, the number of the virtual machines in the virtual machine resource pool can be accurately adjusted.

Inventors

  • DENG JINMEI

Assignees

  • 深圳市腾讯计算机系统有限公司

Dates

Publication Date
20260512
Application Date
20241111

Claims (19)

  1. 1. A method for processing a virtual machine, the method comprising: Obtaining a virtual machine resource pool, wherein the virtual machine resource pool is used for storing virtual machines created in a cloud; determining the consumption speed of the virtual machines in the virtual machine resource pool, and determining the increase speed of the virtual machines in the virtual machine resource pool; Determining an adjustment mode for the number of virtual machines in the virtual machine resource pool by combining the consumption speed of the virtual machines and the increase speed of the virtual machines; and adjusting the number of the virtual machines in the virtual machine resource pool by adopting the determined adjustment mode.
  2. 2. The method of claim 1, wherein the determining the adjustment mode for the number of virtual machines in the virtual machine resource pool by combining the consumption speed of the virtual machine and the increase speed of the virtual machine comprises: Determining an adjustment mode for the number of virtual machines in the virtual machine resource pool as a first adjustment mode when the consumption speed of the virtual machine is greater than the increase speed of the virtual machine, wherein the first adjustment mode comprises a recycling mode for indicating recycling of consumed virtual machines; the adjusting the number of the virtual machines in the virtual machine resource pool by adopting the determined adjusting mode comprises the following steps: Acquiring an account type corresponding to an account logged in the consumed virtual machine, and acquiring first running information of the consumed virtual machine; and determining a first virtual machine based on the account type and the first running information, and recycling the first virtual machine to the virtual machine resource pool.
  3. 3. The method of claim 2, wherein the determining a first virtual machine based on the account type and the first operational information comprises: If the account number type is a trial type, determining the consumed virtual machine as the first virtual machine if the first operation information characterizes that the operation state of the consumed virtual machine is a disconnection state; If the account number type is a payment type, if the first running information characterizes that the remaining using time length of the consumed virtual machine is smaller than a time length threshold value, determining the consumed virtual machine as the first virtual machine; the reclaiming the first virtual machine into the virtual machine resource pool comprises: restoring the state of the first virtual machine to an original state, and adding the virtual machine in the original state to the virtual machine resource pool.
  4. 4. The method of claim 2, wherein the determining a first virtual machine based on the account type and the first operational information comprises: Determining the use frequency of the consumed virtual machine in a preset duration based on the first running information under the condition that the account number type is a personal type, and determining the consumed virtual machine as the first virtual machine under the condition that the use frequency is smaller than a use frequency threshold value; if the account number type is a group type, determining the consumed virtual machine as the first virtual machine if the first operation information characterizes that the distance between the first area and the second area is greater than a preset distance threshold; The first area is an area where the electronic device running the consumed virtual machine is located, and the second area is an area where an object corresponding to an account number of the consumed virtual machine is located.
  5. 5. The method of claim 2, wherein the first adjustment means further comprises a first adjustment sub-means; the determining that the adjustment mode for the number of virtual machines in the virtual machine resource pool is a first adjustment mode includes: Determining a difference between a consumption speed of the virtual machine and an increase speed of the virtual machine; If the difference value belongs to a first difference value interval, determining that the adjustment mode for the number of virtual machines in the virtual machine resource pool is the recovery mode and the first adjustment sub-mode; And if the difference value belongs to a second difference value interval, determining an adjustment mode for the number of the virtual machines in the virtual machine resource pool as the recovery mode, wherein the numerical value of the first difference value interval is larger than that of the second difference value interval.
  6. 6. The method according to claim 2, wherein the recycling modes include different sub-recycling modes, different sub-recycling modes being associated with different priorities, the sub-recycling modes being in one-to-one correspondence with the priorities; the determining that the adjustment mode for the number of virtual machines in the virtual machine resource pool is a first adjustment mode includes: Determining a difference between a consumption speed of the virtual machine and an increase speed of the virtual machine; Determining the priority corresponding to a third difference interval based on the third difference interval to which the difference belongs, and determining a sub-recycling mode associated with the priority corresponding to the third difference interval; And determining a sub-recycling mode associated with the priority corresponding to the third difference interval as an adjustment mode for the number of virtual machines in the virtual machine resource pool.
  7. 7. The method of claim 2, wherein the first adjustment means further comprises a second adjustment sub-means; when the consumption speed of the virtual machine is greater than the increase speed of the virtual machine, determining that the adjustment mode for the number of virtual machines in the virtual machine resource pool is a first adjustment mode, the method further includes: Stopping adjusting the number of virtual machines in the virtual machine resource pool by adopting the recovery mode when the consumption speed of the virtual machine is changed from being greater than the increase speed of the virtual machine to be smaller than the increase speed of the virtual machine and the number of the virtual machines in the virtual machine resource pool is smaller than a preset number threshold; And stopping adjusting the number of virtual machines in the virtual machine resource pool by adopting the recycling mode and the second adjustment sub-mode when the consumption speed of the virtual machine is changed from being greater than the increasing speed of the virtual machine to being smaller than the increasing speed of the virtual machine and the number of the virtual machines in the virtual machine resource pool is greater than or equal to a preset number threshold.
  8. 8. The method of claim 1, wherein the determining the adjustment mode for the number of virtual machines in the virtual machine resource pool by combining the consumption speed of the virtual machine and the increase speed of the virtual machine comprises: Determining an adjustment mode for the number of virtual machines in the virtual machine resource pool as a second adjustment mode when the increasing speed of the virtual machines is larger than the consumption speed of the virtual machines, wherein the second adjustment mode is used for indicating to create the virtual machines; the adjusting the number of the virtual machines in the virtual machine resource pool by adopting the determined adjusting mode comprises the following steps: Determining a difference between the increasing speed of the virtual machine and the consuming speed of the virtual machine, and determining a creating speed for creating a second virtual machine based on the difference; And creating the second virtual machine by adopting the creation speed, and adding the second virtual machine into the virtual machine resource pool.
  9. 9. The method of claim 8, wherein virtual machines in the virtual machine resource pool are running on electronic devices in different areas; the creating the second virtual machine with the creation speed and adding the second virtual machine to the virtual machine resource pool comprises Acquiring second operation information of the electronic equipment in different areas; determining a sub-creation speed corresponding to each region based on a plurality of the second operation information and the creation speed; the sub creation speed is sent to the electronic equipment of the corresponding area, and the electronic equipment of each area receives a second virtual machine created by adopting the corresponding sub creation speed; adding the second virtual machine to the virtual machine resource pool.
  10. 10. The method of claim 1, wherein after said adjusting the number of virtual machines in the virtual machine resource pool using the determined adjustment, the method further comprises: acquiring the number of virtual machines in the virtual machine resource pool, and determining a virtual machine number threshold corresponding to a time period based on the time period of the current time point; and stopping adopting the adjustment mode to adjust the number of the virtual machines in the virtual machine resource pool under the condition that the number of the virtual machines reaches the threshold value of the number of the virtual machines.
  11. 11. The method of claim 1, wherein the virtual machine resource pool includes a plurality of virtual machine queues, wherein the levels of virtual machines in different virtual machine queues are different, and wherein different levels correspond to different configuration information, and wherein the method further comprises: Responding to a virtual machine acquisition request, wherein the virtual machine acquisition request comprises configuration information for a virtual machine, and determining the grade of the virtual machine corresponding to the virtual machine acquisition request based on the configuration information in the virtual machine acquisition request; and determining the virtual machine corresponding to the virtual machine acquisition request from the corresponding virtual machine queue based on the determined level of the virtual machine, and sending the determined access information of the virtual machine.
  12. 12. The method of claim 1, wherein the adjustment mode is a reclamation mode, the reclamation mode being used to indicate reclamation of a consumed virtual machine; After determining the adjustment mode for the number of virtual machines in the virtual machine resource pool by combining the consumption speed of the virtual machines and the increase speed of the virtual machines, the method further comprises: generating a difference mirror image based on a difference between the consumed virtual machine and the original virtual machine; Acquiring an account number for logging in the consumed virtual machine; And carrying out association storage on the difference mirror image and the account corresponding to the consumed virtual machine.
  13. 13. The method according to claim 1, wherein the method further comprises: Responding to a virtual machine acquisition request, wherein the virtual machine acquisition request comprises an account number and demand information, and under the condition that a virtual machine corresponding to the account number is not found, acquiring an initial virtual machine from the virtual machine resource pool based on the demand information, and acquiring a difference mirror image corresponding to the account number based on the account number; and generating a third virtual machine based on the initial virtual machine and the difference mirror image, and sending access information of the third virtual machine.
  14. 14. The method of claim 1, wherein the determining the adjustment mode for the number of virtual machines in the virtual machine resource pool by combining the consumption speed of the virtual machine and the increase speed of the virtual machine comprises: Determining the allocable duration of the virtual machines in the virtual machine resource pool based on the consumption speed of the virtual machines, the increasing speed of the virtual machines and the number of the virtual machines in the virtual machine resource pool; and under the condition that the allocable duration is smaller than a preset duration threshold, determining a third adjusting mode corresponding to the allocable duration from the corresponding relation between the candidate allocable duration and the candidate adjusting mode, and determining the third adjusting mode as an adjusting mode aiming at the number of virtual machines in the virtual machine resource pool.
  15. 15. The method of claim 14, wherein the determining the allocatable duration of a virtual machine in the virtual machine resource pool based on the consumption rate of the virtual machine, the rate of increase of the virtual machine, and the number of virtual machines in the virtual machine resource pool comprises: And determining a difference value between the consumption speed of the virtual machine and the increasing speed of the virtual machine, and determining a first ratio between the number of the virtual machines in the virtual machine resource pool and the difference value as the allocable duration of the virtual machines in the virtual machine resource pool.
  16. 16. A processing apparatus of a virtual machine, the apparatus comprising: an acquisition module for acquiring a virtual machine resource pool, the virtual machine resource pool is used for storing virtual machines created in the cloud; the determining module is used for determining the consumption speed of the virtual machine in the virtual machine resource pool and determining the increase speed of the virtual machine in the virtual machine resource pool; The determining module is further configured to determine an adjustment mode for the number of virtual machines in the virtual machine resource pool by combining the consumption speed of the virtual machines and the increase speed of the virtual machines; The determining module is further configured to adjust the number of virtual machines in the virtual machine resource pool by using the determined adjustment manner.
  17. 17. An electronic device, the electronic device comprising: A memory for storing computer executable instructions or computer programs; A processor for implementing the method of processing a virtual machine according to any one of claims 1 to 15 when executing computer executable instructions or computer programs stored in said memory.
  18. 18. A computer-readable storage medium storing computer-executable instructions or a computer program, wherein the computer-executable instructions or the computer program, when executed by a processor, implement the method of processing a virtual machine according to any one of claims 1 to 15.
  19. 19. A computer program product comprising computer-executable instructions or a computer program, which, when executed by a processor, implements the method of processing a virtual machine according to any one of claims 1 to 15.

Description

Processing method and device of virtual machine, electronic equipment, computer readable storage medium and computer program product Technical Field The present application relates to the field of computer technologies, and in particular, to a method and an apparatus for processing a virtual machine, an electronic device, a computer readable storage medium, and a computer program product. Background In order to improve the use experience of the user, the cloud end can provide virtualized computer resources (namely virtual machines) for the user, and under the condition that the user wants to use the virtual machines, the cloud end can receive a virtual machine acquisition request corresponding to the hardware configuration which the user wants to use, create the virtual machines of the hardware configuration which the user wants to use according to the virtual machine acquisition request, and further can distribute the virtual machines corresponding to the virtual machine acquisition request to the user. That is, in the related art, for each virtual machine acquisition request corresponding to a user, corresponding virtual machines are created, that is, the number of virtual machines is consistent with the number of virtual machine acquisition requests, but the time period for creating the virtual machines is long, which results in a long time period for the user to wait for the virtual machines. Disclosure of Invention The embodiment of the application provides a processing method, a processing device, electronic equipment, a computer readable storage medium and a computer program product for a virtual machine, which can reduce the waiting time of a user and can realize accurate adjustment of the number of virtual machines in a virtual machine resource pool. The technical scheme of the embodiment of the application is realized as follows: the embodiment of the application provides a processing method of a virtual machine, which comprises the following steps: Obtaining a virtual machine resource pool, wherein the virtual machine resource pool is used for storing virtual machines created in a cloud; determining the consumption speed of the virtual machines in the virtual machine resource pool, and determining the increase speed of the virtual machines in the virtual machine resource pool; Determining an adjustment mode for the number of virtual machines in the virtual machine resource pool by combining the consumption speed of the virtual machines and the increase speed of the virtual machines; and adjusting the number of the virtual machines in the virtual machine resource pool by adopting the determined adjustment mode. The embodiment of the application provides a processing device of a virtual machine, which comprises: an acquisition module for acquiring a virtual machine resource pool, the virtual machine resource pool is used for storing virtual machines created in the cloud; the determining module is used for determining the consumption speed of the virtual machine in the virtual machine resource pool and determining the increase speed of the virtual machine in the virtual machine resource pool; The determining module is further configured to determine an adjustment mode for the number of virtual machines in the virtual machine resource pool by combining the consumption speed of the virtual machines and the increase speed of the virtual machines; The determining module is further configured to adjust the number of virtual machines in the virtual machine resource pool by using the determined adjustment manner. In the above scheme, the determining module is further configured to determine that the adjustment mode for the number of virtual machines in the virtual machine resource pool is a first adjustment mode when the consumption speed of the virtual machine is greater than the increase speed of the virtual machine, where the first adjustment mode includes a recycling mode, where the recycling mode is used to instruct recycling of the consumed virtual machine, obtain an account type corresponding to an account logged in the consumed virtual machine, and obtain first operation information of the consumed virtual machine, determine a first virtual machine based on the account type and the first operation information, and recycle the first virtual machine to the virtual machine resource pool. In the above scheme, the determining module is further configured to determine the consumed virtual machine as the first virtual machine if the first operation information indicates that the operation state of the consumed virtual machine is a disconnected state, determine the consumed virtual machine as the first virtual machine if the first operation information indicates that the remaining usage time of the consumed virtual machine is less than a time threshold if the account type is a payment type, and restore the state of the first virtual machine to an original state and increase the virtual machine in the origi