Hot deployment method and device

Through the hot deployment method, the code debugging steps in automated deployment are simplified, and the modified code can be quickly applied to the running virtual machine in the test environment, which improves deployment efficiency and saves resources.

CN119336445APending Publication Date: 2025-01-21JD DIGITS HAIYI INFORMATION TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411364653.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-27
Publication Date
2025-01-21

AI Technical Summary

Technical Problem

Existing automated deployment methods require adding log code during code debugging and verification, resulting in meaningless submission records. When pulling and uploading code, the original process needs to be stopped due to dependencies, which wastes resources and time.

Method used

Provide a heat deployment method. By obtaining the start -up file package and the modified code file, it is compressed to a compressed package and uploads it to the target machine. Make the target virtual machine heat deployment based on code files.

Benefits of technology

It simplifies the code debugging steps, quickly applies the modified code to the running virtual machine, improves deployment efficiency, saves time and resources, and realizes batch replacement of code files.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119336445A_ABST
    Figure CN119336445A_ABST
Patent Text Reader

Abstract

The invention discloses a hot deployment method and device, and relates to the technical field of computers. A specific embodiment of the method comprises the steps of obtaining a starting file package and a modified code file, and compressing the starting file package and the code file into a compressed package; obtaining a target machine identifier and a target virtual machine identifier corresponding to the compressed packet, and sending the compressed packet to a target machine corresponding to the target machine identifier, so that the target machine decompresses the compressed packet; and sending the decompressed proxy running file package to a target virtual machine corresponding to the target virtual machine identifier, so that the proxy running file package is subjected to instrumentation operation on the target virtual machine, and the target virtual machine is subjected to hot deployment based on the code file. According to the implementation mode, the code debugging step during automatic deployment is simplified, the modified code can be quickly acted on the running virtual machine in the test environment, the deployment efficiency is improved, and time and resources are saved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a hot deployment method and device. Background Art

[0002] Currently, when deploying automatically, a machine needs to pull the code from the repository, then compile it and package it, upload it to the target machine, and start the deployment. However, when debugging remote code or verifying modified code, log code needs to be added to the code, which provides meaningless submission records to the code repository. In addition, when pulling the code from the repository, the entire project will be pulled because there may be dependencies between multiple packages. After packaging, the entire package needs to be uploaded, and the original process needs to be stopped before starting the uploaded package, resulting in a waste of resources and time. Summary of the invention

[0003] In view of this, an embodiment of the present invention provides a hot deployment method and device, which can simplify the steps of code debugging during automated deployment, and can quickly apply the modified code to a running virtual machine in a test environment, thereby improving deployment efficiency and saving deployment time and resources.

[0004] To achieve the above object, according to one aspect of an embodiment of the present invention, a hot deployment method is provided, comprising:

[0005] Obtaining a startup file package and a modified code file, and compressing the startup file package and the code file into a compressed package, wherein the startup file package includes an agent operation file package for plugging;

[0006] Obtaining a target machine identifier and a target virtual machine identifier corresponding to the compressed package, and sending the compressed package to a target machine corresponding to the target machine identifier, so that the target machine decompresses the compressed package;

[0007] The decompressed agent execution file package is sent to the target virtual machine corresponding to the target virtual machine identifier, so that the agent execution file package is plugged in the target virtual machine, thereby enabling the target virtual machine to be hot-deployed based on the code file.

[0008] Optionally, sending the decompressed proxy execution file package to a target virtual machine corresponding to the target virtual machine identifier includes:

[0009] Start the startup file package and execute the entry method in the startup file package;

[0010] Get the full path name of the class corresponding to the code file;

[0011] According to the entry method, the target virtual machine identifier and the full path name of the class, the decompressed proxy execution file package is sent to the target virtual machine.

[0012] Optionally, according to the entry method, the target virtual machine identifier and the full path name of the class, sending the decompressed proxy execution file package to the target virtual machine includes:

[0013] Obtaining the path of the code file according to the full path name of the class and the entry method;

[0014] storing the full path name of the class and the path of the code file into the agent running file package to update the agent running file package;

[0015] The updated proxy operation file package is sent to the target virtual machine corresponding to the target virtual machine identifier.

[0016] Optionally, starting the startup file package includes:

[0017] Creating a virtual machine corresponding to the startup file package, and obtaining a current user identifier corresponding to the virtual machine;

[0018] Obtaining a startup user identifier corresponding to the target virtual machine;

[0019] Switching the current user ID to the startup user ID;

[0020] The startup file package is started using the startup user identifier.

[0021] Optionally, the updated agent operation file package includes a converter, so that the agent operation file package performs an instrumentation operation on the target virtual machine, including:

[0022] Execute the proxy entry method in the updated proxy running file package, use the proxy entry method to traverse all loaded classes, and obtain the class file corresponding to the code file according to the full path name of the class;

[0023] Obtaining the path of the code file corresponding to the class file from the converter;

[0024] Acquire the code file according to the path of the code file;

[0025] The full path name of the class is passed into the converter to obtain the code file returned by the converter.

[0026] Optionally, before obtaining the path of the code file corresponding to the class file from the converter, the method further includes:

[0027] Constructing the converter and adding the converter to a converter list of a tool object of the target virtual machine, wherein the converter includes a map attribute;

[0028] The full path name of the class and the path of the code file are stored in the map attribute in the form of key-value pairs.

[0029] Optionally, the converter further includes a switch attribute, and before obtaining the path of the code file corresponding to the class file from the converter, the method further includes: determining that the switch attribute is in an on state;

[0030] After the target virtual machine is hot deployed based on the code file, the method further includes: setting the switch attribute to a closed state, and clearing the key-value pairs stored in the map attribute.

[0031] According to another aspect of an embodiment of the present invention, a hot deployment device is provided, comprising:

[0032] An acquisition module acquires a startup file package and a modified code file, and compresses the startup file package and the code file into a compressed package, wherein the startup file package includes an agent operation file package for plugging;

[0033] The uploading module obtains the target machine identifier and the target virtual machine identifier corresponding to the compressed package, and sends the compressed package to the target machine corresponding to the target machine identifier, so that the target machine decompresses the compressed package;

[0034] The hot deployment module sends the decompressed agent operation file package to the target virtual machine corresponding to the target virtual machine identifier, so that the agent operation file package is inserted on the target virtual machine, thereby enabling the target virtual machine to be hot deployed based on the code file.

[0035] According to another aspect of an embodiment of the present invention, there is provided an electronic device, including:

[0036] one or more processors;

[0037] a storage device for storing one or more programs,

[0038] When the one or more programs are executed by the one or more processors, the one or more processors implement the hot deployment method provided by the present invention.

[0039] According to another aspect of an embodiment of the present invention, a computer-readable medium is provided, on which a computer program is stored. When the program is executed by a processor, the hot deployment method provided by the present invention is implemented.

[0040] An embodiment of the above invention has the following advantages or beneficial effects: the hot deployment method of the embodiment of the present invention obtains the startup file package and the modified code file, and compresses the startup file package and the code file into a compressed package; obtains the target machine identifier and the target virtual machine identifier, uploads the compressed package to the target machine, so that the target machine decompresses the compressed package; sends the decompressed proxy operation file package to the target virtual machine, so that the proxy operation file package performs the plugging operation on the target virtual machine, so that the target virtual machine is hot deployed based on the code file. This method simplifies the steps of code debugging in the context of automated deployment, can quickly apply the modified code to the running virtual machine in a test environment, without stopping the process, and realizes batch replacement of code files, thereby improving deployment efficiency and saving time and resources.

[0041] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with the specific implementation manner. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention.

[0043] Figure 1 is a schematic diagram of the main process of a hot deployment method according to an embodiment of the present invention;

[0044] Figure 2 is a schematic diagram of the structure of a compression package according to an embodiment of the present invention;

[0045] Figure 3 is a schematic diagram of a startup process of a startup file package according to an embodiment of the present invention;

[0046] Figure 4 It is a flowchart of a remote hot deployment method according to an embodiment of the present invention;

[0047] Figure 5 is a flow chart of a hot deployment method according to an embodiment of the present invention;

[0048] Figure 6 is a schematic diagram of main modules of a hot deployment device according to an embodiment of the present invention;

[0049] Figure 7 is an exemplary system architecture diagram to which embodiments of the present invention may be applied;

[0050] Figure 8 It is a schematic diagram of the structure of a computer system of a terminal device or a server suitable for implementing an embodiment of the present invention. DETAILED DESCRIPTION

[0051] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.

[0052] Figure 1 is a schematic diagram of the main process of a hot deployment method according to an embodiment of the present invention, such as Figure 1 As shown, the hot deployment method includes the following steps:

[0053] Step S101: obtaining a startup file package and a modified code file, and compressing the startup file package and the code file into a compressed package, wherein the startup file package includes an agent operation file package for plugging;

[0054] Step S102: obtaining a target machine identifier and a target virtual machine identifier corresponding to the compressed package, and sending the compressed package to a target machine corresponding to the target machine identifier, so that the target machine decompresses the compressed package;

[0055] Step S103: sending the decompressed proxy execution file package to the target virtual machine corresponding to the target virtual machine identifier, so that the proxy execution file package is inserted on the target virtual machine, thereby enabling the target virtual machine to be hot-deployed based on the code file.

[0056] In an embodiment of the present invention, the hot deployment method is used to replace the class file on the virtual machine of the remote machine with the modified code file of the local machine to achieve efficient hot deployment. In the hot deployment method, first, the startup file including the modified code file is obtained in the local machine, wherein the modified code file can be a bytecode file compiled from the class file to be modified; the startup file package (such as agent-starter.jar) includes an agent running file package (such as agent-runtime.jar) for plugging, and plugging, such as java plugging, refers to the technology of dynamically inserting additional operations during the execution of Java bytecode. This technology is usually used to monitor, analyze, debug and modify the behavior of an application without changing the source code. Plug-in can be performed at compile time, load time or runtime. That is, the agent running file package can be used to dynamically insert the modified code file during the execution of java bytecode to achieve hot deployment of code.

[0057] Among them, the startup file package also includes tool dependency packages, such as tools.jar, which is part of the Java Development Kit (JDK) and contains some tools and libraries that are very important for developing and executing Java applications. The tool dependency package can provide a java virtual machine tool interface for running the relevant code of the startup file package on the jre environment. Generally, the jre environment is installed on the machine, so when running the startup file package, the tool dependency package needs to be encapsulated in the startup file package as a dependency. Among them, the tool dependency package can be distinguished according to the operating system of the machine, and different operating systems correspond to different tool dependency packages. In addition, before the agent running file package is sent to the target machine by executing the attach method, it is also necessary to load the virtual machine-related modules so that the virtual machine-related methods can be used.

[0058] like Figure 2 The figure shows a schematic diagram of the structure of a zip package of an embodiment of the present invention, wherein the proxy operation file package is used for the jar package of the plug-in, including a conversion logic implementation class, which is used to define a converter, including a switch attribute and a map attribute, and the proxy operation file package and the tool class dependency package constitute a startup file package; the code file to be modified is compiled to obtain a compiled code file; the startup file package and the compiled code file are compressed to obtain a compressed package, i.e., a zip package.

[0059] After obtaining the startup file package and the modified code file, place the startup file package and the modified code file package in the same directory, and then compress the startup file package and the code file package to obtain a compressed package; then obtain the target machine identifier and the target virtual machine identifier, and send the compressed package to the remote target machine corresponding to the target machine identifier. The target virtual machine runs on the target machine. The target virtual machine is the target JVM (Java Virtual Machine), which is a process running on the target machine. Specifically, the compressed package can be uploaded to the target machine directly, or it can be uploaded to the target machine through a jump machine. For example, the compressed package can be uploaded to the jump machine, and then the jump machine uploads the compressed package to the target machine. The jump machine can be an SSH machine.

[0060] The target machine can decompress the compressed package to obtain the startup file package and the modified code file, and the startup file package includes the agent running file package and the tool class dependency package. Among them, the target machine identifier can be pre-configured through a shell script. The target virtual machine identifier can be the process number of the target virtual machine. To obtain the target virtual machine identifier corresponding to the compressed package, it can be to obtain the port number of the target virtual machine, such as from a shell script, and then query the process number (pid) corresponding to the port number through netstate (a command for querying port information) according to the port number of the target virtual machine. This is because the process number changes after each startup, and the corresponding process number can be obtained by querying through the port number, and the port number is simpler and easier to remember than the process number.

[0061] In an embodiment of the present invention, sending the decompressed proxy execution file package to a target virtual machine corresponding to the target virtual machine identifier includes:

[0062] Start the startup file package and execute the entry method in the startup file package;

[0063] Get the full path name of the class corresponding to the code file;

[0064] According to the entry method, the target virtual machine identifier and the full path name of the class, the decompressed agent running file package is sent to the target virtual machine.

[0065] Specifically, the startup file package also includes an entry method, such as a main method. To start the startup file package, the tool dependency package can be used to execute the entry method in a jre (java runtime environment) environment. The full path name of the class to be replaced and the target virtual machine identifier are passed in the entry method, so that the decompressed proxy running file package can be sent to the target virtual machine.

[0066] In an embodiment of the present invention, according to the entry method, the target virtual machine identifier and the full path name of the class, the decompressed proxy execution file package is sent to the target virtual machine, including:

[0067] Get the path of the code file based on the full path name of the class and the entry method;

[0068] Store the full path name of the class and the path of the code file into the agent running file package to update the agent running file package;

[0069] The updated agent operation file package is sent to the target virtual machine corresponding to the target virtual machine identifier.

[0070] In an embodiment of the present invention, when the decompressed proxy running file package is sent to the target virtual machine corresponding to the target virtual machine identifier, the full path name of the class to be replaced is passed in the entry method, and the entry method can obtain the path of the code file through the full path name of the class. This is because the decompressed code file and the startup file package are in the same directory; then the path of the code file and the full path name of the class are passed to the proxy running file package to update the proxy running file package, and then the updated proxy running file package is sent to the target virtual machine.

[0071] In an embodiment of the present invention, the startup file package includes:

[0072] Create a virtual machine corresponding to the startup file package, and obtain the current user ID corresponding to the virtual machine;

[0073] Obtain the startup user ID corresponding to the target virtual machine;

[0074] Switch the current user ID to the startup user ID;

[0075] Launch the boot file package using the boot user ID.

[0076] In an embodiment of the present invention, after the target machine decompresses the compressed package to obtain the startup file package and the code file, it is necessary to start or run the startup file package to execute the entry method in the startup file package. When starting the startup file package, a virtual machine corresponding to the startup file package is created in advance, and the current user ID corresponding to the virtual machine is obtained; the startup user ID corresponding to the target virtual machine is obtained, and the current user ID is switched to the startup user ID of the target virtual machine, thereby replacing the current user ID of the virtual machine with the startup user ID to realize the startup of the startup file package. After the startup file package is started, the updated proxy operation file package is sent to the target virtual machine. After the sending is completed, the virtual machine is switched from the startup user ID back to the current user ID, and the uploaded compressed package is deleted. Thus, running the startup file package can realize the execution of the entry method in the startup file package, and the full path name of the class and the path of the code file are sent to the proxy operation file package by using the entry method, and the proxy operation file package is updated, and the updated proxy operation file package is sent to the target virtual machine through the process number of the target virtual machine.

[0077] For example, Figure 3 As shown, after uploading the compressed package (zip package) of the local machine to the target machine, the compressed package is decompressed by the target machine to obtain the startup file package and the code file. According to the port number of the target virtual machine, the process number and the startup user of the target virtual machine are queried, the current user of the startup file package is switched to the startup user of the target virtual machine, the startup file package is started by the startup user, and after the startup is completed, the current user is switched back to delete the uploaded compressed package.

[0078] In an embodiment of the present invention, the updated proxy operation file package includes a converter, so that the proxy operation file package performs a plug-in operation on the target virtual machine, including: executing the proxy entry method in the updated proxy operation file package, using the proxy entry method to traverse all loaded classes, and obtaining the class file corresponding to the code file according to the full path name of the class; obtaining the path of the code file corresponding to the class file from the converter; obtaining the code file according to the path of the code file; passing the full path name of the class into the converter to obtain the code file returned by the converter.

[0079] In an embodiment of the present invention, after the decompressed agent operation file package is sent to the target virtual machine, the agent operation file package can be plugged in on the target virtual machine to implement hot deployment of the code file. Specifically, the updated agent operation file package includes a converter, through which the plugging operation of the agent operation file package can be implemented. After the agent operation file package is sent to the target virtual machine, the target virtual machine runs the agent entry method (such as the agentmain method) therein, uses the agent entry method to traverse all loaded classes, obtains the class file that needs to be replaced, reloads the class file, and uses the converter to process the class file, that is, obtains the path of the code file according to the full path name, obtains the code file according to the path of the code file, returns the code file, and implements reloading. Among them, the agent operation file package includes the implementation of the agentmain method, and the corresponding attribute is specified as the class that implements the agentmain method in the manifest, so that the agent operation file package can be used for the plugging operation.

[0080] In the embodiment of the present invention, before obtaining the path of the code file corresponding to the class file from the converter, the method further includes:

[0081] Construct a converter and add the converter to the converter list of the tool object of the target virtual machine. The converter includes a map attribute.

[0082] Store the full path name of the class and the path of the code file in the map attribute as a key-value pair.

[0083] In an embodiment of the present invention, an instrumentation object, i.e., a tool object, or a plug-in object, is provided in the target virtual machine. The plug-in object includes a converter list for storing converters. All classes that need to be loaded or manually reloaded need to pass through all converters in the converter list. The converter is used to replace the bytecode file that has been loaded, that is, to replace the bytecode file of the class that already exists in the target virtual machine with the modified code file, thereby realizing the replacement of the function. Specifically, firstly, the full path name of the class that needs to be replaced and the path of the code file are obtained, and a converter object is defined. The converter object includes a map attribute, and the full path name of the class and the path of the code file are stored in the code running file package, that is, the full path name of the class and the path of the code file are stored in the map attribute of the converter, and a class file converter object is added to the plug-in object of the target virtual machine, that is, the converter is added to the converter list of the plug-in object, and all loaded classes are traversed to obtain the class file that needs to be replaced, reload, and replace the class file with the code file to realize hot deployment.

[0084] In the embodiment of the present invention, the converter further includes a switch attribute, and before obtaining the path of the code file corresponding to the class file from the converter, it also includes: determining that the switch attribute is in an on state;

[0085] After the target virtual machine is hot deployed based on the code file, the method further includes: setting the switch attribute to a closed state, and clearing the key-value pairs stored in the map attribute.

[0086] In an embodiment of the present invention, after constructing the converter, a converter object is added to the instrumentation object of the target virtual machine, that is, the converter is added to the converter category corresponding to the instrumentation object. The constructed converter also includes a switch attribute. When the switch attribute is in the on state, the full path name and code file of the class to be replaced can be stored in the map attribute as key and value in the form of key-value pairs. If the switch attribute is in the on state, if the full path name of the class has a value in the map attribute, the converter will find the path of the code file corresponding to the value to load the replaced code file and return the code file. When the converter switch attribute is in the off state, the content in the map attribute, that is, the stored key-value pair, is cleared, or the class file converter list in the converter is removed.

[0087] Figure 4The present invention is a flowchart of a remote hot deployment method according to an embodiment of the present invention. The method includes: the input parameters are the process number of the target virtual machine and the full path name of the class to be replaced, and then the compiled code file in the current folder is matched according to the full path name of the class to obtain the path of the code file, and the proxy operation file package is sent to the target virtual machine. The input parameters are the full path name of the class and the path of the code file. After the target virtual machine receives the proxy operation file package, it executes the proxy entry method, and puts the full path name of the class and the path of the code file into the map attribute; creates a new converter, the switch attribute is turned on, the map attribute is assigned to the map of the previous step, and the converter is added to the converter list; traverses all loaded classes, obtains the class file that needs to be replaced, and reloads; uses the newly created class converter and the full path name of the class to obtain the path of the code file, obtains the code file and returns; after all reloading is completed, the switch attribute is turned off, the map assignment is cleared, and the converter is logically set to an invalid state.

[0088] Figure 5 The present invention is a flowchart of a hot deployment method according to an embodiment of the present invention. The local machine codes the ide, directly runs the script from the ide such as idea, compresses the startup file package and the code file compiled by the local machine to obtain a compressed package, uploads the compressed package to the target machine, and decompresses the target machine to obtain the startup file package and the code file. The startup file package includes the agent operation file package, and the startup file package is started to send the agent operation file package to the target virtual machine to perform hot deployment on the target virtual machine, that is, replace the class file to be replaced by the JVMTI technology; or, the compressed package is sent to the target machine through a jump board machine such as an ssh machine.

[0089] The hot deployment method of the embodiment of the present invention obtains the startup file package and the modified code file, and compresses the startup file package and the code file into a compressed package; obtains the target machine identifier and the target virtual machine identifier, and uploads the compressed package to the target machine so that the target machine decompresses the compressed package; sends the decompressed proxy operation file package to the target virtual machine so that the proxy operation file package performs the plugging operation on the target virtual machine, so that the target virtual machine is hot deployed based on the code file. The method compresses the startup file package and the code file and uploads them to the target machine, and after the target machine decompresses them, uploads the decompressed proxy operation file package to the target virtual machine for operation, and uses the target virtual machine and the plugging object to hot replace the code file, thereby realizing hot deployment of the code file; the method simplifies the steps of code debugging in the context of automated deployment, and can quickly apply the modified code to the running virtual machine in a test environment without stopping the process, thereby realizing batch replacement of code files, improving deployment efficiency, and saving time and resources.

[0090] According to another aspect of the embodiment of the present invention, Figure 6 As shown, a hot deployment device 600 is provided, comprising

[0091] The acquisition module 601 acquires a startup file package and a modified code file, and compresses the startup file package and the code file into a compressed package, wherein the startup file package includes an agent operation file package for plugging;

[0092] The upload module 602 obtains the target machine identifier and the target virtual machine identifier corresponding to the compressed package, and sends the compressed package to the target machine corresponding to the target machine identifier, so that the target machine decompresses the compressed package;

[0093] The hot deployment module 603 sends the decompressed agent execution file package to the target virtual machine corresponding to the target virtual machine identifier, so that the agent execution file package is inserted on the target virtual machine, thereby enabling the target virtual machine to be hot deployed based on the code file.

[0094] In an embodiment of the present invention, the hot deployment module 603 is further used to: start the startup file package and execute the entry method in the startup file package; obtain the full path name of the class corresponding to the code file; and send the decompressed proxy running file package to the target virtual machine based on the entry method, the target virtual machine identifier and the full path name of the class.

[0095] In an embodiment of the present invention, the hot deployment module 603 is further used to: obtain the path of the code file according to the full path name of the class and the entry method; store the full path name of the class and the path of the code file in the agent operation file package to update the agent operation file package; and send the updated agent operation file package to the target virtual machine corresponding to the target virtual machine identifier.

[0096] In an embodiment of the present invention, the hot deployment module 603 is further used to: create a virtual machine corresponding to the startup file package and obtain the current user identifier corresponding to the virtual machine; obtain the startup user identifier corresponding to the target virtual machine; switch the current user identifier to the startup user identifier; and use the startup user identifier to start the startup file package.

[0097] In an embodiment of the present invention, the updated proxy operation file package includes a converter, and the hot deployment module 603 is further used to: execute the proxy entry method in the updated proxy operation file package, use the proxy entry method to traverse all loaded classes, and obtain the class file corresponding to the code file according to the full path name of the class; obtain the path of the code file corresponding to the class file from the converter; obtain the code file according to the path of the code file; pass the full path name of the class into the converter to obtain the code file returned by the converter.

[0098] In an embodiment of the present invention, the hot deployment module 603 is also used to build a converter before obtaining the path of the code file corresponding to the class file from the converter, and add the converter to the converter list of the tool object of the target virtual machine. The converter includes a map attribute; the full path name of the class and the path of the code file are stored in the map attribute in the form of a key-value pair.

[0099] In the embodiment of the present invention, the converter further includes a switch attribute, and the hot deployment module 603 is further used to: before obtaining the path of the code file corresponding to the class file from the converter, determine that the switch attribute is in the on state;

[0100] The hot deployment module 603 is further used to: after the target virtual machine is hot deployed based on the code file, set the switch attribute to a closed state and clear the key-value pairs stored in the map attribute.

[0101] According to another aspect of an embodiment of the present invention, an electronic device is provided, comprising: one or more processors; a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the hot deployment method provided by the present invention.

[0102] According to another aspect of an embodiment of the present invention, a computer-readable medium is provided, on which a computer program is stored. When the program is executed by a processor, the hot deployment method provided by the present invention is implemented.

[0103] Figure 7 An exemplary system architecture 700 is shown to which the hot deployment method or hot deployment apparatus according to the embodiment of the present invention can be applied.

[0104] like Figure 7 As shown, system architecture 700 may include terminal devices 701, 702, 703, network 704 and server 705. Network 704 is used to provide a medium for communication links between terminal devices 701, 702, 703 and server 705. Network 704 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.

[0105] The user can use the terminal devices 701, 702, 703 to interact with the server 705 through the network 704 to receive or send messages, etc. Various communication client applications can be installed on the terminal devices 701, 702, 703, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only for example).

[0106] The terminal devices 701 , 702 , and 703 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, and desktop computers.

[0107] The server 705 may be a server that provides various services, such as a backend management server (only an example) that provides support for shopping websites browsed by users using the terminal devices 701, 702, and 703. The backend management server may analyze and process the received data such as product information query requests, and feed back the processing results (such as target push information, product information - only an example) to the terminal device.

[0108] It should be noted that the hot deployment method provided in the embodiment of the present invention is generally executed by the server 705 , and accordingly, the hot deployment device is generally disposed in the server 705 .

[0109] It should be understood that Figure 7 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to the implementation requirements.

[0110] Reference below Figure 8 , which shows a schematic diagram of the structure of a computer system 800 of a terminal device suitable for implementing an embodiment of the present invention. Figure 8 The terminal device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.

[0111] like Figure 8 As shown, the computer system 800 includes a central processing unit (CPU) 801, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 802 or a program loaded from a storage part 808 to a random access memory (RAM) 803. In the RAM 803, various programs and data required for the operation of the system 800 are also stored. The CPU 801, the ROM 802, and the RAM 803 are connected to each other through a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.

[0112] The following components are connected to the I / O interface 805: an input section 806 including a keyboard, a mouse, etc.; an output section 807 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 808 including a hard disk, etc.; and a communication section 809 including a network interface card such as a LAN card, a modem, etc. The communication section 809 performs communication processing via a network such as the Internet. A drive 810 is also connected to the I / O interface 805 as needed. A removable medium 811, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 810 as needed, so that a computer program read therefrom is installed into the storage section 808 as needed.

[0113] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 809, and / or installed from the removable medium 811. When the computer program is executed by the central processing unit (CPU) 801, the above-mentioned functions defined in the system of the present invention are executed.

[0114] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, 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 disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.

[0115] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0116] The modules involved in the embodiments of the present invention may be implemented in software or hardware. The modules described may also be set in a processor. For example, they may be described as: a processor includes an acquisition module, an upload module, and a hot deployment module. The names of these modules do not, in some cases, constitute a limitation on the modules themselves. For example, the acquisition module may also be described as "obtaining a startup file package and a modified code file, and compressing the startup file package and the code file into a compressed package."

[0117] As another aspect, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiment; or it may exist independently without being assembled into the device. The above computer-readable medium carries one or more programs. When the above one or more programs are executed by a device, the device includes: obtaining a startup file package and a modified code file, and compressing the startup file package and the code file into a compressed package, the startup file package includes an agent running file package for plugging; obtaining a target machine identifier and a target virtual machine identifier corresponding to the compressed package, sending the compressed package to the target machine corresponding to the target machine identifier, so that the target machine decompresses the compressed package; sending the decompressed agent running file package to the target virtual machine corresponding to the target virtual machine identifier, so that the agent running file package performs a plugging operation on the target virtual machine, so that the target virtual machine is hot deployed based on the code file.

[0118] According to the technical solution of the embodiment of the present invention, the hot deployment method of the embodiment of the present invention obtains the startup file package and the modified code file, and compresses the startup file package and the code file into a compressed package; obtains the target machine identifier and the target virtual machine identifier, and uploads the compressed package to the target machine so that the target machine decompresses the compressed package; sends the decompressed proxy operation file package to the target virtual machine so that the proxy operation file package performs the plugging operation on the target virtual machine, so that the target virtual machine is hot deployed based on the code file. The method compresses the startup file package and the code file and uploads them to the target machine, and after the target machine decompresses them, uploads the decompressed proxy operation file package to the target virtual machine for operation, and uses the target virtual machine and the plugging object to hot replace the code file, thereby realizing hot deployment of the code file; the method simplifies the steps of code debugging in the context of automated deployment, and can quickly apply the modified code to the running virtual machine in a test environment without stopping the process, thereby realizing batch replacement of code files, improving deployment efficiency, and saving time and resources.

[0119] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A hot deployment method, characterized in that: include: Obtaining a startup file package and a modified code file, and compressing the startup file package and the code file into a compressed package, wherein the startup file package includes an agent operation file package for plugging; Obtaining a target machine identifier and a target virtual machine identifier corresponding to the compressed package, and sending the compressed package to a target machine corresponding to the target machine identifier, so that the target machine decompresses the compressed package; The decompressed agent execution file package is sent to the target virtual machine corresponding to the target virtual machine identifier, so that the agent execution file package performs a plug-in operation on the target virtual machine, thereby enabling the target virtual machine to be hot-deployed based on the code file.

2. The method according to claim 1, characterized in that Sending the decompressed proxy execution file package to the target virtual machine corresponding to the target virtual machine identifier includes: Start the startup file package and execute the entry method in the startup file package; Get the full path name of the class corresponding to the code file; According to the entry method, the target virtual machine identifier and the full path name of the class, the decompressed proxy execution file package is sent to the target virtual machine.

3. The method according to claim 2, characterized in that According to the entry method, the target virtual machine identifier and the full path name of the class, the decompressed proxy execution file package is sent to the target virtual machine, including: Obtaining the path of the code file according to the full path name of the class and the entry method; storing the full path name of the class and the path of the code file into the agent running file package to update the agent running file package; The updated proxy operation file package is sent to the target virtual machine corresponding to the target virtual machine identifier.

4. The method according to claim 2, characterized in that: Starting the startup file package includes: Creating a virtual machine corresponding to the startup file package, and obtaining a current user identifier corresponding to the virtual machine; Obtaining a startup user identifier corresponding to the target virtual machine; Switching the current user ID to the startup user ID; The startup file package is started using the startup user identifier.

5. The method according to claim 2, characterized in that: The updated agent operation file package includes a converter, so that the agent operation file package performs a plug-in operation on the target virtual machine, including: Execute the proxy entry method in the updated proxy running file package, use the proxy entry method to traverse all loaded classes, and obtain the class file corresponding to the code file according to the full path name of the class; Obtaining the path of the code file corresponding to the class file from the converter; Acquire the code file according to the path of the code file; The full path name of the class is passed into the converter to obtain the code file returned by the converter.

6. The method according to claim 5, characterized in that Before obtaining the path of the code file corresponding to the class file from the converter, the method further includes: Constructing the converter and adding the converter to a converter list of a tool object of the target virtual machine, wherein the converter includes a map attribute; The full path name of the class and the path of the code file are stored in the map attribute in the form of key-value pairs.

7. The method according to claim 5, characterized in that The converter further includes a switch attribute, and before obtaining the path of the code file corresponding to the class file from the converter, the method further includes: determining that the switch attribute is in an on state; After the target virtual machine is hot deployed based on the code file, the method further includes: setting the switch attribute to a closed state, and clearing the key-value pairs stored in the map attribute.

8. A hot deployment device, characterized in that: include: An acquisition module acquires a startup file package and a modified code file, and compresses the startup file package and the code file into a compressed package, wherein the startup file package includes an agent operation file package for plugging; The uploading module obtains the target machine identifier and the target virtual machine identifier corresponding to the compressed package, and sends the compressed package to the target machine corresponding to the target machine identifier, so that the target machine decompresses the compressed package; The hot deployment module sends the decompressed agent operation file package to the target virtual machine corresponding to the target virtual machine identifier, so that the agent operation file package is inserted on the target virtual machine, thereby enabling the target virtual machine to be hot deployed based on the code file.

9. An electronic device, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 7.

10. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.