Data hot updating method and device, computer readable storage medium and electronic equipment

By generating a listening tool in the virtual machine to establish communication with it and sending parsing and update request protocols, the problems of low efficiency and memory leaks in existing hot update technologies are solved, and efficient and secure hot updates are achieved.

CN115981779BActive Publication Date: 2026-07-31NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
NETEASE (HANGZHOU) NETWORK CO LTD
Filing Date
2022-12-07
Publication Date
2026-07-31

AI Technical Summary

Technical Problem

Existing hot update methods suffer from memory leak risks and the inability to automatically handle asynchronous method calls, resulting in low efficiency.

Method used

By acquiring the virtual machine's message distribution component to generate a listening tool, communication with the virtual machine is established, a parsing listening request protocol is sent, target parsing data is received, and a data update request protocol is generated based on the script's unique identifier to enable the virtual machine to update the data to be updated.

Benefits of technology

It improves the efficiency of hot update, reduces the risk of memory leaks, and ensures the security and efficiency of the hot update process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115981779B_ABST
    Figure CN115981779B_ABST
Patent Text Reader

Abstract

This disclosure relates to a data hot update method and apparatus, a computer-readable storage medium, and an electronic device, belonging to the field of computer technology. The method includes: acquiring a message distribution component of a virtual machine; generating a listening tool based on the message distribution component; establishing communication with the virtual machine through the listening tool; sending a parsing listening request protocol for data to be updated to the virtual machine; receiving target parsing data associated with the data to be updated based on the parsing listening request protocol; acquiring target update data and a unique script identifier of the parsed data to be updated included in the target parsing data; generating a data update request protocol based on the target update data and the unique script identifier and sending it to the virtual machine, so that the virtual machine updates the data to be updated according to the data update request protocol. This disclosure improves the efficiency of data hot updates.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of computer technology, and more specifically, to a data hot update method, a data hot update apparatus, a computer-readable storage medium, and an electronic device. Background Technology

[0002] In order to create a better gaming experience for users, hot update was required when dealing with server code execution failures. That is, the server is kept running without downtime, and the failure is handled by updating the running code in real time.

[0003] In related technologies, there are two methods to achieve hot updates. In the first method, code references are based on module implementation, so the references between submodules and parent modules can be directly disconnected, the reference cache can be cleared, and new submodules can be re-introduced. In the second method, the dynamic language feature is used to replace the method references that need to be modified with the methods newly loaded into the virtual machine.

[0004] However, the first method carries the risk of memory leaks and cannot automatically handle asynchronous method calls, while the second method has the problem of difficulty in automatically modifying the direction references of already generated objects. Both of these methods result in low efficiency for hot updates.

[0005] Therefore, a new method for hot data updates is needed.

[0006] It should be noted that the information in the background section above is only used to enhance the understanding of the background of the present invention, and therefore may include information that does not constitute prior art known to those skilled in the art. Summary of the Invention

[0007] The purpose of this disclosure is to provide a data hot update method, a data hot update device, a computer-readable storage medium, and an electronic device, thereby overcoming, at least to some extent, the problem of low hot update efficiency caused by the limitations and defects of related technologies.

[0008] According to one aspect of this disclosure, a data hot update method is provided, comprising:

[0009] Obtain the message distribution component of the virtual machine, generate a listening tool based on the message distribution component, and establish communication with the virtual machine through the listening tool;

[0010] Send a parsing listening request protocol for the data to be updated to the virtual machine, and receive target parsing data associated with the data to be updated based on the parsing listening request protocol;

[0011] The system obtains the target update data and the unique script identifier of the data to be updated included in the target parsed data. It then generates a data update request protocol based on the target update data and the unique script identifier and sends it to the virtual machine, so that the virtual machine updates the data to be updated according to the data update request protocol.

[0012] According to one aspect of this disclosure, a data hot update apparatus is provided, comprising:

[0013] A communication establishment module is used to obtain the message distribution component of the virtual machine, generate a listening tool based on the message distribution component, and establish communication with the virtual machine through the listening tool;

[0014] The target parsing data acquisition module is used to send a parsing listening request protocol for the data to be updated to the virtual machine, and to receive target parsing data associated with the data to be updated based on the parsing listening request protocol;

[0015] The data hot update module is used to obtain the target update data and the unique script identifier of the data to be updated included in the target parsed data, generate a data update request protocol based on the target update data and the unique script identifier, and send it to the virtual machine so that the virtual machine updates the data to be updated according to the data update request protocol.

[0016] According to one aspect of this disclosure, a computer storage medium is provided that stores a computer program thereon, which, when executed by a processing unit, implements the data hot update method described in any of the exemplary embodiments above.

[0017] According to one aspect of this disclosure, an electronic device is provided, comprising:

[0018] Processing unit; and

[0019] A storage unit for storing the executable instructions of the processing unit;

[0020] The processing unit is configured to execute the data hot update method described in any of the above exemplary embodiments by executing the executable instructions.

[0021] This disclosure provides a data hot update method, which involves: acquiring a message distribution component of a virtual machine; generating a listening tool based on the message distribution component; establishing communication with the virtual machine through the listening tool; sending a parsing listening request protocol for data to be updated to the virtual machine; receiving target parsing data associated with the data to be updated based on the parsing listening request protocol; acquiring target update data and a unique script identifier of the parsed data to be updated included in the target parsing data; generating a data update request protocol based on the target update data and the unique script identifier and sending it to the virtual machine, so that the virtual machine updates the data to be updated according to the data update request protocol. On the one hand, a listening tool is generated using the virtual machine's message distribution component. This tool establishes communication with the virtual machine and sends a parsing listening request protocol to the virtual machine after communication is established. It receives target parsing data associated with the data to be updated from the virtual machine, determines the unique identifier of the data to be updated within the virtual machine based on the target parsing data, and transmits the target update data to the virtual machine through the unique identifier of the data to be updated within the virtual machine. This allows the virtual machine to replace the data to be updated based on the target update data, thus improving the efficiency of hot updates. On the other hand, the hot update process only involves communication with the virtual machine and does not involve modification of module references or reference relationships, reducing the risk of memory leaks during hot updates.

[0022] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit the invention. Attached Figure Description

[0023] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention. It is obvious that the drawings described below are merely some embodiments of the invention, and those skilled in the art can obtain other drawings based on these drawings without any inventive effort.

[0024] Figure 1 The flowchart illustrates a data hot update method according to an example embodiment of the present disclosure.

[0025] Figure 2 The illustration shows a flowchart of a method for establishing communication with a virtual machine by generating a listening tool based on a message distribution component according to an example embodiment of the present disclosure.

[0026] Figure 3 The flowchart illustrates a data hot update method according to an example embodiment of the present disclosure, prior to establishing communication with the virtual machine via the listening tool.

[0027] Figure 4The illustration shows a flowchart of a method for sending a parsing listening request protocol for data to be updated to a virtual machine, according to an example embodiment of the present disclosure, and receiving target parsing data associated with the data to be updated based on the parsing listening request protocol.

[0028] Figure 5 The flowchart illustrates a method for obtaining target parsed data associated with data to be updated based on parsed data, according to an example embodiment of the present disclosure.

[0029] Figure 6 The flowchart illustrates a method for storing mapping relationships according to an example embodiment of the present disclosure.

[0030] Figure 7 The flowchart illustrates a data hot update method according to an example embodiment of the present disclosure before obtaining target update data and script unique identifier.

[0031] Figure 8 The flowchart illustrates a data hot update method according to an example embodiment of the present disclosure, after receiving data content to be updated corresponding to a unique identifier of a script.

[0032] Figure 9 The flowchart illustrates a method for generating a data update request protocol based on target update data and a script unique identifier and sending it to a virtual machine, according to an example embodiment of the present disclosure.

[0033] Figure 10 The flowchart illustrates a data hot update method according to an example embodiment of the present disclosure, before modifying a method constant corresponding to a script unique identifier.

[0034] Figure 11 The diagram schematically illustrates a data hot update apparatus according to an exemplary embodiment of the present disclosure.

[0035] Figure 12 An electronic device for implementing the above-described data hot update method is illustrated according to an example embodiment of the present disclosure. Detailed Implementation

[0036] Exemplary embodiments will now be described more fully with reference to the accompanying drawings. However, these exemplary embodiments can be implemented in many forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided to make the invention more comprehensive and complete, and to fully convey the concept of the exemplary embodiments to those skilled in the art. The described features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to give a full understanding of embodiments of the invention. However, those skilled in the art will recognize that the technical solutions of the invention may be practiced with one or more of these specific details omitted, or other methods, components, apparatus, steps, etc., may be employed. In other instances, well-known technical solutions are not shown or described in detail to avoid obscuring various aspects of the invention.

[0037] Furthermore, the accompanying drawings are merely illustrative of the invention and are not necessarily drawn to scale. The same reference numerals in the drawings denote the same or similar parts, and therefore repeated descriptions of them will be omitted. Some block diagrams shown in the drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software, in one or more hardware modules or integrated circuits, or in different network and / or processor devices and / or microcontroller devices.

[0038] Node.js is used for server-side programming, encapsulating reusable code within various modules. In related technologies, hot reloading can be achieved through two methods: reloading code modules in Node or modifying object method references. In the Node reloading code module approach, code references are based on modules. The steps for a parent module to import a child module include: a. checking if the child module cache exists; b. if it doesn't exist, recompiling the child module, adding it to the child module reference cache, and adding the child module reference to the parent module's child module array; c. if it exists, checking if the child module exists in the parent module's child module array, and adding the child module reference if it doesn't exist. When hot reloading is needed, the reference between the child module and parent module is broken, the reference cache is cleared, and the child module is re-imported. However, this approach carries the risk of memory leaks and cannot automatically handle asynchronous method calls.

[0039] Alternatively, hot updates can be achieved by modifying object method references. This leverages the characteristics of dynamic languages ​​to replace the method references that need to be modified with the newly loaded methods in the virtual machine. However, there is a problem with automatically modifying already generated object method references.

[0040] Based on one or more of the above-mentioned problems, this example embodiment first provides a data hot update method, referring to... Figure 1As shown, the following steps may be included:

[0041] Step S110. Obtain the message distribution component of the virtual machine, generate a listening tool based on the message distribution component, and establish communication with the virtual machine through the listening tool;

[0042] Step S120. Send a parsing listening request protocol for the data to be updated to the virtual machine, and receive target parsing data associated with the data to be updated based on the parsing listening request protocol;

[0043] Step S130. Obtain the target update data and the unique script identifier of the data to be updated included in the target parsed data. Generate a data update request protocol based on the target update data and the unique script identifier and send it to the virtual machine so that the virtual machine updates the data to be updated according to the data update request protocol.

[0044] The above-described data hot update method involves: acquiring a message distribution component of a virtual machine; generating a listening tool based on the message distribution component; establishing communication with the virtual machine through the listening tool; sending a parsing listening request protocol for data to be updated to the virtual machine; receiving target parsing data associated with the data to be updated based on the parsing listening request protocol; acquiring target update data and a unique script identifier of the parsed data to be updated included in the target parsing data; generating a data update request protocol based on the target update data and the unique script identifier and sending it to the virtual machine, so that the virtual machine updates the data to be updated according to the data update request protocol. On the one hand, a listening tool is generated using the virtual machine's message distribution component. This tool establishes communication with the virtual machine and sends a parsing listening request protocol to the virtual machine after communication is established. It receives target parsing data associated with the data to be updated from the virtual machine, determines the unique identifier of the data to be updated within the virtual machine based on the target parsing data, and transmits the target update data to the virtual machine through the unique identifier of the data to be updated within the virtual machine. This allows the virtual machine to replace the data to be updated based on the target update data, thus improving the efficiency of hot updates. On the other hand, the hot update process only involves communication with the virtual machine and does not involve modification of module references or reference relationships, reducing the risk of memory leaks during hot updates.

[0045] The following provides a detailed explanation and description of each step involved in the data hot update method of the exemplary embodiments of this disclosure.

[0046] First, the application scenarios and purposes of the exemplary embodiments of this disclosure will be explained and described. Specifically, the exemplary embodiments of this disclosure can be used to keep the server running without interruption when the server code fails, and to handle the failure by updating the running code in real time.

[0047] This disclosure is based on the message distribution component of a virtual machine. A listening tool is generated using the message distribution component of the virtual machine. The listening tool establishes a connection with the virtual machine and sends a communication protocol to the virtual machine through the established connection. The unique identifier of the data to be updated in the virtual machine is obtained through the communication protocol. The target update data is sent to the virtual machine according to the unique identifier of the data to be updated in the virtual machine. After receiving the unique identifier of the data to be updated in the virtual machine and the target update data, the virtual machine updates the data to be updated, thereby improving the efficiency of hot update.

[0048] Next, steps S110-S130 will be further explained and described.

[0049] In step S110, the message distribution component of the virtual machine is obtained, a listening tool is generated based on the message distribution component, and communication with the virtual machine is established through the listening tool.

[0050] In this example embodiment, the V8 engine in Node.js is the interpreter for JavaScript. Before running JavaScript, the V8 engine compiles it into native machine code. The Inspector module in the V8 engine includes an interface for users to interact with the virtual machine while running code. During program execution, the InspectorSession component in the Inspector module can be used to connect with the virtual machine. After connection, a specific communication protocol can be sent to the V8 virtual machine to obtain program-related information during the underlying execution of the program by the V8 virtual machine.

[0051] In this example embodiment, reference Figure 2 As shown, obtaining the message distribution component of the virtual machine, generating a listening tool based on the message distribution component, and establishing communication with the virtual machine through the listening tool may include:

[0052] Step S210. Encapsulate the message distribution component of the virtual machine into a listening tool, and establish a connection with the virtual machine through the listening tool;

[0053] Step S220. Send a debug enable protocol to the virtual machine based on the connection. Through the debug enable protocol, notify the virtual machine to enable support for debug level protocols and establish communication with the virtual machine.

[0054] The following will further explain and illustrate steps S210 and S220. Specifically, firstly, the message dispatch component InspectorSession of the virtual machine's Inspector module is encapsulated into a listening tool. A connection is established with the V8 virtual machine through the message dispatch component InspectorSession in the encapsulated tool. Only after a successful connection can communication protocols be sent to the virtual machine. Then, based on the established connection, the debugger.enable protocol is sent to the virtual machine. Debugger.enable notifies the V8 virtual machine to enable support for debug-level protocols to avoid being filtered by communication protocol validity checks when sending debug-level communication protocols to the virtual machine. Based on this, communication with the V8 virtual machine is established.

[0055] refer to Figure 3 As shown, before establishing communication with the virtual machine through the monitoring tool, the data hot update method may further include:

[0056] Step S310. Obtain the server code execution entry point, and reference the listening tool before the server code execution entry point;

[0057] Step S320. Obtain and call the initialization method of the monitoring tool, and initialize the monitoring tool through the initialization method.

[0058] The following will further explain and illustrate steps S310 and S320. Specifically, before establishing a connection with the V8 virtual machine through the listening tool, it is necessary to obtain the server code's execution entry point in the code. That is, before loading all the code used by the server, the listening component generated by the message dispatch component InspectorSession is referenced. After referencing the listening tool before the server code's execution entry point, it is also necessary to obtain the listening tool's initialization method and initialize the listening tool through the initialization method. After initializing the listening tool, it can be ensured that every code file introduced before the server code execution can be listened to by the listening tool, improving the listening efficiency of the listening tool.

[0059] In step S120, a parsing listening request protocol for data to be updated is sent to the virtual machine, and target parsing data associated with the data to be updated is received based on the parsing listening request protocol.

[0060] The parsing and listening request protocol is Debugger.scriptParsed. After sending this protocol to the V8 virtual machine, the parsing and compilation of the code loaded into the virtual machine can be monitored. After the virtual machine completes the parsing and compilation, the processed script file and the corresponding unique script identifier can be obtained.

[0061] In this example embodiment, reference Figure 4 As shown, a parsing listening request protocol for sending data to be updated to the virtual machine, and receiving target parsing data associated with the data to be updated based on the parsing listening request protocol, may include:

[0062] Step S410. Send the debug level's parsing and listening request protocol for the data to be updated to the virtual machine;

[0063] Step S420. Based on the parsing listening request of the debugging level, after the virtual machine successfully parses the data to be updated, receive the parsed data sent by the virtual machine;

[0064] Step S430. Obtain target parsed data associated with the data to be updated based on the parsed data.

[0065] The parsed data includes the unique identifier of the script after parsing the data to be updated within the virtual machine, the file directory where the parsed script is located, the context identifier of the executed script, the hash code of the script, the script file length, and the script stack information.

[0066] The following will further explain and illustrate steps S410-S430. Specifically, based on the support of the debug level protocol enabled by the V8 virtual machine, a debug level parsing and listening request protocol Debugger.scriptParsed is first sent to the virtual machine to listen for the parsing of the data to be updated. In the code, the data to be updated can be the code file containing the code to be updated. That is, a parsing and listening request protocol for the code file to be updated is sent to the virtual machine. After the virtual machine receives the parsing and listening request protocol for the code file to be updated, it sends the parsed data of the successfully parsed code file to the listening tool through the message dispatch component InspectorSession. After the listening tool receives the parsed data, it filters the parsed data to obtain the target parsed data associated with the data to be updated, that is, the target parsed data associated with the code file to be updated. The parsed data after successful parsing by the virtual machine may include: the unique identifier of the script after parsing the data to be updated within the virtual machine, the directory of the parsed script file, the context identifier of the executed script, the script's hash code, the script file length, and script stack information, etc. In this example embodiment, the parsed data is not specifically limited.

[0067] Further reference Figure 5 As shown, the target parsed data associated with the data to be updated, obtained based on the parsed data, may include:

[0068] Step S510. Generate filtering conditions based on the file directory where the parsed script is located, so that the virtual machine can filter the programming language public library data according to the filtering conditions to obtain the target parsed data;

[0069] Step S520. Receive the target parsing data, generate a mapping relationship based on the file name in the file directory where the parsed script is located and the unique identifier of the script in the target parsing data, and store the mapping relationship.

[0070] The following will further explain and illustrate steps S510 and S520. Specifically, when the virtual machine parses the data to be updated, in order to avoid consuming too much virtual machine memory, a filtering condition can be generated based on the file directory where the parsed script is located in the parsed data. This filtering condition is then sent to the virtual machine, allowing the virtual machine to filter the data related to the programming language's common library in the parsed data according to the filtering condition, thereby obtaining the target parsed data corresponding to the data to be updated. After obtaining the target parsed data, the virtual machine sends the target data to be updated to the monitoring tool. The monitoring tool generates a mapping relationship based on the file name in the file directory where the parsed script is located, which is included in the target parsed data, and the unique identifier of the script in the virtual machine, and stores this mapping relationship in the cache.

[0071] In this example embodiment, reference Figure 6 As shown, storing the mapping relationship can include:

[0072] Step S610. Query the file name to determine whether there is a first file name in the monitoring tool that is the same as the file name in the file directory where the parsed script is located;

[0073] Step S620. When it exists, obtain the storage path to store the mapping relationship in the monitoring tool, and determine the target hierarchical path in the storage path as the difference identifier;

[0074] Step S630. Generate a second filename using the difference identifier and the first filename, generate a mapping relationship based on the second filename and the script unique identifier, and store the mapping relationship in the cache of the monitoring tool.

[0075] The following will further explain and illustrate steps S610-S630. Specifically, when storing the mapping relationship in the monitoring tool's cache, it is necessary to determine whether a first filename with the same filename as the one in the mapping relationship exists in the cache. When the same first filename exists in the cache, it is necessary to mark the filename in the mapping relationship as different. This can be done by obtaining the storage path of the mapping relationship in the cache and the current storage level in the cache where the mapping relationship is stored. The path of the storage level above the current storage level is determined as the differentiator. The differentiator and the first filename are concatenated to obtain the second filename. The mapping relationship is generated based on the second filename and the script's unique identifier, and the generated mapping relationship is stored in the monitoring tool's cache.

[0076] In step S130, target update data and the unique script identifier of the data to be updated included in the target parsed data are obtained. A data update request protocol is generated based on the target update data and the unique script identifier and sent to the virtual machine so that the virtual machine updates the data to be updated according to the data update request protocol.

[0077] In this example embodiment, reference Figure 7 As shown, before obtaining the target update data and the unique script identifier of the data to be updated included in the target parsed data, the data hot update method further includes:

[0078] Step S710. Obtain the unique identifier of the script after parsing the data to be updated from the cache of the monitoring tool, and use the unique identifier of the script to generate a parsing data acquisition request protocol;

[0079] Step S720. Send the parsed data acquisition request protocol to the virtual machine, so that the virtual machine can determine whether the data to be updated has been loaded and parsed according to the parsed data acquisition request protocol;

[0080] Step S730. Receive the data to be updated, which corresponds to the unique identifier of the script, sent by the virtual machine after it has determined that the data to be updated has been loaded and parsed.

[0081] The following will further explain and illustrate steps S710-S730. Specifically, before updating the data to be updated, the unique identifier of the parsed script of the data to be updated can be obtained from the cache of the monitoring tool. This unique identifier is used to generate a parsing data retrieval request protocol, `Debugger.getScriptSource`. `Debugger.getScriptSource` is used to pass the unique script identifier to the virtual machine and obtain the script information of the data to be updated that has been loaded in the virtual machine. After generating the parsing data retrieval request protocol, it is sent to the virtual machine. Upon receiving the parsing data retrieval request protocol, the virtual machine determines, based on the unique script identifier in the protocol, whether the data to be updated corresponding to the unique script identifier has already been loaded and parsed within the virtual machine. Once it is determined that the data to be updated corresponding to the unique script identifier has been loaded and parsed, the virtual machine sends the data to be updated corresponding to the unique script identifier to the monitoring tool. In this example embodiment, the data to be updated can only be updated after it has been loaded and parsed by the virtual machine. Therefore, by sending the parsing data retrieval request protocol to the virtual machine, the feasibility of hot updating is verified, ensuring the correct implementation of hot updating.

[0082] Further reference Figure 8 As shown, after receiving the data content to be updated corresponding to the unique identifier of the script, the data hot update method may further include:

[0083] Step S810. Define data validation rules;

[0084] Step S820. Verify the data to be updated sent by the virtual machine according to the data verification rules.

[0085] The following will further explain and illustrate steps S810 and S820. Specifically, after obtaining the update data sent by the virtual machine corresponding to the script's unique identifier, a custom data verification rule can be defined to verify the update data sent by the virtual machine corresponding to the script's unique identifier.

[0086] In this example embodiment, after receiving the update data corresponding to the script's unique identifier sent by the virtual machine, the update data is verified using custom verification rules, thus realizing the legality verification of the update data.

[0087] refer to Figure 9As shown, obtaining the target update data and the unique script identifier of the data to be updated included in the target parsed data, generating a data update request protocol based on the target update data and the unique script identifier, and sending it to the virtual machine may include:

[0088] Step S910. Obtain the unique identifier of the script from the cache of the monitoring tool;

[0089] Step S920. Generate the data update request protocol based on the script unique identifier and the target update data;

[0090] Step S930. Send the data update request protocol to the virtual machine so that the virtual machine parses and compiles the target update data in the data update request protocol, modifies the method constant corresponding to the script unique identifier, and generates a unique identifier for the target update data in the virtual machine;

[0091] Step S940. Receive the unique identifier of the target update data within the virtual machine sent by the virtual machine, and update the mapping relationship according to the unique identifier of the target update data within the virtual machine.

[0092] The following will further explain and illustrate steps S910-S940. Specifically, after the feasibility and legality verification of the data to be updated is completed, the data to be updated can be updated. During the update, firstly, the unique script identifier of the data to be updated in the virtual machine is obtained from the cache of the monitoring tool. Based on the unique script identifier and the target update data, a data update request protocol Debugger.setScriptSource is generated and sent to the virtual machine. After receiving the data update request protocol, the virtual machine parses and compiles the target update data in the data update request protocol. After parsing and compiling the target update data, the method constants corresponding to the unique script identifier are modified to complete the update of the data to be updated. After the update of the data to be updated is completed using the target update data, i.e., after the hot update is completed, the virtual machine generates a unique identifier corresponding to the target update data. After generating the unique identifier of the target update data in the virtual machine, the unique identifier of the target update data in the virtual machine is sent to the monitoring tool. The monitoring tool receives the unique identifier of the target update data in the virtual machine sent by the virtual machine and updates the mapping relationship of the data to be updated in the monitoring tool according to the received unique identifier of the target update data in the virtual machine.

[0093] Furthermore, the mapping relationship is updated based on the unique identifier of the target update data within the virtual machine, including:

[0094] Using the unique identifier of the target update data within the virtual machine, the unique identifier of the script after parsing the data to be updated in the mapping relationship is replaced.

[0095] Specifically, updating the mapping relationship of the data to be updated in the cache of the monitoring tool mainly involves using the unique identifier of the target update data sent by the virtual machine within the virtual machine to replace the unique identifier of the script in the mapping relationship.

[0096] Further, refer to Figure 10 As shown, before modifying the method constant corresponding to the unique identifier of the script, the data hot update method may further include:

[0097] Step S1010. Determine whether a generator exists in the heap memory, wherein the generator is a generator used for suspension during asynchronous calls;

[0098] Step S1020. When the generator exists in the heap memory, return an error message;

[0099] Step S1030. When the generator does not exist in the heap memory, modify the method constant corresponding to the unique identifier of the script.

[0100] The following will further explain and illustrate steps S1010-S1030. Specifically, the key steps for implementing hot updates are: modifying the method constant corresponding to the unique identifier of the script of the data to be updated within the virtual machine; before modifying the method constant, determining whether a generator exists in the heap memory (this generator is used for suspending asynchronous calls); if no generator exists in memory, it means there is no asynchronous call, and the method constant corresponding to the unique identifier of the script of the data to be updated can be modified, i.e., hot updates are performed; if a generator exists in the heap memory, an error message is returned, indicating that an asynchronous call exists in memory, and hot updates are not allowed.

[0101] In this example embodiment, the generator used to suspend the asynchronous call is used to determine whether an asynchronous call exists in memory before the hot update is performed, thus ensuring the safety of the asynchronous call.

[0102] The data hot update method provided in this exemplary embodiment has at least the following advantages: On the one hand, a listening tool is generated using the virtual machine's message distribution component. This listening tool establishes communication with the virtual machine and sends a parsing listening request protocol to the virtual machine after communication is established. It receives target parsing data associated with the data to be updated sent by the virtual machine, determines the unique identifier of the data to be updated within the virtual machine based on the target parsing data, and transmits the target update data to the virtual machine based on the unique identifier of the data to be updated within the virtual machine. This allows the virtual machine to replace the data to be updated based on the target update data, thereby improving the efficiency of hot update. On the other hand, the hot update process only involves communication with the virtual machine and does not involve modification of module references or reference relationships, reducing the risk of memory leaks during the hot update process.

[0103] This disclosure also provides a data hot update apparatus, with reference to... Figure 11 As shown, it may include: a communication establishment module 1110, a target parsing data acquisition module 1120, and a data hot update module 1130. Wherein:

[0104] The communication establishment module 1110 is used to obtain the message distribution component of the virtual machine, generate a listening tool based on the message distribution component, and establish communication with the virtual machine through the listening tool;

[0105] The target parsing data acquisition module 1120 is used to send a parsing listening request protocol for the data to be updated to the virtual machine, and to receive target parsing data associated with the data to be updated based on the parsing listening request protocol;

[0106] The data hot update module 1130 is used to obtain target update data and the unique script identifier of the data to be updated included in the target parsed data, generate a data update request protocol according to the target update data and the unique script identifier, and send it to the virtual machine so that the virtual machine updates the data to be updated according to the data update request protocol.

[0107] The specific details of each module in the above-mentioned data hot update device have been described in detail in the corresponding data hot update method, so they will not be repeated here.

[0108] In one exemplary embodiment of this disclosure, obtaining a message distribution component for a virtual machine, generating a listening tool based on the message distribution component, and establishing communication with the virtual machine through the listening tool include:

[0109] The message distribution component of the virtual machine is encapsulated into a listening tool, and a connection is established with the virtual machine through the listening tool.

[0110] Based on the connection, a debug enable protocol is sent to the virtual machine. Through the debug enable protocol, the virtual machine is notified to enable support for debug level protocols, and communication with the virtual machine is established.

[0111] In one exemplary embodiment of this disclosure, before establishing communication with the virtual machine through the monitoring tool, the data hot update method further includes:

[0112] Obtain the server code execution entry point, and reference the listening tool before the server code execution entry point;

[0113] Obtain and invoke the initialization method of the monitoring tool, and initialize the monitoring tool through the initialization method.

[0114] In one exemplary embodiment of this disclosure, a parsing listening request protocol for data to be updated is sent to the virtual machine, and target parsing data associated with the data to be updated is received based on the parsing listening request protocol, including:

[0115] Send the debug-level parsing and listening request protocol for the data to be updated to the virtual machine;

[0116] Based on the parsing listening request at the debugging level, after the virtual machine successfully parses the data to be updated, the parsing data sent by the virtual machine is received;

[0117] Based on the parsed data, target parsed data associated with the data to be updated is obtained.

[0118] The parsed data includes the unique identifier of the script after parsing the data to be updated, the file directory where the parsed script is located, the context identifier of the executed script, the hash code of the script, the length of the script file, and the script stack information.

[0119] In one exemplary embodiment of this disclosure, obtaining target parsed data associated with the data to be updated based on the parsed data includes:

[0120] The filtering conditions are generated by the file directory where the parsed script is located, so that the virtual machine can filter the programming language public library data according to the filtering conditions to obtain the target parsed data;

[0121] Receive the target parsing data, generate a mapping relationship based on the file name in the file directory where the parsed script is located and the unique identifier of the script in the target parsing data, and store the mapping relationship.

[0122] In one exemplary embodiment of this disclosure, storing the mapping relationship includes:

[0123] The filename is queried to determine whether there is a first filename in the monitoring tool that is identical to the filename in the directory where the parsed script is located;

[0124] If it exists, obtain the storage path to store the mapping relationship in the monitoring tool, and determine the target hierarchical path in the storage path as the difference identifier;

[0125] A second filename is generated using the difference identifier and the first filename. A mapping relationship is generated based on the second filename and the script's unique identifier. The mapping relationship is then stored in the cache of the monitoring tool.

[0126] In one exemplary embodiment of this disclosure, before obtaining the target update data and the unique script identifier of the data to be updated included in the target parsed data, the data hot update method further includes:

[0127] Obtain the unique identifier of the script after parsing the data to be updated from the cache of the monitoring tool, and use the unique identifier of the script to generate a parsed data acquisition request protocol;

[0128] The parsing data acquisition request protocol is sent to the virtual machine so that the virtual machine can determine whether the data to be updated has been loaded and parsed according to the parsing data acquisition request protocol;

[0129] The virtual machine receives the data to be updated, which corresponds to the unique identifier of the script, after determining that the data to be updated has been loaded and parsed.

[0130] In one exemplary embodiment of this disclosure, after receiving the data content to be updated corresponding to the unique identifier of the script, the data hot update method further includes:

[0131] Define data validation rules;

[0132] The data to be updated sent by the virtual machine is verified according to the data verification rules.

[0133] In one exemplary embodiment of this disclosure, obtaining target update data and a unique script identifier of the data to be updated included in the target parsed data, generating a data update request protocol based on the target update data and the unique script identifier, and sending it to the virtual machine includes:

[0134] Obtain the unique identifier of the script from the cache of the monitoring tool;

[0135] The data update request protocol is generated based on the script's unique identifier and the target update data;

[0136] The data update request protocol is sent to the virtual machine so that the virtual machine parses and compiles the target update data in the data update request protocol, modifies the method constants corresponding to the unique identifier of the script, and generates a unique identifier for the target update data in the virtual machine.

[0137] The system receives a unique identifier of the target update data within the virtual machine, sent by the virtual machine, and updates the mapping relationship based on this unique identifier.

[0138] In one exemplary embodiment of this disclosure, updating the mapping relationship based on the unique identifier of the target update data within the virtual machine includes:

[0139] Using the unique identifier of the target update data within the virtual machine, the unique identifier of the script after parsing the data to be updated in the mapping relationship is replaced.

[0140] In one exemplary embodiment of this disclosure, before modifying the method constant corresponding to the parsed script unique identifier, the data hot update method further includes:

[0141] Determine whether a generator exists in the heap memory, wherein the generator is a generator used for suspension during asynchronous calls;

[0142] An error message is returned when the generator exists in the heap memory.

[0143] When the generator is not present in the heap memory, the method constant corresponding to the unique identifier of the script is modified.

[0144] It should be noted that although several modules or units of the device for performing actions have been mentioned in the detailed description above, this division is not mandatory. In fact, according to embodiments of the present invention, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided and embodied by multiple modules or units.

[0145] Furthermore, although the steps of the method in this invention are described in a specific order in the accompanying drawings, this does not require or imply that the steps must be performed in that specific order, or that all the steps shown must be performed to achieve the desired result. Additional or alternative steps may be omitted, multiple steps may be combined into one step, and / or a step may be broken down into multiple steps.

[0146] In an exemplary embodiment of the present invention, an electronic device capable of implementing the above-described method is also provided.

[0147] Those skilled in the art will understand that various aspects of the present invention can be implemented as systems, methods, or program products. Therefore, various aspects of the present invention can be specifically implemented in the following forms: entirely hardware implementations, entirely software implementations (including firmware, microcode, etc.), or implementations combining hardware and software aspects, collectively referred to herein as “circuits,” “modules,” or “systems.”

[0148] The following reference Figure 12 To describe an electronic device 1200 according to this embodiment of the present invention. Figure 12 The electronic device 1200 shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of the present invention.

[0149] like Figure 12 As shown, the electronic device 1200 is manifested in the form of a general-purpose computing device. The components of the electronic device 1200 may include, but are not limited to: at least one processing unit 1210, at least one storage unit 1220, a bus 1230 connecting different system components (including storage unit 1220 and processing unit 1210), and a display unit 1240.

[0150] The storage unit stores program code that can be executed by the processing unit 1210, causing the processing unit 1210 to perform the steps described in the "Exemplary Methods" section of this specification according to various exemplary embodiments of the present invention. For example, the processing unit 1210 can perform actions such as... Figure 1 The steps shown are as follows: S110: Obtain the message distribution component of the virtual machine, generate a listening tool based on the message distribution component, and establish communication with the virtual machine through the listening tool; S120: Send a parsing listening request protocol for the data to be updated to the virtual machine, and receive target parsing data associated with the data to be updated based on the parsing listening request protocol; S130: Obtain the target update data and the unique script identifier of the parsed data to be updated included in the target parsing data, generate a data update request protocol based on the target update data and the unique script identifier, and send it to the virtual machine so that the virtual machine updates the data to be updated according to the data update request protocol.

[0151] Storage unit 1220 may include a readable medium in the form of a volatile storage unit, such as random access memory (RAM) 12201 and / or cache memory 12202, and may further include a read-only memory (ROM) 12203.

[0152] Storage unit 1220 may also include a program / utility 12204 having a set (at least one) program module 12205, such program module 12205 including but not limited to: operating system, one or more application programs, other program modules and program data, each of these examples or some combination of these may include an implementation of a network environment.

[0153] Bus 1230 can represent one or more of several bus structures, including memory units.

[0154] A bus or memory unit controller, peripheral bus, graphics acceleration port, processing unit, or a local bus that uses any of the various bus structures.

[0155] Electronic device 1200 can also communicate with one or more external devices 1300 (e.g., keyboard, pointing device, Bluetooth device, etc.), and can also communicate with one or more devices that enable a user to interact with electronic device 1200, and / or devices that enable electronic device 1200 to communicate with one or more external devices 1300.

[0156] Any device that communicates with other computing devices (such as routers, modems, etc.) can communicate via the input / output (I / O) interface 1250. Furthermore, electronic devices...

[0157] The backup 1200 can also connect to one or more networks (such as local area networks) via network adapter 1260.

[0158] (LAN), wide area network (WAN), and / or public network, such as the Internet) communication. As shown, network adapter 1260 communicates with other modules of electronic device 1200 via bus 1230.

[0159] It should be understood that, although not shown in the figures, other hardware and / or software modules may be used in conjunction with electronic device 1200, including but not limited to: microcode, device drivers, redundant processing units, and external...

[0160] Disk drive arrays, RAID systems, tape drives, and data backup storage systems, etc.

[0161] From the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software, or by combining software with necessary hardware.

[0162] This is achieved in a certain way. Therefore, the technical solution according to the embodiments of the present invention can be embodied in the form of software product 5, which can be stored in a non-volatile storage medium (which can be

[0163] It is contained in a CD-ROM, USB flash drive, portable hard drive, etc., or on a network, and includes several instructions to cause a computing device (which may be a personal computer, server, terminal device, or network device, etc.) to execute the method according to the embodiments of the present invention.

[0164] In exemplary embodiments of the present invention, a computer-readable storage medium is also provided, on which a program product capable of implementing the methods described above is stored. In some possible embodiments, various aspects of the present invention may also be implemented as a program product comprising program code, which, when the program product is run on a terminal device, causes the terminal device to perform the steps of the various exemplary embodiments of the present invention described in the "Exemplary Methods" section above.

[0165] According to embodiments of the present invention, a program product for implementing the above-described method may employ a portable compact disc read-only memory (CD-ROM) and include program code, and may run on a terminal device, such as a personal computer. However, the program product of the present invention is not limited thereto. In this document, a readable storage medium may be any tangible medium containing or storing a program that may be used by or in conjunction with an instruction execution system, apparatus, or device.

[0166] The program product may employ any combination of one or more readable media. A readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of readable storage media (a non-exhaustive list) include: an electrical connection having one or more wires, a portable disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.

[0167] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, carrying readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A readable signal medium may also be any readable medium other than a readable storage medium, capable of sending, propagating, or transmitting programs for use by or in conjunction with an instruction execution system, apparatus, or device.

[0168] The program code contained on the readable medium may be transmitted using any suitable medium, including but not limited to wireless, wired, optical fiber, RF, etc., or any suitable combination thereof.

[0169] Program code for performing the operations of this invention can be written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Java and C++, and conventional procedural programming languages ​​such as C or similar languages. The program code can execute entirely on the user's computing device, partially on the user's device, as a standalone software package, partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing device can be connected to the user's computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computing device (e.g., via the Internet using an Internet service provider).

[0170] Furthermore, the above figures are merely illustrative of the processes included in the method according to exemplary embodiments of the present invention, and are not intended to be limiting. It is readily understood that the processes shown in the above figures do not indicate or limit the temporal order of these processes. Additionally, it is readily understood that these processes may be executed synchronously or asynchronously, for example, in multiple modules.

[0171] Other embodiments of the invention will readily occur to those skilled in the art upon consideration of the specification and practice of the invention described herein. This application is intended to cover any variations, uses, or adaptations of the invention that follow the general principles of the invention and include common knowledge or customary techniques in the art not invented herein. The specification and embodiments are to be considered exemplary only, and the true scope and spirit of the invention are indicated by the claims.

Claims

1. A data hot update method, characterized in that, include: Obtain the message distribution component of the virtual machine, generate a listening tool based on the message distribution component, and establish communication with the virtual machine through the listening tool; Send the debug-level data update parsing and listening request protocol to the virtual machine; Based on the parsing and listening request protocol of the debugging level, after the virtual machine successfully parses the data to be updated, the parsed data sent by the virtual machine is received; The filtering conditions are generated by the file directory where the parsed script is located, so that the virtual machine can filter the programming language public library data according to the filtering conditions to obtain the target parsed data; The system receives the target parsed data, generates a mapping relationship based on the filename and unique identifier of the parsed script in the file directory, and stores the mapping relationship. The parsed data includes the unique identifier of the script after parsing the data to be updated, the file directory of the parsed script, the context identifier of the executed script, the hash code of the script, the length of the script file, and the script stack information. The system obtains the target update data and the unique script identifier of the data to be updated included in the target parsed data. It then generates a data update request protocol based on the target update data and the unique script identifier and sends it to the virtual machine, so that the virtual machine updates the data to be updated according to the data update request protocol.

2. The data hot update method according to claim 1, characterized in that, Obtain the message distribution component of the virtual machine, generate a listening tool based on the message distribution component, and establish communication with the virtual machine through the listening tool, including: The message distribution component of the virtual machine is encapsulated into a listening tool, and a connection is established with the virtual machine through the listening tool. Based on the connection, a debug enable protocol is sent to the virtual machine. Through the debug enable protocol, the virtual machine is notified to enable support for debug level protocols, and communication with the virtual machine is established.

3. The data hot update method according to claim 2, characterized in that, Before establishing communication with the virtual machine through the monitoring tool, the data hot update method further includes: Obtain the server code execution entry point, and reference the listening tool before the server code execution entry point; Obtain and invoke the initialization method of the monitoring tool, and initialize the monitoring tool through the initialization method.

4. The data hot update method of claim 1, wherein, Storing the mapping relationship includes: The filename is queried to determine whether there is a first filename in the monitoring tool that is identical to the filename in the directory where the parsed script is located; If it exists, obtain the storage path to store the mapping relationship in the monitoring tool, and determine the target hierarchical path in the storage path as the difference identifier; A second filename is generated using the difference identifier and the first filename. A mapping relationship is generated based on the second filename and the script's unique identifier. The mapping relationship is then stored in the cache of the monitoring tool.

5. The data hot update method according to claim 4, characterized in that, Before obtaining the target update data and the unique script identifier of the data to be updated included in the target parsed data, the data hot update method further includes: Obtain the unique identifier of the script after parsing the data to be updated from the cache of the monitoring tool, and use the unique identifier of the script to generate a parsed data acquisition request protocol; The parsing data acquisition request protocol is sent to the virtual machine so that the virtual machine can determine whether the data to be updated has been loaded and parsed according to the parsing data acquisition request protocol; The virtual machine receives the data to be updated, which corresponds to the unique identifier of the script, after determining that the data to be updated has been loaded and parsed.

6. The data hot update method according to claim 5, characterized in that, After receiving the data content to be updated corresponding to the unique identifier of the script, the data hot update method further includes: Define data validation rules; The data to be updated sent by the virtual machine is verified according to the data verification rules.

7. The data hot update method according to claim 1, characterized in that, Obtain the target update data and the unique script identifier of the data to be updated included in the target parsed data; generate a data update request protocol based on the target update data and the unique script identifier and send it to the virtual machine, including: Obtain the unique identifier of the script from the cache of the monitoring tool; The data update request protocol is generated based on the script's unique identifier and the target update data; The data update request protocol is sent to the virtual machine so that the virtual machine parses and compiles the target update data in the data update request protocol, modifies the method constants corresponding to the unique identifier of the script, and generates a unique identifier for the target update data in the virtual machine. The system receives a unique identifier of the target update data within the virtual machine, sent by the virtual machine, and updates the mapping relationship based on this unique identifier.

8. The data hot update method according to claim 7, characterized in that, The mapping relationship is updated based on the unique identifier of the target update data within the virtual machine, including: Using the unique identifier of the target update data within the virtual machine, the unique identifier of the script after parsing the data to be updated in the mapping relationship is replaced.

9. The data hot update method according to claim 7, characterized in that, Before modifying the method constant corresponding to the unique identifier of the parsed script, the data hot update method further includes: Determine whether a generator exists in the heap memory, wherein the generator is a generator used for suspension during asynchronous calls; An error message is returned when the generator exists in the heap memory. When the generator is not present in the heap memory, the method constant corresponding to the unique identifier of the script is modified.

10. A data hot update device, characterized in that, include: A communication establishment module is used to obtain the message distribution component of the virtual machine, generate a listening tool based on the message distribution component, and establish communication with the virtual machine through the listening tool; The target parsing data acquisition module is used to send a parsing and listening request protocol for debug-level data to be updated to the virtual machine; Based on the parsing and listening request protocol of the debugging level, after the virtual machine successfully parses the data to be updated, the parsed data sent by the virtual machine is received; The filtering conditions are generated by the file directory where the parsed script is located, so that the virtual machine can filter the programming language public library data according to the filtering conditions to obtain the target parsed data; The system receives the target parsed data, generates a mapping relationship based on the filename and unique identifier of the parsed script in the file directory, and stores the mapping relationship. The parsed data includes the unique identifier of the script after parsing the data to be updated, the file directory of the parsed script, the context identifier of the executed script, the hash code of the script, the length of the script file, and the script stack information. The data hot update module is used to obtain the target update data and the unique script identifier of the data to be updated included in the target parsed data, generate a data update request protocol based on the target update data and the unique script identifier, and send it to the virtual machine so that the virtual machine updates the data to be updated according to the data update request protocol.

11. A computer storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processing unit, it implements the data hot update method according to any one of claims 1-9.

12. An electronic device, characterized in that, include: Processing unit; as well as A storage unit for storing the executable instructions of the processing unit; The processing unit is configured to execute the data hot update method according to any one of claims 1-9 by executing the executable instructions.