A virtual machine allocation method and device, electronic equipment and storage medium
Patent Information
- Application Number
- CN202211285338.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-10-20
- Publication Date
- 2026-10-27
- Estimated Expiration
- 2042-10-20
AI Technical Summary
[0003]但是,在实现本发明的过程中,发现现有技术至少存在以下技术问题:用户在需要进行实操时才申请进行虚拟化操作,物理机虚拟化过程则会增加用户的等待时间;并且,采用随机分配的方式易造成网络延迟,降低用户在实操过程中的体验感
[0018]本发明实施例的技术方案,通过获取到的实操请求确定用户终端对应的用户区域信息,基于各预先构建的备选虚拟机对应的备选物理机房的机房位置信息,以及用户区域信息,确定出用户终端与各备选物理机房之间的传输距离;基于各传输距离,在各备选虚拟机中确定出目标虚拟机,并将目标虚拟机分配至用户终端,以使用户终端与目标虚拟机建立连接并进行实操训练,从而在确定分配至用户终端的目标虚拟机时,考虑到用户终端与物理机房之间的传输距离的因素,能够按照传输距离分配虚拟机,有利于避免网络延迟,提高操作流畅度;并且,将预先构建的目标虚拟机分配至用户终端,能够减少用户终端的等待时间,实现提高用户在实操过程中的体验感的效果。
Smart Images

Figure CN115509690B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a virtual machine allocation method, apparatus, electronic device and storage medium. Background Technology
[0002] With the rapid development of digitalization and information technology, live-streaming teaching has become a widely used teaching method. In existing technologies, users can conduct hands-on practice via cloud desktops during live streams. When a user terminal makes a practical request, it requests virtualization operations from physical machines in the computer room to create virtual machines. These virtual machines are then randomly assigned to various user terminals, establishing a communication connection between the virtual machines and the user terminals. Users can then remotely operate the cloud desktop for practical exercises.
[0003] However, in the process of realizing this invention, it was found that the prior art has at least the following technical problems: users only apply for virtualization operation when they need to perform practical operation, and the virtualization process of physical machine will increase the user's waiting time; in addition, the random allocation method is prone to network latency, which reduces the user's experience during the practical operation. Summary of the Invention
[0004] This invention provides a virtual machine allocation method, apparatus, electronic device, and storage medium to improve the user experience during operation.
[0005] According to one aspect of the present invention, a virtual machine allocation method is provided, comprising:
[0006] Obtain the operation request sent by the user terminal, and determine the user area information corresponding to the user terminal based on the operation request;
[0007] Based on the location information of the candidate physical data centers corresponding to each pre-built candidate virtual machine, and the user area information, the transmission distance between the user terminal and each of the candidate physical data centers is determined.
[0008] Based on the transmission distances, a target virtual machine is determined from the candidate virtual machines, and the target virtual machine is assigned to the user terminal so that the user terminal can establish a connection with the target virtual machine and conduct practical training.
[0009] According to another aspect of the present invention, a virtual machine allocation apparatus is provided, the apparatus comprising:
[0010] The practical operation request acquisition module is used to acquire practical operation requests sent by user terminals and determine the user area information corresponding to the user terminal based on the practical operation requests.
[0011] The transmission distance determination module is used to determine the transmission distance between the user terminal and each of the candidate physical data centers based on the data center location information of each pre-built candidate virtual machine and the user area information.
[0012] The target virtual machine determination module is used to determine the target virtual machine from the candidate virtual machines based on the transmission distance, and to assign the target virtual machine to the user terminal so that the user terminal can establish a connection with the target virtual machine and perform practical training.
[0013] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:
[0014] At least one processor; and
[0015] A memory communicatively connected to the at least one processor; wherein,
[0016] The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the virtual machine allocation method according to any embodiment of the present invention.
[0017] According to another aspect of the present invention, a computer-readable storage medium is provided, the computer-readable storage medium storing computer instructions for causing a processor to execute and implement the virtual machine allocation method according to any embodiment of the present invention.
[0018] The technical solution of this invention determines the user area information corresponding to the user terminal by obtaining the practical request, and determines the transmission distance between the user terminal and each candidate physical data center based on the data center location information of each pre-built candidate virtual machine and the user area information. Based on each transmission distance, a target virtual machine is determined from each candidate virtual machine, and the target virtual machine is assigned to the user terminal so that the user terminal can establish a connection with the target virtual machine and perform practical training. Thus, when determining the target virtual machine assigned to the user terminal, the transmission distance between the user terminal and the physical data center is taken into account, and the virtual machine can be assigned according to the transmission distance, which helps to avoid network latency and improve the smoothness of operation. Furthermore, assigning the pre-built target virtual machine to the user terminal can reduce the waiting time of the user terminal and improve the user's experience during the practical training process.
[0019] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description
[0020] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0021] Figure 1 This is a flowchart of a virtual machine allocation method provided according to an embodiment of the present invention;
[0022] Figure 2 This is a schematic diagram of the structure of a virtual machine allocation device according to an embodiment of the present invention;
[0023] Figure 3 This is a schematic diagram of the structure of an electronic device that implements the virtual machine allocation method of this invention. Detailed Implementation
[0024] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0025] It should be noted that the terms "comprising" and "etc." and any variations thereof in the specification, claims and accompanying drawings of this invention are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are explicitly listed, but may include other steps or units that are not explicitly listed or that are inherent to such processes, methods, products or devices.
[0026] Figure 1 This is a flowchart illustrating a virtual machine allocation method according to an embodiment of the present invention. The method can be executed by a virtual machine allocation device, which can be implemented in hardware and / or software.
[0027] like Figure 1 As shown, the method in this embodiment may specifically include:
[0028] S110. Obtain the operation request sent by the user terminal, and determine the user area information corresponding to the user terminal based on the operation request.
[0029] In this embodiment, when a user needs to conduct practical training, they can send a practical training request to the server through their user terminal. After receiving the practical training request, the server can allocate a virtual machine to the user terminal based on the request to complete the practical training corresponding to the request. For example, a practical training request may include an operation request for hands-on training, such as a request for hands-on practice in Photoshop.
[0030] In practice, user area information refers to the location information of the area to which the user terminal belongs. The user area information corresponding to the user terminal can be determined by parsing the operation request, or the user area information of the user terminal can be obtained by sending a location acquisition request to the user terminal.
[0031] Optionally, the user area information includes the Internet Protocol (IP) address of the user terminal. Determining the user area information corresponding to the user terminal based on the operation request includes: parsing the operation request, determining the IP address of the user terminal based on the parsing result, and using the IP address as the user area information.
[0032] Specifically, by parsing the practice request, the network interconnection protocol address of the user terminal that sent the practice request can be determined, and the network interconnection protocol address can be identified as the user area information.
[0033] S120. Based on the location information of the candidate physical data centers corresponding to each pre-built candidate virtual machine, and the user area information, determine the transmission distance between the user terminal and each candidate physical data center.
[0034] In practice, alternative virtual machines can be pre-built on each alternative physical machine in the alternative physical data center. An alternative physical data center may include at least one alternative physical machine, and an alternative physical machine may build at least one alternative virtual machine.
[0035] In this embodiment, different candidate physical data centers can have different location information. The location information can be differentiated by geographical region, including at least one of North China, South China, East China, and Central China; it can also be differentiated by province or city, such as Beijing, Shanghai, or Shenzhen. Furthermore, the location information can be refined to make it more precise. For example, the location information could be Chaoyang District of Beijing, Haidian District of Beijing, etc.
[0036] In practical implementation, the transmission distance between the user terminal and each candidate physical data center can be determined based on the data center location information and the user's area information. The transmission distance can be the geographical distance between the user terminal's location and the locations of the candidate physical data centers; or it can be the network transmission distance between the user terminal and each candidate physical data center.
[0037] S130. Based on each transmission distance, the target virtual machine is determined from each candidate virtual machine, and the target virtual machine is assigned to the user terminal so that the user terminal can establish a connection with the target virtual machine and conduct practical training.
[0038] In this embodiment, the method for determining the target virtual machine from among the candidate virtual machines may include: randomly selecting a candidate virtual machine from the candidate physical data centers corresponding to the minimum transmission distance, and determining it as the target virtual machine.
[0039] In this embodiment, the specific implementation method for determining the target virtual machine from each candidate virtual machine based on each transmission distance further includes: sorting the transmission distances in ascending order, and determining whether the candidate physical data centers corresponding to the current transmission distance meet the preset conditions in the order of sorting from front to back. If the preset conditions are met, the candidate physical data center corresponding to the current transmission distance is determined as the target physical data center; and the target virtual machine is determined from the candidate virtual machines corresponding to the target physical data center.
[0040] Specifically, the transmission distances can be sorted in ascending order. The shorter the transmission distance, the faster the network communication speed and the lower the network latency between the user terminal and the candidate physical data center. Therefore, while meeting the preset conditions, the candidate physical data center with the shortest transmission distance can be selected as the target physical data center, and the target virtual machine can be determined from the candidate virtual machines in the target physical data center.
[0041] For example, the preset conditions may include: whether the candidate physical data centers corresponding to the current transmission distance include candidate virtual machines for completing the practical training corresponding to the practical request; the preset conditions may also include: whether there are candidate virtual machines in the candidate physical data centers corresponding to the current transmission distance whose working status is idle. This embodiment, by selecting the candidate physical data center with the shortest transmission distance among the candidate physical data centers that meet the preset conditions as the target physical data center, and determining the target virtual machine in the target physical data center, can ensure that the transmission distance between the target virtual machine and the user terminal is small, reducing network latency and improving the user's experience during practical training.
[0042] Optionally, determine whether the candidate physical data center corresponding to the current transmission distance meets the preset conditions, including: determining the working status of each candidate virtual machine in the candidate physical data center corresponding to the current transmission distance; if there is a candidate virtual machine whose working status is idle, then determine that the candidate physical data center corresponding to the current transmission distance meets the preset conditions.
[0043] Specifically, the working status of candidate virtual machines includes idle and busy states. An idle state indicates that the candidate virtual machine is currently unoccupied and available for allocation; a busy state indicates that the candidate virtual machine is currently occupied and cannot be allocated again. Therefore, among the candidate virtual machines in the candidate physical data centers corresponding to the current transmission distance, if there is a candidate virtual machine in an idle state, it means that there is an available candidate virtual machine in that data center, and the candidate physical data center corresponding to the current transmission distance meets the preset conditions. In this case, the candidate physical data center can be designated as the target physical data center, and the target virtual machine can be identified within that target physical data center. If there is no candidate virtual machine in an idle state, it means that all candidate virtual machines in that data center cannot be allocated again, and the candidate physical data center corresponding to the current transmission distance does not meet the preset conditions. The process continues until a target physical data center that meets the preset conditions is identified.
[0044] In this embodiment, the working status is used to determine whether the candidate physical data center meets the preset conditions, thereby ensuring that there are available candidate virtual machines in the target physical data center for allocation to user terminals, which helps to improve the allocation efficiency of virtual machines.
[0045] In practice, when assigning a target virtual machine to a user terminal, the virtual machine information of the target virtual machine can be determined and sent to the user terminal to complete the assignment operation. This virtual machine information includes the virtual machine name, identifier, and other details. Based on the received virtual machine information, the user terminal can establish a communication connection with the target virtual machine to complete the practical training corresponding to the requested operation.
[0046] In this embodiment, before obtaining the operation request sent by the user terminal, the process includes: sending virtualization requests to each candidate physical machine in each candidate physical data center to generate candidate virtual machines; constructing a candidate queue corresponding to each candidate physical data center and storing the virtual machine information of the candidate virtual machines corresponding to each candidate physical data center in the corresponding candidate queue; allocating the target virtual machine to the user terminal, including: obtaining the virtual machine information of the target virtual machine in the target queue corresponding to the target virtual machine; and sending the virtual machine information of the target virtual machine to the user terminal.
[0047] To ensure rapid and efficient allocation of virtual machines to user terminals upon receiving a practical operation request, virtualization requests can be sent to each of the alternative physical machines in each alternative physical data center before receiving the practical operation request from the user terminal. These virtualization requests are used to request alternative physical machines to be created.
[0048] In practice, upon receiving a virtualization request, each candidate physical machine can generate at least one candidate virtual machine based on its remaining resources. Furthermore, after generating the candidate virtual machines, each candidate physical machine can send the virtual machine information corresponding to each candidate virtual machine to the server; this information includes the virtual machine name, identifier, and other details. To store the virtual machine information of each candidate virtual machine, the server can generate different candidate queues based on the candidate physical data center to which each candidate virtual machine belongs, and store the virtual machine information of candidate virtual machines generated in the candidate physical data center into the corresponding candidate queue.
[0049] Furthermore, when allocating a target virtual machine to a user terminal, the virtual machine information of the target virtual machine can be obtained from the target queue corresponding to the target virtual machine; the virtual machine information of the target virtual machine is then sent to the user terminal. This embodiment, through various alternative queues, can quickly determine the virtual machine information of alternative virtual machines generated in different alternative physical data centers, accurately determine the virtual machine information of the target virtual machine, and complete the allocation operation of the target virtual machine.
[0050] Optionally, after obtaining the virtual machine information of the target virtual machine, the method further includes: deleting the virtual machine information of the target virtual machine from the target queue, and updating the target queue based on the deletion result.
[0051] The target queue is a queue used to store virtual machine information of the target virtual machine. In this embodiment, in order to avoid mistakenly reassigning an already assigned target virtual machine when allocating virtual machines to other user terminals, the virtual machine information of the target virtual machine in the target queue can be deleted after obtaining the virtual machine information of the target virtual machine, and the target queue can be updated, thereby improving the accuracy of allocating virtual machines to target users.
[0052] In this embodiment, the method further includes: detecting the number of virtual machines corresponding to each candidate physical data center; when the number of virtual machines is less than a preset threshold, sending an add request to each candidate physical machine in each candidate physical data center to generate a new virtual machine.
[0053] To prevent a shortage of available virtual machines (VMs) when receiving numerous simultaneous operation requests from user terminals, thus hindering timely allocation of VM resources to each user terminal, the number of currently unoccupied VMs in each alternative physical data center can be periodically or randomly checked. If the number of VMs is less than a preset threshold, it indicates a shortage of available VMs, and an add request can be sent to each alternative physical machine in each alternative physical data center to generate VMs as new VMs. If the number of VMs is greater than or less than the threshold, it indicates that the current reserve of available VMs is sufficient, and no new VMs are needed. This embodiment, by detecting the number of VMs, prevents the inability to allocate VM resources to user terminals in a timely manner when a large number of operation requests occur simultaneously, helping to complete the VM allocation operation promptly and reducing the waiting time for users during the physical machine virtualization process.
[0054] Figure 2 This is a schematic diagram of a virtual machine allocation device according to an embodiment of the present invention. This device is used to execute the virtual machine allocation method provided in any of the above embodiments. This device and the virtual machine allocation methods of the above embodiments belong to the same inventive concept. Details not described in detail in the embodiments of the virtual machine allocation device can be found in the embodiments of the above virtual machine allocation methods. Figure 3 As shown, the device includes:
[0055] The practical operation request acquisition module 10 is used to acquire practical operation requests sent by user terminals and determine the user area information corresponding to the user terminal based on the practical operation requests.
[0056] The transmission distance determination module 11 is used to determine the transmission distance between the user terminal and each of the candidate physical data centers based on the data center location information of each pre-built candidate virtual machine and the user area information.
[0057] The target virtual machine determination module 12 is used to determine the target virtual machine from the candidate virtual machines based on the transmission distance, and to assign the target virtual machine to the user terminal so that the user terminal can establish a connection with the target virtual machine and perform practical training.
[0058] Based on any optional technical solution in the embodiments of the present invention, optionally, the target virtual machine determination module 12 includes:
[0059] The sorting unit is used to sort the transmission distances in ascending order. Following the sorting order from front to back, it determines whether the candidate physical data centers corresponding to the current transmission distance meet the preset conditions. If the preset conditions are met, the candidate physical data center corresponding to the current transmission distance is determined as the target physical data center.
[0060] The target virtual machine determination unit is used to determine the target virtual machine from the candidate virtual machines corresponding to the target physical data center.
[0061] Based on any optional technical solution in the embodiments of the present invention, the sorting unit may optionally include:
[0062] The working status determination subunit is used to determine the working status of each candidate virtual machine in the candidate physical data center corresponding to the current transmission distance;
[0063] The preset conditions are met to determine the sub-unit, which is used to determine the candidate physical data center corresponding to the current transmission distance if there is a candidate virtual machine in an idle state.
[0064] Based on any optional technical solution in the embodiments of the present invention, the device may optionally further include:
[0065] The alternative virtual machine generation module is used to send virtualization requests to each alternative physical machine in each alternative physical data center before receiving the practical request sent by the user terminal, so as to generate alternative virtual machines.
[0066] The alternative queue construction module is used to construct alternative queues corresponding to each alternative physical data center, and to store the virtual machine information of the alternative virtual machines corresponding to each alternative physical data center into the corresponding alternative queue.
[0067] Target virtual machine determination module 12 includes:
[0068] The virtual machine information acquisition unit is used to acquire virtual machine information of the target virtual machine from the target queue corresponding to the target virtual machine;
[0069] The virtual machine information sending unit is used to send virtual machine information of the target virtual machine to the user terminal.
[0070] Based on any optional technical solution in the embodiments of the present invention, the device may optionally further include:
[0071] The virtual machine information deletion module is used to delete the virtual machine information of the target virtual machine from the target queue after obtaining the virtual machine information of the target virtual machine, and update the target queue based on the deletion result.
[0072] Based on any optional technical solution in the embodiments of the present invention, the device may optionally further include:
[0073] The virtual machine quantity detection module is used to detect the number of virtual machines corresponding to each candidate physical data center.
[0074] An add request sending module is added to send add requests to each of the alternative physical machines in each alternative physical data center when the number of virtual machines is less than a preset threshold, so as to generate new virtual machines.
[0075] Based on any optional technical solution in the embodiments of the present invention, optionally, the practical request acquisition module 10 includes: including:
[0076] The practical request parsing unit is used to parse practical requests and determine the Internet Protocol address of the user terminal based on the parsing results, and use the Internet Protocol address as the user area information.
[0077] The technical solution of this invention determines the user area information corresponding to the user terminal by obtaining the practical request, and determines the transmission distance between the user terminal and each candidate physical data center based on the data center location information of each pre-built candidate virtual machine and the user area information. Based on each transmission distance, a target virtual machine is determined from each candidate virtual machine, and the target virtual machine is assigned to the user terminal so that the user terminal can establish a connection with the target virtual machine and perform practical training. Thus, when determining the target virtual machine assigned to the user terminal, the transmission distance between the user terminal and the physical data center is taken into account, and the virtual machine can be assigned according to the transmission distance, which helps to avoid network latency and improve the smoothness of operation. Furthermore, assigning the pre-built target virtual machine to the user terminal can reduce the waiting time of the user terminal and improve the user's experience during the practical training process.
[0078] It is worth noting that in the above-described embodiments of the virtual machine allocation device, the various units and modules included are only divided according to functional logic, but are not limited to the above division, as long as the corresponding functions can be achieved; in addition, the specific names of each functional unit are only for easy differentiation and are not used to limit the scope of protection of the present invention.
[0079] Figure 3 This is a schematic diagram of the structure of an electronic device implementing the virtual machine allocation method of embodiments of the present invention. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.
[0080] like Figure 3As shown, the electronic device 20 includes at least one processor 21 and a memory, such as a read-only memory (ROM) 22 or a random access memory (RAM) 23, communicatively connected to the at least one processor 21. The memory stores computer programs executable by the at least one processor. The processor 21 can perform various appropriate actions and processes based on the computer program stored in the ROM 22 or loaded from storage unit 28 into the RAM 23. The RAM 23 can also store various programs and data required for the operation of the electronic device 20. The processor 21, ROM 22, and RAM 23 are interconnected via a bus 24. An input / output (I / O) interface 25 is also connected to the bus 24.
[0081] Multiple components in electronic device 20 are connected to I / O interface 25, including: input unit 26, such as keyboard, mouse, etc.; output unit 27, such as various types of monitors, speakers, etc.; storage unit 28, such as disk, optical disk, etc.; and communication unit 29, such as network card, modem, wireless transceiver, etc. Communication unit 29 allows electronic device 20 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0082] Processor 21 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 21 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 21 performs the various methods and processes described above, such as virtual machine allocation methods.
[0083] In some embodiments, the virtual machine allocation method may be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 28. In some embodiments, part or all of the computer program may be loaded and / or installed on electronic device 20 via ROM 22 and / or communication unit 29. When the computer program is loaded into RAM 23 and executed by processor 21, one or more steps of the virtual machine allocation method described above may be performed. Alternatively, in other embodiments, processor 21 may be configured to execute the virtual machine allocation method by any other suitable means (e.g., by means of firmware).
[0084] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0085] Computer programs used to implement the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0086] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0087] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0088] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or computing systems that include middleware components (e.g., application servers), or computing systems that include frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.
[0089] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.
[0090] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.
[0091] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.
Claims
1. A virtual machine allocation method, characterized in that, include: Obtain the operation request sent by the user terminal, and determine the user area information corresponding to the user terminal based on the operation request; Based on the location information of the candidate physical data centers corresponding to each pre-built candidate virtual machine, and the user area information, the transmission distance between the user terminal and each of the candidate physical data centers is determined. Based on the transmission distances, a target virtual machine is determined from the candidate virtual machines, and the target virtual machine is assigned to the user terminal so that the user terminal can establish a connection with the target virtual machine and perform practical training. Prior to obtaining the practical request sent by the user terminal, the process includes: A virtualization request is sent to each of the candidate physical machines in each of the candidate physical data centers to generate a candidate virtual machine; wherein the virtualization request is used to request the candidate physical machines to generate a candidate virtual machine; Construct a candidate queue corresponding to each of the candidate physical data centers, and store the virtual machine information of the candidate virtual machines corresponding to each of the candidate physical data centers into the corresponding candidate queue; The step of allocating the target virtual machine to the user terminal includes: Obtain the virtual machine information of the target virtual machine from the target queue corresponding to the target virtual machine; The virtual machine information of the target virtual machine is sent to the user terminal.
2. The method according to claim 1, characterized in that, The step of determining the target virtual machine from the candidate virtual machines based on the transmission distances includes: The transmission distances are sorted in ascending order. Then, in descending order of sorting, the candidate physical data centers corresponding to the current transmission distances are determined to meet the preset conditions. If the preset conditions are met, the candidate physical data center corresponding to the current transmission distance is determined as the target physical data center. The target virtual machine is determined from the candidate virtual machines corresponding to the target physical data center.
3. The method according to claim 2, characterized in that, The step of sequentially determining whether the candidate physical data centers corresponding to the current transmission distance meet the preset conditions includes: Determine the working status of each candidate virtual machine in the candidate physical data center corresponding to the current transmission distance; If there is a candidate virtual machine whose working state is idle, then it is determined that the candidate physical data center corresponding to the current transmission distance meets the preset conditions.
4. The method according to claim 1, characterized in that, After obtaining the virtual machine information of the target virtual machine, the process further includes: The virtual machine information of the target virtual machine is deleted from the target queue, and the target queue is updated based on the deletion result.
5. The method according to claim 1, characterized in that, Also includes: Detect the number of virtual machines corresponding to each of the candidate physical data centers; When the number of virtual machines is less than a preset threshold, an add request is sent to each of the alternative physical machines in each of the alternative physical data centers to generate a new virtual machine.
6. The method according to claim 1, characterized in that, The step of determining the user region information corresponding to the user terminal based on the practical request includes: The operation request is parsed, and the Internet Protocol address of the user terminal is determined based on the parsing result. The Internet Protocol address is then used as the user area information.
7. A virtual machine allocation device, characterized in that, include: The practical operation request acquisition module is used to acquire practical operation requests sent by user terminals and determine the user area information corresponding to the user terminal based on the practical operation requests. The transmission distance determination module is used to determine the transmission distance between the user terminal and each of the candidate physical data centers based on the data center location information of each pre-built candidate virtual machine and the user area information. The target virtual machine determination module is used to determine the target virtual machine from the candidate virtual machines based on the transmission distance, and to allocate the target virtual machine to the user terminal so that the user terminal can establish a connection with the target virtual machine and perform practical training. The device further includes: The alternative virtual machine generation module is used to send virtualization requests to each alternative physical machine in each of the alternative physical data centers before obtaining the practical request sent by the user terminal, so as to generate alternative virtual machines; wherein, the virtualization request is used to request the alternative physical machines to construct alternative virtual machines; The alternative queue construction module is used to construct alternative queues corresponding to each of the alternative physical data centers, and to store the virtual machine information of the alternative virtual machines corresponding to each of the alternative physical data centers into the corresponding alternative queues. The target virtual machine determination module includes: a virtual machine information acquisition unit, used to acquire virtual machine information of the target virtual machine from the target queue corresponding to the target virtual machine; and a virtual machine information sending unit, used to send the virtual machine information of the target virtual machine to the user terminal.
8. An electronic device, characterized in that, The electronic device includes: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the virtual machine allocation method according to any one of claims 1-6.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that cause a processor to execute the virtual machine allocation method according to any one of claims 1-6.
Citation Information
Patent Citations
A virtual machine scheduling method and system for high network communication
CN109189557A