CN110147266B - Virtual machine starting method and device, storage medium and electronic device - Google Patents
Virtual machine starting method and device, storage medium and electronic device Download PDFInfo
- Publication number
- CN110147266B CN110147266B CN201910356688.XA CN201910356688A CN110147266B CN 110147266 B CN110147266 B CN 110147266B CN 201910356688 A CN201910356688 A CN 201910356688A CN 110147266 B CN110147266 B CN 110147266B
- Authority
- CN
- China
- Prior art keywords
- virtual machine
- information
- data information
- original data
- started
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/455—Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
- G06F9/45533—Hypervisors; Virtual machine monitors
- G06F9/45558—Hypervisor-specific management and integration aspects
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/455—Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
- G06F9/45533—Hypervisors; Virtual machine monitors
- G06F9/45558—Hypervisor-specific management and integration aspects
- G06F2009/45575—Starting, stopping, suspending or resuming virtual machine instances
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/455—Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
- G06F9/45533—Hypervisors; Virtual machine monitors
- G06F9/45558—Hypervisor-specific management and integration aspects
- G06F2009/45583—Memory management, e.g. access or allocation
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/455—Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
- G06F9/45533—Hypervisors; Virtual machine monitors
- G06F9/45558—Hypervisor-specific management and integration aspects
- G06F2009/45595—Network integration; Enabling network access in virtual machine instances
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The invention discloses a virtual machine starting method and device, a storage medium and an electronic device. Wherein the method comprises the following steps: before a first virtual machine is started, a data transfer template is obtained, storage information of original data information is stored in the data transfer template, the original data information is information used when a second virtual machine is started according to the storage information in the data transfer template, the second virtual machine is started before the first virtual machine is started, the second virtual machine is a virtual machine with the same type as the first virtual machine or the second virtual machine is the first virtual machine, the original data information is obtained, the original data information is stored in a memory, and when the first virtual machine is started, the original data information in the memory is called to start the first virtual machine. The method and the device solve the technical problem of low starting efficiency of the virtual machine in the related art.
Description
Technical Field
The present invention relates to the field of virtual machines, and in particular, to a method and apparatus for starting a virtual machine, a storage medium, and an electronic device.
Background
In the related art, in the process of starting the virtual machine, the virtual machine is generally required to access the memory for multiple times, read data from the memory, call the data into the memory, and then use the data in the memory to start the virtual machine.
However, if the method is adopted, the time required for reading the data from the memory is too long when the virtual machine is started, and if the data required for starting the virtual machine is stored in the memory in advance, the data required for starting the virtual machine cannot be determined due to the difference of the virtual machines.
In view of the above problems, no effective solution has been proposed at present.
Disclosure of Invention
The embodiment of the invention provides a virtual machine starting method and device, a storage medium and an electronic device, which are used for at least solving the technical problem of low virtual machine starting efficiency in the related art.
According to an aspect of the embodiment of the present invention, there is provided a virtual machine starting method, including: before a first virtual machine is started, a data transfer template is obtained, wherein storage information of original data information is stored in the data transfer template, the original data information is information used when a second virtual machine is started, the second virtual machine is started before the first virtual machine is started, and the second virtual machine is a virtual machine with the same type as the first virtual machine or the second virtual machine is the first virtual machine; acquiring the original data information according to the stored information in the data transfer template; storing the original data information into a memory; and when the first virtual machine is started, calling the original data information in the memory to start the first virtual machine.
According to another aspect of the embodiment of the present invention, there is also provided a virtual machine starting apparatus, including: the first obtaining unit is configured to obtain a data transfer template before a first virtual machine is started, where the data transfer template stores storage information of original data information, where the original data information is information used when a second virtual machine is started, the second virtual machine is started before the first virtual machine is started, and the second virtual machine is a virtual machine of the same type as the first virtual machine or the second virtual machine is the first virtual machine; the second acquisition unit is used for acquiring the original data information according to the stored information in the data transfer template; the storage unit is used for storing the original data information into a memory; and the calling unit is used for calling the original data information in the memory to start the first virtual machine when the first virtual machine is started.
As an alternative example, the second acquisition unit includes: the first acquisition module is used for acquiring a plurality of pieces of information in the original data information in parallel according to the stored information.
As an alternative example, the above apparatus further includes: a configuration unit, configured to configure a reference value for the storage information stored in the data transfer template before the first virtual machine is started; and the deleting unit is used for deleting the stored information corresponding to the reference value smaller than the first threshold value from the data transfer template when the reference value is smaller than the first threshold value after the first virtual machine is started.
As an alternative example, the above apparatus further includes: a first adjustment unit configured to increase the reference value of the storage information corresponding to the used original data information after the first virtual machine is started, if the original data information stored in the memory is used when the first virtual machine is started; and a second adjustment unit configured to reduce the reference value of the stored information corresponding to the unused original data information after the first virtual machine is started, if the original data information stored in the memory is unused when the first virtual machine is started.
According to still another aspect of the embodiments of the present invention, there is also provided a storage medium having a computer program stored therein, wherein the computer program is configured to execute the above-described virtual machine starting method when running.
According to still another aspect of the embodiments of the present invention, there is further provided an electronic device including a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor executes the virtual machine starting method described above through the computer program.
In the embodiment of the invention, a method for acquiring a data transfer template before starting a first virtual machine, wherein the data transfer template stores storage information of original data information, the original data information is information used when starting a second virtual machine, the original data information is acquired according to the storage information in the data transfer template, the original data information is stored in a memory, and the original data information in the memory is called when the first virtual machine is started to start the first virtual machine is adopted. In the method, the storage information of the data required for starting the first virtual machine or starting the second virtual machine which is the same as the first virtual machine is acquired, so that before the first virtual machine is started again, the data is written into the memory in advance according to the storage information to start the first virtual machine, the time for reading the data when the first virtual machine is started is saved, the efficiency of starting the first virtual machine is improved, and the technical problem of low virtual machine starting efficiency in the related art is solved.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this application, illustrate embodiments of the invention and together with the description serve to explain the invention and do not constitute a limitation on the invention. In the drawings:
FIG. 1 is a schematic illustration of an application environment of an alternative virtual machine starting method according to an embodiment of the invention;
FIG. 2 is a schematic illustration of an application environment of another alternative virtual machine startup method according to an embodiment of the invention;
FIG. 3 is a flow chart of an alternative virtual machine startup method according to an embodiment of the invention;
FIG. 4 is a schematic diagram of an alternative virtual machine startup method according to an embodiment of the invention;
FIG. 5 is a schematic diagram of another alternative virtual machine startup method according to an embodiment of the invention;
FIG. 6 is a flow chart of another alternative virtual machine startup method according to an embodiment of the invention;
FIG. 7 is a schematic diagram of yet another alternative virtual machine startup method according to an embodiment of the present invention;
FIG. 8 is a schematic diagram of yet another alternative virtual machine startup method according to an embodiment of the present invention;
FIG. 9 is a schematic diagram of yet another alternative virtual machine startup method according to an embodiment of the present invention;
FIG. 10 is a schematic diagram of an alternative virtual machine starting apparatus according to an embodiment of the present invention;
fig. 11 is a schematic structural view of an alternative electronic device according to an embodiment of the present invention.
Detailed Description
In order that those skilled in the art will better understand the present invention, a technical solution in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in which it is apparent that the described embodiments are only some embodiments of the present invention, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the present invention without making any inventive effort, shall fall within the scope of the present invention.
It should be noted that the terms "first," "second," and the like in the description and the claims of the present invention and the above figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments of the invention described herein may be implemented in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
According to an aspect of the embodiment of the present invention, a virtual machine starting method is provided, optionally, as an optional implementation manner, the virtual machine starting method may be applied, but is not limited to, in an environment as shown in fig. 1.
As shown in fig. 1, virtual machine 102 interacts with server 106 via network 104. The virtual machine 102 includes a memory 102-1 for storing data and a processor 102-2 for processing data. The server 106 includes a database 106-1 for storing data, and a processing engine 106-2 for processing data. In the process that the virtual machine 102 is started for the first time, the original data information used for starting the virtual machine is acquired, the storage information of the original data information is acquired, and the storage information is stored in the server 106. Before the virtual machine 102 is started for the second time, the virtual machine 102 obtains a data transfer template from the server 106, obtains original data information used for starting the virtual machine 102 for the first time from the storage 102-1, and saves the original data information into the memory. When the virtual machine 102 is started for the second time, the original data information is directly obtained from the memory and the virtual machine 102 is started.
Alternatively, the virtual machine starting method described above may be applied, but is not limited to being applied, to an environment as shown in fig. 2.
Virtual machine 202 interacts with server 208 over network 204, and virtual machine 206 interacts with server 208 over network 204. Virtual machine 202 includes memory 202-1 for storing data and processor 202-2 for processing data. The virtual machine 204 includes memory 204-1 for storing data and a processor 204-2 for processing data. Server 208 includes a database 208-1 for storing data and a processing engine 208-2 for processing data. Virtual machine 202 is the same type as virtual machine 206. In the process of starting the virtual machine 204, the original data information required by the virtual machine 204 during starting is acquired, and the storage information of the original data information is stored in the server 208. Before the virtual machine 202 is started, the original data information used when the virtual machine 204 is started is obtained from the memory 102-1 according to the storage information stored in the server 208, and the original data information is stored in the memory of the virtual machine 202. When the virtual machine 202 is started, the original data information used for starting the virtual machine 204 is directly called from the memory, and the virtual machine 202 is started.
In the related art, in the process of starting the virtual machine, the virtual machine is generally required to access the memory for multiple times, read data from the memory, call the data into the memory, and then start the virtual machine by using the data in the memory, so that the starting efficiency of the virtual machine is low. In this embodiment, when the virtual machine is started, the storage information of the data required for starting the first virtual machine or starting the second virtual machine of the same type as the first virtual machine is obtained, so before the first virtual machine is started again, the data is written into the memory in advance according to the storage information, so as to start the first virtual machine, thereby saving the time for reading the data when the first virtual machine is started, and improving the efficiency of starting the first virtual machine.
Alternatively, the network may include, but is not limited to, a wireless network or a wired network. Wherein the wireless network comprises: WIFI and other networks that enable wireless communications. The wired network may include, but is not limited to: wide area network, metropolitan area network, local area network. The server may include, but is not limited to, any hardware device that can perform the calculations.
Optionally, as an optional implementation manner, as shown in fig. 3, the virtual machine starting method includes:
s302, acquiring a data transfer template before starting a first virtual machine, wherein the data transfer template stores storage information of original data information, the original data information is information used when starting a second virtual machine, the second virtual machine is started before the first virtual machine is started, and the second virtual machine is a virtual machine with the same type as the first virtual machine or the second virtual machine is the first virtual machine;
s304, acquiring the original data information according to the stored information in the data transfer template;
s306, storing the original data information into a memory;
s308, when the first virtual machine is started, the original data information in the memory is called to start the first virtual machine.
Alternatively, the virtual machine starting method can be applied to the process of starting the virtual machine, but is not limited to the process. Before the first virtual machine is started, the storage information of data required for starting the first virtual machine or starting a second virtual machine which is the same as the first virtual machine is acquired, so that before the first virtual machine is started again, the data is written into the memory in advance according to the storage information so as to start the first virtual machine, the time for reading the data when the first virtual machine is started is saved, and the efficiency for starting the first virtual machine is improved.
Alternatively, the second virtual machine in this embodiment may be the first virtual machine or a virtual machine of the same type as the first virtual machine. That is, the stored information stored in the data transfer template may be obtained for the last time the first virtual machine was started, or for the start of a second virtual machine of the same type as the first virtual machine.
Alternatively, before the first virtual machine is started, when the original data information is acquired, the original data information may be acquired from a memory such as a hard disk, an optical disk, an array SAN storage-block device, or a distributed storage-block device according to a data transfer template. The original data information can comprise a plurality of pieces of information, and when the plurality of pieces of information in the original data information are acquired, the plurality of pieces of information in the original data information can be acquired in parallel according to the data transfer template, so that the speed of acquiring the original data information is improved.
Alternatively, since the data transfer template is acquired at the time of starting the second virtual machine, the data transfer template has the stored information of the original data information used for starting the second virtual machine recorded therein. And because the first virtual machine and the second virtual machine are virtual machines with the same type, the original data information can be acquired according to the storage information recorded in the data transfer template, and the original data information is stored in the memory of the first virtual machine so as to be used when the first virtual machine is started.
Optionally, the storage information recorded in the data transfer template includes a storage location of the original data information and a data length of the original data information. For example, the data length is 8, and after the storage location and the data length of the original data information used when the second virtual machine is started are acquired, when the original data information is acquired, the data with the data length of the original data information may be acquired directly from the storage location of the original data information. For example, as shown in fig. 4, the original data information 402 is shown in fig. 4, and the original data information 402 is stored in the memory. Block 404 in fig. 4 may be a unit of storage of a memory. When the storage location 406 (the location of the 8 black boxes in fig. 4) of the data of the original data information is acquired, the original data information of 8 lengths is acquired directly from the storage location.
Alternatively, the original data information may be plural and stored in different locations, respectively. When a plurality of pieces of original data information are acquired, the pieces of original data information may be acquired in parallel. As shown in fig. 5, the original data information includes data 502 and data 504, the data 502 has a length of 5, the data 504 has a length of 3, and the data 502 and the data 504 are stored in different locations of the memory. In acquiring the original data information, the original data information 502 with length 5 and the original data information 504 with length 3 are acquired in parallel according to the storage positions 502-1 (5 consecutive black boxes in fig. 5) and 504-1 (3 consecutive black boxes in fig. 5) of the original data information recorded in the data transfer template.
Alternatively, the storage locations of the original data information may not be consecutive, such as the original data information length of 2, but the storage locations of the original data information of two units are not consecutive. At this time, after the 1 st unit of original data information is acquired, the 2 nd unit of original data information is searched for according to the 1 st unit of original data information, and the 2 nd unit of original data information is acquired.
Optionally, after the original data information used for starting the second virtual machine is stored in the memory, when the first virtual machine is started, because the first virtual machine and the second virtual machine are the same type virtual machines, at this time, the first virtual machine can directly call the original data information stored in the memory to start the first virtual machine, thereby improving the efficiency of starting the first virtual machine.
It should be noted that, in this embodiment, the original data information of the first virtual machine started last time may also be obtained, the storage location and the data length of the original data information are saved in the data transfer template, and before the first virtual machine is started again, the original data information is saved in the memory according to the data transfer template, and the first virtual machine is started.
Optionally, when the first virtual machine is started by using the original data information in the memory, a data acquisition instruction of the first virtual machine may also be acquired, where the data acquisition instruction is used to acquire data required for starting the first virtual machine. According to the data acquisition instruction, the target data information can be determined. And then comparing the original data information with the target data information, and updating the original data information.
Alternatively, when the original data information is updated according to the target data information, the storage location and the data length of the information different from the original data information of the target data information may be written into the data transfer template. When the first virtual machine is started next time, transferring data to the memory by using the updated data transfer template, and starting the first virtual machine.
Optionally, the present embodiment may also configure the reference value for the stored information in the data transfer template. The above reference value is used to indicate the accuracy of the stored information. The higher the reference value, the higher the possibility that the original data information corresponding to the stored information is used when the first virtual machine is started. The reference value will change along with each starting of the virtual machine, if the original data information is not used after the virtual machine is started, the reference value corresponding to the storage information of the original data information will be reduced. When the reference value drops to a threshold value, the stored information is deleted from the data transfer template.
For example, two pieces of storage information are recorded in the data transfer template, and the reference value corresponding to the first piece of storage information and the second piece of storage information is 100. If the original data information stored in the memory corresponding to the first piece of storage information is used when the first virtual machine is started, the reference value of the first piece of storage information is increased, for example, 20, while the original data information stored in the memory corresponding to the second piece of storage information is not used when the first virtual machine is started, at this time, the reference value corresponding to the second piece of storage information is reduced, for example, 20. After the data transfer template is used for a plurality of times, the reference value corresponding to the second storage information is zero, and the second storage information is deleted from the data transfer template, so that the burden of transferring the original data information to the memory is reduced.
It should be noted that, the above reference values may include an upper limit and/or a lower limit. If the reference value reaches 100, the increase is not continued.
The method for starting the virtual machine will be described below taking the case where the first virtual machine and the second virtual machine are the same type of virtual machine.
In the prior art, if a virtual machine is to be started, when a VM process of the virtual machine is started and each program is started by Loop, a large amount of disk reading processing exists in each step, and more than 1 thousand times of operations of reading a storage medium are accumulated, the storage medium is usually a common hard disk or a storage system, the time delay of reading data is thousands of times slower than that of a memory, for example, the access time delay of a solid state disk is generally 50-100 microseconds, the access time delay of a server hard disk, an array SAN storage-block device and a Ceph distributed storage-block device is generally 2-30 milliseconds or longer, and the overall starting speed of the operating system of the virtual machine is slow.
In the virtual machine starting logic of the embodiment, a machine learning module is added in addition to a computing module (providing computing resources such as a virtual machine CPU and a memory) and a storage module (providing data storage resources of a virtual machine, such as an independent disk or a distributed storage system). The description is made in connection with S602 to S624 of fig. 6. When the user 602 creates the first virtual machine 604, a data transfer template is imported in the machine learning module 608. The data transfer template is recorded with storage information of original data information used when the second virtual machine is started, and the storage information comprises a storage position and a data length. The machine learning module 608 holds the data transfer templates. When the first virtual machine 604 is started, a VM process in the first virtual machine 604 is started, the VM process notifies the machine learning module 608 of loading the type of the data transfer template through parameters, the machine learning module 608 loads the corresponding data transfer module and acquires the data transfer template and sends the data transfer template to the storage module 606, and notifies the storage module 606 of loading data into the memory according to the storage position and the storage length in the data transfer template. In addition, the data transfer template may also store the order in which the data is called when the virtual machine is started. Since the data transfer templates for all data have been acquired, reading all data into memory may be performed concurrently before the first virtual machine 604 is started. Typically the time taken to read 1 thousand data requests one by one is the single request latency times 1 thousand. But the time spent executing 1 thousand requests in parallel is the single request latency times 1 thousand divided by concurrency. For example, the concurrency value is 100, and the total consumption time delay is 1/100 of the original time delay. The data is stored in a storage with larger time delay, such as a distributed storage system (single request is larger in time delay, but multiple concurrent processing of requests is supported), and the acceleration effect generated by the scheme is more obvious. In addition, at the time of starting up the first virtual machine 604, when data is obtained from the memory of the storage module 606, a data reading request for starting up the first virtual machine 604 needs to be sent to the machine learning module 608. The machine learning module 608 determines target data information required to boot the first virtual machine 604 based on the received request and updates the data transfer template based on the target data information. The machine learning module 608 identifies differences in the read data of the first virtual machine 604 (data read location, length, timing changes, data requests to be added, data requests to be subtracted) and updates to the data timing template to form a new data template for the next time the virtual machine is started for provisioning. After the first virtual machine startup is complete, the machine learning module 608 may be notified to stop updating the data templates (not shown in fig. 6).
It should be noted that, in fig. 6, the step S618 and the step S622 may be performed simultaneously, or sequentially, and the order of the sequential steps is not limited.
When the data transfer template is updated, the stored information in the data transfer template may be updated. For example, a reference value is configured for each piece of stored information in the data transfer template. As shown in fig. 7. The stored information includes an operation sequence, a storage location, a data length, an operation type, and a reference value of the original data information. The reference value may initially be set to 100.
When updating the data transfer template, if the target data information used for starting the first virtual machine is not in the original data information, namely new data is used, the storage information of the data of the new data is added into the data transfer template, and a corresponding reference value is set. To avoid occasional situations, the reference value may be set to 10. If the target data information is already existing in the original data information, the first virtual machine is started to use the data in the original data information, and the reference value of the storage information of the original data information to be used is increased, for example, increased by 1. And if the original data information contains the data which is not contained in the target data information, indicating that the original data information contains unused information. At this time, the reference value of the stored information corresponding to the unused original data information is reduced. At this time, in order to accelerate the elimination of the unusual original data information, the reference value may be reduced by 3. When the reference value is 0, the stored information with the reference value of 0 is eliminated.
For example, as shown in fig. 8 and 9, fig. 8 is a data transfer template, where hit refers to original data information loaded into a memory corresponding to storage information being used when a first virtual machine is started, and miss refers to original data information loaded into a memory corresponding to storage information being unused or having an error. The missing hit of the 8 pieces of information shown in fig. 8 indicates that the original data information loaded into the memory is used when the first virtual machine is started, is not used, and has a data error. At this point the data transfer template needs to be updated. As shown in fig. 9, the reference value of the hit storage location is increased by 1, the reference value of the storage information of the missed original data information is decreased by 1, and the storage information of the missed original data information is newly added to the original data information.
In this embodiment, a standard data transfer template used for starting a type of virtual machine can be obtained by starting a virtual machine hundreds of times and updating the data transfer template, and the standard data transfer template is put into use.
According to the embodiment, before the first virtual machine is started, the data transfer template is obtained according to the storage information in the data transfer template, the original data information is obtained and stored in the memory, when the first virtual machine is started, the first virtual machine is started by calling the original data information in the memory, and therefore before the first virtual machine is started again, data are written into the memory in advance according to the storage information, and the first virtual machine is started, time for reading data when the first virtual machine is started is saved, and efficiency of starting the first virtual machine is improved.
As an alternative embodiment, the obtaining the original data information according to the stored information in the data transfer template comprises:
s1, acquiring a plurality of pieces of information in the original data information in parallel according to the storage information.
Optionally, the storage information may include a reading sequence, a storage location, and a data length of data (original data information) used when the second virtual machine is started, where each reading sequence, storage location, and data length form a piece of storage information. In acquiring a plurality of pieces of stored information, if the pieces of stored information are acquired in a single piece in the reading order, the time is consumed. Therefore, after the data transfer template is obtained and the data to be transferred to the memory is determined, the plurality of pieces of storage information can be obtained in parallel. In the case of acquiring stored information in parallel, the speed of acquiring stored information is greatly increased. For example, the time taken to read 1 thousand data requests one by one is typically the single request latency times 1 thousand. But the time spent executing 1 thousand requests in parallel is the single request latency times 1 thousand divided by concurrency. If the concurrency is set to 100, the total consumption delay is reduced to one percent.
According to the embodiment, when the original data information is acquired, the plurality of pieces of information of the original data information are acquired in parallel, so that the efficiency of acquiring the original data information is improved, and the efficiency of starting the virtual machine is further improved.
As an alternative embodiment, said obtaining said original data information from said stored information in said data transfer template comprises:
s1, acquiring a storage position of the original data information and a data length of the original data information stored in the data transfer template, wherein the storage information comprises the storage position of the original data information and the data length of the original data information;
s2, acquiring the original data information according to the storage position of the original data information and the data length of the original data information.
Alternatively, as shown in fig. 7, the operation sequence of the original data information, the storage location, the data length, the operation type, and the reference value may be recorded in the data transfer template. The reference value is used to indicate the likelihood that the original data information is used. The larger the reference value, the higher the likelihood that the original data information is used. After the data transfer template is acquired, the original data information can be acquired directly according to the data transfer template because the storage position and the data length of the data are recorded in the data transfer template.
According to the method and the device for obtaining the original data information, the original data information is obtained according to the storage position and the data length of the original data information, so that the original data information can be accurately and efficiently obtained, the accuracy of obtaining the original data information is improved, and the efficiency of starting the virtual machine is further improved.
As an alternative embodiment, the acquiring the original data information according to the storage location of the original data information and the data length of the original data information includes:
s1, starting from a storage position of the original data information, acquiring data with the length being the data length, and obtaining the original data information.
Alternatively, the storage location may be a location in the memory of the original data information. After the position of the original data information in the memory is acquired, the original data information is positioned in the memory, such as the 200 th storage unit of the memory, and then 8 units of data is acquired according to the data length of 8, for example, the 200 th storage unit of the memory, and the acquired data is taken as the original data information.
According to the method, the original data information is obtained, so that the original data information can be accurately and efficiently obtained, the accuracy of obtaining the original data information is improved, and the efficiency of starting the virtual machine is further improved.
As an optional implementation manner, after the first virtual machine is started up by calling the original data information in the memory, the method further includes:
s1, acquiring target data information used for starting the first virtual machine, wherein the target data information is information required by starting the first virtual machine;
s2, updating the data transfer template according to the target data information.
Optionally, when the first virtual machine is started, target data information required for starting the first virtual machine needs to be acquired. The target data information may be the same as or different from the original data information. If the target data information contains the content which is not included in the original data information, the first virtual machine is started, and partial data is needed besides the original data information stored in the memory in advance. The portion of data may be retrieved from memory. If the original data information includes content not included in the target data information, the method indicates that part of data in the original data information is not needed when the first virtual machine is started. The portion of the content may not be saved to memory to reduce the workload of the central processing unit.
According to the embodiment, after the target data information is obtained, the data transfer template is updated according to the target data information, so that the data transfer template can be trained by starting the virtual machine for multiple times, the accuracy of the data transfer template is improved, and the efficiency of starting the virtual machine is further improved.
As an alternative embodiment, said updating said data transfer template according to said target data information comprises:
s1, storing the storage position and the data length of the data information which is different from the original data information in the target data information into the data transfer template.
For example, taking the case that the original data information includes original data information 1 and original data information 2, the target data information includes target data information 1 and target data information 2, the original data information 1 is identical to the target data information 1, the original data information 2 is different from the target data information 2, and the original data information 1 and the original data information 2 are stored in the memory, when the first virtual machine is started, the original data information 1 (target data information 1) is used, the original data information 2 is not used, and the target data information 2 is used. At this time, the storage location and the data length of the target data information 2 need to be stored in the data transfer template, and when the virtual machine is restarted to use the data transfer template next time, the original data information 1, the original data information 2 and the target data information 2 can be stored in the memory. Alternatively, after the storage location and the data length of the target data information 2 are saved in the data transfer template, the storage location and the data length of the original data information 2 stored in the data transfer template may be deleted. Then the next time the virtual machine is started to use the data transfer template, only the original data information 1 and the target data information 2 need to be saved into the memory.
According to the embodiment, the data transfer template is updated by the method, so that the data transfer template can be trained by starting the virtual machine for multiple times, the accuracy of the data transfer template is improved, and the efficiency of starting the virtual machine is further improved.
As an alternative to this embodiment of the present invention,
s1, before starting the first virtual machine, the method further comprises the following steps: configuring a reference value for the stored information stored in the data transfer template;
s2, after the first virtual machine is started, the method further comprises the following steps: and deleting the stored information corresponding to the reference value smaller than the first threshold value from the data transfer template under the condition that the reference value is smaller than the first threshold value.
Optionally, the above reference value is used to indicate a possibility that the original data information corresponding to the stored information is used. The larger the reference value, the higher the likelihood. And too small a reference value indicates that the probability of using the original data information is small when starting the virtual machine. If the reference value is zero, the stored information with the reference value of zero needs to be deleted from the data transfer template so as to reduce the quantity of data stored in the memory.
For example, a reference value of stored information in the data transfer template may be detected each time the data transfer template is invoked. If the reference value is zero, deleting the stored information with the reference value being zero.
According to the embodiment, the reference value is set for the storage information in the data transfer template, so that the storage information in the data transfer template can be monitored, the accuracy of the data transfer template is improved, and the efficiency of starting the virtual machine is further improved.
As an alternative embodiment, after the first virtual machine is started, the method further includes:
s1, when the first virtual machine is started, increasing the reference value of storage information corresponding to the used original data information under the condition that the original data information stored in a memory is used;
s2, when the first virtual machine is started, in the case that the original data information stored in the memory is not used, reducing the reference value of the stored information corresponding to the unused original data information.
Optionally, the reference value may be adjusted after the first virtual machine is started. Or the reference value in the data transfer template needs to be adjusted after the data transfer template is called once every time and the virtual machine is started once.
The adjustment strategy is: if the data transfer template is called and the virtual machine is started, the reference value of the storage information corresponding to the used data is increased according to the data transferred by the storage information in the data transfer template, and if the data transferred according to the storage information in the data transfer template is not used, the reference value of the storage information corresponding to the unused data is reduced. If the virtual machine is started, data except the data transferred according to the data transfer template is also used, the storage position and the data length of the additionally used data need to be saved in the data transfer template.
For example as shown in fig. 7-9. In fig. 7, 2000 pieces of storage information are stored, and when the first virtual machine is started, 2000 pieces of original data information can be stored in the memory according to the 2000 pieces of storage information stored in fig. 7. Fig. 8 shows 900 pieces of storage information used when the first virtual machine is started, and 900 pieces of label data information are acquired. The 900 pieces of stored information are included in the 2000 pieces of stored information of fig. 7, and the 900 pieces of stored information are not included in the 2000 pieces of stored information of fig. 7. At this time, the data transfer template of fig. 7 needs to be updated. For example, the first two pieces of stored information of fig. 8 are already present in fig. 7, and thus, the reference value of the first two pieces of stored information in fig. 7 is added by 1. The 3 rd piece of storage information in fig. 8 is not included in the 2000 th piece of storage information in fig. 7, which indicates that new data is used when the first virtual machine is started, and therefore, a storage location and a data length of the new data to be used need to be added, such as adding the 4 th piece of storage information in fig. 9. The 3 rd piece of storage information in fig. 7 stores the corresponding original data information in the memory when the first virtual machine is started, but is not used when the first virtual machine is started. Therefore, the corresponding reference value needs to be reduced. As in item 3 of stored information in fig. 9, the reference value is subtracted by 1.
According to the embodiment, the reference value is adjusted by the method, the reference value can be adjusted according to the result of starting the virtual machine, the accuracy of the data transfer template is improved, and the efficiency of starting the virtual machine is further improved.
It should be noted that, for simplicity of description, the foregoing method embodiments are all described as a series of acts, but it should be understood by those skilled in the art that the present invention is not limited by the order of acts described, as some steps may be performed in other orders or concurrently in accordance with the present invention. Further, those skilled in the art will also appreciate that the embodiments described in the specification are all preferred embodiments, and that the acts and modules referred to are not necessarily required for the present invention.
According to another aspect of the embodiment of the invention, a virtual machine starting device for implementing the virtual machine starting method is also provided. As shown in fig. 10, the apparatus includes:
(1) A first obtaining unit 1002, configured to obtain a data transfer template before a first virtual machine is started, where storage information of original data information is stored in the data transfer template, where the original data information is information used when a second virtual machine is started, the second virtual machine is started before the first virtual machine is started, and the second virtual machine is a virtual machine with the same type as the first virtual machine or the second virtual machine is the first virtual machine;
(2) A second obtaining unit 1004, configured to obtain the original data information according to the stored information in the data transfer template;
(3) A storage unit 1006, configured to store the original data information into a memory;
(4) And the calling unit 1008 is used for calling the original data information in the memory to start the first virtual machine when the first virtual machine is started.
Alternatively, the virtual machine starting device may be applied to, but not limited to, a process of starting a virtual machine. Before the first virtual machine is started, the storage information of data required for starting the first virtual machine or starting a second virtual machine which is the same as the first virtual machine is acquired, so that before the first virtual machine is started again, the data is written into the memory in advance according to the storage information so as to start the first virtual machine, the time for reading the data when the first virtual machine is started is saved, and the efficiency for starting the first virtual machine is improved.
Alternatively, the second virtual machine in this embodiment may be the first virtual machine or a virtual machine of the same type as the first virtual machine. That is, the stored information stored in the data transfer template may be obtained for the last time the first virtual machine was started, or for the start of a second virtual machine of the same type as the first virtual machine.
Alternatively, before the first virtual machine is started, when the original data information is acquired, the original data information may be acquired from a memory such as a hard disk, an optical disk, an array SAN storage-block device, or a distributed storage-block device according to a data transfer template. The original data information can comprise a plurality of pieces of information, and when the plurality of pieces of information in the original data information are acquired, the plurality of pieces of information in the original data information can be acquired in parallel according to the data transfer template, so that the speed of acquiring the original data information is improved.
Alternatively, since the data transfer template is acquired at the time of starting the second virtual machine, the data transfer template has the stored information of the original data information used for starting the second virtual machine recorded therein. And because the first virtual machine and the second virtual machine are virtual machines with the same type, the original data information can be acquired according to the storage information recorded in the data transfer template, and the original data information is stored in the memory of the first virtual machine so as to be used when the first virtual machine is started.
Optionally, the storage information recorded in the data transfer template includes a storage location of the original data information and a data length of the original data information. For example, the data length is 8, and after the storage location and the data length of the original data information used when the second virtual machine is started are acquired, when the original data information is acquired, the data with the data length of the original data information may be acquired directly from the storage location of the original data information. For example, as shown in fig. 4, the original data information 402 is shown in fig. 4, and the original data information 402 is stored in the memory. Block 404 in fig. 4 may be a unit of storage of a memory. When the storage location 406 (the location of the 8 black boxes in fig. 4) of the data of the original data information is acquired, the original data information of 8 lengths is acquired directly from the storage location.
Alternatively, the original data information may be plural and stored in different locations, respectively. When a plurality of pieces of original data information are acquired, the pieces of original data information may be acquired in parallel. As shown in fig. 5, the original data information includes data 502 and data 504, the data 502 has a length of 5, the data 504 has a length of 3, and the data 502 and the data 504 are stored in different locations of the memory. In acquiring the original data information, the original data information 502 with length 5 and the original data information 504 with length 3 are acquired in parallel according to the storage positions 502-1 (5 consecutive black boxes in fig. 5) and 504-1 (3 consecutive black boxes in fig. 5) of the original data information recorded in the data transfer template.
Alternatively, the storage locations of the original data information may not be consecutive, such as the original data information length of 2, but the storage locations of the original data information of two units are not consecutive. At this time, after the 1 st unit of original data information is acquired, the 2 nd unit of original data information is searched for according to the 1 st unit of original data information, and the 2 nd unit of original data information is acquired.
Optionally, after the original data information used for starting the second virtual machine is stored in the memory, when the first virtual machine is started, because the first virtual machine and the second virtual machine are the same type virtual machines, at this time, the first virtual machine can directly call the original data information stored in the memory to start the first virtual machine, thereby improving the efficiency of starting the first virtual machine.
It should be noted that, in this embodiment, the original data information of the first virtual machine started last time may also be obtained, the storage location and the data length of the original data information are saved in the data transfer template, and before the first virtual machine is started again, the original data information is saved in the memory according to the data transfer template, and the first virtual machine is started.
Optionally, when the first virtual machine is started by using the original data information in the memory, an instruction for acquiring data may also be sent to the memory. After the first virtual machine is started, target data information used for starting the first virtual machine is obtained. And then comparing the original data information with the target data information, and updating the original data information.
Alternatively, when the original data information is updated according to the target data information, the storage location and the data length of the information different from the original data information of the target data information may be written into the data transfer template. When the first virtual machine is started next time, transferring data to the memory by using the updated data transfer template, and starting the first virtual machine.
Optionally, the present embodiment may also configure the reference value for the stored information in the data transfer template. The above reference value is used to indicate the accuracy of the stored information. The higher the reference value, the higher the possibility that the original data information corresponding to the stored information is used when the first virtual machine is started. The reference value will change along with each starting of the virtual machine, if the original data information is not used after the virtual machine is started, the reference value corresponding to the storage information of the original data information will be reduced. When the reference value drops to a threshold value, the stored information is deleted from the data transfer template.
For example, two pieces of storage information are recorded in the data transfer template, and the reference value corresponding to the first piece of storage information and the second piece of storage information is 100. If the original data information stored in the memory corresponding to the first piece of storage information is used when the first virtual machine is started, the reference value of the first piece of storage information is increased, for example, 20, while the original data information stored in the memory corresponding to the second piece of storage information is not used when the first virtual machine is started, at this time, the reference value corresponding to the second piece of storage information is reduced, for example, 20. After the data transfer template is used for a plurality of times, the reference value corresponding to the second storage information is zero, and the second storage information is deleted from the data transfer template, so that the burden of transferring the original data information to the memory is reduced.
It should be noted that, the above reference values may include an upper limit and/or a lower limit. If the reference value reaches 100, the increase is not continued.
The method for starting the virtual machine will be described below taking the case where the first virtual machine and the second virtual machine are the same type of virtual machine.
In the prior art, if a virtual machine is to be started, when a VM process of the virtual machine is started and each program is started by Loop, a large amount of disk reading processing exists in each step, and more than 1 thousand times of operations of reading a storage medium are accumulated, the storage medium is usually a common hard disk or a storage system, the time delay of reading data is thousands of times slower than that of a memory, for example, the access time delay of a solid state disk is generally 50-100 microseconds, the access time delay of a server hard disk, an array SAN storage-block device and a Ceph distributed storage-block device is generally 2-30 milliseconds or longer, and the overall starting speed of the operating system of the virtual machine is slow.
In the virtual machine starting logic of the embodiment, a machine learning module is added in addition to a computing module (providing computing resources such as a virtual machine CPU and a memory) and a storage module (providing data storage resources of a virtual machine, such as an independent disk or a distributed storage system). The description is made in connection with S602 to S624 of fig. 6. When the user 602 creates the first virtual machine 604, a data transfer template is imported in the machine learning module 608. The data transfer template is recorded with storage information of original data information used when the second virtual machine is started, and the storage information comprises a storage position and a data length. The machine learning module 608 holds the data transfer templates. When the first virtual machine 604 is started, a VM process in the first virtual machine 604 is started, the VM process notifies the machine learning module 608 of loading the type of the data transfer template through parameters, the machine learning module 608 loads the corresponding data transfer module and acquires the data transfer template and sends the data transfer template to the storage module 606, and notifies the storage module 606 of loading data into the memory according to the storage position and the storage length in the data transfer template. In addition, the data transfer template may also store the order in which the data is called when the virtual machine is started. Since the data transfer templates for all data have been acquired, reading all data into memory may be performed concurrently before the first virtual machine 604 is started. Typically the time taken to read 1 thousand data requests one by one is the single request latency times 1 thousand. But the time spent executing 1 thousand requests in parallel is the single request latency times 1 thousand divided by concurrency. For example, the concurrency value is 100, and the total consumption time delay is 1/100 of the original time delay. The data is stored in a storage with larger time delay, such as a distributed storage system (single request is larger in time delay, but multiple concurrent processing of requests is supported), and the acceleration effect generated by the scheme is more obvious. In addition, at the time of starting up the first virtual machine 604, when data is obtained from the memory of the storage module 606, a data reading request for starting up the first virtual machine 604 needs to be sent to the machine learning module 608. The machine learning module 608 determines target data information required to boot the first virtual machine 604 based on the received request and updates the data transfer template based on the target data information. The machine learning module 608 identifies differences in the read data of the first virtual machine 604 (data read location, length, timing changes, data requests to be added, data requests to be subtracted) and updates to the data timing template to form a new data template for the next time the virtual machine is started for provisioning. After the first virtual machine startup is complete, the machine learning module 608 may be notified to stop updating the data templates (not shown in fig. 6).
It should be noted that, in fig. 6, the step S618 and the step S622 may be performed simultaneously, or sequentially, and the order of the sequential steps is not limited.
When the data transfer template is updated, the stored information in the data transfer template may be updated. For example, a reference value is configured for each piece of stored information in the data transfer template. As shown in fig. 7. The stored information includes an operation sequence, a storage location, a data length, an operation type, and a reference value of the original data information. The reference value may initially be set to 100.
When updating the data transfer template, if the target data information used for starting the first virtual machine is not in the original data information, namely new data is used, the storage information of the data of the new data is added into the data transfer template, and a corresponding reference value is set. To avoid occasional situations, the reference value may be set to 10. If the target data information is already existing in the original data information, the first virtual machine is started to use the data in the original data information, and the reference value of the storage information of the original data information to be used is increased, for example, increased by 1. And if the original data information contains the data which is not contained in the target data information, indicating that the original data information contains unused information. At this time, the reference value of the stored information corresponding to the unused original data information is reduced. At this time, in order to accelerate the elimination of the unusual original data information, the reference value may be reduced by 3. When the reference value is 0, the stored information with the reference value of 0 is eliminated.
For example, as shown in fig. 8 and 9, fig. 8 is a data transfer template, where hit refers to original data information loaded into a memory corresponding to storage information being used when a first virtual machine is started, and miss refers to original data information loaded into a memory corresponding to storage information being unused or having an error. The missing hit of the 8 pieces of information shown in fig. 8 indicates that the original data information loaded into the memory is used when the first virtual machine is started, is not used, and has a data error. At this point the data transfer template needs to be updated. As shown in fig. 9, the reference value of the hit storage location is increased by 1, the reference value of the storage information of the missed original data information is decreased by 1, and the storage information of the missed original data information is newly added to the original data information.
In this embodiment, a standard data transfer template used for starting a type of virtual machine can be obtained by starting a virtual machine hundreds of times and updating the data transfer template, and the standard data transfer template is put into use.
According to the embodiment, before the first virtual machine is started, the data transfer template is obtained according to the storage information in the data transfer template, the original data information is obtained and stored in the memory, when the first virtual machine is started, the first virtual machine is started by calling the original data information in the memory, and therefore before the first virtual machine is started again, data are written into the memory in advance according to the storage information, and the first virtual machine is started, time for reading data when the first virtual machine is started is saved, and efficiency of starting the first virtual machine is improved.
As an alternative embodiment, the second acquiring unit 1004 includes:
the first acquisition module is used for acquiring a plurality of pieces of information in the original data information in parallel according to the stored information.
According to the embodiment, when the original data information is acquired, the plurality of pieces of information of the original data information are acquired in parallel, so that the efficiency of acquiring the original data information is improved, and the efficiency of starting the virtual machine is further improved.
As an alternative embodiment, the second obtaining unit 1004 further includes:
the second acquisition module is used for acquiring the storage position of the original data information and the data length of the original data information stored in the data transfer template, wherein the storage information comprises the storage position of the original data information and the data length of the original data information;
and the third acquisition module is used for acquiring the original data information according to the storage position of the original data information and the data length of the original data information.
According to the method and the device for obtaining the original data information, the original data information is obtained according to the storage position and the data length of the original data information, so that the original data information can be accurately and efficiently obtained, the accuracy of obtaining the original data information is improved, and the efficiency of starting the virtual machine is further improved.
As an alternative embodiment, the second obtaining module includes:
and the acquisition sub-module is used for acquiring the data with the length of the data length from the storage position of the original data information to obtain the original data information.
According to the method, the original data information is obtained, so that the original data information can be accurately and efficiently obtained, the accuracy of obtaining the original data information is improved, and the efficiency of starting the virtual machine is further improved.
As an alternative embodiment, the apparatus further comprises:
the third obtaining unit is used for obtaining target data information used for starting the first virtual machine after the original data information in the memory is called to start the first virtual machine when the first virtual machine is started, wherein the target data information is information required by starting the first virtual machine;
and the updating unit is used for updating the data transfer template according to the target data information.
According to the embodiment, after the target data information is obtained, the data transfer template is updated according to the target data information, so that the data transfer template can be trained by starting the virtual machine for multiple times, the accuracy of the data transfer template is improved, and the efficiency of starting the virtual machine is further improved.
As an alternative embodiment, the updating unit includes:
and the storage module is used for storing the storage position and the data length of the data information which is different from the original data information in the target data information into the data transfer template.
According to the embodiment, the data transfer template is updated by the method, so that the data transfer template can be trained by starting the virtual machine for multiple times, the accuracy of the data transfer template is improved, and the efficiency of starting the virtual machine is further improved.
As an alternative embodiment, the apparatus further comprises:
the configuration unit is used for configuring a reference value for the storage information stored in the data transfer template before the first virtual machine is started;
and the deleting unit is used for deleting the stored information corresponding to the reference value smaller than the first threshold value from the data transfer template under the condition that the reference value is smaller than the first threshold value after the first virtual machine is started.
According to the embodiment, the reference value is set for the storage information in the data transfer template, so that the storage information in the data transfer template can be monitored, the accuracy of the data transfer template is improved, and the efficiency of starting the virtual machine is further improved.
As an alternative embodiment, the apparatus further comprises:
the first adjusting unit is used for adding the reference value of the storage information corresponding to the used original data information after the first virtual machine is started if the original data information stored in the memory is used when the first virtual machine is started;
and the second adjusting unit is used for reducing the reference value of the stored information corresponding to the unused original data information after the first virtual machine is started if the original data information stored in the memory is unused when the first virtual machine is started.
According to the embodiment, the reference value is adjusted by the method, the reference value can be adjusted according to the result of starting the virtual machine, the accuracy of the data transfer template is improved, and the efficiency of starting the virtual machine is further improved.
According to a further aspect of the embodiments of the present invention, there is also provided an electronic device for implementing the above-mentioned virtual machine starting method, as shown in fig. 11, the electronic device comprising a memory 1102 and a processor 1104, the memory 1102 having stored therein a computer program, the processor 1104 being arranged to execute the steps of any of the method embodiments described above by means of the computer program.
Alternatively, in this embodiment, the electronic apparatus may be located in at least one network device of a plurality of network devices of the computer network.
Alternatively, in the present embodiment, the above-described processor may be configured to execute the following steps by a computer program:
s1, before a first virtual machine is started, acquiring a data transfer template, wherein storage information of original data information is stored in the data transfer template, the original data information is information used when a second virtual machine is started, the second virtual machine is started before the first virtual machine is started, and the second virtual machine is a virtual machine with the same type as the first virtual machine or the second virtual machine is the first virtual machine;
s2, acquiring the original data information according to the stored information in the data transfer template;
s3, storing the original data information into a memory;
s4, when the first virtual machine is started, the original data information in the memory is called to start the first virtual machine.
Alternatively, it will be understood by those skilled in the art that the structure shown in fig. 11 is only schematic, and the electronic device may also be a terminal device such as a smart phone (e.g. an Android phone, an iOS phone, etc.), a tablet computer, a palm computer, and a mobile internet device (Mobile Internet Devices, MID), a PAD, etc. Fig. 11 is not limited to the structure of the electronic device. For example, the electronic device may also include more or fewer components (e.g., network interfaces, etc.) than shown in FIG. 11, or have a different configuration than shown in FIG. 11.
The memory 1102 may be used to store software programs and modules, such as program instructions/modules corresponding to the method and apparatus for starting a virtual machine in the embodiments of the present invention, and the processor 1104 executes the software programs and modules stored in the memory 1102 to perform various functional applications and data processing, that is, implement the method for starting a virtual machine. Memory 1102 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, memory 1102 may further include memory located remotely from processor 1104, which may be connected to the terminal via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof. The memory 1102 may be used to store, but is not limited to, information such as raw data information. As an example, as shown in fig. 11, the memory 1102 may include, but is not limited to, a first obtaining unit 1002, a second obtaining unit 1004, a storage unit 1006, and a calling unit 1008 in the virtual machine starting apparatus. In addition, other module units in the virtual machine starting apparatus may be further included, but are not limited to, and are not described in detail in this example.
Optionally, the transmission device 1106 is used to receive or transmit data via a network. Specific examples of the network described above may include wired networks and wireless networks. In one example, the transmission device 1106 includes a network adapter (Network Interface Controller, NIC) that may be connected to other network devices and routers via a network cable to communicate with the internet or a local area network. In one example, the transmission device 1106 is a Radio Frequency (RF) module for communicating wirelessly with the internet.
In addition, the electronic device further includes: a display 1108 for displaying the screen of the first virtual machine started; and a connection bus 1110 for connecting the respective module parts in the above-described electronic apparatus.
According to a further aspect of embodiments of the present invention there is also provided a storage medium having stored therein a computer program, wherein the computer program is arranged to perform the steps of any of the method embodiments described above when run.
Alternatively, in the present embodiment, the above-described storage medium may be configured to store a computer program for performing the steps of:
S1, before a first virtual machine is started, acquiring a data transfer template, wherein storage information of original data information is stored in the data transfer template, the original data information is information used when a second virtual machine is started, the second virtual machine is started before the first virtual machine is started, and the second virtual machine is a virtual machine with the same type as the first virtual machine or the second virtual machine is the first virtual machine;
s2, acquiring the original data information according to the stored information in the data transfer template;
s3, storing the original data information into a memory;
s4, when the first virtual machine is started, the original data information in the memory is called to start the first virtual machine.
Alternatively, in this embodiment, it will be understood by those skilled in the art that all or part of the steps in the methods of the above embodiments may be performed by a program for instructing a terminal device to execute the steps, where the program may be stored in a computer readable storage medium, and the storage medium may include: flash disk, read-Only Memory (ROM), random-access Memory (Random Access Memory, RAM), magnetic or optical disk, and the like.
The foregoing embodiment numbers of the present invention are merely for the purpose of description, and do not represent the advantages or disadvantages of the embodiments.
The integrated units in the above embodiments may be stored in the above-described computer-readable storage medium if implemented in the form of software functional units and sold or used as separate products. Based on such understanding, the technical solution of the present invention may be embodied in essence or a part contributing to the prior art or all or part of the technical solution in the form of a software product stored in a storage medium, comprising several instructions for causing one or more computer devices (which may be personal computers, servers or network devices, etc.) to perform all or part of the steps of the method described in the embodiments of the present invention.
In the foregoing embodiments of the present invention, the descriptions of the embodiments are emphasized, and for a portion of this disclosure that is not described in detail in this embodiment, reference is made to the related descriptions of other embodiments.
In several embodiments provided in the present application, it should be understood that the disclosed client may be implemented in other manners. The above-described embodiments of the apparatus are merely exemplary, and the division of the units, such as the division of the units, is merely a logical function division, and may be implemented in another manner, for example, multiple units or components may be combined or may be integrated into another system, or some features may be omitted, or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be through some interfaces, units or modules, or may be in electrical or other forms.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in the embodiments of the present invention may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in software functional units.
The foregoing is merely a preferred embodiment of the present invention and it should be noted that modifications and adaptations to those skilled in the art may be made without departing from the principles of the present invention, which are intended to be comprehended within the scope of the present invention.
Claims (15)
1. A virtual machine starting method, comprising:
before starting a first virtual machine, acquiring a data transfer template, wherein storage information stored in the data transfer template is used for indicating: the method comprises the steps that original data information is used when a second virtual machine started before the first virtual machine is started, the second virtual machine is a virtual machine with the same type as the first virtual machine or the second virtual machine is the first virtual machine, a reference value is configured in storage information stored in a data transfer template, and the reference value is used for indicating the possibility of the original data information being used when the virtual machine is started;
Acquiring the original data information according to the stored information in the data transfer template;
storing the original data information into a memory;
when the first virtual machine is started, calling the original data information in the memory to start the first virtual machine;
after the first virtual machine is started, acquiring target data information used for starting the first virtual machine, wherein the target data information is information required by starting the first virtual machine; and storing the target data information into the data transfer template to update the data transfer template in the case that the target data information is different from the original data information, wherein the reference value is reduced in the case that the original data information is not used when the first virtual machine is started.
2. The method of claim 1, wherein obtaining the raw data information from the stored information in the data transfer template comprises:
and acquiring a plurality of pieces of information in the original data information in parallel according to the stored information.
3. The method of claim 1, wherein the obtaining the original data information from the stored information in the data transfer template comprises:
Acquiring a storage position of the original data information and a data length of the original data information stored in the data transfer template, wherein the storage information comprises the storage position of the original data information and the data length of the original data information;
and acquiring the original data information according to the storage position of the original data information and the data length of the original data information.
4. The method of claim 3, wherein the obtaining the original data information based on the storage location of the original data information and the data length of the original data information comprises:
and starting from the storage position of the original data information, acquiring data with the length of the data length, and obtaining the original data information.
5. The method of claim 1, wherein storing the target data information in the data transfer template to update the data transfer template if the target data information is different from the original data information comprises:
and storing the storage position and the data length of the data information which is different from the original data information in the target data information into the data transfer template.
6. The method of claim 1, wherein the step of determining the position of the substrate comprises,
after the first virtual machine is started, the method further comprises: and deleting the stored information corresponding to the reference value smaller than the first threshold value from the data transfer template under the condition that the reference value is smaller than the first threshold value.
7. The method of claim 6, further comprising, after starting the first virtual machine:
when the first virtual machine is started, in the case where the original data information stored in the memory is used, the reference value of the stored information corresponding to the used original data information is increased.
8. A virtual machine starting apparatus, comprising:
the first obtaining unit is used for obtaining a data transfer template before the first virtual machine is started, wherein storage information stored in the data transfer template is used for indicating: the method comprises the steps that original data information is used when a second virtual machine started before the first virtual machine is started, the second virtual machine is a virtual machine with the same type as the first virtual machine or the second virtual machine is the first virtual machine, a reference value is configured in storage information stored in a data transfer template, and the reference value is used for indicating the possibility of the original data information being used when the virtual machine is started;
The second acquisition unit is used for acquiring the original data information according to the stored information in the data transfer template;
the storage unit is used for storing the original data information into a memory;
the calling unit is used for calling the original data information in the memory to start the first virtual machine when the first virtual machine is started;
the third acquisition unit is used for acquiring target data information used for starting the first virtual machine after the first virtual machine is started, wherein the target data information is information required by starting the first virtual machine; and an updating unit configured to store the target data information in the data transfer template to update the data transfer template when the target data information is different from the original data information, where the reference value is reduced when the original data information is not used when the first virtual machine is started.
9. The apparatus of claim 8, wherein the second acquisition unit comprises:
the second acquisition module is used for acquiring the storage position of the original data information and the data length of the original data information stored in the data transfer template, wherein the storage information comprises the storage position of the original data information and the data length of the original data information;
And the third acquisition module is used for acquiring the original data information according to the storage position of the original data information and the data length of the original data information.
10. The apparatus of claim 9, wherein the second acquisition module comprises: and the acquisition sub-module is used for acquiring the data with the length of the data length from the storage position of the original data information to obtain the original data information.
11. The apparatus of claim 8, wherein the updating unit comprises:
and the storage module is used for storing the storage position and the data length of the data information which is different from the original data information in the target data information into the data transfer template.
12. The apparatus of claim 8, wherein the apparatus further comprises:
the deleting unit is configured to, after the first virtual machine is started, further include: and deleting the stored information corresponding to the reference value smaller than the first threshold value from the data transfer template under the condition that the reference value is smaller than the first threshold value.
13. The apparatus of claim 12, wherein the apparatus further comprises:
And the first adjusting unit is used for increasing the reference value of the storage information corresponding to the used original data information when the original data information stored in the memory is used when the first virtual machine is started.
14. A storage medium storing a computer program, characterized in that the computer program when run performs the method of any one of claims 1 to 7.
15. An electronic device comprising a memory and a processor, characterized in that the memory has stored therein a computer program, the processor being arranged to execute the method according to any of the claims 1 to 7 by means of the computer program.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910356688.XA CN110147266B (en) | 2019-04-29 | 2019-04-29 | Virtual machine starting method and device, storage medium and electronic device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910356688.XA CN110147266B (en) | 2019-04-29 | 2019-04-29 | Virtual machine starting method and device, storage medium and electronic device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN110147266A CN110147266A (en) | 2019-08-20 |
CN110147266B true CN110147266B (en) | 2024-03-15 |
Family
ID=67593904
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910356688.XA Active CN110147266B (en) | 2019-04-29 | 2019-04-29 | Virtual machine starting method and device, storage medium and electronic device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110147266B (en) |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2008033392A (en) * | 2006-07-26 | 2008-02-14 | Nec Corp | Virtual computer system and operation method thereof |
CN104281486A (en) * | 2014-09-26 | 2015-01-14 | 华为技术有限公司 | Processing method and device of VM (virtual machine) |
CN106339254A (en) * | 2015-07-15 | 2017-01-18 | 中兴通讯股份有限公司 | Quick starting method and device, and management node for virtual machine |
CN106598653A (en) * | 2016-11-24 | 2017-04-26 | 合肥中科云巢科技有限公司 | Method and device used for solving boot storm of virtual machine |
CN109491757A (en) * | 2018-10-11 | 2019-03-19 | 广东微云科技股份有限公司 | The Acceleration of starting method of local computing mode virtual machine |
Family Cites Families (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102467408B (en) * | 2010-11-12 | 2014-03-19 | 阿里巴巴集团控股有限公司 | Method and device for accessing data of virtual machine |
EP3211531B1 (en) * | 2016-02-25 | 2021-12-22 | Huawei Technologies Co., Ltd. | Virtual machine start method and apparatus |
CN106201659B (en) * | 2016-07-12 | 2019-07-05 | 腾讯科技(深圳)有限公司 | A kind of method and host of live migration of virtual machine |
-
2019
- 2019-04-29 CN CN201910356688.XA patent/CN110147266B/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2008033392A (en) * | 2006-07-26 | 2008-02-14 | Nec Corp | Virtual computer system and operation method thereof |
CN104281486A (en) * | 2014-09-26 | 2015-01-14 | 华为技术有限公司 | Processing method and device of VM (virtual machine) |
CN106339254A (en) * | 2015-07-15 | 2017-01-18 | 中兴通讯股份有限公司 | Quick starting method and device, and management node for virtual machine |
CN106598653A (en) * | 2016-11-24 | 2017-04-26 | 合肥中科云巢科技有限公司 | Method and device used for solving boot storm of virtual machine |
CN109491757A (en) * | 2018-10-11 | 2019-03-19 | 广东微云科技股份有限公司 | The Acceleration of starting method of local computing mode virtual machine |
Also Published As
Publication number | Publication date |
---|---|
CN110147266A (en) | 2019-08-20 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN113641457B (en) | Container creation method, device, apparatus, medium, and program product | |
EP3410288B1 (en) | Online upgrade method, device and system | |
US9898338B2 (en) | Network computer system and method for dynamically changing execution sequence of application programs | |
CN108064377B (en) | Management method and device for multi-system shared memory | |
CN110532077B (en) | Task processing method and device and storage medium | |
CN111124286A (en) | Libcloud-based multi-cloud management implementation method | |
CN110502310B (en) | Time synchronization method and device of virtual machine | |
EP3518100A1 (en) | Quick loading method for kernel image file, and apparatus | |
CN111488181B (en) | Task scheduling method, device, storage medium and server | |
US11038783B2 (en) | Method and apparatus for managing network connection, and storage medium | |
US20120122573A1 (en) | Apparatus and method for synchronizing virtual machine | |
CN109842621A (en) | A kind of method and terminal reducing token storage quantity | |
US9047110B2 (en) | Virtual machine handling system, virtual machine handling method, computer, and storage medium | |
CN112748961A (en) | Method and device for executing starting task | |
CN112835634A (en) | Cache-based android application program quick start system and method | |
CN111045789A (en) | Virtual machine starting method and device, electronic equipment and storage medium | |
CN117407370A (en) | Checkpoint file processing method and system, electronic equipment and storage medium | |
JP5518950B2 (en) | Virtual machine management system and management method | |
CN110147266B (en) | Virtual machine starting method and device, storage medium and electronic device | |
CN111506388A (en) | Container performance detection method, container management platform and computer storage medium | |
CN112015458B (en) | Device upgrade method, terminal device, electronic device and storage medium | |
CN113608742A (en) | Detection method, code packet processing method, operation control method and computing device | |
CN117950751A (en) | Method, device, equipment and medium for adapting embedded product of kernel | |
US20250110749A1 (en) | Method and apparatus for bios option modifications to take effect, non-volatile readable storage medium, and electronic device | |
TWI465072B (en) | System firmware update method and server system using the same |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |