CN111723051A - Mirror image reconstruction method and device based on module - Google Patents
Mirror image reconstruction method and device based on module Download PDFInfo
- Publication number
- CN111723051A CN111723051A CN201910202767.5A CN201910202767A CN111723051A CN 111723051 A CN111723051 A CN 111723051A CN 201910202767 A CN201910202767 A CN 201910202767A CN 111723051 A CN111723051 A CN 111723051A
- Authority
- CN
- China
- Prior art keywords
- instruction
- mirror image
- module
- modules
- instruction modules
- 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.)
- Pending
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/60—Software deployment
- G06F8/61—Installation
- G06F8/63—Image based installation; Cloning; Build to order
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- General Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Image Processing (AREA)
Abstract
The invention discloses a module-based mirror image reconstruction method and device, and relates to the technical field of computers. One embodiment of the method comprises: modularizing the instructions in the mirror image to form one or more instruction modules, wherein the one or more instruction modules are independent of each other; determining the weight of the instruction module according to the repeated times of the instruction module in the mirror image and the storage space occupied by the instruction module; sequencing a plurality of the one or more instruction modules according to the weight; and reconstructing the storage sequence of the instruction modules in the mirror image according to the sequencing result to form a reconstructed mirror image, wherein the instruction modules with large weight values are stored at the bottom layer of the reconstructed mirror image. The embodiment can reduce the storage space of the mirror image and reduce the cost of mirror image modification.
Description
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method and an apparatus for reconstructing a module-based image, an electronic device, and a computer-readable medium.
Background
With the further popularization and development of the mirror image technology, people can avoid complex environment deployment and configuration by using the shared mirror image file, and directly put the shared mirror image file into production and learning tasks, so that a great amount of time and energy are saved.
Docker, among other things, is a tool that enables the creation and maintenance of container environments on physical machines. A container is a lightweight virtualized environment with its own independent operating space. The Docker image is a statically-defined file system that is run inside a container by the Docker tool. Dockerfile is a text file based on which a Docker image can be constructed using Docker. Docker has a set of hierarchical storage mechanism, customize the mirror image through Dockerfile, include a strip of order in it, every order constructs a layer of storage, in constructing the course, every layer will buffer and come down. Meanwhile, by using the FROM instruction of the initial content of the Dockerfile file, a new instruction can be added on a certain mirror image as a basis to construct a mirror image, and the new mirror image can reuse the space of the basic mirror image.
In the process of implementing the invention, the inventor finds that at least the following problems exist in the prior art:
however, with the increase of task complexity, the functions of the image files need to be continuously improved, which requires that a large number of software packages are installed, and at this time, a large number of repeated contents may exist among a plurality of image files, which occupies a large amount of disk space resources; moreover, the continuous richness of functions means that the mirror image making logic is more and more complex, and after the mirror image making logic is modified, a large amount of time is usually spent on making the mirror image again; after the image file is modified, the image file needs to be remanufactured, and based on the hierarchical cache of Docker, when the position of the modified instruction in the Dockerfile is back, the modified instruction can be reconstructed only by spending little time. However, when the modification instruction is located forward, it often takes a significant time cost, especially when there are a large number of software package installation instructions behind the modified instruction. How to construct the mirror image with low repetition rate and easy modification has important significance in the engineering level.
Disclosure of Invention
In view of this, embodiments of the present invention provide a method and an apparatus for reconstructing a mirror image based on a module, which can reduce a storage space of the mirror image and reduce a cost of modifying the mirror image.
To achieve the above object, according to an aspect of an embodiment of the present invention, there is provided a module-based image reconstruction method including: modularizing the instructions in the mirror image to form one or more instruction modules, wherein the one or more instruction modules are independent of each other; determining the weight of the instruction module according to the repeated times of the instruction module in the mirror image and the storage space occupied by the instruction module; sequencing a plurality of the one or more instruction modules according to the weight; and reconstructing the storage sequence of the instruction modules in the mirror image according to the sequencing result to form a reconstructed mirror image, wherein the instruction modules with large weight values are stored at the bottom layer of the reconstructed mirror image.
Optionally, if there is a dependency relationship between the instruction modules, merging the instruction modules having the dependency relationship.
Optionally, the mirroring is Docker-based mirroring.
Optionally, an instruction module with a repeating sequence is selected from the reconstructed images to make a multiplexed image.
Optionally, the multiplexed image is invoked using the FROM instruction of Dockerfile.
Optionally, the storage order of the scattered instruction modules in the mirror image is reconstructed according to the stability of the scattered instruction modules, and the scattered instruction modules with high stability are stored in the bottom layer of the mirror image, where the scattered instruction modules are in the mirror image and include instruction modules outside the multiplexing mirror image.
Optionally, the stability of the scattered instruction module is determined according to the modification frequency of the scattered instruction module.
To achieve the above object, according to another aspect of an embodiment of the present invention, there is provided a module-based image reconstruction apparatus including: the module unit is used for modularizing the instructions in the mirror image to form one or more instruction modules, wherein the one or more instruction modules are mutually independent; the weighting unit is used for determining the weight of the instruction module according to the repeated times of the instruction module in the mirror image and the storage space occupied by the instruction module; the sequencing unit is used for sequencing the one or more instruction modules according to the weight; and the reconstruction unit is used for reconstructing the storage sequence of the instruction modules in the mirror image according to the sequencing result to form a reconstructed mirror image, wherein the instruction modules with large weight values are stored at the bottom layer of the reconstructed mirror image.
Optionally, the apparatus further comprises: and the merging unit is used for merging the instruction modules with the dependency relationship if the dependency relationship exists between the instruction modules.
Optionally, the mirroring is Docker-based mirroring.
Optionally, the apparatus further comprises: and the manufacturing unit is used for selecting the instruction module with the repeated sequence from the reconstructed mirror image to manufacture the multiplexing mirror image.
Optionally, the apparatus further comprises: and the calling unit is used for calling the multiplexing mirror image by using an FROM instruction of Dockerfile.
Optionally, the reconstructing unit is further configured to reconstruct, according to stability of a scattered instruction module, a storage order of the scattered instruction module in the mirror image, where the scattered instruction module with high stability is stored at a bottom layer of the mirror image, and the scattered instruction module is in the mirror image and includes an instruction module outside the multiplexed mirror image.
Optionally, the weighting unit is further configured to determine the stability of the scattered instruction module according to the modification frequency of the scattered instruction module.
To achieve the above object, according to still another aspect of an embodiment of the present invention, there is provided an electronic apparatus including: one or more processors; a storage device to store one or more programs that, when executed by the one or more processors, cause the one or more processors to implement any of the methods of the module-based image reconstruction method.
To achieve the above object, according to still another aspect of embodiments of the present invention, there is provided a computer-readable medium having stored thereon a computer program which, when executed by one or more processors, implements any one of the methods of the module-based image reconstruction method.
One embodiment of the above invention has the following advantages or benefits: because the technical means of reconstructing the mirror image after modularizing the instructions is adopted, the technical problems of disordered instruction storage logic and high modification cost in the existing mirror image are solved, and the technical effects of simplifying the instruction storage logic in the mirror image and reducing the modification cost are further achieved.
Further effects of the above-mentioned non-conventional alternatives will be described below in connection with the embodiments.
Drawings
The drawings are included to provide a better understanding of the invention and are not to be construed as unduly limiting the invention. Wherein:
FIG. 1 is a schematic diagram of the main steps of a method for module-based image reconstruction according to an embodiment of the present invention;
FIG. 2-1 is a schematic diagram of the respective module components of which there are four image files A, B, C, D according to an embodiment of the present invention;
FIG. 2-2 is a schematic diagram of an instruction module in a mirror after reconfiguring a storage order, according to an embodiment of the invention;
FIG. 3 is a schematic diagram of the main parts of a module-based image reconstruction apparatus according to an embodiment of the present invention;
FIG. 4 is an exemplary system architecture diagram in which embodiments of the present invention may be employed;
fig. 5 is a schematic block diagram of a computer system suitable for use in implementing a terminal device or server of an embodiment of the invention.
Detailed Description
Exemplary embodiments of the present invention are described below with reference to the accompanying drawings, in which various details of embodiments of the invention are included to assist understanding, and which are to be considered as merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the invention. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
Fig. 1 is a schematic diagram of main steps of a module-based image reconstruction method according to an embodiment of the present invention, as shown in fig. 1:
the embodiment of the invention takes a mirror image based on Docker as an example.
Step S101 modularizes the instructions in the mirror image to form one or more instruction modules, wherein the one or more instruction modules are independent of each other. If the dependency relationship exists between the instruction modules, merging the instruction modules with the dependency relationship.
The Docker file comprises a plurality of instructions and has the function of constructing an environment required by the operation of a Docker mirror image. For each image, the overall environment is divided into different modules (i.e., instruction modules) which are implemented by different instructions. Modularizing the instructions facilitates simplifying the storage logic for the instructions in the image. Since the instruction modules may be independent of each other, there may also be a dependency relationship (e.g., the instruction module a needs to wait for the instruction module C to output a result). The dependency relationship between the instruction modules can be eliminated by incorporating them into one instruction module.
Step S102, determining the weight of the instruction module according to the repeated times of the instruction module in the mirror image and the size of the storage space occupied by the instruction module; the larger the weight of the instruction module is, the more the instruction module is repeated, the larger the occupied storage space is.
Each mirror image is divided into a plurality of instruction modules, and the repeated instruction modules and the unique instruction modules are contained among the mirror images. The sizes of the spaces occupied by the instruction modules which are independent from each other in the mirror images of the hierarchical storage are different. Counting the repetition times of the instruction modules and the size of the space occupied by the instruction modules, and taking the product of the repetition times and the size of the space occupied by the instruction modules as the weight of each instruction module. Fig. 2-1 is a schematic diagram of respective module compositions of four image files A, B, C, D, where the instruction modules are { a, b, c, d }, the occurrence times are {4, 3, 2, 1}, and the occupied storage space sizes are {100M,200M,150M, 350M }, respectively. The weight of each instruction block is calculated to be {4 x 100, 3 x 200, 2 x 150, 350 x 1}, and finally to be {400, 600, 300, 350 }.
Step S103, ordering the one or more instruction modules according to the weight; for example, after the instruction blocks { a, b, c, d } in fig. 2-1 are sorted according to the weights from large to small, the sorting result is { b, a, d, c }.
And step S104, reconstructing the storage sequence of the instruction modules in the mirror image according to the sequencing result to form a reconstructed mirror image, wherein the instruction modules with large weight values are stored at the bottom layer of the reconstructed mirror image.
According to the composition of the instruction modules of each mirror image, the storage sequence of the instruction modules is rearranged in the mirror image according to the sequencing result obtained in the step S103. Because the instruction modules are arranged according to the weight, the instruction modules which occupy larger space and have more repetition times can be positioned at the lower layer of each mirror image to the greatest extent, so that the mirror image storage logic is clearer and the modification cost is lower.
As shown in fig. 2-2, which is a schematic diagram of the memory order of the instruction modules in the mirror image of fig. 2-1 according to the weighted order, it can be seen that the instruction module b is located at the bottom layer of the mirror images A, B and D, respectively, because the instruction module b has the largest weight.
After the mirror images are reconstructed, the command modules with the repeated sequence can be selected from the reconstructed mirror images to manufacture the multiplexing mirror images.
Wherein, the repeated sequence means that the storage sequence of the repeated instruction modules is also the same. The (Run) multiplex image may be called using the FROM instruction of Dockerfile. For example, as shown in fig. 2-2, since the instruction blocks having the repeated sequence are { B, a } and { a, C }, the images B and/or C can be directly multiplexed as a multiplexing block. For example, the mirror B is used as a multiplexing mirror, so the mirror A and the mirror D can directly multiplex the mirror B. Assuming that A, B, C, D the four images are all image-base based images, the Dockerfile before and after reconstruction is shown in Table 1, and the image A and the image D not only multiplex the image B, save space storage, but also are shorter and clearer at the code logic level.
TABLE 1
TABLE 2
As shown in Table 2, the total memory space after reconstruction is saved by 600M. When the number of instruction modules in the mirror image is large and the number of the mirror images is large, the multiplexing possibility is high, and therefore more storage space can be saved.
Further, the storage sequence of the scattered instruction modules in the mirror image is reconstructed according to the stability of the scattered instruction modules, and the scattered instruction modules with high stability are stored at the bottom layer of the mirror image, wherein the scattered instruction modules are in the mirror image and comprise instruction modules outside the multiplexing mirror image.
The stability of the scattered instruction module can be determined according to the modification frequency of the scattered instruction module, and a higher modification frequency indicates a lower stability of the instruction module.
On the basis of reconstructing the mirror image, the storage sequence of the instruction modules can be reasonably arranged to reduce the cost of mirror image modification as much as possible. When the Docker constructs the mirror image through the Dockerfile, the corresponding hierarchy of each instruction module is cached, so that the characteristic can be fully utilized. In addition to the reusable instruction modules, the stability of the remaining scattered instruction modules (i.e., the instruction modules not included in the called reuse image) can be evaluated, for example, the stability of the instruction modules is worse when the modification frequency of the instruction modules is used as the stability evaluation index and the instruction modules that are modified more frequently represent higher modification cost. The unrepeated instruction modules are ordered according to stability, with the more stable modules having a lower level in the Docker image. If the mirror image is reconstructed after the instruction module with the higher level in the mirror image is modified in the Dockerfile, at the moment, the instruction module without modification can directly utilize the cache due to the lower level, and repeated construction is not needed, so that the time for constructing the mirror image can be saved. For example, for the image C in fig. 2-2, it is assumed that the command module a includes a file frequently modified, and the command module C includes only some operations for installing software packages, and the storage locations of the command modules a and C may be exchanged, and the command module C is placed at the highest level of the image C. The Dockerfile pseudo-code before and after the reconstructed image C is shown in Table 3.
TABLE 3
When the file in the instruction module a needs to be updated, the software package in the instruction module c does not need to be updated, so that the cache constructed last time can be directly utilized, and only the part of the instruction module a is reconstructed.
Fig. 3 is a schematic diagram of a main part of a module-based image reconstruction apparatus 300 according to an embodiment of the present invention, as shown in fig. 3:
the embodiment of the invention takes a mirror image based on Docker as an example.
The module unit 301 is configured to modularize instructions in the mirror image to form one or more instruction modules, where the one or more instruction modules are independent of each other; the Docker file comprises a plurality of instructions and has the function of constructing an environment required by the operation of a Docker mirror image. For each image, the overall environment is divided into different modules (i.e., instruction modules) which are implemented by different instructions.
A weighting unit 302, configured to determine a weight of the instruction module according to the number of times the instruction module is repeated in the mirror image and a storage space occupied by the instruction module; the larger the weight of the instruction module is, the more the instruction module is repeated, the larger the occupied storage space is.
Each mirror image is divided into a plurality of instruction modules, and the repeated instruction modules and the unique instruction modules are contained among the mirror images. The sizes of the spaces occupied by the instruction modules which are independent from each other in the mirror images of the hierarchical storage are different. Counting the repetition times of the instruction modules and the size of the space occupied by the instruction modules, and taking the product of the repetition times and the size of the space occupied by the instruction modules as the weight of each instruction module. Fig. 2-1 is a schematic diagram of respective module compositions of four image files A, B, C, D, where the instruction modules are { a, b, c, d }, the occurrence times are {4, 3, 2, 1}, and the occupied storage space sizes are {100M,200M,150M, 350M }, respectively. The weight of each instruction block is calculated to be {4 x 100, 3 x 200, 2 x 150, 350 x 1}, and finally to be {400, 600, 300, 350 }.
A sorting unit 303, configured to sort the plurality of one or more instruction modules according to the weight; for example, after the instruction blocks { a, b, c, d } in fig. 2-1 are sorted according to the weights from large to small, the sorting result is { b, a, d, c }.
A reconstructing unit 304, configured to reconstruct, in the mirror image, a storage order of the instruction modules according to the sorting result, so as to form a reconstructed mirror image, where the instruction modules with large weight values are stored in a bottom layer of the reconstructed mirror image. According to the composition of the instruction modules of each mirror image, the storage sequence of the instruction modules is rearranged in the mirror image according to the sequencing result obtained in the step S103. Because the instruction modules are arranged according to the weight, the instruction modules which occupy larger space and have more repetition times can be positioned at the lower layer of each mirror image to the greatest extent, so that the mirror image storage logic is clearer and the modification cost is lower.
As shown in fig. 2-2, which is a schematic diagram of the memory order of the instruction modules in the mirror image of fig. 2-1 according to the weighted order, it can be seen that the instruction module b is located at the bottom layer of the mirror images A, B and D, respectively, because the instruction module b has the largest weight.
The apparatus 300 may further comprise: and the merging unit is used for merging the instruction modules with the dependency relationship if the dependency relationship exists between the instruction modules. Since the instruction modules may be independent of each other, there may also be a dependency relationship (e.g., the instruction module a needs to wait for the instruction module C to output a result). The dependency relationship between the instruction modules can be eliminated by incorporating them into one instruction module.
The apparatus 300 may further comprise: and the manufacturing unit is used for selecting the instruction module with the repeated sequence from the reconstructed mirror image to manufacture the multiplexing mirror image. Wherein, the repeated sequence means that the storage sequence of the repeated instruction modules is also the same. For example, as shown in fig. 2-2, since the instruction blocks having the repeated sequence are { B, a } and { a, C }, the images B and/or C can be directly multiplexed as a multiplexing block. For example, the mirror B is used as a multiplexing mirror, so the mirror A and the mirror D can directly multiplex the mirror B. Assuming that A, B, C, D the four images are all image-base based images, the Dockerfile before and after reconstruction is shown in Table 1, and the image A and the image D not only multiplex the image B, save space storage, but also are shorter and clearer at the code logic level.
As shown in Table 2, the total memory space after reconstruction is saved by 600M. When the number of instruction modules in the mirror image is large and the number of the mirror images is large, the multiplexing possibility is high, and therefore more storage space can be saved.
The apparatus 300 may further comprise: and the calling unit is used for calling (Run) the multiplexing mirror image by using an FROM instruction of Dockerfile.
The reconstructing unit 304 is further configured to reconstruct a storage order of the scattered instruction modules in the mirror according to stability of the scattered instruction modules, where the scattered instruction modules with high stability are stored at a bottom layer of the mirror, and the scattered instruction modules are in the mirror and include instruction modules outside the multiplexed mirror.
The weighting unit 302 is further configured to determine the stability of the scatter instruction module according to the modification frequency of the scatter instruction module.
On the basis of reconstructing the mirror image, the storage sequence of the instruction modules can be reasonably arranged to reduce the cost of mirror image modification as much as possible. When the Docker constructs the mirror image through the Dockerfile, the corresponding hierarchy of each instruction module is cached, so that the characteristic can be fully utilized. In addition to the reusable instruction modules, the stability of the remaining scattered instruction modules (i.e., the instruction modules not included in the called reuse image) can be evaluated, for example, the stability of the instruction modules is worse when the modification frequency of the instruction modules is used as the stability evaluation index and the instruction modules that are modified more frequently represent higher modification cost. The unrepeated instruction modules are ordered according to stability, with the more stable modules having a lower level in the Docker image. If the mirror image is reconstructed after the instruction module with the higher level in the mirror image is modified in the Dockerfile, at the moment, the instruction module without modification can directly utilize the cache due to the lower level, and repeated construction is not needed, so that the time for constructing the mirror image can be saved. For example, for the image C in fig. 2-2, it is assumed that the command module a includes a file frequently modified, and the command module C includes only some operations for installing software packages, and the storage locations of the command modules a and C may be exchanged, and the command module C is placed at the highest level of the image C. When the file in the instruction module a needs to be updated, since the software package in the instruction module C does not need to be updated, the cache constructed last time is directly utilized, only the instruction module a is partially reconstructed, and the Dockerfile pseudo-codes before and after the reconstructed mirror image C are shown in table 3.
Fig. 4 illustrates an exemplary system architecture 400 of a module-based image reconstruction method or a module-based image reconstruction apparatus to which embodiments of the present invention may be applied.
As shown in fig. 4, the system architecture 400 may include terminal devices 401, 402, 403, a network 404, and a server 405. The network 404 serves as a medium for providing communication links between the terminal devices 401, 402, 403 and the server 405. Network 404 may include various types of connections, such as wire, wireless communication links, or fiber optic cables, to name a few.
A user may use terminal devices 401, 402, 403 to interact with a server 405 over a network 404 to receive or send messages or the like.
The terminal devices 401, 402, 403 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop portable computers, desktop computers, and the like.
The server 405 may be a server providing various services, such as a background management server providing support for users using the terminal devices 401, 402, 403. The background management server can analyze and process the received data such as the product information inquiry request and feed back the processing result to the terminal equipment.
It should be noted that, the module-based image reconstruction method provided by the embodiment of the present invention is generally executed by the server 405, and accordingly, a module-based image reconstruction apparatus is generally disposed in the server 405.
It should be understood that the number of terminal devices, networks, and servers in fig. 4 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
FIG. 5 is a block diagram of a computer system 500 suitable for implementing a terminal device of an embodiment of the invention. The terminal device shown in fig. 5 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present invention.
As shown in fig. 5, the computer system 500 includes a Central Processing Unit (CPU)501 that can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM)502 or a program loaded from a storage section 508 into a Random Access Memory (RAM) 503. In the RAM 503, various programs and data necessary for the operation of the system 500 are also stored. The CPU 501, ROM 502, and RAM 503 are connected to each other via a bus 504. An input/output (I/O) interface 505 is also connected to bus 504.
The following components are connected to the I/O interface 505: an input portion 506 including a keyboard, a mouse, and the like; an output portion 507 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage portion 508 including a hard disk and the like; and a communication section 509 including a network interface card such as a LAN card, a modem, or the like. The communication section 509 performs communication processing via a network such as the internet. The driver 510 is also connected to the I/O interface 505 as necessary. A removable medium 511 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 510 as necessary, so that a computer program read out therefrom is mounted into the storage section 508 as necessary.
In particular, the processes described in the above step diagrams may be implemented as computer software programs, according to embodiments of the present disclosure. For example, the disclosed embodiments of the invention include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the step diagrams. In such an embodiment, the computer program may be downloaded and installed from a network through the communication section 509, and/or installed from the removable medium 511. The computer program performs the above-described functions defined in the system of the present invention when executed by the Central Processing Unit (CPU) 501.
It should be noted that the computer readable media shown in the present invention include computer readable signal media or computer readable storage media, or any combination of the two. A computer readable storage medium includes, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, semiconductor system, apparatus, or device, or any combination of the foregoing. Computer-readable storage media specifically include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any combination of the foregoing. In the present invention, a computer readable storage medium includes any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device; a computer readable signal medium includes a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave, which may take many forms, including, but not limited to, electromagnetic signals, optical signals, or any combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF (radio frequency), etc., or any combination of the preceding.
The block diagrams or step diagrams in the figures, which illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention, may each represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or step diagrams, and combinations of blocks in the block diagrams or step diagrams, can be implemented by special purpose hardware-based systems that perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The modules or units described in the embodiments of the present invention may be implemented by software, or may be implemented by hardware. The described modules or units may also be provided in a processor, and may be described as: a processor includes a module unit, a weighting unit, an ordering unit, and a reconstruction unit. Where the names of such modules or units do not in some cases constitute a limitation on the module or unit itself, for example, a module unit may also be described as a "unit for modularizing instructions in a mirror image, forming one or more instruction modules".
On the other hand, the embodiment of the present invention also provides a computer-readable medium, which may be included in the apparatus described in the above embodiment; or may be separate and not incorporated into the device. The computer readable medium carries one or more programs which, when executed by a device, cause the device to comprise: modularizing the instructions in the mirror image to form one or more instruction modules, wherein the one or more instruction modules are independent of each other; determining the weight of the instruction module according to the repeated times of the instruction module in the mirror image and the storage space occupied by the instruction module; ordering the one or more instruction modules according to the weights; and reconstructing the storage sequence of the instruction modules in the mirror image according to the sequencing result to form a reconstructed mirror image, wherein the instruction modules with large weight values are stored at the bottom layer of the reconstructed mirror image.
According to the technical scheme of the embodiment of the invention, the technical means of reconstructing the mirror image after modularizing the instruction is adopted, so that the technical problems of disordered instruction storage logic and high modification cost in the existing mirror image are solved, and the technical effects of simplifying the instruction storage logic in the mirror image and reducing the modification cost are further achieved.
The above-described embodiments should not be construed as limiting the scope of the invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions can occur, depending on design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims (16)
1. A method for reconstructing a mirror image based on a module is characterized by comprising the following steps:
modularizing the instructions in the mirror image to form one or more instruction modules, wherein the one or more instruction modules are independent of each other;
determining the weight of the instruction module according to the repeated times of the instruction module in the mirror image and the storage space occupied by the instruction module;
ordering the one or more instruction modules according to the weights;
and reconstructing the storage sequence of the instruction modules in the mirror image according to the sequencing result to form a reconstructed mirror image, wherein the instruction modules with large weight values are stored at the bottom layer of the reconstructed mirror image.
2. The method according to claim 1, wherein if there is a dependency relationship between the instruction modules, merging the instruction modules having the dependency relationship.
3. The method of claim 1, wherein the mirroring is Docker-based mirroring.
4. The method of claim 1, wherein a command module with a repeating sequence is selected from the reconstructed images to produce a multiplexed image.
5. The method of claim 4, wherein the multiplexed image is invoked using a FROM instruction of Dockerfile.
6. The method according to claim 4, wherein the storage order of the scattered instruction modules in the mirror is reconstructed according to the stability of the scattered instruction modules, and the scattered instruction modules with high stability are stored at the bottom layer of the mirror, wherein the scattered instruction modules are in the mirror and comprise instruction modules outside the multiplexing mirror.
7. The method of claim 6, wherein the stability of the scatter instruction module is determined based on a modified frequency of the scatter instruction module.
8. A module-based image reconstruction apparatus, comprising:
the module unit is used for modularizing the instructions in the mirror image to form one or more instruction modules, wherein the one or more instruction modules are mutually independent;
the weighting unit is used for determining the weight of the instruction module according to the repeated times of the instruction module in the mirror image and the storage space occupied by the instruction module;
the sequencing unit is used for sequencing the one or more instruction modules according to the weight;
and the reconstruction unit is used for reconstructing the storage sequence of the instruction modules in the mirror image according to the sequencing result to form a reconstructed mirror image, wherein the instruction modules with large weight values are stored at the bottom layer of the reconstructed mirror image.
9. The apparatus of claim 8, further comprising:
and the merging unit is used for merging the instruction modules with the dependency relationship if the dependency relationship exists between the instruction modules.
10. The apparatus of claim 8, wherein the mirror image is a Docker-based mirror image.
11. The apparatus of claim 8, further comprising:
and the manufacturing unit is used for selecting the instruction module with the repeated sequence from the reconstructed mirror image to manufacture the multiplexing mirror image.
12. The apparatus of claim 11, further comprising:
and the calling unit is used for calling the multiplexing mirror image by using an FROM instruction of Dockerfile.
13. The apparatus according to claim 11, wherein the reconstructing unit is further configured to reconstruct a storage order of the scattered instruction modules in the mirror according to stability of the scattered instruction modules, the scattered instruction modules with high stability being stored at a bottom layer of the mirror, wherein the scattered instruction modules are instruction modules included in the mirror and outside the multiplexing mirror.
14. The apparatus of claim 13, wherein the weighting unit is further configured to determine the stability of the scatter instruction module based on a modification frequency of the scatter instruction module.
15. An electronic device, comprising:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the method of any one of claims 1-7.
16. A computer-readable medium, on which a computer program is stored, which, when being executed by one or more processors, carries out the method according to any one of claims 1-7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910202767.5A CN111723051A (en) | 2019-03-18 | 2019-03-18 | Mirror image reconstruction method and device based on module |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910202767.5A CN111723051A (en) | 2019-03-18 | 2019-03-18 | Mirror image reconstruction method and device based on module |
Publications (1)
Publication Number | Publication Date |
---|---|
CN111723051A true CN111723051A (en) | 2020-09-29 |
Family
ID=72563017
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910202767.5A Pending CN111723051A (en) | 2019-03-18 | 2019-03-18 | Mirror image reconstruction method and device based on module |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111723051A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114780820A (en) * | 2022-04-28 | 2022-07-22 | 广州高专资讯科技有限公司 | Open source platform-based target matching system and method |
-
2019
- 2019-03-18 CN CN201910202767.5A patent/CN111723051A/en active Pending
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114780820A (en) * | 2022-04-28 | 2022-07-22 | 广州高专资讯科技有限公司 | Open source platform-based target matching system and method |
CN114780820B (en) * | 2022-04-28 | 2022-11-01 | 广州高专资讯科技有限公司 | Open source platform-based target matching system and method |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109189835A (en) | The method and apparatus of the wide table of data are generated in real time | |
CN110109659A (en) | A kind of system that realizing front end applications scaffold and server | |
CN109032796B (en) | Data processing method and device | |
CN107832143B (en) | Method and device for processing physical machine resources | |
US10810220B2 (en) | Platform and software framework for data intensive applications in the cloud | |
CN110019062A (en) | Method of data synchronization and system | |
CN110019123A (en) | A kind of data migration method and device | |
CN110706093A (en) | Accounting processing method and device | |
CN113760251A (en) | Form development method and device based on Vue | |
CN113495779A (en) | Task scheduling method and device and task execution system | |
CN112612467A (en) | Method and device for processing micro front-end architecture based on qiankun | |
CN110489158B (en) | Method, device, medium and electronic equipment for optimizing code hosting platform | |
CN117609226A (en) | Information stream data storage method and device, electronic equipment and readable medium | |
CN111723051A (en) | Mirror image reconstruction method and device based on module | |
CN110807058B (en) | Method and system for exporting data | |
CN111694670A (en) | Resource allocation method, device, equipment and computer readable medium | |
CN113127430A (en) | Mirror image information processing method and device, computer readable medium and electronic equipment | |
CN113391882B (en) | Virtual machine memory management method and device, storage medium and electronic equipment | |
CN111753226A (en) | Page loading method and device | |
CN113778659B (en) | Multithreading processing method and device | |
EP3872630A2 (en) | Request processing method and apparatus, electronic device, and computer storage medium | |
CN110019525A (en) | A kind of method and apparatus of data-base capacity-enlarging | |
CN114237902A (en) | Service deployment method and device, electronic equipment and computer readable medium | |
CN114169733A (en) | Resource allocation method and device | |
US20120023222A1 (en) | Moving deployment of images between computers |
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 |