Method and system for realizing hot loading of WEB server

By installing the application and session control of the WEB server on the application virtual machine and the session virtual machine respectively, and listening to the encrypted packets between the two, the problem of poor thermal loading stability in the existing technology is solved, and the uninterrupted service and normal display of the Kanban is achieved.

CN119690542APending Publication Date: 2025-03-25HAINAN JINPAN INTELLIGENCE TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411947865.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-27
Publication Date
2025-03-25

AI Technical Summary

Technical Problem

In the prior art, when hot loading of WEB servers is performed through class loaders, adding or deleting methods will cause hot loading to fail and have poor stability.

Method used

Install the application and session control of the WEB server on the application virtual machine and the session virtual machine respectively, and listen for encrypted packets between the two. If the encrypted message is a restart message, restart the application virtual machine, and then access the restarted application virtual machine through the session service provided by the session virtual machine to complete the hot loading.

Benefits of technology

It improves the stability of hot loading, ensures uninterrupted provision of business services, and avoids the problem of logging in again after restart, and ensures that the Kanban can be displayed normally.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119690542A_ABST
    Figure CN119690542A_ABST
Patent Text Reader

Abstract

The invention provides a method and a system for realizing hot loading of a WEB server, which are characterized in that application and session control of the WEB server are respectively installed in an application virtual machine and a session virtual machine, and an encrypted message between the application virtual machine and the session virtual machine is monitored. If the encrypted message is the restart message, the application virtual machine is restarted, and the restarted application virtual machine is accessed through the session service provided by the session virtual machine to complete hot loading, so that the stability of hot loading can be improved, and business services can be continuously provided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of hot loading, and in particular to a method and system for realizing hot loading of a WEB server. Background Art

[0002] Currently, hot loading of WEB servers is basically done through class loaders. However, when new methods are added or deleted in some classes, hot loading may fail and the hot loading stability is poor. Summary of the invention

[0003] In view of this, an embodiment of the present invention provides a method and system for implementing hot loading of a WEB server, so as to solve the problem of poor hot loading stability existing in the method of loading through a class loader.

[0004] To achieve the above objectives, the embodiments of the present invention provide the following technical solutions:

[0005] A first aspect of an embodiment of the present invention discloses a method for implementing hot loading of a WEB server, the method comprising:

[0006] Monitoring encrypted messages between an application virtual machine and a session virtual machine, wherein the application virtual machine is installed with an application of a web server, and the session virtual machine is installed with a session control of the web server;

[0007] Determining whether the encrypted message is a restart message;

[0008] If the encrypted message is a restart message, restart the application virtual machine;

[0009] The restarted application virtual machine is accessed through the session service provided by the session virtual machine.

[0010] Preferably, the method further comprises:

[0011] Listen to the classes published on the WEB server;

[0012] If the class published on the WEB server changes, reload the class published on the WEB server;

[0013] The application virtual machine is accessed through a session service provided by the session virtual machine.

[0014] Preferably, determining whether the encrypted message is a restart message includes:

[0015] Decrypting the encrypted message using a preset key to obtain a plaintext message;

[0016] Determine whether the format of the plaintext message is a specified format corresponding to the restart message;

[0017] If the format of the plaintext message is the specified format, it is determined that the encrypted message is a restart message.

[0018] Preferably, if the encrypted message is a restart message, restarting the application virtual machine includes:

[0019] If the encrypted message is a restart message, stop the application virtual machine;

[0020] The virtual machine startup command is executed in a virtual thread manner to restart the application virtual machine.

[0021] Preferably, monitoring encrypted messages between the application virtual machine and the session virtual machine includes:

[0022] Use the socket service to monitor the encrypted messages between the application virtual machine and the session virtual machine.

[0023] A second aspect of an embodiment of the present invention discloses a system for implementing hot loading of a WEB server, the system comprising:

[0024] A monitoring unit, used for monitoring encrypted messages between an application virtual machine and a session virtual machine, wherein the application virtual machine is installed with an application of a WEB server, and the session virtual machine is installed with a session control of the WEB server;

[0025] A judging unit, used to judge whether the encrypted message is a restart message;

[0026] A restart unit, configured to restart the application virtual machine if the encrypted message is a restart message;

[0027] The first access unit is used to access the restarted application virtual machine through the session service provided by the session virtual machine.

[0028] Preferably, the monitoring unit is further used to: monitor the classes published on the WEB server;

[0029] Accordingly, the system further comprises:

[0030] A reloading unit, used for reloading the class published on the WEB server if the class published on the WEB server changes;

[0031] The second access unit is used to access the application virtual machine through the session service provided by the session virtual machine.

[0032] Preferably, the judging unit comprises:

[0033] A decryption module, used to decrypt the encrypted message using a preset key to obtain a plaintext message;

[0034] A judging module, used to judge whether the format of the plaintext message is a specified format corresponding to the restart message;

[0035] A determination module is used to determine that the encrypted message is a restart message if the format of the plaintext message is the specified format.

[0036] Preferably, the restart unit comprises:

[0037] A stop module, used for stopping the application virtual machine if the encrypted message is a restart message;

[0038] The execution module is used to execute the virtual machine startup command through a virtual thread to restart the application virtual machine.

[0039] Preferably, the monitoring unit is specifically used to monitor encrypted messages between the application virtual machine and the session virtual machine using a socket service.

[0040] Based on the above-mentioned embodiment of the present invention, a method and system for implementing hot loading of a WEB server are provided. The method comprises: monitoring encrypted messages between an application virtual machine and a session virtual machine, wherein the application virtual machine is installed with an application of the WEB server, and the session virtual machine is installed with a session control of the WEB server; determining whether the encrypted message is a restart message; if the encrypted message is a restart message, restarting the application virtual machine; and accessing the restarted application virtual machine through the session service provided by the session virtual machine. In this solution, the application and session control of the WEB server are installed in the application virtual machine and the session virtual machine, respectively, and encrypted messages between the application virtual machine and the session virtual machine are monitored. If the encrypted message is a restart message, restart the application virtual machine, and access the restarted application virtual machine through the session service provided by the session virtual machine to complete the hot loading, which can improve the stability of hot loading and provide business services without interruption. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.

[0042] Figure 1 A flowchart of a method for implementing hot loading of a WEB server provided by an embodiment of the present invention;

[0043] Figure 2 Another flow chart of a method for implementing hot loading of a WEB server provided by an embodiment of the present invention;

[0044] Figure 3A structural block diagram of a system for implementing hot loading of a WEB server provided in an embodiment of the present invention;

[0045] Figure 4 Another structural block diagram of a system for implementing hot loading of a WEB server provided by an embodiment of the present invention;

[0046] Figure 5 Another structural block diagram of a system for implementing hot loading of a WEB server provided by an embodiment of the present invention;

[0047] Figure 6 Another structural block diagram of a system for implementing hot loading of a WEB server provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0048] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0049] In this application, the terms "comprises", "comprising" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprising a ..." does not exclude the presence of other identical elements in the process, method, article or device comprising the element.

[0050] As can be seen from the background technology, the current hot loading of WEB servers is basically loaded through class loaders. However, when new methods appear or methods are deleted in some classes, hot loading may fail. Specifically, by using different class loaders to achieve hot loading, sometimes it will cause inconsistencies in the loading of some classes, which in turn leads to reference conflicts and poor hot loading stability.

[0051] In addition, the WEB server needs to restart the application when performing publishing operations, which will cause business services to be interrupted, and after restarting the application, you need to log in again, which will cause some dashboards to not display properly.

[0052] In order to solve the above problems, this solution provides a method and system for implementing hot loading of a WEB server, wherein the application and session control of the WEB server are installed in the application virtual machine and the session virtual machine respectively, and the encrypted messages between the application virtual machine and the session virtual machine are monitored. If the encrypted message is a restart message, the application virtual machine is restarted, and the restarted application virtual machine is accessed through the session service provided by the session virtual machine to complete the hot loading, which can improve the stability of hot loading and provide business services without interruption. In addition, by accessing the restarted application virtual machine through the session service provided by the session virtual machine, some dashboards will not need to be re-logged in due to restart, ensuring that the dashboards can be displayed normally.

[0053] See also Figure 1 , shows a flow chart of a method for implementing hot loading of a WEB server provided by an embodiment of the present invention, the method comprising:

[0054] Step S101: monitor encrypted messages between the application virtual machine and the session virtual machine.

[0055] It should be noted that the WEB server at least includes a session saving mechanism for session control, HTTP protocol parsing and application deployment. The middleware of the WEB server of this solution is built based on TCP.

[0056] The session control and application of the WEB server are independently installed on different virtual machines (Java virtual machine, JVM for short) and run.

[0057] Among them, the application virtual machine is installed with the application of the WEB server, and the session virtual machine is installed with the session control of the WEB server. That is, the virtual machine that independently installs the application of the WEB server is called an application virtual machine, and the virtual machine that independently installs the session control of the WEB server is called a session virtual machine.

[0058] The session virtual machine provides session services, and the application virtual machine provides application services.

[0059] In the specific implementation of step S101, the socket service is used to monitor the encrypted messages between the application virtual machine and the session virtual machine.

[0060] It is understandable that messages are transmitted between the application virtual machine and the session virtual machine in an encrypted manner, that is, the message to be transmitted is first encrypted by a preset key to obtain an encrypted message, and then the encrypted message is transmitted.

[0061] Step S102: Determine whether the encrypted message is a restart message. If the encrypted message is a restart message, execute step S103; if the encrypted message is not a restart message, execute other operations related to the encrypted message.

[0062] In the specific process of implementing step S102, it is determined whether the encrypted message is a restart message, and the restart message carries a restart command for restarting the application virtual machine.

[0063] If the encrypted message is a restart message, execute step S103; if the encrypted message is not a restart message, execute other operations related to the encrypted message (non-restarting the application virtual machine).

[0064] In some embodiments, the specific method of determining whether the encrypted message is a restart message is: decrypting the encrypted message using a preset key to obtain a plaintext message; and determining whether the format of the plaintext message is a specified format corresponding to the restart message.

[0065] If the format of the plaintext message is a specified format corresponding to the restart message, it is determined that the encrypted message is a restart message.

[0066] If the format of the plaintext message is not a specified format corresponding to the restart message, it is determined that the encrypted message is not a restart message.

[0067] In actual applications, the application virtual machine implements a virtual machine restart service through an interface, and the virtual machine restart service is used to send a restart message to the session virtual machine.

[0068] The virtual machine restart service of the application virtual machine is monitored through the socket service, that is, the encrypted message sent by the application virtual machine to the session virtual machine is monitored, and the encrypted message is encrypted based on a preset key.

[0069] The encrypted message sent by the application virtual machine to the session virtual machine is decrypted using the key to obtain a plaintext message. If the format of the plaintext message is the specified format corresponding to the restart message, it can be determined that the encrypted message is a restart message; otherwise, it can be determined that the encrypted message is not a restart message.

[0070] Step S103: Restart the application virtual machine.

[0071] In the specific implementation of step S103, if the encrypted message is a restart message (the monitored encrypted message is a restart message), the application virtual machine is stopped; and the virtual machine start command is executed through a virtual thread to restart the application virtual machine.

[0072] That is, if the encrypted message is a restart message, the application virtual machine is stopped first, and then the virtual machine startup command is executed in a virtual thread manner to start the application virtual machine, thereby completing the restart of the application virtual machine.

[0073] Step S104: access the restarted application virtual machine through the session service provided by the session virtual machine.

[0074] In the specific implementation of step S104, after the application virtual machine is restarted, the session service provided by the session virtual machine is used to access the restarted application virtual machine to ensure seamless connection of the business.

[0075] From the contents of the above steps S101 to S104, it can be seen that the first mechanism of hot loading of the WEB server provided by this solution is:

[0076] Divide application startup into two parts: "session services provided by session virtual machines" and "application services provided by application virtual machines";

[0077] The virtual machine restart service is monitored through the socket service, wherein the messages transmitted between the application virtual machine and the session virtual machine are encrypted messages;

[0078] When the monitored encrypted message is a restart message, the application virtual machine is first stopped, and then the virtual machine startup command is executed through the virtual thread mode to restart the application virtual machine;

[0079] The restarted application virtual machine is accessed through the session service provided by the original session virtual machine to ensure seamless service connection.

[0080] The above is an explanation of the first mechanism of hot loading of the WEB server.

[0081] In the embodiment of the present invention, the application and session control of the WEB server are installed in the application virtual machine and the session virtual machine respectively, and the encrypted message between the application virtual machine and the session virtual machine is monitored. If the encrypted message is a restart message, the application virtual machine is restarted, and the restarted application virtual machine is accessed through the session service provided by the session virtual machine to complete the hot loading, which can improve the stability of hot loading and provide business services without interruption.

[0082] In some embodiments, the present solution also provides a second mechanism for hot loading of the WEB server, see Figure 2 , shows another flow chart of a method for implementing hot loading of a WEB server provided by an embodiment of the present invention, comprising the following steps:

[0083] Step S201: monitor the classes published on the WEB server.

[0084] It should be noted that the session control and application of the WEB server are independently installed and run on different virtual machines (Java virtual machines, JVM for short). The virtual machine that independently installs the application of the WEB server is called the application virtual machine, and the virtual machine that independently installs the session control of the WEB server is called the session virtual machine.

[0085] In the specific implementation of step S201 , the class published on the WEB server is monitored to determine whether the class published on the WEB server has changed.

[0086] If the class published on the WEB server changes, execute step S202;

[0087] If the class published on the WEB server has not changed, the class published on the WEB server is not reloaded.

[0088] Step S202: If the class published on the WEB server changes, reload the class published on the WEB server.

[0089] In the process of implementing step S202, if the class published on the WEB server changes, the class published on the WEB server is reloaded, that is, the class of the WEB server is reloaded, and there is no need to restart the application virtual machine.

[0090] Step S203: Access the application virtual machine through the session service provided by the session virtual machine.

[0091] In the specific implementation of step S203, after reloading the class published on the WEB server, the application virtual machine is accessed through the session service provided by the session virtual machine.

[0092] above Figure 2 This is an explanation of the second mechanism of hot loading of the WEB server. Under the second mechanism of hot loading of the WEB server, you only need to monitor whether the class published on the WEB server has changed; when the class changes, reloading the class can complete the hot loading of the WEB server without restarting the application virtual machine.

[0093] Combined with the above Figure 1 and Figure 2 As can be seen from the illustrated embodiment, this solution runs the session control (session) and application of the WEB server independently on different virtual machines (i.e., the above-mentioned session virtual machine and application virtual machine), and realizes hot loading by restarting the application virtual machine without interruption, thereby achieving the following beneficial effects:

[0094] 1. Business services can be provided uninterruptedly;

[0095] 2. Some dashboards will not require re-login due to restart;

[0096] 3. Remote hot loading can be controlled through WEB pages.

[0097] Corresponding to the method for implementing hot loading of a WEB server provided in the above embodiment of the present invention, see Figure 3, the embodiment of the present invention also provides a structural block diagram of a system for implementing hot loading of a WEB server, the system comprising: a monitoring unit 100, a judging unit 200, a restarting unit 300 and a first accessing unit 400;

[0098] The monitoring unit 100 is used to monitor encrypted messages between an application virtual machine and a session virtual machine, wherein the application virtual machine is installed with an application of a WEB server, and the session virtual machine is installed with a session control of the WEB server.

[0099] In a specific implementation, the monitoring unit 100 is specifically used to monitor the encrypted messages between the application virtual machine and the session virtual machine using the socket service.

[0100] The judging unit 200 is used to judge whether the encrypted message is a restart message.

[0101] The restart unit 300 is used to restart the application virtual machine if the encrypted message is a restart message.

[0102] The first access unit 400 is used to access the restarted application virtual machine through the session service provided by the session virtual machine.

[0103] In the embodiment of the present invention, the application and session control of the WEB server are installed in the application virtual machine and the session virtual machine respectively, and the encrypted message between the application virtual machine and the session virtual machine is monitored. If the encrypted message is a restart message, the application virtual machine is restarted, and the restarted application virtual machine is accessed through the session service provided by the session virtual machine to complete the hot loading, which can improve the stability of hot loading and provide business services without interruption.

[0104] Preferably, combined Figure 3 , see Figure 4 , shows another structural block diagram of a system for implementing hot loading of a WEB server provided by an embodiment of the present invention;

[0105] The monitoring unit 100 is also used to: monitor the classes published on the WEB server;

[0106] Accordingly, the system also includes:

[0107] The reloading unit 500 is used to reload the class published on the WEB server if the class published on the WEB server changes.

[0108] The second access unit 600 is used to access the application virtual machine through the session service provided by the session virtual machine.

[0109] In the embodiment of the present invention, it is monitored whether a class published on a WEB server changes; when a class changes, hot loading of the WEB server can be completed by reloading the class without restarting the application virtual machine.

[0110] Preferably, combined Figure 4 , see Figure 5 , shows another structural block diagram of a system for implementing hot loading of a WEB server provided by an embodiment of the present invention, wherein the judgment unit 200 includes a decryption module 201, a judgment module 202 and a determination module 203.

[0111] The decryption module 201 is used to decrypt the encrypted message using a preset key to obtain a plaintext message.

[0112] A judging module 202 is used to judge whether the format of the plain text message is a specified format corresponding to the restart message;

[0113] The determination module 203 is configured to determine that the encrypted message is a restart message if the format of the plaintext message is a specified format.

[0114] Preferably, combined Figure 4 , see Figure 6 , shows another structural block diagram of a system for implementing hot loading of a WEB server provided by an embodiment of the present invention, wherein the restart unit 300 includes a stop module 301 and an execution module 302;

[0115] The stopping module 301 is used to stop the application virtual machine if the encrypted message is a restart message.

[0116] The execution module 302 is used to execute the virtual machine startup command through a virtual thread to restart the application virtual machine.

[0117] In summary, the embodiment of the present invention provides a method and system for implementing hot loading of a WEB server, wherein the application and session control of the WEB server are installed in the application virtual machine and the session virtual machine respectively, and the encrypted messages between the application virtual machine and the session virtual machine are monitored. If the encrypted message is a restart message, the application virtual machine is restarted, and the restarted application virtual machine is accessed through the session service provided by the session virtual machine to complete the hot loading, which can improve the stability of hot loading and provide business services without interruption.

[0118] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can refer to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system or system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can refer to the partial description of the method embodiment. The system and system embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without creative work.

[0119] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.

[0120] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A method for implementing hot loading of a WEB server, characterized in that: The method comprises: Monitoring encrypted messages between an application virtual machine and a session virtual machine, wherein the application virtual machine is installed with an application of a web server, and the session virtual machine is installed with a session control of the web server; Determining whether the encrypted message is a restart message; If the encrypted message is a restart message, restart the application virtual machine; The restarted application virtual machine is accessed through the session service provided by the session virtual machine.

2. The method according to claim 1, characterized in that The method further comprises: Listen to the classes published on the WEB server; If the class published on the WEB server changes, reload the class published on the WEB server; The application virtual machine is accessed through a session service provided by the session virtual machine.

3. The method according to claim 1 or 2, characterized in that: Determining whether the encrypted message is a restart message includes: Decrypting the encrypted message using a preset key to obtain a plaintext message; Determine whether the format of the plaintext message is a specified format corresponding to the restart message; If the format of the plaintext message is the specified format, it is determined that the encrypted message is a restart message.

4. The method according to claim 1 or 2, characterized in that: If the encrypted message is a restart message, restarting the application virtual machine includes: If the encrypted message is a restart message, stop the application virtual machine; The virtual machine startup command is executed in a virtual thread manner to restart the application virtual machine.

5. The method according to claim 1, characterized in that Monitor the encrypted messages between the application VM and the session VM, including: Use the socket service to monitor the encrypted messages between the application virtual machine and the session virtual machine.

6. A system for implementing hot loading of a WEB server, characterized in that: The system comprises: A monitoring unit, used for monitoring encrypted messages between an application virtual machine and a session virtual machine, wherein the application virtual machine is installed with an application of a WEB server, and the session virtual machine is installed with a session control of the WEB server; A judging unit, used to judge whether the encrypted message is a restart message; A restart unit, configured to restart the application virtual machine if the encrypted message is a restart message; The first access unit is used to access the restarted application virtual machine through the session service provided by the session virtual machine.

7. The system according to claim 6, characterized in that The monitoring unit is also used to: monitor the classes published on the WEB server; Accordingly, the system further comprises: A reloading unit, used for reloading the class published on the WEB server if the class published on the WEB server changes; The second access unit is used to access the application virtual machine through the session service provided by the session virtual machine.

8. The system according to claim 6 or 7, characterized in that: The judging unit comprises: A decryption module, used to decrypt the encrypted message using a preset key to obtain a plaintext message; A judging module, used to judge whether the format of the plaintext message is a specified format corresponding to the restart message; A determination module is used to determine that the encrypted message is a restart message if the format of the plaintext message is the specified format.

9. The system according to claim 6 or 7, characterized in that: The restart unit comprises: A stop module, used for stopping the application virtual machine if the encrypted message is a restart message; The execution module is used to execute the virtual machine startup command through a virtual thread to restart the application virtual machine.

10. The system according to claim 6, characterized in that The monitoring unit is specifically used to monitor the encrypted messages between the application virtual machine and the session virtual machine using the socket service.