Virtual machine processing method and device, electronic equipment, computer readable storage medium and computer program product
By acquiring the consumption and increase rate of the virtual machine resource pool and adjusting the number of virtual machines, the problem of excessively long virtual machine creation time was solved, achieving rapid response and precise management, and improving the user experience.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SHENZHEN TENCENT COMP SYST CO LTD
- Filing Date
- 2024-11-11
- Publication Date
- 2026-05-12
AI Technical Summary
In existing technologies, virtual machine creation takes a long time, resulting in excessively long user wait times and potentially leading to user churn.
By acquiring the virtual machine resource pool, we can determine the rate at which virtual machines are consumed and the rate at which they are added. We can then adjust the number of virtual machines based on both factors and optimize the number of virtual machines in the resource pool by either recycling or creating them.
It reduces user waiting time, enables precise adjustment of the number of virtual machines in the virtual machine resource pool, and improves user experience.
Smart Images

Figure CN122019047A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a method, apparatus, electronic device, computer-readable storage medium, and computer program product for processing virtual machines. Background Technology
[0002] To improve user experience, the cloud can provide virtualized computing resources (i.e., virtual machines) to users. When a user wants to use a virtual machine, the cloud can receive a virtual machine request corresponding to the hardware configuration the user wants to use. Based on the virtual machine request, the cloud creates a virtual machine with the desired hardware configuration and then allocates the virtual machine corresponding to the request to the user. In other words, related technologies create a corresponding virtual machine for each user's virtual machine request, meaning the number of virtual machines is consistent with the number of virtual machine requests. However, the virtual machine creation time is relatively long, resulting in a longer waiting time for users. Summary of the Invention
[0003] This application provides a virtual machine processing method, apparatus, electronic device, computer-readable storage medium, and computer program product, which can reduce user waiting time and enable precise adjustment of the number of virtual machines in the virtual machine resource pool.
[0004] The technical solution of this application embodiment is implemented as follows:
[0005] This application provides a method for processing virtual machines, the method comprising:
[0006] Obtain a virtual machine resource pool, which is used to store virtual machines created in the cloud;
[0007] Determine the consumption rate of virtual machines in the virtual machine resource pool, and determine the addition rate of virtual machines in the virtual machine resource pool;
[0008] Based on the consumption rate and the increase rate of the virtual machines, determine the adjustment method for the number of virtual machines in the virtual machine resource pool;
[0009] The number of virtual machines in the virtual machine resource pool is adjusted using the determined adjustment method.
[0010] This application provides a virtual machine processing device, the device comprising:
[0011] The acquisition module is used to acquire the virtual machine resource pool, which is used to store virtual machines created in the cloud;
[0012] The determination module is used to determine the consumption rate of virtual machines in the virtual machine resource pool and the increase rate of virtual machines in the virtual machine resource pool;
[0013] The determining module is further configured to determine the adjustment method for the number of virtual machines in the virtual machine resource pool by combining the consumption rate of the virtual machine and the increase rate of the virtual machine.
[0014] The determining module is further configured to adjust the number of virtual machines in the virtual machine resource pool using the determined adjustment method.
[0015] In the above scheme, the determining module is further configured to, when the consumption rate of the virtual machine is greater than the increase rate of the virtual machine, determine the adjustment method for the number of virtual machines in the virtual machine resource pool as a first adjustment method, the first adjustment method including a recycling method, the recycling method being used to indicate the recycling of consumed virtual machines; obtain the account type corresponding to the account that logged into the consumed virtual machine, and obtain the first running information of the consumed virtual machine; determine a first virtual machine based on the account type and the first running information, and recycle the first virtual machine to the virtual machine resource pool.
[0016] In the above scheme, the determining module is further configured to: if the account type is trial type, and the first running information indicates that the running status of the consumed virtual machine is disconnected, then determine the consumed virtual machine as the first virtual machine; if the account type is paid type, and the first running information indicates that the remaining usage time of the consumed virtual machine is less than the duration threshold, then determine the consumed virtual machine as the first virtual machine; restore the state of the first virtual machine to its original state, and add the virtual machine in the original state to the virtual machine resource pool.
[0017] In the above scheme, the determining module is further configured to, when the account type is personal, determine the usage frequency of the consumed virtual machine within a preset time period based on the first running information, and if the usage frequency is less than a usage frequency threshold, determine the consumed virtual machine as the first virtual machine; when the account type is group type, if the distance between the first region and the second region represented by the first running information is greater than a preset distance threshold, then determine the consumed virtual machine as the first virtual machine; wherein, the first region is the region where the electronic device running the consumed virtual machine is located, and the second region is the region where the object corresponding to the account that logged into the consumed virtual machine is located.
[0018] In the above scheme, the first adjustment method further includes a first adjustment sub-method; the determining module is further configured to determine the difference between the consumption rate of the virtual machine and the increase rate of the virtual machine; if the difference belongs to a first difference range, the adjustment method for the number of virtual machines in the virtual machine resource pool is determined to be the recycling method and the first adjustment sub-method; if the difference belongs to a second difference range, the adjustment method for the number of virtual machines in the virtual machine resource pool is determined to be the recycling method, wherein the values in the first difference range are all greater than the values in the second difference range.
[0019] In the above scheme, the recycling method includes different sub-recycling methods, and different sub-recycling methods are associated with different priorities. The sub-recycling methods correspond one-to-one with the priorities. The determining module is also used to determine the difference between the consumption rate of the virtual machine and the increase rate of the virtual machine; based on the third difference interval to which the difference belongs, determine the priority corresponding to the third difference interval, and determine the sub-recycling method associated with the priority corresponding to the third difference interval; and determine the sub-recycling method associated with the priority corresponding to the third difference interval as the adjustment method for the number of virtual machines in the virtual machine resource pool.
[0020] In the above scheme, the first adjustment method further includes a second adjustment sub-method; the determining module is further configured to, after determining that the adjustment method for the number of virtual machines in the virtual machine resource pool is the first adjustment method when the consumption rate of the virtual machine is greater than the increase rate of the virtual machine, the method further includes: stopping the use of the recycling method to adjust the number of virtual machines in the virtual machine resource pool when the consumption rate of the virtual machine changes from being greater than the increase rate of the virtual machine to being less than the increase rate of the virtual machine and the number of virtual machines in the virtual machine resource pool is less than a preset number threshold; stopping the use of the recycling method and the second adjustment sub-method to adjust the number of virtual machines in the virtual machine resource pool when the consumption rate of the virtual machine changes from being greater than the increase rate of the virtual machine to being less than the increase rate of the virtual machine and the number of virtual machines in the virtual machine resource pool is greater than or equal to a preset number threshold.
[0021] In the above scheme, the determining module is further configured to, when the increase rate of the virtual machine is greater than the consumption rate of the virtual machine, determine the adjustment method for the number of virtual machines in the virtual machine resource pool as a second adjustment method, the second adjustment method being used to instruct the creation of virtual machines; determine the difference between the increase rate of the virtual machine and the consumption rate of the virtual machine, and based on the difference, determine the creation rate for creating a second virtual machine; create the second virtual machine using the creation rate, and add the second virtual machine to the virtual machine resource pool.
[0022] In the above scheme, the virtual machines in the virtual machine resource pool run on electronic devices in different regions; the determining module is also used to obtain the second running information of the electronic devices in different regions; based on multiple second running information and the creation speed, determine the sub-creation speed corresponding to each region; send the sub-creation speed to the electronic devices in the corresponding region, and receive the second virtual machine created by the electronic devices in each region using the corresponding sub-creation speed; add the second virtual machine to the virtual machine resource pool.
[0023] In the above scheme, the determining module is further configured to, after adjusting the number of virtual machines in the virtual machine resource pool using the determined adjustment method, obtain the number of virtual machines in the virtual machine resource pool, and determine the virtual machine number threshold corresponding to the time period based on the time period in which the current time point is located; and when the number of virtual machines reaches the virtual machine number threshold, stop using the adjustment method to adjust the number of virtual machines in the virtual machine resource pool.
[0024] In the above scheme, the virtual machine resource pool includes multiple virtual machine queues, and the virtual machines in different virtual machine queues have different levels, and different levels correspond to different configuration information; the determining module is also used to respond to a virtual machine acquisition request, the virtual machine acquisition request including configuration information for the virtual machine, determine the level of the virtual machine corresponding to the virtual machine acquisition request based on the configuration information in the virtual machine acquisition request; based on the determined virtual machine level, determine the virtual machine corresponding to the virtual machine acquisition request from the corresponding virtual machine queue, and send the access information of the determined virtual machine.
[0025] In the above scheme, the adjustment method is a recycling method, which is used to indicate the recycling of consumed virtual machines; the determining module is further used to determine the adjustment method for the number of virtual machines in the virtual machine resource pool after combining the consumption rate and the increase rate of the virtual machines, and generate a difference image based on the difference between the consumed virtual machines and the original virtual machines; obtain the account that logs in to the consumed virtual machine; and associate the difference image with the account corresponding to the consumed virtual machine for storage.
[0026] In the above scheme, the determining module is also used to respond to a virtual machine acquisition request, which includes account and demand information. If no virtual machine corresponding to the account is found, an initial virtual machine is obtained from the virtual machine resource pool based on the demand information, and a differential image corresponding to the account is obtained based on the account. Based on the initial virtual machine and the differential image, a third virtual machine is generated, and access information of the third virtual machine is sent.
[0027] In the above scheme, the determining module is further configured to determine the allocatable duration of the virtual machines in the virtual machine resource pool based on the consumption rate of the virtual machines, the increase rate of the virtual machines, and the number of virtual machines in the virtual machine resource pool; if the allocatable duration is less than a preset duration threshold, determine the third adjustment method corresponding to the allocatable duration from the correspondence between the candidate allocatable durations and the candidate adjustment methods, and determine the third adjustment method as the adjustment method for the number of virtual machines in the virtual machine resource pool.
[0028] In the above scheme, the determining module is further used to determine the difference between the consumption rate of the virtual machine and the increase rate of the virtual machine, and to determine the first ratio between the number of virtual machines in the virtual machine resource pool and the difference as the allocatable time of the virtual machines in the virtual machine resource pool.
[0029] This application provides an electronic device, the electronic device comprising:
[0030] Memory is used to store executable instructions or computer programs.
[0031] The processor, when executing computer-executable instructions or computer programs stored in the memory, implements the virtual machine processing method provided in the embodiments of this application.
[0032] This application provides a computer-readable storage medium storing a computer program or computer-executable instructions for implementing the virtual machine processing method provided in this application when executed by a processor.
[0033] This application provides a computer program product, including a computer program or computer executable instructions. When the computer program or computer executable instructions are executed by a processor, they implement the virtual machine processing method provided in this application.
[0034] The embodiments of this application have the following beneficial effects:
[0035] In the virtual machine processing method provided in this application embodiment, a virtual machine resource pool can be obtained. The virtual machine resource pool is used to store virtual machines created in the cloud. The consumption rate of virtual machines in the virtual machine resource pool is determined, and the increase rate of virtual machines in the virtual machine resource pool is determined. Combining the consumption rate and the increase rate of virtual machines, an adjustment method for the number of virtual machines in the virtual machine resource pool is determined, and the number of virtual machines in the virtual machine resource pool is adjusted by adopting the determined adjustment method.
[0036] In this application, a virtual machine resource pool of virtual machines created in the cloud can be obtained. Furthermore, this application can adjust the number of virtual machines in the virtual machine resource pool by combining the consumption rate and the addition rate of virtual machines. The consumption rate of virtual machines is the speed at which virtual machines are taken from the virtual machine resource pool and allocated to users. Compared with related technologies, it is not necessary to create and consume corresponding virtual machines for each virtual machine acquisition request, which can reduce the waiting time for users and achieve precise adjustment of the number of virtual machines in the virtual machine resource pool without the user's awareness. Attached Figure Description
[0037] Figure 1 This is a schematic diagram of the structure of the virtual machine processing system provided in the embodiments of this application;
[0038] Figure 2 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application;
[0039] Figure 3 This is a flowchart illustrating the virtual machine processing method provided in the embodiments of this application. Figure 1 ;
[0040] Figure 4 This is a flowchart illustrating the virtual machine processing method provided in the embodiments of this application. Figure 2 ;
[0041] Figure 5 This is a flowchart illustrating the virtual machine processing method provided in the embodiments of this application. Figure 3 ;
[0042] Figure 6 This is a flowchart illustrating the virtual machine processing method provided in the embodiments of this application. Figure 4 ;
[0043] Figure 7 This is a flowchart illustrating the virtual machine processing method provided in the embodiments of this application. Figure 5 ;
[0044] Figure 8 This is a flowchart illustrating the virtual machine processing method provided in the embodiments of this application. Figure 6 ;
[0045] Figure 9 This is a flowchart illustrating the virtual machine processing method provided in the embodiments of this application. Figure 7 ;
[0046] Figure 10 This is a flowchart illustrating the virtual machine processing method provided in the embodiments of this application. Figure 8 ;
[0047] Figure 11 This is a flowchart illustrating the virtual machine processing method provided in the embodiments of this application. Figure 9 ;
[0048] Figure 12 This is a schematic diagram of an electronic device cluster provided in an embodiment of this application;
[0049] Figure 13 This is a schematic diagram of the virtual machine provided in the embodiments of this application. Detailed Implementation
[0050] To make the objectives, technical solutions, and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings. The described embodiments should not be regarded as limitations on this application. All other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0051] In the following description, references are made to “some embodiments,” which describe a subset of all possible embodiments. However, it is understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.
[0052] In the following description, the terms "first, second, third" are used merely to distinguish similar objects and do not represent a specific ordering of objects. It is understood that "first, second, third" may be interchanged in a specific order or sequence where permitted, so that the embodiments of this application described herein can be implemented in an order other than that illustrated or described herein.
[0053] In this application embodiment, the terms "module" or "unit" refer to a computer program or part of a computer program that has a predetermined function and works with other related parts to achieve a predetermined goal, and can be implemented wholly or partially using software, hardware (such as processing circuitry or memory), or a combination thereof. Similarly, a processor (or multiple processors or memory) can be used to implement one or more modules or units. Furthermore, each module or unit can be part of an overall module or unit that includes the functionality of that module or unit.
[0054] Unless otherwise defined, all technical and scientific terms used in the embodiments of this application have the same meaning as commonly understood by one of ordinary skill in the art. The terminology used in the embodiments of this application is for the purpose of describing the embodiments of this application only and is not intended to limit this application.
[0055] In the implementation of this application, the collection and processing of relevant data should strictly comply with the requirements of relevant laws and regulations, obtain the informed consent or separate consent of the personal information subject, and carry out subsequent data use and processing within the scope of laws and regulations and the authorization of the personal information subject.
[0056] Before providing a further detailed description of the embodiments of this application, the nouns and terms involved in the embodiments of this application will be explained, and the nouns and terms involved in the embodiments of this application shall be interpreted as follows.
[0057] 1) Virtual machines, also known as cloud computer virtual machines, are computer virtual machines stored in the cloud. Virtual machines can simulate computer systems, including operating systems, processors, memory, storage, and network interfaces. Virtual machines run on electronic devices in the cloud. Users request virtual machines according to their needs, which is equivalent to users accessing the virtualized computing resources of electronic devices located in the cloud through the Internet.
[0058] 2) Cloud gaming is a gaming method that utilizes cloud computing resources. In cloud gaming, the game runs on a cloud-based electronic device. This device compresses the rendered game footage and sends it over the network to the user's electronic device. The user's device, with its powerful processor and graphics card, can then display the game footage through video decompression. In other words, cloud gaming is a gaming mode where cloud-based electronic devices render the game footage, and the user's device only displays it. For this solution, the user's electronic device can request a virtual machine, thus enabling cloud gaming.
[0059] 3) Client, also known as user terminal, refers to the program that provides local services to users in contrast to the server. Except for some applications that can only run locally, it is generally installed on ordinary client machines and needs to cooperate with the server to run. That is, there needs to be a corresponding server and service program in the network to provide the corresponding services. Thus, a specific communication connection needs to be established between the client and the server to ensure the normal operation of the application, such as a game client.
[0060] During the research process, the inventors discovered the following technical problems in the relevant technology:
[0061] Technical Issue 1: In related technologies, the cloud can provide users with virtualized computer resources (i.e., virtual machines). When a user wants to use a high-configuration hardware device, the cloud can receive a virtual machine request corresponding to the user's desired hardware configuration. Based on the virtual machine request, the cloud creates a virtual machine with the desired hardware configuration and then allocates the virtual machine to the user. In other words, related technologies create a corresponding virtual machine for each user's virtual machine request, meaning the number of virtual machines matches the number of virtual machine requests. However, the virtual machine creation time is long, resulting in long waiting times for users and potentially leading to user churn.
[0062] This application provides a virtual machine processing method, a virtual machine processing device, an electronic device, a computer-readable storage medium, and a computer program product, which can reduce user waiting time and enable precise adjustment of the number of virtual machines in the virtual machine resource pool.
[0063] See Figure 1 , Figure 1 This is a schematic diagram of the structure of the virtual machine processing system provided in the embodiment of this application. The virtual machine processing system 100 is used to support the processing application of a virtual machine. The terminal 400-1 is connected to the server 200 through the network 300. The network 300 can be a wide area network or a local area network, or a combination of the two.
[0064] In some embodiments, terminal 400-1 is the user's terminal (i.e., client). In order to facilitate users to quickly obtain virtual machines when requesting them, without waiting for the cloud electronic device (i.e., server 200) to create virtual machines according to the virtual machine acquisition request, a virtual machine resource pool can be set up. The virtual machine resource pool is used to store virtual machines created in the cloud.
[0065] In order to achieve precise adjustment of the number of virtual machines in the virtual machine resource pool, the server 200 can obtain the virtual machine resource pool, determine the consumption rate of virtual machines in the virtual machine resource pool, and determine the increase rate of virtual machines in the virtual machine resource pool. Combining the consumption rate and the increase rate of virtual machines, the server determines the adjustment method for the number of virtual machines in the virtual machine resource pool, and adjusts the number of virtual machines in the virtual machine resource pool using the determined adjustment method.
[0066] In response to a virtual machine acquisition request triggered by display page 410-1 for terminal 400-1, terminal 400-1 can send a virtual machine acquisition request to server 200. Server 200 can then determine the virtual machine corresponding to the virtual machine acquisition request from the virtual machine resource pool and send the access information of the virtual machine corresponding to the virtual machine acquisition request to terminal 400-1.
[0067] This application can adjust the number of virtual machines in the virtual machine resource pool by combining the consumption rate and the addition rate of virtual machines. The consumption rate of virtual machines is the speed at which virtual machines are taken from the virtual machine resource pool and allocated to users. Compared with related technologies, it does not require creating and consuming corresponding virtual machines for each virtual machine acquisition request, which can reduce the waiting time for users and can achieve precise adjustment of the number of virtual machines in the virtual machine resource pool without the user's awareness.
[0068] The electronic devices provided in the embodiments of this application will be described below. The electronic devices that implement the virtual machine processing method of the embodiments of this application can be terminals, servers, or a combination of the two. Among them, the terminals can be implemented as various types of terminals such as laptops, tablets, desktop computers, set-top boxes, smartphones, smart speakers, smartwatches, smart TVs, and vehicle terminals.
[0069] The server can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms. The terminal and server can be connected directly or indirectly via wired or wireless communication, which is not limited in this embodiment.
[0070] See Figure 2 , Figure 2 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application. Figure 2 The illustrated electronic device includes at least one processor 410, a memory 450, at least one network interface 420, and a user interface 430. The various components of the electronic device are coupled together via a bus system 440. It is understood that the bus system 440 is used to implement communication between these components. In addition to a data bus, the bus system 440 also includes a power bus, a control bus, and a status signal bus. However, for clarity, in… Figure 2 The general labeled all buses as Bus System 440.
[0071] The processor 410 can be an integrated circuit chip with signal processing capabilities, such as a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or any conventional processor, etc.
[0072] User interface 430 includes one or more output devices 431 that enable the presentation of media content, including one or more speakers and / or one or more visual displays. User interface 430 also includes one or more input devices 432, including user interface components that facilitate user input, such as a keyboard, mouse, microphone, touch screen display, camera, other input buttons and controls.
[0073] The memory 450 may be removable, non-removable, or a combination thereof. Exemplary hardware devices include solid-state storage, hard disk drives, optical disk drives, etc. The memory 450 may optionally include one or more storage devices physically located away from the processor 410.
[0074] The memory 450 may include volatile memory or non-volatile memory, or both. The non-volatile memory may be read-only memory (ROM), and the volatile memory may be random access memory (RAM). The memory 450 described in this application embodiment is intended to include any suitable type of memory.
[0075] In some embodiments, memory 450 is capable of storing data to support various operations, examples of which include programs, modules, and data structures or subsets or supersets thereof, as illustrated below.
[0076] Operating system 451 includes system programs for handling various basic system services and performing hardware-related tasks, such as the framework layer, core library layer, driver layer, etc., for implementing various basic business functions and handling hardware-based tasks;
[0077] The network communication module 452 is used to reach other electronic devices via one or more (wired or wireless) network interfaces 420, exemplary network interfaces 420 including: Bluetooth, WiFi, and Universal Serial Bus (USB), etc.
[0078] Presentation module 453 is configured to enable the presentation of information (e.g., a user interface for operating peripheral devices and displaying content and information) via one or more output devices 431 (e.g., a display screen, a speaker, etc.) associated with user interface 430;
[0079] The input processing module 454 is used to detect and translate one or more user inputs or interactions from one or more input devices 432.
[0080] In some embodiments, the virtual machine processing device provided in this application can be implemented in software. Figure 2 A processing device 455 for a virtual machine stored in memory 450 is shown. This device can be software in the form of programs and plug-ins, and includes the following software modules: an acquisition module 4551 and a determination module 4552. These modules are logically linked and can therefore be arbitrarily combined or further divided according to their implemented functions. The functions of each module will be described below.
[0081] In other embodiments, the virtual machine processing device provided in this application can be implemented in hardware. As an example, the virtual machine processing device provided in this application can be a processor in the form of a hardware decoding processor, which is programmed to execute the virtual machine processing method provided in this application. For example, the processor in the form of a hardware decoding processor can be one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), programmable logic devices (PLDs), complex programmable logic devices (CPLDs), field-programmable gate arrays (FPGAs), or other electronic components.
[0082] In some embodiments, the terminal or server can implement the virtual machine processing method provided in this application by running various computer-executable instructions or computer programs. For example, computer-executable instructions can be microprogram-level commands, machine instructions, or software instructions. Computer programs can be native programs or software modules in an operating system; they can be native applications (APPs), i.e., programs that need to be installed in the operating system to run, such as virtual machine applications; or they can be applets that can be embedded in any APP, i.e., programs that only need to be downloaded to a browser environment to run. In summary, the aforementioned computer-executable instructions can be any form of instruction, and the aforementioned computer programs can be any form of application, module, or plugin.
[0083] The following describes the virtual machine processing method provided in the embodiments of this application. As mentioned above, the electronic device implementing the virtual machine processing method of the embodiments of this application can be a terminal, a server, or a combination of both. See also Figure 3 , Figure 3 This is a flowchart illustrating the virtual machine processing method provided in the embodiments of this application. Figure 1 The following is combined with Figure 3 The steps shown, and taking a cloud-based server as an example, illustrate the virtual machine processing method provided in this application embodiment.
[0084] In step 101, the virtual machine resource pool is obtained.
[0085] The virtual machine resource pool is used to store virtual machines created in the cloud. The server is located in the cloud. The electronic device that creates the virtual machine can be a terminal, a server, or a combination of both located in the cloud. The virtual machine resource pool is also used to determine the virtual machine corresponding to the virtual machine acquisition request based on the virtual machine acquisition request.
[0086] When a user needs to use a virtual machine, the user's terminal can send a virtual machine acquisition request to the server. The server can then determine the virtual machine corresponding to the virtual machine acquisition request from the virtual machine resource pool based on the virtual machine acquisition request, and send the access information of the virtual machine corresponding to the virtual machine acquisition request to the terminal, so that the user can use the virtual machine corresponding to the virtual machine acquisition request.
[0087] To meet user needs, specifically to facilitate the selection of the appropriate virtual machine from the virtual machine resource pool when a user wants to use a virtual machine, the number of virtual machines in the virtual machine resource pool needs to be precisely adjusted. To achieve this precise adjustment, the virtual machine resource pool can be obtained first.
[0088] There is a first number threshold for the number of virtual machines in the virtual machine resource pool. The first number threshold is the maximum number of virtual machines stored in the virtual machine resource pool. In other words, the number of virtual machines in the virtual machine resource pool is less than or equal to the first number threshold.
[0089] The method for determining the first quantity threshold is described below. In some embodiments, the first quantity threshold can be determined based on one or more of the central processing unit, memory, and graphics card (i.e., image processor) of the electronic device running the virtual machine in the cloud, as well as the pre-set information of the virtual machine.
[0090] For example, the electronic device is a server (host), the number of servers is 3, each server has 4 graphics processors, and the information of the virtual machine is that the virtual machine corresponds to one graphics processor. Therefore, the first quantity threshold can be 12, that is, 3 servers can create 12 virtual machines, that is, the virtual machine resource pool can store 12 virtual machines.
[0091] The virtual machines running on devices within a virtual machine resource pool can be located in the same or different regions. The configuration information of the virtual machines within the virtual machine resource pool can also be the same or different, depending on actual usage requirements.
[0092] The virtual machines in the virtual machine resource pool are in an idle state, which means that the virtual machines in the virtual machine resource pool are virtual machines that have been created but have not been requested. When a client terminal requests a virtual machine, it is called a sold virtual machine. The virtual machines in the virtual machine resource pool are virtual machines that have been created but have not been sold. Virtual machines can also be called cloud computers or instances. The virtual machines in the virtual machine resource pool can be called inventory instances.
[0093] Virtual machines have several states. Besides being idle, when a virtual machine is in use by a user, its state is "consumed," and a consumed virtual machine can also be called a "sold virtual machine." When a virtual machine is being created, its state is "creating." Under certain destruction conditions, a virtual machine can be destroyed, and its state can be "destroyed." Specific settings can be configured according to actual usage requirements.
[0094] In some embodiments, to facilitate the management of virtual machines in the virtual machine resource pool, a database table can be created to record the status of virtual machines. The database table can record idle virtual machines, consumed virtual machines, virtual machines being created, and destroyed virtual machines.
[0095] In some embodiments, to further facilitate the management of virtual machines in the virtual machine resource pool, the virtual machines can be divided according to the region where the electronic device running the virtual machine is located, and a corresponding database sub-table is recorded for each region. The database sub-table records the idle virtual machines, consumed virtual machines, virtual machines being created, and destroyed virtual machines corresponding to that region.
[0096] In step 102, the consumption rate of virtual machines in the virtual machine resource pool is determined, and the addition rate of virtual machines in the virtual machine resource pool is determined.
[0097] In some embodiments, step 102 can be implemented in the following way: when a virtual machine acquisition request is received, the access address of the virtual machine corresponding to the virtual machine acquisition request can be sent to the terminal corresponding to the virtual machine acquisition request, so that the terminal can establish a connection with the virtual machine corresponding to the virtual machine acquisition request, which is equivalent to consuming a virtual machine.
[0098] For consuming virtual machines, the number of virtual machines consumed by the virtual machine resource pool can be obtained at a first interval (i.e., the consumption count), which is the number of virtual machines that successfully obtained requests within the first interval. The ratio of the consumption count to the first interval is used as the consumption rate. The first interval can be set according to actual usage requirements.
[0099] If there are idle electronic devices in the cloud, virtual machines can be added by reclaiming virtual machines and creating virtual machines. If there are no idle electronic devices in the cloud, virtual machines can be added by reclaiming virtual machines.
[0100] In this context, "idle state" refers to the graphics processing unit (GPU) and / or central processing unit (CPU) of an electronic device being idle, meaning that at least one of the GPU and CPU is not being used. Of course, depending on the actual usage requirements of the virtual machine, this can also be determined based on the hardware configuration of other electronic devices; therefore, no specific limitations are made here.
[0101] To add virtual machines, the number of virtual machines added to the virtual machine resource pool can be obtained at a second interval (i.e., the number of additions). This is at least one of the virtual machines created and / or reclaimed within the second interval. The ratio of the number of additions to the second interval is used as the addition rate. The second interval can be set according to actual usage requirements; it can be greater than, less than, or equal to the first interval, all of which are reasonable.
[0102] In step 103, the method for adjusting the number of virtual machines in the virtual machine resource pool is determined by combining the consumption rate of virtual machines and the increase rate of virtual machines.
[0103] In some embodiments, step 103 can be implemented by comparing the consumption rate of virtual machines with the increase rate of virtual machines. If the consumption rate of virtual machines is greater than the increase rate of virtual machines, it indicates that the number of requests for virtual machines is large and the number of users who want to use virtual machines is large. Therefore, the adjustment method for the number of virtual machines in the virtual machine resource pool can be determined as the first adjustment method.
[0104] If the rate at which virtual machines are consumed equals the rate at which they are added, it means that the number of virtual machines added is equal to the number of virtual machines consumed, so the number of virtual machines in the virtual machine resource pool does not need to be adjusted. If there are idle electronic devices in the cloud and the number of virtual machines in the virtual machine resource pool is less than the pre-set threshold, then virtual machines can be created, thereby increasing the number of virtual machines in the virtual machine resource pool.
[0105] When the rate at which virtual machines are consumed is less than the rate at which they are added, that is, when the rate at which virtual machines are added is greater than the rate at which they are consumed, it indicates that the number of requests for virtual machines is relatively small and the number of users who want to use virtual machines is relatively small. Therefore, it can be determined that the adjustment method for the number of virtual machines in the virtual machine resource pool is the second adjustment method. The second adjustment method is used to indicate the creation of virtual machines, that is, the second adjustment method is the creation method.
[0106] To facilitate understanding, we will first explain the scenario where the rate of virtual machine consumption exceeds the rate of virtual machine creation. In this case, the first adjustment method includes a reclamation method, which instructs the reclamation of consumed virtual machines, i.e., virtual machine recycling. The first adjustment method may also include a creation method, which instructs the creation of new virtual machines. The first adjustment method may include a reclamation method, or it may include both a reclamation method and a creation method.
[0107] In some embodiments, the first adjustment method further includes a first adjustment sub-method, which is the creation method, see [link to documentation]. Figure 4 , Figure 4 This is a flowchart illustrating the virtual machine processing method provided in the embodiments of this application. Figure 2 The following is combined with Figure 4 The steps shown are for Figure 3 The step 103 shown, "determining the adjustment method for the number of virtual machines in the virtual machine resource pool as the first adjustment method", will be explained.
[0108] In step 1031A, the difference between the rate at which the virtual machine is consumed and the rate at which the virtual machine is added is determined.
[0109] In some embodiments, step 1031A can be implemented by subtracting the virtual machine's growth rate from the virtual machine's consumption rate to obtain the difference between the virtual machine's consumption rate and its growth rate.
[0110] After determining the difference, the interval to which the difference belongs can be determined. If the difference belongs to the first difference interval, proceed to step 1032A. If the difference belongs to the second difference interval, proceed to step 1033A.
[0111] In step 1032A, if the difference belongs to the first difference range, then the adjustment method for the number of virtual machines in the virtual machine resource pool is determined to be the recycling method and the first adjustment sub-method.
[0112] In step 1033A, if the difference belongs to the second difference range, then the adjustment method for the number of virtual machines in the virtual machine resource pool is determined to be the recycling method.
[0113] Among them, the values in the first difference interval are all greater than the values in the second difference interval. In other words, when the difference between the virtual machine consumption rate and the virtual machine increase rate is large (belonging to the first difference interval), simply recycling the consumed virtual machines is still insufficient to meet the user's needs. Therefore, both recycling and creation methods can be used to increase the number of virtual machines.
[0114] When the difference between the rate at which virtual machines are consumed and the rate at which they are added is significant (falling within the first difference range), and there are idle electronic devices in the cloud, simply reclaiming consumed virtual machines is insufficient to meet user needs. Therefore, a combination of reclamation and creation methods can be used to increase the number of virtual machines. This approach allows for dynamic adjustment of the first adjustment method based on the difference between the rate at which virtual machines are added and consumed, enabling more precise control over the number of virtual machines in the virtual machine resource pool.
[0115] When the difference between the rate at which virtual machines are consumed and the rate at which virtual machines are added is small (belonging to the second difference range), or when there are no idle electronic devices in the cloud, the number of virtual machines can be increased simply by recycling them.
[0116] In some embodiments, the recycling method includes different sub-recycling methods, and different sub-recycling methods are associated with different priorities. The sub-recycling methods correspond one-to-one with the priorities. For example, the priorities include low, medium and high. The sub-recycling methods include sub-recycling method 1, sub-recycling method 2 and sub-recycling method 3. Sub-recycling method 1 corresponds to low, sub-recycling method 2 corresponds to medium and sub-recycling method 3 corresponds to high.
[0117] For example, priorities include priority 1 through priority 5, and sub-recycling methods include sub-recycling method 1 through sub-recycling method 5. Priority 1 corresponds to sub-recycling method 1, priority 2 corresponds to sub-recycling method 2, priority 3 corresponds to sub-recycling method 3, priority 4 corresponds to sub-recycling method 4, and priority 5 corresponds to sub-recycling method 5. The specific settings can be configured according to actual usage requirements; no specific limitations are made here.
[0118] See Figure 5 , Figure 5 This is a flowchart illustrating the virtual machine processing method provided in the embodiments of this application. Figure 3 The following is combined with Figure 5 The steps shown are for Figure 5 The step 103 shown, "determining the adjustment method for the number of virtual machines in the virtual machine resource pool as the first adjustment method", will be explained.
[0119] In step 1031B, the difference between the rate at which the virtual machine is consumed and the rate at which the virtual machine is added is determined.
[0120] Step 1031B is the same as step 1031A. For details, please refer to the explanation of step 1031A. It will not be repeated here.
[0121] In step 1032B, based on the third difference interval to which the difference belongs, the priority corresponding to the third difference interval is determined, and the sub-recycling method associated with the priority corresponding to the third difference interval is determined.
[0122] Different difference intervals correspond to different priorities, and there is a correspondence between priorities and difference intervals. The third difference interval is less than or equal to the union of the first and second difference intervals. After determining the difference, the third difference interval to which the difference belongs can be determined. Then, based on the third difference interval to which the difference belongs, the priority corresponding to the third difference interval can be determined, and the sub-recycling method associated with the priority corresponding to the third difference interval can be determined.
[0123] Priority is the priority for reclaiming consumed virtual machines, and the priority can be determined based on the account logged into the consumed virtual machine. The account logged into the consumed virtual machine can be classified according to one or more of the following: usage mode, usage purpose, usage frequency, service level, region, and business type. In other words, there are account types for logging into consumed virtual machines, and the priority can be determined based on the account type corresponding to the account logged into the consumed virtual machine.
[0124] When accounts are categorized by usage patterns, account types can be divided into trial and paid types. Trial accounts allow users to try the virtual machine for free for a specified period. Paid accounts allow users to purchase virtual machine usage time, meaning they can pay to use the virtual machine. Based on actual usage needs, paid types can be further subdivided; for example, hourly billing could be one account type, while monthly billing could be another.
[0125] When accounts are categorized by their purpose, account types can be divided into personal accounts and group accounts. Personal accounts are used by a single user for entertainment, work, or study within a virtual machine. Group accounts belong to a group of users who collaborate using the virtual machine within that group.
[0126] When accounts are categorized by usage frequency, specifically by virtual machine usage frequency, account types can be divided into high-frequency and low-frequency types. High-frequency accounts are those where virtual machine usage exceeds a preset threshold within a preset time period, while low-frequency accounts are those where virtual machine usage is less than or equal to the preset threshold within the same time period. Account types can also be divided by usage frequency ranges, with the number of account types matching the number of usage frequency ranges.
[0127] When accounts are categorized by service level, higher service levels correspond to more services. When accounts are categorized by virtual machine configuration levels, account types can be basic or advanced. Basic accounts are those logged into when the virtual machine's configuration level is less than or equal to a preset threshold, while advanced accounts are those logged into when the virtual machine's configuration level is greater than the preset threshold. Account types can also be categorized by the level range corresponding to the configuration level, with the number of account types matching the number of level ranges.
[0128] When accounts are categorized by region, that is, by the region of the electronic device running the virtual machine, the number of account types is the same as the number of regions. For example, regions include region 1, region 2 and region 3, and account types can be divided into virtual machines corresponding to region 1 (i.e., account type 1), virtual machines corresponding to region 2 (i.e., account type 2) and virtual machines corresponding to region 3 (i.e., account type 3).
[0129] When accounts are categorized by business type, that is, when accounts are divided according to the type of business that users perform using virtual machines, the number of account types can be less than or equal to the number of business types. For example, the business type can be software development and machine learning, and correspondingly, the account type can be software development and machine learning.
[0130] Different account types can correspond to different priorities. Priorities are one-to-one with account types. Priorities are also related to difference ranges. One difference range can correspond to one or more priorities. Priorities are one-to-one with sub-recycling methods.
[0131] Different sub-recycling methods can be used to recycle virtual machines that have been consumed at different priorities. For virtual machines that have been consumed at the same priority, different sub-recycling methods can also be used to recycle virtual machines that have been consumed at that priority at different rates.
[0132] In step 1033B, the sub-recycling method associated with the priority corresponding to the third difference interval is determined as the adjustment method for the number of virtual machines in the virtual machine resource pool.
[0133] In some embodiments, step 1033B can be implemented in the following way: after determining the sub-recycling method associated with the priority corresponding to the third difference interval, the sub-recycling method associated with the priority corresponding to the third difference interval can be determined as the adjustment method for the number of virtual machines in the virtual machine resource pool, that is, the sub-recycling method associated with the priority corresponding to the third difference interval is determined as the first adjustment method, and the first adjustment method includes one or more sub-recycling methods.
[0134] Sub-reclamation methods are used to reclaim consumed virtual machines corresponding to different priorities, that is, to reclaim consumed virtual machines corresponding to different account types. In some embodiments, multiple sub-reclamation methods can exist for the same priority, and different sub-reclamation methods have different reclamation speeds.
[0135] For ease of understanding Figure 5 Steps 1031B-1033B are shown below. Specific examples will be used to illustrate these steps. Figure 5 Steps 1031B-1033B are illustrated below. For example, account types include trial type and paid type, with the paid type having a higher priority than the trial type. The third difference interval includes third difference interval 1 and third difference interval 2. Third difference interval 1 corresponds to the priority of the trial type, and third difference interval 2 corresponds to the priority of the usage type and the priority of the paid type. The sub-recycling method corresponding to the priority of the trial type is to recycle the virtual machines consumed by the trial type, and the sub-recycling method corresponding to the priority of the paid type is to recycle the virtual machines consumed by the paid type.
[0136] If the difference between the rate at which virtual machines are consumed and the rate at which virtual machines are added falls within the third difference interval of 1, the reclamation method can be determined to be the sub-reclamation method corresponding to the priority of the trial type, which is the sub-reclamation method used to reclaim the consumed virtual machines corresponding to the usage type.
[0137] If the difference between the rate at which virtual machines are consumed and the rate at which virtual machines are added falls within the third difference interval 2, then the recycling method can be determined as the sub-recycling method corresponding to the priority of the trial type and the sub-recycling method corresponding to the priority of the paid type. In other words, it is the sub-recycling method used to recycle consumed virtual machines corresponding to the trial type and the sub-recycling method used to recycle consumed virtual machines corresponding to the paid type.
[0138] For example, account types are divided according to usage frequency, including account type 1 to account type 3. Account type 1 corresponds to usage frequency range 1, account type 2 corresponds to usage frequency range 2, and account type 3 corresponds to usage frequency range 3. Usage frequency range 1 is greater than usage frequency range 2, and usage frequency range 2 is greater than usage frequency range 3.
[0139] The third difference interval 1 corresponds to the priority of account type 1, the priority of account type 2, and the priority of account type 3. The third difference interval 2 corresponds to the priority of account type 2 and the priority of account type 3. The third difference interval 3 corresponds to the priority of account type 3.
[0140] If the difference between the virtual machine consumption rate and the virtual machine increase rate falls within the third difference interval 3, the recycling method can be determined as the sub-recycling method corresponding to the priority of account type 3, that is, the first recycling rate is adopted to recycle the consumed virtual machines whose usage frequency is in the usage frequency interval 3.
[0141] If the difference between the virtual machine consumption rate and the virtual machine increase rate falls within the third difference interval 2, the recycling method can be determined as the sub-recycling method corresponding to the priority of account type 3 and the sub-recycling method corresponding to the priority of account type 2. That is, the second recycling speed is used to recycle the consumed virtual machines whose usage frequency is in the usage frequency interval 3, and the third recycling speed is used to recycle the consumed virtual machines whose usage frequency is in the usage frequency interval 2. The second recycling speed is greater than the first recycling speed, and the third recycling speed is less than the first recycling speed.
[0142] If the difference between the virtual machine consumption rate and the virtual machine increase rate falls within the third difference interval 1, the recycling method can be determined as the sub-recycling method corresponding to the priority of account type 3, the sub-recycling method corresponding to the priority of account type 2, and the sub-recycling method corresponding to the priority of account type 1.
[0143] That is, the fourth recycling speed is used to recycle virtual machines that have been used and whose usage frequency is in the usage frequency range 3; the fifth recycling speed is used to recycle virtual machines that have been used and whose usage frequency is in the usage frequency range 2; and the sixth recycling speed is used to recycle virtual machines that have been used and whose usage frequency is in the usage frequency range 1. Among these, the fourth recycling speed is greater than the second recycling speed, the fifth recycling speed is greater than the third recycling speed, and the sixth recycling speed is less than the first recycling speed.
[0144] By identifying the third difference interval between the rate of virtual machine consumption and the rate of virtual machine addition, different sub-reclamation methods can be determined. This is equivalent to determining different reclamation methods, enabling dynamic adjustment of the reclamation method based on the difference between the rate of virtual machine addition and the rate of virtual machine consumption. This allows for more precise control over the number of virtual machines in the virtual machine resource pool.
[0145] The following explains the situation where the rate of virtual machine consumption is less than the rate of virtual machine growth. When the rate of virtual machine consumption is less than the rate of virtual machine growth, that is, when the rate of virtual machine growth is greater than the rate of virtual machine consumption, it can be determined that the adjustment method for the number of virtual machines in the virtual machine resource pool is the second adjustment method. The second adjustment method is used to indicate the creation of virtual machines, that is, the second adjustment method is the creation method.
[0146] In some embodiments, the creation method includes multiple sub-creation methods. Different sub-creation methods correspond to different creation speeds, which are the speeds at which virtual machines are created. Different sub-creation methods are associated with different priorities, and there is a one-to-one correspondence between the sub-creation methods and the priorities.
[0147] Determine the difference between the virtual machine consumption rate and the virtual machine addition rate. Based on the fourth difference interval to which the difference belongs, determine the priority corresponding to the fourth difference interval, and determine the sub-creation method associated with the priority corresponding to the fourth difference interval. The sub-creation method associated with the priority corresponding to the fourth difference interval is determined as the adjustment method for the number of virtual machines in the virtual machine resource pool. In other words, the sub-creation method associated with the priority corresponding to the fourth difference interval is determined as the second adjustment method.
[0148] By identifying the fourth difference interval between the rate at which virtual machines are consumed and the rate at which they are added, different sub-creation methods can be determined. This allows for dynamic adjustment of the creation method based on the difference between the rate at which virtual machines are added and the rate at which they are consumed, thereby enabling more precise control over the number of virtual machines in the virtual machine resource pool.
[0149] In some embodiments, see Figure 6 , Figure 6 This is a flowchart illustrating the virtual machine processing method provided in the embodiments of this application. Figure 4 ,right Figure 3 The step 103 shown, "determining the adjustment method for the number of virtual machines in the virtual machine resource pool as the first adjustment method", will be explained.
[0150] In step 1031C, the allocatable duration of the virtual machines in the virtual machine resource pool is determined based on the consumption rate of the virtual machines, the increase rate of the virtual machines, and the number of virtual machines in the virtual machine resource pool.
[0151] In some embodiments, step 1031C can be implemented by determining the difference between the virtual machine's consumption rate and its increase rate. For details, please refer to the description of step 1301A, which will not be repeated here.
[0152] After determining the difference between the rate at which virtual machines are consumed and the rate at which they are added, the first ratio between the number of virtual machines in the virtual machine resource pool and the difference between the rate at which virtual machines are consumed and the rate at which they are added is determined as the allocatable time of the virtual machines in the virtual machine resource pool. In this way, the precise allocatable time of the virtual machines in the virtual machine resource pool can be obtained.
[0153] After determining the allocatable duration, it can be checked whether the allocatable duration is less than a preset duration threshold. If the allocatable duration is greater than or equal to the preset duration threshold, it indicates that the virtual machines in the virtual machine resource pool can still be allocated a longer duration, and there is no need to adjust the number of virtual machines in the virtual machine resource pool. If there are idle electronic devices in the cloud, and the number of virtual machines in the virtual machine resource pool is less than the preset virtual machine number threshold, virtual machines can be created to increase the number of virtual machines in the virtual machine resource pool. If the allocatable duration is less than the preset duration threshold, step 1032C can be executed.
[0154] In step 1032C, if the allocatable duration is less than the preset duration threshold, the third adjustment method corresponding to the allocatable duration is determined from the correspondence between candidate allocatable durations and candidate adjustment methods, and the third adjustment method is determined as the adjustment method for the number of virtual machines in the virtual machine resource pool.
[0155] If the allocatable duration is less than the preset duration threshold, it indicates that the virtual machines in the virtual machine resource pool can be continuously allocated to users for a short period of time. In order to ensure that the virtual machine resource pool can continuously allocate virtual machines to users, the third adjustment method corresponding to the allocatable duration can be determined from the correspondence between the candidate allocatable duration and the candidate adjustment method.
[0156] The third adjustment method can be at least one of the creation and recycling methods; that is, the third adjustment method can include creation and / or recycling. When electronic devices in the cloud have idle time, the third adjustment method can include creation. The longer the allocable time, the slower the virtual machine creation speed corresponding to the creation method. In other words, the allocable time is inversely related to the virtual machine creation speed.
[0157] The third adjustment method can also include a reclamation method. The longer the allocable time, the lower the priority of reclamating consumed virtual machines. In other words, the allocable time and the priority of consumed virtual machines are inversely related. For consumed virtual machines of the same priority, the longer the allocable time, the slower the reclamation speed. This allows for more precise control over the number of virtual machines in the virtual machine resource pool by determining the corresponding third creation method based on the allocable time.
[0158] Step 103 allows for precise adjustment of the number of virtual machines in the virtual machine resource pool by combining the consumption rate and the increase rate of virtual machines. The adjustment method can be a first adjustment method, a second adjustment method, or a third adjustment method. The adjustment method is used to adjust the number of virtual machines in the virtual machine resource pool, enabling precise adjustment of the number of virtual machines in the virtual machine resource pool.
[0159] See also Figure 3 In step 104, the number of virtual machines in the virtual machine resource pool is adjusted using a determined adjustment method.
[0160] In some embodiments, step 104 is implemented in the following manner, for the case where the adjustment method is the first adjustment method, the first adjustment method includes a recycling method, which is described below. See [link to relevant documentation]. Figure 7 , Figure 7 This is a flowchart illustrating the virtual machine processing method provided in the embodiments of this application. Figure 5 The following is combined with Figure 7 The steps shown are for Figure 3 Step 104 is illustrated below.
[0161] In step 1041A, the account type corresponding to the account that logged into the consumed virtual machine is obtained, and the first running information of the consumed virtual machine is obtained.
[0162] In some embodiments, step 1041A is implemented in the following way: the user terminal may have a virtual machine application installed that uses a virtual machine, and the user's account is logged in in the virtual machine application. When the user needs to use the virtual machine, the cloud electronic device responds to the virtual machine acquisition request and sends the virtual machine access information corresponding to the virtual machine acquisition request to the terminal. Then the user can use the virtual machine corresponding to the virtual machine acquisition request. In this case, the virtual machine corresponding to the virtual machine acquisition request is the consumed virtual machine, and the account logged in by the virtual machine application is the account that logged in to the consumed virtual machine. Then the account type corresponding to the account that logged in to the consumed virtual machine can be obtained.
[0163] In some embodiments, in response to a virtual machine acquisition request, the cloud-based electronic device can send virtual machine access information corresponding to the virtual machine acquisition request to the terminal. The access information includes the account and password used to log in to the virtual machine corresponding to the virtual machine acquisition request. Therefore, the account used to log in to the virtual machine that has been consumed can be determined from the access information, and the account type corresponding to the account used to log in to the virtual machine that has been consumed can be obtained.
[0164] For step 1041A, the first running information of the consumed virtual machine can also be obtained. The first running information may include the usage frequency of the consumed virtual machine within a preset time period, the remaining usage time of the consumed virtual machine, the running status of the consumed virtual machine, the region where the electronic device running the consumed virtual machine is located, the configuration information of the consumed virtual machine, the performance information of the consumed virtual machine, etc. The specific settings can be configured according to actual usage requirements.
[0165] The running status of the consumed virtual machine can include waiting for connection, connected, and disconnected states. The configuration information of the consumed virtual machine can include system disk, computing resources, network bandwidth, etc. The performance information of the consumed virtual machine can include CPU utilization, the corresponding video frame rate, network latency, and bandwidth usage.
[0166] In step 1042A, the first virtual machine is determined based on the account type and the first running information, and the first virtual machine is recycled to the virtual machine resource pool.
[0167] In some embodiments, virtual machines exist in different states, which may include idle virtual machines, consumed virtual machines, virtual machines being created, and destroyed virtual machines. The virtual machine resource pool includes virtual machines marked with different states, that is, the virtual machine resource pool includes idle virtual machines, consumed virtual machines, virtual machines being created, and destroyed virtual machines. The first quantity threshold is the maximum number of idle virtual machines.
[0168] Regarding step 1042A, based on the account type and the first running information, the first virtual machine can be identified from the virtual machines in the first virtual machine resource pool whose status is consumed, and the first virtual machine can be recycled back to the virtual machine resource pool. Specifically, the state of the consumed virtual machine can be restored to its original state, and the virtual machine in the original state is the idle virtual machine, which is equivalent to increasing the number of idle virtual machines in the virtual machine resource pool, thereby increasing the virtual machine in the original state to the virtual machine resource pool.
[0169] In some embodiments, step 1042A can be implemented in the following ways, which will be described in detail below. The first implementation method is as follows: when the account type is trial type, it can be determined whether the running status of the consumed virtual machine is disconnected. If the first running information indicates that the running status of the consumed virtual machine is disconnected, then the consumed virtual machine is determined as the first virtual machine, thereby enabling the determination of the first virtual machine in the virtual machine resource pool.
[0170] If the first running information indicates that the running status of the consumed virtual machine is connected, it can be further determined whether the remaining usage time of the consumed virtual machine is less than the first time threshold. If the remaining usage time of the consumed virtual machine is less than the first time threshold, the consumed virtual machine can be identified as the first virtual machine. If the remaining usage time of the consumed virtual machine is greater than or equal to the first time threshold, the consumed virtual machine can be left unreclaimed.
[0171] When the account type is paid, it can be determined whether the remaining usage time of the consumed virtual machine is less than the second duration threshold (i.e., the duration threshold). If the first running information indicates that the remaining usage time of the consumed virtual machine is less than the duration threshold (second duration threshold), then the consumed virtual machine is identified as the first virtual machine. If the first running information indicates that the consumed virtual machine is greater than or equal to the duration threshold (second duration threshold), then the consumed virtual machine does not need to be reclaimed. In this way, the consumption virtual machine (i.e., the first virtual machine) that needs to be reclaimed can be determined by considering whether the account type is trial or paid.
[0172] After identifying the first virtual machine, its state can be restored to its original state. In some embodiments, the differences between the first virtual machine and the original virtual machine can be determined, and the content corresponding to the differences in the first virtual machine can be deleted to restore the first virtual machine to its original state. Then, the first virtual machine can be marked as an idle virtual machine, thereby restoring the state of the first virtual machine to its original state. The virtual machine in its original state can then be added to the virtual machine resource pool. In this way, the number of virtual machines in the virtual machine resource pool can be precisely adjusted.
[0173] The second implementation method, when the account type is personal, determines the usage frequency of virtual machines consumed within a preset time period based on the first running information. After determining the usage frequency, it can be determined whether the usage frequency is less than a usage frequency threshold. If the usage frequency is less than the usage frequency threshold, the consumed virtual machine is identified as the first virtual machine. If the usage frequency is greater than or equal to the usage frequency threshold, the consumed virtual machine may not be reclaimed.
[0174] In some embodiments, if the distance between the first running information representing the first region and the second region is less than or equal to a preset distance threshold, the consumed virtual machine may not be recycled. Here, the first region is the region where the electronic device running the consumed virtual machine is located, and the second region is the region where the object corresponding to the account that logged into the consumed virtual machine is located.
[0175] In some embodiments, if the first runtime information indicates that the distance between the first region and the second region is less than or equal to a preset distance threshold, it can be further determined whether the usage frequency is less than a usage frequency threshold. If the usage frequency is less than the usage frequency threshold, the consumed virtual machine is identified as the first virtual machine. If the usage frequency is greater than or equal to the usage frequency threshold, the consumed virtual machine may not be reclaimed.
[0176] If the distance between the first region and the second region, as indicated by the first runtime information, is greater than a preset distance threshold, then the consumed virtual machine is identified as the first virtual machine. After identifying the first virtual machine, its state can be restored to its original state, and then the virtual machine in its original state can be added to the virtual machine resource pool. In this way, the number of virtual machines in the virtual machine resource pool can be precisely adjusted.
[0177] Combining the first and second implementation methods described above, it can be seen that, based on different account types, the first virtual machine can also be determined by combining information from other classification methods besides account type. For example, if account types are classified according to usage patterns, the first virtual machine can also be determined by combining one or more of the following: usage purpose, usage frequency, service level, region, and business type. Specific settings can be configured according to actual usage requirements, and no specific limitations are made here.
[0178] The third implementation method is to classify the accounts that have logged in to consumed virtual machines according to one or more of the following: usage mode, usage purpose, usage frequency, service level, region, and business type. For specific account types, please refer to the above description. For each account type, there is a pre-set weight. For the account type corresponding to the consumed virtual machine, the account type can be multiplied by the corresponding weight to obtain the first product. Then, the first products corresponding to each account type can be added together to obtain the score corresponding to the consumed virtual machine.
[0179] In some embodiments, consumed virtual machines with scores greater than or equal to a preset score threshold may not be reclaimed, and consumed virtual machines with scores less than the preset score threshold may be designated as first virtual machines. After the first virtual machine is determined, its state may be restored to its original state, and then the virtual machines in their original state may be added to the virtual machine resource pool. In this way, the number of virtual machines in the virtual machine resource pool can be precisely adjusted.
[0180] In some embodiments, step 104 can also be implemented in the following manner, for the case where the adjustment method is the second adjustment method, see [link to relevant documentation]. Figure 8 , Figure 8 This is a flowchart illustrating the virtual machine processing method provided in the embodiments of this application. Figure 6 The following is combined with Figure 8 The steps shown are for Figure 3 Step 104 is illustrated below.
[0181] In step 1041B, the difference between the rate at which virtual machines are added and the rate at which virtual machines are consumed is determined, and based on the difference, the creation rate of the second virtual machine is determined.
[0182] In some embodiments, the method for determining the difference between the rate at which virtual machines are added and the rate at which they are consumed can be found in [reference needed]. Figure 4 The description of step 1031A shown is not specifically limited here. After determining the difference, the creation speed of the second virtual machine can be determined based on the difference.
[0183] In some embodiments, a pre-defined correspondence between candidate differences and candidate creation speeds is established. After determining the difference, the creation speed of the second virtual machine corresponding to the difference can be determined from the correspondence between the candidate differences and candidate creation speeds. The larger the difference, the smaller the creation speed of the second virtual machine. In this way, the precise creation speed of the second virtual machine can be determined.
[0184] In some embodiments, the maximum speed for creating a second virtual machine at the current moment can be determined based on the operating information of the electronic device in the cloud. After determining the creation speed corresponding to the difference from the correspondence between the candidate difference and the candidate creation speed, if the creation speed corresponding to the difference is greater than the maximum speed for creating a second virtual machine at the current moment, then the maximum speed for creating a second virtual machine at the current moment is taken as the creation speed for creating a second virtual machine.
[0185] If the creation speed corresponding to the difference is less than or equal to the maximum speed at which the second virtual machine is created at the current moment, then the creation speed corresponding to the difference can be used as the creation speed of the second virtual machine. In this way, combined with the electronic devices in the cloud, a more accurate creation speed for the second virtual machine can be determined.
[0186] The following explains how to determine the maximum speed for creating a second virtual machine at the current moment based on the operating information of electronic devices in the cloud. For ease of understanding, we will first explain how to create virtual machines from electronic devices in the cloud.
[0187] In some embodiments, creating a virtual machine using an electronic device includes determining the electronic device, packing, powering on, and verifying. The process of determining the electronic device involves using the configuration information of the virtual machine to be created and the operating information of the electronic device to determine the electronic device for creating the virtual machine; that is, determining the electronic device for running the virtual machine. For example, if the configuration information of the virtual machine to be created is that the number of graphics processor cores is 2, the electronic device corresponding to an idle graphics processor with 2 cores can be determined based on the operating information of the electronic device. Therefore, the electronic device corresponding to an idle graphics processor with 2 cores can be determined as the electronic device for running the virtual machine.
[0188] Boxing involves copying the required operating system into the virtual machine based on its configuration information. Booting involves loading the operating system, initializing network connections, and allocating memory addresses. Verification checks whether the operating system is loaded correctly, the network connection is working properly, and the storage space of the devices running the virtual machine is sufficient. The specific steps can be determined based on actual usage requirements.
[0189] The creation time for a single virtual machine can range from 10 to 20 minutes. To improve the creation speed, multiple virtual machines can be created simultaneously. For the second virtual machine, based on its configuration information and the operating information of the electronic device (see the explanation of second operating information for details), the maximum number of second virtual machines that can be created simultaneously at any given time can be determined. Then, the maximum number of second virtual machines can be divided by the average creation time (e.g., 15 minutes) to obtain a second ratio of the maximum number of second virtual machines to the creation time. This second ratio represents the maximum speed at which second virtual machines can be created at any given time.
[0190] In step 1042B, a second virtual machine is created using the creation speed, and the second virtual machine is added to the virtual machine resource pool.
[0191] In some embodiments, the creation speed can be multiplied by the time it takes to create the second virtual machine to obtain the number of second virtual machines created. Then, by determining the electronic device used to create the second virtual machine, the created second virtual machine can be boxed, powered on, and verified. After the second virtual machine is created, it can be added to the virtual machine resource pool.
[0192] In some embodiments, virtual machines in the virtual machine resource pool run on electronic devices in different regions. After obtaining the creation speed of creating a second virtual machine, second operating information of electronic devices in different regions can be obtained. The second operating information may include the operating information of the graphics processor of the electronic device, the operating information of the central processing unit of the electronic device, the storage information of the electronic device, the network connection information of the electronic device, and the environmental information of the electronic device.
[0193] Graphics processor (GPU) operating information may include model, number of cores, core frequency, and graphics card memory capacity. Central processing unit (CPU) operating information may include model, number of cores, number of threads, and cache size. Storage information may include capacity and read / write speed. Network connectivity information may include connection status, uploaded data volume, and downloaded data volume. Environmental information may include temperature and humidity information of the environment in which the electronic device is located.
[0194] To achieve load balancing among electronic devices in different regions, the sub-creation speed for each region can be determined based on the configuration information of the second virtual machine, multiple second runtime information, and the creation speed. In some embodiments, regions can be filtered based on the configuration information and the second runtime information to obtain target regions.
[0195] For example, if the configuration information indicates that the second virtual machine needs a read / write speed greater than a preset read / write speed threshold, then the area corresponding to the electronic device whose read / write speed is greater than the preset read / write speed threshold can be used as the target area.
[0196] The number of idle CPU cores in the electronic devices corresponding to each target region is determined. For each target region, a third ratio is determined to be the number of idle cores compared to the total number of idle cores across all target regions. The product of this third ratio and the second creation speed is used as the sub-creation speed for that target region. The sub-creation speed for regions other than the target region is 0. This can also be determined based on other second operational information, but no specific limitations are made here.
[0197] After obtaining the sub-creation speed of each region, the sub-creation speed can be sent to the electronic device in the corresponding region. After receiving the sub-creation speed, the electronic device in each region can determine the time required to create the second virtual machine in that region, and multiply the time required to create the second virtual machine by the sub-creation speed to determine the number of second virtual machines that need to be created at the same time, and then create the corresponding number of second virtual machines.
[0198] For each region's electronic device, after creating a second virtual machine, the created second virtual machine can be returned to the electronic device. In other words, the electronic device can receive second virtual machines created by electronic devices in each region using the corresponding sub-creation speed. The sub-creation speeds for different regions can be different, and the number of second virtual machines created in different regions can also be different. After receiving the second virtual machines created by each region, the second virtual machines can be added to the virtual machine resource pool, enabling precise adjustment of the number of virtual machines in the virtual machine resource pool.
[0199] In some embodiments, the first adjustment method also includes a creation method. For details on the creation method, please refer to [the section on...]. Figure 8 The steps shown differ in that, for the creation method in the first adjustment method, the greater the difference between the rate at which virtual machines are added and the rate at which they are consumed, the faster the second virtual machine is created. Other details can be adjusted accordingly. Figure 8 The steps shown are equivalent substitutions and will not be repeated here.
[0200] In some embodiments, when the number of virtual machines in the virtual machine resource pool is adjusted using the first adjustment method, the first adjustment method further includes a second adjustment sub-method, wherein the second adjustment sub-method is a creation method. The second adjustment sub-method can be the same as the first adjustment sub-method, or the creation speed corresponding to the second adjustment sub-method can be different from that of the first adjustment sub-method. The specific settings can be configured according to actual usage requirements.
[0201] When the rate at which virtual machines are consumed changes from being greater than the rate at which they are added to being less than the rate at which they are added, and the number of virtual machines in the virtual machine resource pool is less than a preset threshold, it indicates that the number of virtual machines in the virtual machine resource pool is small, but the rate at which they are consumed is slow. In this case, the method of recycling can be stopped from adjusting the number of virtual machines in the virtual machine resource pool. Instead, the method of creation (i.e., the second adjustment sub-method) can be used to adjust the number of virtual machines in the virtual machine resource pool. The creation speed of the creation method can be determined based on the difference between the rate at which virtual machines are consumed and the rate at which they are added.
[0202] When the rate at which virtual machines are consumed changes from being greater than the rate at which they are added to being less than the rate at which they are added, and the number of virtual machines in the virtual machine resource pool is greater than or equal to a preset threshold, it indicates that there are too many virtual machines in the resource pool. In this case, the methods of recycling and the second adjustment sub-method (i.e., creation) for adjusting the number of virtual machines in the resource pool can be stopped; that is, the number of virtual machines in the resource pool can be left unchanged. In this way, the number of virtual machines in the resource pool can be precisely adjusted by combining the rate at which virtual machines are consumed and the rate at which they are added.
[0203] In some embodiments, when the number of virtual machines in the virtual machine resource pool is adjusted using the second adjustment method (creation method), if the consumption rate of virtual machines changes from being less than the increase rate of virtual machines to being greater than the increase rate of virtual machines, the creation speed of the creation method can be increased to increase the increase rate of virtual machines until the consumption rate of virtual machines is less than or equal to the increase rate of virtual machines.
[0204] If the rate at which virtual machines are consumed changes from being less than the rate at which they are added to being greater than the rate at which they are added, the creation and recycling methods can be used to further increase the rate at which virtual machines are added until the rate at which virtual machines are consumed is less than or equal to the rate at which they are added. In this way, the number of virtual machines in the virtual machine resource pool can be precisely adjusted by combining the rate at which virtual machines are consumed and the rate at which they are added.
[0205] In this application, a virtual machine resource pool of virtual machines created in the cloud can be obtained. Furthermore, this application can adjust the number of virtual machines in the virtual machine resource pool by combining the consumption rate and the increase rate of virtual machines. The consumption rate of virtual machines is the rate at which virtual machines are retrieved from the virtual machine resource pool and allocated to users. Compared to related technologies, it is not necessary to create and consume corresponding virtual machines for each virtual machine acquisition request, which can reduce user waiting time. Moreover, it can achieve precise adjustment of the number of virtual machines in the virtual machine resource pool without the user's awareness. During the adjustment process, virtual machines can be recycled, which is equivalent to reusing the computer resources corresponding to the virtual machines, reducing the pressure on cloud electronic devices. This application embodiment can achieve precise adjustment of the number of inventory instances, thereby solving the problem of insufficient inventory instances in the virtual machine resource pool caused by inconsistent consumption and increase rates of virtual machines at different time periods.
[0206] In some embodiments, Figure 3 After step 104 shown, the number of virtual machines in the virtual machine resource pool can be obtained, and the threshold number of virtual machines corresponding to the time period can be determined based on the time period in which the current time point is located.
[0207] The threshold for the number of virtual machines corresponding to a time period can be determined based on the number of virtual machines consumed in the past. For example, if the average number of virtual machines consumed each day from 9:00 to 10:00 in the previous week was 200, the threshold for the number of virtual machines corresponding to 9:00 to 10:00 can be determined as 200 plus the sum of the pre-set redundancy number.
[0208] The threshold for the number of virtual machines corresponding to a time period can also be determined based on the activity. For example, if the game will be launched at 11 o'clock, the threshold for the number of virtual machines in the first 5 hours after the game is launched (i.e., 11 o'clock to 4 o'clock) can be set as the first threshold for the number of virtual machines in the virtual machine resource pool.
[0209] When the number of virtual machines reaches a certain threshold, the adjustment process stops, and the number of virtual machines in the virtual machine resource pool is no longer adjusted. In other words, if the number of virtual machines reaches the second threshold (i.e., the second threshold is less than the first threshold), no adjustment is needed. This method allows for precise adjustment of the number of virtual machines in the resource pool based on the actual number of virtual machines.
[0210] In some embodiments, the electronic devices running virtual machines are located in different regions, and there is a third quantity threshold for each region. The number of idle virtual machines in each region can be polled at fourth intervals.
[0211] For each region, if the number of idle virtual machines in that region is less than the corresponding third threshold, the number of idle virtual machines in that region can be increased by creating or reclaiming them. If the number of idle virtual machines in a region is greater than or equal to the corresponding third threshold, there is no need to adjust the number of virtual machines in that region. This method allows for precise adjustment of the number of virtual machines in different regions.
[0212] The following explains how to request virtual machines. The virtual machine resource pool includes multiple virtual machine queues. Virtual machines in different queues have different levels, and different levels correspond to different configuration information. Figure 3 Before step 101, before step 102, before step 103, before step 104, or after step 104, that is, at any time, the cloud-based electronic device can receive a virtual machine acquisition request sent by the client's electronic device.
[0213] See Figure 9 , Figure 9 This is a flowchart illustrating the virtual machine processing method provided in the embodiments of this application. Figure 7 The following is combined with Figure 9 The steps shown illustrate how to request a virtual machine.
[0214] In step 901, in response to the virtual machine acquisition request, the level of the virtual machine corresponding to the virtual machine acquisition request is determined based on the configuration information in the virtual machine acquisition request.
[0215] The virtual machine acquisition request includes configuration information for the virtual machine. The configuration information of the virtual machine includes multiple configuration sub-information, such as the name of the virtual machine, its identifier, the region of the electronic device running the virtual machine, the operating system required by the virtual machine, the image version number, the capacity of the system disk, the central processing unit, the graphics processor, the network bandwidth, and the billing information of the virtual machine.
[0216] In some embodiments, a configuration weight is pre-set for each configuration sub-information. The configuration sub-information can be multiplied by the configuration weight to obtain a third product. Then, the third products can be added together to obtain the configuration score corresponding to the configuration information. Then, based on the score range to which the configuration score belongs, the level of the virtual machine corresponding to the virtual machine acquisition request associated with the score range can be determined. The higher the configuration score, the higher the level of the virtual machine.
[0217] In step 902, based on the determined virtual machine level, the virtual machine corresponding to the virtual machine acquisition request is determined from the corresponding virtual machine queue, and the access information of the determined virtual machine is sent.
[0218] After determining the virtual machine's level, the virtual machine corresponding to the virtual machine acquisition request can be identified from the virtual machine queue corresponding to the level. In other words, the virtual machine corresponding to the virtual machine acquisition request can be identified from the corresponding virtual machine queue, and then the access information of the identified virtual machine can be sent.
[0219] The access information can include the virtual machine's login credentials, access address and port information, configuration information, and network information. The login credentials can be the virtual machine's username and password (distinct from the username and password used to log in to virtual machine applications). Based on this access information, the client's electronic device can access the virtual machine, allowing the user to use it; this virtual machine is the one that has been consumed.
[0220] To make it easier to understand, the following examples will illustrate this. Figure 9 The steps shown are illustrated with an example. For instance, the virtual machine resource pool includes three virtual machine queues: virtual machine queue 1, virtual machine queue 2, and virtual machine queue 3. The virtual machines in virtual machine queue 1 are at level 1, the virtual machines in virtual machine queue 2 are at level 2, and the virtual machines in virtual machine queue 3 are at level 3. The configuration information of level 1 is higher than that of level 2, and the configuration information of level 2 is higher than that of level 3.
[0221] In response to Virtual Machine Acquisition Request 1, which includes configuration information 1 for the virtual machine (configuration information 1 is level 2 configuration information), the level 2 of the virtual machine corresponding to the virtual machine acquisition request is determined based on configuration information 1 in Virtual Machine Acquisition Request 1. Based on the determined level 2 of the virtual machine, Virtual Machine 1 corresponding to Virtual Machine Acquisition Request 1 is determined from the virtual machine queue 2 corresponding to level 2, and access information 1 for the determined virtual machine 1 is sent.
[0222] In response to virtual machine acquisition request 2, which includes configuration information 2 for the virtual machine (configuration information for level 3), the level 3 of the virtual machine corresponding to the acquisition request is determined based on this configuration information. Based on the determined level 3, the virtual machine 2 corresponding to acquisition request 2 is selected from the virtual machine queue 3 corresponding to level 3, and access information 2 for the selected virtual machine 2 is sent. This method enables the determination of a virtual machine that meets the user's actual needs based on the configuration information in the acquisition request, thereby improving the accuracy of virtual machine selection and enhancing the user experience.
[0223] In some embodiments, after creating virtual machines with different configuration information, virtual machines can be added to the corresponding virtual machine queues based on their configuration level. Similarly, when reclaiming consumed virtual machines, they can also be added to the corresponding virtual machine queues based on their configuration level. This allows for automatic scaling of the virtual machine queue length without the user's awareness. Since the virtual machine queues are included in the virtual machine resource pool, precise adjustment of the number of virtual machines in the pool is possible.
[0224] In some embodiments, when dealing with the case of reclaiming consumed virtual machines, that is, when the adjustment method is reclamation, for the reclaimed consumed virtual machines, a difference image can be generated based on the differences between the consumed virtual machine and the original virtual machine, the account that logged into the consumed virtual machine can be obtained, and the difference image can be associated with the account corresponding to the consumed virtual machine for storage, thereby obtaining the correspondence between candidate accounts and candidate difference images.
[0225] The original virtual machine is the virtual machine that was not consumed before it was consumed, that is, the virtual machine when it was not used by the user. The original virtual machine can also be an idle virtual machine that belongs to the same virtual machine queue as the consumed virtual machine, which is reasonable.
[0226] See Figure 10 , Figure 10 This is a flowchart illustrating the virtual machine processing method provided in the embodiments of this application. Figure 8 The following is combined with Figure 10 The steps shown illustrate how to request a virtual machine.
[0227] In step 1001, in response to the virtual machine acquisition request, if no virtual machine corresponding to the account is found, an initial virtual machine is obtained from the resource pool based on the demand information, and based on the account, the differential image corresponding to the account is obtained.
[0228] The virtual machine acquisition request includes an account (the account used to log in to the virtual machine application) and requirement information. The requirement information includes the virtual configuration requirements needed by the user. The configuration requirement information may include one or more types of configuration information. For details, please refer to the description of configuration information, which will not be elaborated here.
[0229] After receiving a virtual machine retrieval request, you can check if there is a virtual machine corresponding to the account included in the virtual machine retrieval request. That is, you can search for the virtual machine corresponding to the account included in the virtual machine retrieval request from the pre-stored correspondence between candidate accounts and candidate virtual machines.
[0230] Once the virtual machine corresponding to the account is located, access information for the virtual machine corresponding to the account can be sent, that is, the access information for the virtual machine corresponding to the account can be sent to the electronic device of the client corresponding to the virtual machine's request.
[0231] If no virtual machine is found for an account, an initial virtual machine is obtained from the resource pool based on the demand information, and the differential image corresponding to the account is obtained based on the account. In other words, if no virtual machine is found for an account, an initial virtual machine can be obtained from the virtual machine resource pool based on the demand information, and the differential image corresponding to the account can be determined from the pre-stored correspondence between candidate accounts and candidate differential images.
[0232] In step 1002, a third virtual machine is generated based on the initial virtual machine and the differential image, and access information for the third virtual machine is sent.
[0233] In some embodiments, a third virtual machine can be generated based on an initial virtual machine and a differential image, and access information for the third virtual machine can be sent. The initial virtual machine includes an initial image, and the differential image is an image obtained by modifying the initial image. The differential image includes user data, system configurations set by the user, applications installed by the user, etc.
[0234] In some embodiments, the initial image and the differential image can be merged. Specifically, the differential image can be copied into the initial image to complete the configuration of the initial virtual machine. The configured virtual machine is then the third virtual machine. Since the differential image includes changes made to the original image by the user corresponding to the account, to improve the user experience, a third virtual machine including the differential image can be generated for the user to use. The third virtual machine is equivalent to the virtual machine used by the user, eliminating the need for the user to readjust or configure the corresponding content in the virtual machine, thus further improving the user experience.
[0235] In some embodiments, the initial image corresponding to the virtual machine in the virtual machine resource pool can be updated. The following describes the method of updating the initial image. The electronic device running the virtual machine can be located in different regions, so that users in different regions can conveniently use the virtual machine in the corresponding region.
[0236] The electronic device in the cloud (i.e., the electronic device running the virtual machine) consists of a first electronic device and a second electronic device. The first electronic device can store a first initial image, and then the first electronic device can send the first initial image to the second electronic device located in a different region.
[0237] When the first initial image is updated, the first electronic device obtains the updated image and generates a second image file based on the updated image and the first initial image file. The updated image can then be sent to the second electronic device, which can then generate the second image file based on the first initial image file and the updated image file.
[0238] To facilitate understanding of the virtual machine processing method provided in the embodiments of this application, the following description, in conjunction with specific examples, illustrates the virtual machine processing method provided in the embodiments of this application. (See also...) Figure 11 , Figure 11 This is a flowchart illustrating the virtual machine processing method provided in the embodiments of this application. Figure 9 The following is combined with Figure 11 The steps are explained below.
[0239] In step 1101, the electronic devices in the cloud acquire the virtual machine resource pool.
[0240] The cloud includes clusters of electronic devices located in different regions. The electronic device in the cloud referred to in step 1101 can be any electronic device in the electronic device cluster, or it can be the first electronic device. The specific settings can be configured according to actual usage requirements.
[0241] See Figure 12 , Figure 12 This is a schematic diagram of an electronic device cluster provided in an embodiment of this application. The electronic device cluster includes a first electronic device cluster 1201, a second electronic device cluster 1202, and a third electronic device cluster 1203. The first electronic device cluster 1201, the second electronic device cluster 1202, and the third electronic device cluster 1203 are located in different regions.
[0242] The first electronic device cluster 1201 includes multiple first electronic devices. Figure 12 The diagram shows first electronic device 1 and first electronic device N. The second electronic device cluster 1202 includes multiple second electronic devices. Figure 12 The diagram shows a second electronic device 1 and a second electronic device M. N and M may be the same or different. The second electronic device and the second electronic device are used only to distinguish them. See the above description for details.
[0243] The third electronic equipment cluster 1203 includes multiple second electronic equipment. Figure 12 The diagram shows a second electronic device 1 and a second electronic device F. F and M can be the same or different, depending on actual usage requirements. Both the first and second electronic devices can be physical machines (hosts), and both are electronic devices running virtual machines.
[0244] The storage area of the first electronic device cluster 1201 stores the initial image (base) and the updated image (diff). This storage area can be a storage server (GlusterFS). Furthermore, the first electronic device cluster 1201 can send the initial image and the updated image to the second electronic device cluster 1202, and also to the third electronic device cluster 1203. In other words, the first electronic device cluster 1201, the second electronic device cluster 1202, and the third electronic device cluster 1203 each have corresponding storage areas used to store the initial image and the updated image.
[0245] The first and second electronic devices can store the initial image. When it is necessary to update the image, the storage area can be accessed through the intranet of the corresponding area, thereby obtaining the complete image file.
[0246] The virtual machine resource pool includes Figure 12 The virtual machines (VMs) in the virtual machine resource pool correspond to different electronic device clusters. In other words, the VMs in the virtual machine resource pool run on different electronic devices located in different regions. Different electronic devices run different numbers of VMs; for example, in... Figure 12 In the second electronic device cluster 1202, the second electronic device 1 runs two virtual machines, namely virtual machine 1206 and virtual machine 1204, and the second electronic device F in the third electronic device cluster 1203 runs one virtual machine, namely virtual machine 1205.
[0247] In step 1102, the consumption rate of virtual machines in the virtual machine resource pool is determined, and the addition rate of virtual machines in the virtual machine resource pool is determined.
[0248] In some embodiments, cloud-based electronic devices can record consumed virtual machines and added virtual machines, wherein added virtual machines include created virtual machines and reclaimed virtual machines, and then determine the consumption rate of virtual machines in the virtual machine resource pool and the addition rate of virtual machines in the virtual machine resource pool based on the recorded consumed virtual machines and added virtual machines.
[0249] Specifically, when a user needs to use a virtual machine (cloud computer), in response to the virtual machine acquisition request, the cloud-based electronic device can send the virtual machine to the user's terminal. Accordingly, the cloud-based electronic device can record the consumption of 1 virtual machine, which means the inventory instance is reduced by 1.
[0250] In response to a virtual machine acquisition request, the user's unique identifier (corresponding to the account) in the request can be read. The user's unique identifier can be generated from the account, and then it can be determined whether a virtual machine corresponding to the user's unique identifier exists. If it exists, the access information of the virtual machine corresponding to the user's unique identifier can be sent to the user's corresponding terminal. After the virtual machine starts, virtual machine streaming can be performed.
[0251] If it does not exist, it means that the user has not used the virtual machine for the first time, or the virtual machine used by the user has been recycled or destroyed. Therefore, the virtual machine corresponding to the virtual machine acquisition request can be obtained from the virtual machine resource pool, and the access information of the virtual machine corresponding to the virtual machine acquisition request can be sent to the user's terminal. After the virtual machine starts, virtual machine streaming can be performed.
[0252] For example, see Figure 13 , Figure 13 This is a schematic diagram of the virtual machine provided in the embodiments of this application. Figure 13 The diagram shows controls in the display interface corresponding to multiple virtual machines, including a hidden control 1301 (i.e., hidden keys), a keyboard display control 1302 (i.e., call up the keyboard), a first click control 1303 (left click), a second click control 1304 (right click), a window switching control 1305 (i.e., switch windows), a first scroll control 1306 (i.e., scroll wheel up), a second scroll control 1307 (i.e., scroll wheel down), and a return control (1308).
[0253] In response to a trigger operation on the hidden control 1301, the keyboard display control 1302 (i.e., bringing up the keyboard), the first click control 1303 (left click), the second click control 1304 (right click), the window switching control 1305 (i.e., switching windows), the first scroll control 1306 (i.e., scroll wheel up), the second scroll control 1307 (i.e., scroll wheel down), and the return control (1308) can be hidden. In other words, the keyboard display control 1302 (i.e., bringing up the keyboard), the first click control 1303 (left click), the second click control 1304 (right click), the window switching control 1305 (i.e., switching windows), the first scroll control 1306 (i.e., scroll wheel up), the second scroll control 1307 (i.e., scroll wheel down), and the return control 1308 (i.e., returning to the desktop) can be hidden.
[0254] In response to a trigger operation on the keyboard display control 1302, the keyboard can be displayed on the display page. In response to a trigger operation on the first click control 1303, a left-click operation can be performed. In response to a trigger operation on the second click control 1304, a right-click operation can be performed.
[0255] In response to a trigger operation on the window switching control 1305, the displayed window can be switched. In response to a trigger operation on the first scroll control 1306, the content on the page can be scrolled upwards. In response to a trigger operation on the second scroll control 1307, the content on the page can be scrolled downwards. In response to a trigger operation on the return control 1308, the user can return to the desktop of the corresponding terminal, i.e., the virtual machine display page is canceled. Through the above controls, the user can use the virtual machine, improving the user experience.
[0256] If the account type corresponding to the account used to log in to the virtual machine is a paid type, that is, if the user pays to use the virtual machine, and if the user does not continue to pay and the payment period has expired, the corresponding virtual machine can be destroyed after a preset number of days. After the virtual machine is destroyed, the status of the virtual machine can be marked as destroyed.
[0257] When a virtual machine is destroyed, all data corresponding to the user can be deleted from the system disk (or data disk), and the state of the destroyed virtual machine can be restored to its original state. This allows the virtual machine in its original state to be added to the virtual machine resource pool, which is equivalent to reclaiming the virtual machine.
[0258] If the user continues to pay, the corresponding virtual machine can be retained until the payment period expires. Step 1102 and... Figure 3 The steps shown are consistent with step 102; for details, please refer to [link / reference]. Figure 3 The description of step 102 shown is not specifically limited here.
[0259] In step 1103, if the rate at which virtual machines are consumed exceeds the rate at which virtual machines are added, the consumed virtual machines are reclaimed and the reclaimed virtual machines are added to the virtual machine resource pool.
[0260] For step 1103, if the rate at which virtual machines are consumed is greater than the rate at which virtual machines are added, and the number of virtual machines in the virtual machine resource pool is lower than a preset threshold, the consumed virtual machines are reclaimed and the reclaimed virtual machines are added to the virtual machine resource pool.
[0261] In some embodiments, if the difference between the rate at which virtual machines are consumed and the rate at which virtual machines are added falls within a first difference range, then consumed virtual machines are reclaimed and new virtual machines are created, and the reclaimed and created virtual machines are added to the virtual machine resource pool. If the difference between the rate at which virtual machines are consumed and the rate at which virtual machines are added falls within a second difference range, then only consumed virtual machines are reclaimed, and the reclaimed virtual machines are added to the virtual machine resource pool.
[0262] If the rate at which virtual machines are consumed changes from being greater than the rate at which virtual machines are added to being less than the rate at which virtual machines are added, and the number of virtual machines in the virtual machine resource pool is less than a preset threshold, then the process of recycling consumed virtual machines will stop, and new virtual machines will be created and added to the virtual machine resource pool.
[0263] In step 1104, if the rate at which virtual machines are consumed is less than the rate at which virtual machines are added, a virtual machine is created and added to the virtual machine resource pool.
[0264] In some embodiments, the maximum number of users online, the number of idle virtual machines (i.e., the number of virtual machines in the virtual machine resource pool) and the second operating information of the electronic device can be obtained. When the second operating information indicates that the electronic device is in an idle state, virtual machines can be created and added to the virtual machine resource pool until the number of virtual machines in the virtual machine resource pool is greater than a preset threshold.
[0265] If the number of online users exceeds the user threshold, and the second running information indicates that all electronic devices are not idle, the consumed virtual machines can be reclaimed, and the reclaimed virtual machines can be added to the virtual machine resource pool.
[0266] In this application, a virtual machine resource pool of virtual machines created in the cloud can be obtained. Furthermore, this application can adjust the number of virtual machines in the virtual machine resource pool by combining the consumption rate and the addition rate of virtual machines. The consumption rate of virtual machines is the speed at which virtual machines are taken from the virtual machine resource pool and allocated to users. Compared with related technologies, it is not necessary to create and consume corresponding virtual machines for each virtual machine acquisition request, which can reduce the waiting time for users and achieve precise adjustment of the number of virtual machines in the virtual machine resource pool without the user's awareness.
[0267] The following description continues to illustrate the exemplary structure of the virtual machine processing device 455 provided in the embodiments of this application as a software module. In some embodiments, such as Figure 2 As shown, the software modules in the processing device 455 of the virtual machine stored in the memory 450 may include:
[0268] The acquisition module 4551 is used to acquire the virtual machine resource pool, which is used to store virtual machines created in the cloud;
[0269] The determination module 4552 is used to determine the consumption rate of virtual machines in the virtual machine resource pool and the increase rate of virtual machines in the virtual machine resource pool;
[0270] The determination module 4552 is also used to determine the adjustment method for the number of virtual machines in the virtual machine resource pool by combining the consumption rate of the virtual machine and the increase rate of the virtual machine;
[0271] The determining module 4552 is further configured to adjust the number of virtual machines in the virtual machine resource pool using the determined adjustment method.
[0272] In some embodiments, the determining module 4552 is further configured to, when the consumption rate of the virtual machine is greater than the increase rate of the virtual machine, determine the adjustment method for the number of virtual machines in the virtual machine resource pool as a first adjustment method, the first adjustment method including a recycling method, the recycling method being used to indicate the recycling of consumed virtual machines; obtain the account type corresponding to the account that logged into the consumed virtual machine, and obtain the first running information of the consumed virtual machine; determine a first virtual machine based on the account type and the first running information, and recycle the first virtual machine to the virtual machine resource pool.
[0273] In some embodiments, the determining module 4552 is further configured to: if the account type is a trial type, and the first running information indicates that the running state of the consumed virtual machine is disconnected, then determine the consumed virtual machine as the first virtual machine; if the account type is a paid type, and the first running information indicates that the remaining usage time of the consumed virtual machine is less than a duration threshold, then determine the consumed virtual machine as the first virtual machine; restore the state of the first virtual machine to its original state, and add the virtual machine in the original state to the virtual machine resource pool.
[0274] In some embodiments, the determining module 4552 is further configured to, when the account type is an individual type, determine the usage frequency of the consumed virtual machine within a preset time period based on the first running information, and if the usage frequency is less than a usage frequency threshold, determine the consumed virtual machine as the first virtual machine; when the account type is a group type, if the distance between the first region and the second region represented by the first running information is greater than a preset distance threshold, then determine the consumed virtual machine as the first virtual machine; wherein, the first region is the region where the electronic device running the consumed virtual machine is located, and the second region is the region where the object corresponding to the account that logged into the consumed virtual machine is located.
[0275] In some embodiments, the first adjustment method further includes a first adjustment sub-method; the determining module 4552 is further configured to determine the difference between the consumption rate of the virtual machine and the increase rate of the virtual machine; if the difference belongs to a first difference range, the adjustment method for the number of virtual machines in the virtual machine resource pool is determined to be the recycling method and the first adjustment sub-method; if the difference belongs to a second difference range, the adjustment method for the number of virtual machines in the virtual machine resource pool is determined to be the recycling method, wherein the values in the first difference range are all greater than the values in the second difference range.
[0276] In some embodiments, the recycling method includes different sub-recycling methods, each associated with a different priority, and the sub-recycling methods correspond one-to-one with the priorities; the determining module 4552 is further configured to determine the difference between the consumption rate of the virtual machine and the increase rate of the virtual machine; based on the third difference interval to which the difference belongs, determine the priority corresponding to the third difference interval, and determine the sub-recycling method associated with the priority corresponding to the third difference interval; and determine the sub-recycling method associated with the priority corresponding to the third difference interval as an adjustment method for the number of virtual machines in the virtual machine resource pool.
[0277] In some embodiments, the first adjustment method further includes a second adjustment sub-method; the determining module 4552 is further configured to, after determining that the adjustment method for the number of virtual machines in the virtual machine resource pool is the first adjustment method when the consumption rate of the virtual machine is greater than the increase rate of the virtual machine, the method further includes: stopping the use of the recycling method to adjust the number of virtual machines in the virtual machine resource pool when the consumption rate of the virtual machine changes from being greater than the increase rate of the virtual machine to being less than the increase rate of the virtual machine and the number of virtual machines in the virtual machine resource pool is less than a preset number threshold; stopping the use of the recycling method and the second adjustment sub-method to adjust the number of virtual machines in the virtual machine resource pool when the consumption rate of the virtual machine changes from being greater than the increase rate of the virtual machine to being less than the increase rate of the virtual machine and the number of virtual machines in the virtual machine resource pool is greater than or equal to a preset number threshold.
[0278] In some embodiments, the determining module 4552 is further configured to, when the increase rate of the virtual machine is greater than the consumption rate of the virtual machine, determine a second adjustment method for adjusting the number of virtual machines in the virtual machine resource pool, wherein the second adjustment method is used to instruct the creation of virtual machines; determine the difference between the increase rate of the virtual machine and the consumption rate of the virtual machine, and based on the difference, determine the creation rate for creating a second virtual machine; create the second virtual machine using the creation rate, and add the second virtual machine to the virtual machine resource pool.
[0279] In some embodiments, the virtual machines in the virtual machine resource pool run on electronic devices in different regions; the determining module 4552 is further configured to obtain second operating information of electronic devices in different regions; determine the sub-creation speed corresponding to each region based on multiple pieces of the second operating information and the creation speed; send the sub-creation speed to the electronic devices in the corresponding regions, and receive the second virtual machines created by the electronic devices in each region using the corresponding sub-creation speed; and add the second virtual machines to the virtual machine resource pool.
[0280] In some embodiments, the determining module 4552 is further configured to, after adjusting the number of virtual machines in the virtual machine resource pool using the determined adjustment method, obtain the number of virtual machines in the virtual machine resource pool, and determine the virtual machine number threshold corresponding to the time period based on the time period in which the current time point is located; and if the number of virtual machines reaches the virtual machine number threshold, stop using the adjustment method to adjust the number of virtual machines in the virtual machine resource pool.
[0281] In some embodiments, the virtual machine resource pool includes multiple virtual machine queues, and the virtual machines in different virtual machine queues have different levels, and the different levels correspond to different configuration information; the determining module 4552 is further configured to respond to a virtual machine acquisition request, the virtual machine acquisition request including configuration information for the virtual machine, determine the level of the virtual machine corresponding to the virtual machine acquisition request based on the configuration information in the virtual machine acquisition request; based on the determined virtual machine level, determine the virtual machine corresponding to the virtual machine acquisition request from the corresponding virtual machine queue, and send the access information of the determined virtual machine.
[0282] In some embodiments, the adjustment method is a recycling method, which is used to indicate the recycling of consumed virtual machines; the determining module 4552 is further configured to, after determining the adjustment method for the number of virtual machines in the virtual machine resource pool by combining the consumption rate of the virtual machines and the increase rate of the virtual machines, generate a difference image based on the difference between the consumed virtual machines and the original virtual machines; obtain the account that logs in to the consumed virtual machines; and associate the difference image with the account corresponding to the consumed virtual machines for storage.
[0283] In some embodiments, the determining module 4552 is further configured to respond to a virtual machine acquisition request, the virtual machine acquisition request including account and demand information; if no virtual machine corresponding to the account is found, to acquire an initial virtual machine from the virtual machine resource pool based on the demand information, and to acquire a differential image corresponding to the account based on the account; to generate a third virtual machine based on the initial virtual machine and the differential image, and to send access information for the third virtual machine.
[0284] In some embodiments, the determining module 4552 is further configured to determine the allocatable duration of the virtual machines in the virtual machine resource pool based on the consumption rate of the virtual machines, the increase rate of the virtual machines, and the number of virtual machines in the virtual machine resource pool; if the allocatable duration is less than a preset duration threshold, determine a third adjustment method corresponding to the allocatable duration from the correspondence between the candidate allocatable durations and candidate adjustment methods, and determine the third adjustment method as the adjustment method for the number of virtual machines in the virtual machine resource pool.
[0285] In some embodiments, the determining module 4552 is further configured to determine the difference between the consumption rate of the virtual machine and the increase rate of the virtual machine, and to determine the first ratio between the number of virtual machines in the virtual machine resource pool and the difference as the allocatable duration of the virtual machines in the virtual machine resource pool.
[0286] This application provides a computer program product, which includes a computer program or computer-executable instructions stored in a computer-readable storage medium. A processor of an electronic device reads the computer-executable instructions from the computer-readable storage medium and executes the computer-executable instructions, causing the electronic device to perform the virtual machine processing method described above in this application.
[0287] This application provides a computer-readable storage medium storing computer-executable instructions or a computer program. When the computer-executable instructions or the computer program are executed by a processor, the processor will execute the virtual machine processing method provided in this application, for example, such as... Figure 3 The virtual machine processing method is shown.
[0288] In some embodiments, the computer-readable storage medium may be a memory such as RAM, ROM, flash memory, magnetic surface memory, optical disk, or CD-ROM; or it may be a variety of devices including one or any combination of the above-mentioned memories.
[0289] In some embodiments, computer-executable instructions may take the form of programs, software, software modules, scripts, or code, written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and may be deployed in any form, including as stand-alone programs or as modules, components, subroutines, or other units suitable for use in a computing environment.
[0290] As an example, computer-executable instructions may, but do not necessarily, correspond to files in a file system. They may be stored as part of a file that holds other programs or data, for example, in one or more scripts in a Hyper Text Markup Language (HTML) document, in a single file dedicated to the program in question, or in multiple co-located files (e.g., files that store one or more modules, subroutines, or code sections).
[0291] As an example, computer-executable instructions can be deployed to execute on a single electronic device, or on multiple electronic devices located at one location, or on multiple electronic devices distributed across multiple locations and interconnected via a communication network.
[0292] In this application, a virtual machine resource pool of virtual machines created in the cloud can be obtained. Furthermore, this application can adjust the number of virtual machines in the virtual machine resource pool by combining the consumption rate and the increase rate of virtual machines. The consumption rate of virtual machines is the rate at which virtual machines are retrieved from the virtual machine resource pool and allocated to users. Compared to related technologies, it is not necessary to create and consume corresponding virtual machines for each virtual machine acquisition request, which can reduce user waiting time. Moreover, it can achieve precise adjustment of the number of virtual machines in the virtual machine resource pool without the user's awareness. During the adjustment process, virtual machines can be recycled, which is equivalent to reusing the computer resources corresponding to the virtual machines, reducing the pressure on cloud electronic devices. This application embodiment can achieve precise adjustment of the number of inventory instances, thereby solving the problem of insufficient inventory instances in the virtual machine resource pool caused by inconsistent consumption and increase rates of virtual machines at different time periods.
[0293] The above description is merely an embodiment of this application and is not intended to limit the scope of protection of this application. Any modifications, equivalent substitutions, and improvements made within the spirit and scope of this application are included within the scope of protection of this application.
Claims
1. A method for processing virtual machines, characterized in that, The method includes: Obtain a virtual machine resource pool, which is used to store virtual machines created in the cloud; Determine the consumption rate of virtual machines in the virtual machine resource pool, and determine the addition rate of virtual machines in the virtual machine resource pool; Based on the consumption rate and the increase rate of the virtual machines, determine the adjustment method for the number of virtual machines in the virtual machine resource pool; The number of virtual machines in the virtual machine resource pool is adjusted using the determined adjustment method.
2. The method according to claim 1, characterized in that, The method for adjusting the number of virtual machines in the virtual machine resource pool by combining the consumption rate and the increase rate of the virtual machines includes: If the rate at which virtual machines are consumed is greater than the rate at which virtual machines are added, the adjustment method for the number of virtual machines in the virtual machine resource pool is determined to be the first adjustment method. The first adjustment method includes a recycling method, which is used to indicate that consumed virtual machines are recycled. The step of adjusting the number of virtual machines in the virtual machine resource pool using the determined adjustment method includes: Obtain the account type corresponding to the account that logged into the consumed virtual machine, and obtain the first running information of the consumed virtual machine; Based on the account type and the first running information, a first virtual machine is determined and the first virtual machine is recycled to the virtual machine resource pool.
3. The method according to claim 2, characterized in that, The step of determining the first virtual machine based on the account type and the first runtime information includes: If the account type is a trial type, and the first running information indicates that the running status of the consumed virtual machine is disconnected, then the consumed virtual machine is identified as the first virtual machine. If the account type is a paid type, and the remaining usage time of the consumed virtual machine, as indicated by the first running information, is less than the duration threshold, then the consumed virtual machine is identified as the first virtual machine. The step of reclaiming the first virtual machine into the virtual machine resource pool includes: Restore the state of the first virtual machine to its original state, and add the virtual machine in the original state to the virtual machine resource pool.
4. The method according to claim 2, characterized in that, The step of determining the first virtual machine based on the account type and the first runtime information includes: When the account type is personal, the usage frequency of the virtual machine consumed within a preset time period is determined based on the first running information, and if the usage frequency is less than the usage frequency threshold, the consumed virtual machine is determined as the first virtual machine. If the account type is a group type, and the distance between the first running information representing the first region and the second region is greater than a preset distance threshold, then the consumed virtual machine is identified as the first virtual machine. The first region is the region where the electronic device running the consumed virtual machine is located, and the second region is the region where the object corresponding to the account that logged into the consumed virtual machine is located.
5. The method according to claim 2, characterized in that, The first adjustment method also includes a first adjustment sub-method; The method for determining the adjustment of the number of virtual machines in the virtual machine resource pool as the first adjustment method includes: Determine the difference between the rate at which the virtual machine is consumed and the rate at which the virtual machine is added; If the difference belongs to the first difference range, then the adjustment method for the number of virtual machines in the virtual machine resource pool is determined to be the recycling method and the first adjustment sub-method; If the difference belongs to the second difference interval, then the adjustment method for the number of virtual machines in the virtual machine resource pool is determined to be the recycling method, wherein the values in the first difference interval are all greater than the values in the second difference interval.
6. The method according to claim 2, characterized in that, The recycling method includes different sub-recycling methods, and different sub-recycling methods are associated with different priorities. The sub-recycling methods and the priorities are in one-to-one correspondence. The method for determining the adjustment of the number of virtual machines in the virtual machine resource pool as the first adjustment method includes: Determine the difference between the rate at which the virtual machine is consumed and the rate at which the virtual machine is added; Based on the third difference interval to which the difference belongs, determine the priority corresponding to the third difference interval, and determine the sub-recycling method associated with the priority corresponding to the third difference interval; The sub-recycling method associated with the priority corresponding to the third difference interval is determined as the adjustment method for the number of virtual machines in the virtual machine resource pool.
7. The method according to claim 2, characterized in that, The first adjustment method also includes a second adjustment sub-method; When the rate at which the virtual machines are consumed exceeds the rate at which the virtual machines are added, after determining that the adjustment method for the number of virtual machines in the virtual machine resource pool is the first adjustment method, the method further includes: When the rate at which the virtual machine is consumed changes from being greater than the rate at which the virtual machine increases to being less than the rate at which the virtual machine increases, and the number of virtual machines in the virtual machine resource pool is less than a preset threshold, the method of recycling is stopped from adjusting the number of virtual machines in the virtual machine resource pool. When the rate at which the virtual machine is consumed changes from being greater than the rate at which the virtual machine increases to being less than the rate at which the virtual machine increases, and the number of virtual machines in the virtual machine resource pool is greater than or equal to a preset threshold, the recycling method and the second adjustment sub-method for adjusting the number of virtual machines in the virtual machine resource pool shall be stopped.
8. The method according to claim 1, characterized in that, The method for adjusting the number of virtual machines in the virtual machine resource pool by combining the consumption rate and the increase rate of the virtual machines includes: If the rate at which virtual machines are added exceeds the rate at which virtual machines are consumed, the adjustment method for the number of virtual machines in the virtual machine resource pool is determined to be the second adjustment method, which is used to indicate the creation of virtual machines; The step of adjusting the number of virtual machines in the virtual machine resource pool using the determined adjustment method includes: Determine the difference between the rate at which the virtual machine is added and the rate at which the virtual machine is consumed, and based on the difference, determine the creation rate for creating a second virtual machine; The second virtual machine is created using the aforementioned creation speed, and then added to the virtual machine resource pool.
9. The method according to claim 8, characterized in that, The virtual machines in the virtual machine resource pool run on electronic devices in different regions; The process of creating the second virtual machine using the aforementioned creation speed and adding the second virtual machine to the virtual machine resource pool includes... Acquire secondary operational information of electronic devices in different regions; Based on multiple pieces of the second operational information and the creation speed, the sub-creation speed corresponding to each region is determined; The sub-creation speed is sent to the electronic devices in the corresponding regions, and the second virtual machine created by the electronic devices in each region using the corresponding sub-creation speed is received; Add the second virtual machine to the virtual machine resource pool.
10. The method according to claim 1, characterized in that, After adjusting the number of virtual machines in the virtual machine resource pool using the determined adjustment method, the method further includes: Obtain the number of virtual machines in the virtual machine resource pool, and determine the threshold number of virtual machines corresponding to the time period based on the current time period. When the number of virtual machines reaches the threshold, the adjustment method is stopped, and the number of virtual machines in the virtual machine resource pool is adjusted.
11. The method according to claim 1, characterized in that, The virtual machine resource pool includes multiple virtual machine queues, with different virtual machine levels in different queues, and different levels corresponding to different configuration information; the method further includes: In response to a virtual machine acquisition request, which includes configuration information for the virtual machine, the level of the virtual machine corresponding to the virtual machine acquisition request is determined based on the configuration information in the virtual machine acquisition request. Based on the determined virtual machine level, the virtual machine corresponding to the virtual machine acquisition request is determined from the corresponding virtual machine queue, and the access information of the determined virtual machine is sent.
12. The method according to claim 1, characterized in that, The adjustment method is a recycling method, which is used to instruct the recycling of consumed virtual machines; After determining the adjustment method for the number of virtual machines in the virtual machine resource pool by combining the consumption rate and the increase rate of the virtual machines, the method further includes: Based on the differences between the consumed virtual machine and the original virtual machine, and based on the differences, a differential image is generated; Retrieve the account used to log in to the consumed virtual machine; The differential image is associated with the account corresponding to the consumed virtual machine and stored accordingly.
13. The method according to claim 1, characterized in that, The method further includes: In response to a virtual machine acquisition request, which includes account and demand information, if no virtual machine corresponding to the account is found, an initial virtual machine is acquired from the virtual machine resource pool based on the demand information, and a differential image corresponding to the account is acquired based on the account. Based on the initial virtual machine and the differential image, a third virtual machine is generated, and access information for the third virtual machine is sent.
14. The method according to claim 1, characterized in that, The method for adjusting the number of virtual machines in the virtual machine resource pool by combining the consumption rate and the increase rate of the virtual machines includes: Based on the consumption rate of the virtual machine, the increase rate of the virtual machine, and the number of virtual machines in the virtual machine resource pool, the allocatable time of the virtual machines in the virtual machine resource pool is determined. If the allocatable duration is less than a preset duration threshold, a third adjustment method corresponding to the allocatable duration is determined from the correspondence between candidate allocatable durations and candidate adjustment methods, and the third adjustment method is determined as the adjustment method for the number of virtual machines in the virtual machine resource pool.
15. The method according to claim 14, characterized in that, The process of determining the allocatable duration of virtual machines in the virtual machine resource pool based on the virtual machine's consumption rate, the virtual machine's addition rate, and the number of virtual machines in the virtual machine resource pool includes: The difference between the consumption rate of the virtual machine and the increase rate of the virtual machine is determined, and the first ratio between the number of virtual machines in the virtual machine resource pool and the difference is determined as the allocatable time of the virtual machines in the virtual machine resource pool.
16. A processing apparatus for a virtual machine, characterized in that, The device includes: The acquisition module is used to acquire the virtual machine resource pool, which is used to store virtual machines created in the cloud; The determination module is used to determine the consumption rate of virtual machines in the virtual machine resource pool and the increase rate of virtual machines in the virtual machine resource pool; The determining module is further configured to determine the adjustment method for the number of virtual machines in the virtual machine resource pool by combining the consumption rate of the virtual machine and the increase rate of the virtual machine. The determining module is further configured to adjust the number of virtual machines in the virtual machine resource pool using the determined adjustment method.
17. An electronic device, characterized in that, The electronic device includes: Memory is used to store executable instructions or computer programs. A processor, configured to execute computer-executable instructions or computer programs stored in the memory, implements the virtual machine processing method according to any one of claims 1 to 15.
18. A computer-readable storage medium storing computer-executable instructions or a computer program, characterized in that, When the computer-executable instructions or computer program are executed by a processor, they implement the virtual machine processing method according to any one of claims 1 to 15.
19. A computer program product comprising computer-executable instructions or a computer program, characterized in that, When the computer-executable instructions or computer program are executed by a processor, they implement the processing method of the virtual machine according to any one of claims 1 to 15.