CN117093145A - Application restarting method and terminal - Google Patents
Application restarting method and terminal Download PDFInfo
- Publication number
- CN117093145A CN117093145A CN202310973023.XA CN202310973023A CN117093145A CN 117093145 A CN117093145 A CN 117093145A CN 202310973023 A CN202310973023 A CN 202310973023A CN 117093145 A CN117093145 A CN 117093145A
- Authority
- CN
- China
- Prior art keywords
- cache
- application
- packet
- data
- central node
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 42
- 238000004806 packaging method and process Methods 0.000 claims description 16
- 238000004590 computer program Methods 0.000 claims description 8
- 238000012423 maintenance Methods 0.000 abstract description 6
- 230000003139 buffering effect Effects 0.000 description 4
- 230000009286 beneficial effect Effects 0.000 description 3
- 238000010586 diagram Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 230000004044 response Effects 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0628—Interfaces specially adapted for storage systems making use of a particular technique
- G06F3/0655—Vertical data movement, i.e. input-output transfer; data movement between one or more hosts and one or more storage devices
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/24—Querying
- G06F16/245—Query processing
- G06F16/2455—Query execution
- G06F16/24552—Database cache management
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0602—Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
- G06F3/061—Improving I/O performance
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Human Computer Interaction (AREA)
- Databases & Information Systems (AREA)
- Computational Linguistics (AREA)
- Data Mining & Analysis (AREA)
- Debugging And Monitoring (AREA)
Abstract
The invention discloses a method and a terminal for restarting an application, wherein data in a local cache is packaged and sent to a central node at regular time when the application is started, and a write operation log of data written in the local cache is recorded at the same time; when the application is restarted, the cache packet of the application can be pulled from the central node, and the write operation log is obtained according to the generation time of the cache packet, so that the write operation log is covered in the cache packet to obtain the restarting initialization cache information. Compared with the method for carrying out cache initialization by pulling data from a database in the prior art, the method can carry out cache initialization by combining the cache information and the log in the central node, and when the cache data required by initialization is larger, the method can greatly reduce the time for restarting the initialization cache by application and improve the overall operation and maintenance efficiency.
Description
Technical Field
The present invention relates to the field of application restart technologies, and in particular, to a method and a terminal for application restart.
Background
All systems currently have a requirement of buffering, because the information is usually read from the database through disk IO or network IO on cloud storage, which takes more time. In order to meet the requirements of high concurrency and high throughput, most systems are additionally provided with a memory buffer layer on the basis of application of the system, so that temporary data is stored, the data is read through a memory, the rapid reading of the data can be ensured, and response delay time is reduced.
However, as the amount of system data increases, the cache data also increases gradually, and when each application instance is restarted, the generation of the cache data needs to be synchronously waited, and the generation of the cache data is a longer process, so that a longer process occurs in restarting the whole application.
Disclosure of Invention
The technical problems to be solved by the invention are as follows: the application restarting method and the terminal can reduce the time for initializing the application restarting.
In order to solve the technical problems, the invention adopts the following technical scheme:
a method of application restart, comprising the steps of:
the method comprises the steps of regularly reading data in a local cache, packaging the data into a cache packet, sending the cache packet to a central node, and simultaneously recording a write operation log of the local cache;
and responding to the restarting operation of the application, pulling the cache packet of the application from the central node, acquiring a write operation log from the generating time to the current time according to the generating time of the pulled cache packet, and covering the acquired write operation log into the pulled cache packet to obtain initialization cache information required by restarting.
In order to solve the technical problems, the invention adopts another technical scheme that:
a terminal for application restart comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the following steps when executing the computer program:
the method comprises the steps of regularly reading data in a local cache, packaging the data into a cache packet, sending the cache packet to a central node, and simultaneously recording a write operation log of the local cache;
and responding to the restarting operation of the application, pulling the cache packet of the application from the central node, acquiring a write operation log from the generating time to the current time according to the generating time of the pulled cache packet, and covering the acquired write operation log into the pulled cache packet to obtain initialization cache information required by restarting.
The invention has the beneficial effects that: when the application is started, data in the local cache is packaged and sent to the central node at regular time, and meanwhile, a write operation log of the data written in the local cache is recorded; when the application is restarted, the cache packet of the application can be pulled from the central node, and the write operation log is obtained according to the generation time of the cache packet, so that the write operation log is covered in the cache packet to obtain the restarting initialization cache information. Compared with the method for carrying out cache initialization by pulling data from a database in the prior art, the method can carry out cache initialization by combining the cache information and the log in the central node, and when the cache data required by initialization is larger, the method can greatly reduce the time for restarting the initialization cache by application and improve the overall operation and maintenance efficiency.
Drawings
FIG. 1 is a flow chart of a method for application restart in accordance with an embodiment of the present invention;
fig. 2 is a schematic diagram of a terminal to which restart is applied according to an embodiment of the present invention;
description of the reference numerals:
1. a terminal for restarting an application; 2. a memory; 3. a processor.
Detailed Description
In order to describe the technical contents, the achieved objects and effects of the present invention in detail, the following description will be made with reference to the embodiments in conjunction with the accompanying drawings.
Referring to fig. 1, an embodiment of the present invention provides a method for restarting an application, including the steps of:
the method comprises the steps of regularly reading data in a local cache, packaging the data into a cache packet, sending the cache packet to a central node, and simultaneously recording a write operation log of the local cache;
and responding to the restarting operation of the application, pulling the cache packet of the application from the central node, acquiring a write operation log from the generating time to the current time according to the generating time of the pulled cache packet, and covering the acquired write operation log into the pulled cache packet to obtain initialization cache information required by restarting.
From the above description, the beneficial effects of the invention are as follows: when the application is started, data in the local cache is packaged and sent to the central node at regular time, and meanwhile, a write operation log of the data written in the local cache is recorded; when the application is restarted, the cache packet of the application can be pulled from the central node, and the write operation log is obtained according to the generation time of the cache packet, so that the write operation log is covered in the cache packet to obtain the restarting initialization cache information. Compared with the method for carrying out cache initialization by pulling data from a database in the prior art, the method can carry out cache initialization by combining the cache information and the log in the central node, and when the cache data required by initialization is larger, the method can greatly reduce the time for restarting the initialization cache by application and improve the overall operation and maintenance efficiency.
Further, overlaying the obtained write operation log into the pulled cache packet includes:
and searching the cache data containing the key value in the pulled cache packet according to the key value of the write data in the write operation log, and covering the value in the cache data by using the value of the write data.
As can be seen from the above description, the cache data corresponding to the operation log is searched according to the key value, so that the history cache data stored in the central node can be covered, and the efficiency of generating the restarted initialization cache is improved in a data coverage manner.
Further, sending the buffered packets to a central node includes:
and sending the cache packet to a central node, and recording application information corresponding to the cache packet and the generation time of the cache packet in the central node.
As can be seen from the above description, the generation time of the cache packet and the reference information corresponding to the cache packet are stored in the central node, so that any subsequent application can go to the central node to search the corresponding cache information when restarting, and the efficiency of restarting the application is further improved.
Further, pulling the cached packets of the application from the central node includes:
pulling a corresponding cache packet from the central node according to the application information of the application;
judging whether the pulled cache packet is empty, if so, acquiring application initialization information from a database and generating initialization cache information required by restarting, otherwise, acquiring the generation time of the cache packet.
As can be seen from the above description, when the cache packet pulled to the application is empty, the data is obtained from the database, which can be suitable for different application cache situations.
Further, the obtaining the initialization cache information required by restarting includes:
and deleting the cache packet of the application in the central node, and executing the operation of regularly reading the data in the local cache and packaging the data into the cache packet.
As can be seen from the above description, after the initialization cache information is generated each time of restarting, the cache packet of the corresponding application in the central node is deleted, and the application is started for this time to perform cache packaging, so that the storage pressure of the central node and the cache generation pressure of each time of restarting are reduced.
Referring to fig. 2, another embodiment of the present invention provides a terminal for restarting an application, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the following steps when executing the computer program:
the method comprises the steps of regularly reading data in a local cache, packaging the data into a cache packet, sending the cache packet to a central node, and simultaneously recording a write operation log of the local cache;
and responding to the restarting operation of the application, pulling the cache packet of the application from the central node, acquiring a write operation log from the generating time to the current time according to the generating time of the pulled cache packet, and covering the acquired write operation log into the pulled cache packet to obtain initialization cache information required by restarting.
From the above description, the beneficial effects of the invention are as follows: when the application is started, data in the local cache is packaged and sent to the central node at regular time, and meanwhile, a write operation log of the data written in the local cache is recorded; when the application is restarted, the cache packet of the application can be pulled from the central node, and the write operation log is obtained according to the generation time of the cache packet, so that the write operation log is covered in the cache packet to obtain the restarting initialization cache information. Compared with the method for carrying out cache initialization by pulling data from a database in the prior art, the method can carry out cache initialization by combining the cache information and the log in the central node, and when the cache data required by initialization is larger, the method can greatly reduce the time for restarting the initialization cache by application and improve the overall operation and maintenance efficiency.
Further, overlaying the obtained write operation log into the pulled cache packet includes:
and searching the cache data containing the key value in the pulled cache packet according to the key value of the write data in the write operation log, and covering the value in the cache data by using the value of the write data.
As can be seen from the above description, the cache data corresponding to the operation log is searched according to the key value, so that the history cache data stored in the central node can be covered, and the efficiency of generating the restarted initialization cache is improved in a data coverage manner.
Further, sending the buffered packets to a central node includes:
and sending the cache packet to a central node, and recording application information corresponding to the cache packet and the generation time of the cache packet in the central node.
As can be seen from the above description, the generation time of the cache packet and the reference information corresponding to the cache packet are stored in the central node, so that any subsequent application can go to the central node to search the corresponding cache information when restarting, and the efficiency of restarting the application is further improved.
Further, pulling the cached packets of the application from the central node includes:
pulling a corresponding cache packet from the central node according to the application information of the application;
judging whether the pulled cache packet is empty, if so, acquiring application initialization information from a database and generating initialization cache information required by restarting, otherwise, acquiring the generation time of the cache packet.
As can be seen from the above description, when the cache packet pulled to the application is empty, the data is obtained from the database, which can be suitable for different application cache situations.
Further, the obtaining the initialization cache information required by restarting includes:
and deleting the cache packet of the application in the central node, and executing the operation of regularly reading the data in the local cache and packaging the data into the cache packet.
As can be seen from the above description, after the initialization cache information is generated each time of restarting, the cache packet of the corresponding application in the central node is deleted, and the application is started for this time to perform cache packaging, so that the storage pressure of the central node and the cache generation pressure of each time of restarting are reduced.
The method and the terminal for restarting the application are suitable for greatly reducing the time for initializing the cache by restarting the application when the application is in downtime restart or upgrade restart, and improve the overall operation and maintenance efficiency, and are explained by a specific implementation mode:
example 1
Referring to fig. 1, a method for restarting an application includes the steps of:
s1, regularly reading data in a local cache, packaging the data into a cache packet, sending the cache packet to a central node, and simultaneously recording a write operation log of the local cache.
Specifically, the cache packet is sent to a central node, and application information corresponding to the cache packet and generation time of the cache packet are recorded in the central node.
In this embodiment, an independent asynchronous thread task is started immediately after the application is successfully started. The main work of the task is as follows: and (3) regularly reading related data in the local cache, packaging, calling an interface of the center node, and sending the cache data to the center node. At this time, the central node needs to record, and the relevant information of the cache packet includes: information such as the name of the application, the instance id of the application, the generation time of the cache packet, and the like.
When the subsequent cache is applied to write operation, after the cache data is successfully written, the cache write operation log is required to be synchronously recorded, and the log is stored in a hard disk to ensure that the log content is not lost; wherein the log content includes an operation time, and data content written to the cache.
S2, responding to restarting operation of the application, pulling the cache package of the application from the central node, acquiring a write operation log from the generation time to the current time according to the generation time of the pulled cache package, and covering the acquired write operation log into the pulled cache package to obtain initialization cache information required by restarting.
S21, pulling a corresponding cache packet from the central node according to the application information of the application, judging whether the pulled cache packet is empty, if so, acquiring application initialization information from a database and generating initialization cache information required by restarting, otherwise, acquiring the generation time of the cache packet.
In this embodiment, when the application is in a downtime restart or upgrade restart scenario, the application pulls the already stored cache data from the central node in advance, specifically, according to the name of the application and the instance id of the application.
If the pulled data is empty, the application re-pulls the information from the database according to the service logic of the application and generates local cache information. If the pull data is not empty, when the cache packet is acquired from the central node, the generation time of the cache packet may be acquired, and step S22 is performed.
S22, searching the cache data containing the key value in the pulled cache packet according to the key value of the write data in the write operation log, and covering the value in the cache data by using the value of the write data.
In this embodiment, the latest log is obtained from the local cache log, the log time range is all log data from the generation time of the cache packet to the current time, the log data is covered to the cache packet of the central node according to the key-value of the data, and the final result data is the local cache information at the latest moment before restarting.
S23, deleting the cache packet of the application in the central node, and executing the operation of regularly reading the data in the local cache and packaging the data into the cache packet.
In this embodiment, after the initialization cache information is generated by restarting each time, the cache packet in the central node is deleted, and subsequent cache packaging is performed for the application after the restart is successful, so that the storage pressure of the central node and the cache generation pressure of each restart are reduced.
Therefore, in the prior art, when the application is restarted and initialized, a large amount of data may be pulled from the database, but the IO of the database is much more time-consuming than the buffering IO, so in this embodiment, the buffering is transferred and stored to the central node, and the buffering data of the central node is acquired when the application is restarted, so that the time of the application is restarted and initialized can be reduced. The valid data in the local log is only the data of the instance, and there may be more data of one instance and less data of another instance, so that the merging and covering operation of the log and the data of the central node is required to ensure that the restart cache initialization is performed quickly and accurately.
Example two
Referring to fig. 2, a terminal 1 for restarting an application includes a memory 2, a processor 3, and a computer program stored in the memory 2 and executable on the processor 3, wherein the processor 3 implements the steps of a method for restarting an application according to the first embodiment when executing the computer program.
In summary, according to the method and the terminal for restarting the application provided by the invention, when the application is started, data in the local cache is packaged and sent to the central node at regular time, and meanwhile, a write operation log of the write data in the local cache is recorded; when the application is restarted, the cache packet of the application can be pulled from the central node, and the write operation log is obtained according to the generation time of the cache packet, so that the write operation log is covered in the cache packet to obtain the restarting initialization cache information. Compared with the method for carrying out cache initialization by pulling data from a database in the prior art, the method can carry out cache initialization by combining the cache information and the log in the central node, and when the cache data required by initialization is larger, the method can greatly reduce the time for restarting the initialization cache by application and improve the overall operation and maintenance efficiency.
The foregoing description is only illustrative of the present invention and is not intended to limit the scope of the invention, and all equivalent changes made by the specification and drawings of the present invention, or direct or indirect application in the relevant art, are included in the scope of the present invention.
Claims (10)
1. A method of application restart, comprising the steps of:
the method comprises the steps of regularly reading data in a local cache, packaging the data into a cache packet, sending the cache packet to a central node, and simultaneously recording a write operation log of the local cache;
and responding to the restarting operation of the application, pulling the cache packet of the application from the central node, acquiring a write operation log from the generating time to the current time according to the generating time of the pulled cache packet, and covering the acquired write operation log into the pulled cache packet to obtain initialization cache information required by restarting.
2. The method of claim 1, wherein overwriting the obtained write operation log into the pulled cache packet comprises:
and searching the cache data containing the key value in the pulled cache packet according to the key value of the write data in the write operation log, and covering the value in the cache data by using the value of the write data.
3. The method of claim 1, wherein transmitting the cache packet to a central node comprises:
and sending the cache packet to a central node, and recording application information corresponding to the cache packet and the generation time of the cache packet in the central node.
4. A method of restarting an application according to claim 3 wherein pulling the cached packets of the application from the central node includes:
pulling a corresponding cache packet from the central node according to the application information of the application;
judging whether the pulled cache packet is empty, if so, acquiring application initialization information from a database and generating initialization cache information required by restarting, otherwise, acquiring the generation time of the cache packet.
5. The method for restarting an application according to claim 1, wherein after obtaining the initialization cache information required for restarting, the method comprises:
and deleting the cache packet of the application in the central node, and executing the operation of regularly reading the data in the local cache and packaging the data into the cache packet.
6. A terminal for application restart comprising a memory, a processor and a computer program stored on said memory and executable on the processor, characterized in that said processor implements the following steps when executing said computer program:
the method comprises the steps of regularly reading data in a local cache, packaging the data into a cache packet, sending the cache packet to a central node, and simultaneously recording a write operation log of the local cache;
and responding to the restarting operation of the application, pulling the cache packet of the application from the central node, acquiring a write operation log from the generating time to the current time according to the generating time of the pulled cache packet, and covering the acquired write operation log into the pulled cache packet to obtain initialization cache information required by restarting.
7. The application restart terminal according to claim 6, wherein overwriting the obtained write operation log into the pulled cache packet comprises:
and searching the cache data containing the key value in the pulled cache packet according to the key value of the write data in the write operation log, and covering the value in the cache data by using the value of the write data.
8. The terminal for application restart of claim 6, wherein transmitting the buffered packets to a central node comprises:
and sending the cache packet to a central node, and recording application information corresponding to the cache packet and the generation time of the cache packet in the central node.
9. The application restart terminal according to claim 8, wherein pulling the application cache packet from the central node comprises:
pulling a corresponding cache packet from the central node according to the application information of the application;
judging whether the pulled cache packet is empty, if so, acquiring application initialization information from a database and generating initialization cache information required by restarting, otherwise, acquiring the generation time of the cache packet.
10. The terminal for restarting an application according to claim 6, wherein after obtaining the initialization buffer information required for restarting, the method comprises:
and deleting the cache packet of the application in the central node, and executing the operation of regularly reading the data in the local cache and packaging the data into the cache packet.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310973023.XA CN117093145A (en) | 2023-08-03 | 2023-08-03 | Application restarting method and terminal |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310973023.XA CN117093145A (en) | 2023-08-03 | 2023-08-03 | Application restarting method and terminal |
Publications (1)
Publication Number | Publication Date |
---|---|
CN117093145A true CN117093145A (en) | 2023-11-21 |
Family
ID=88780761
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202310973023.XA Pending CN117093145A (en) | 2023-08-03 | 2023-08-03 | Application restarting method and terminal |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN117093145A (en) |
-
2023
- 2023-08-03 CN CN202310973023.XA patent/CN117093145A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110442560B (en) | Log replay method, device, server and storage medium | |
US7139927B2 (en) | Journaling and recovery method of shared disk file system | |
US7587400B2 (en) | Suspending a result set and continuing from a suspended result set for transparent session migration | |
CN107608627B (en) | Remote data hierarchical storage method, electronic equipment and storage medium | |
CN109325016B (en) | Data migration method, device, medium and electronic equipment | |
CN112486913B (en) | Log asynchronous storage method and device based on cluster environment | |
CN111881116A (en) | Data migration method, data migration system, computer system, and storage medium | |
CN113031864B (en) | Data processing method and device, electronic equipment and storage medium | |
CN113806300B (en) | Data storage method, system, device, equipment and storage medium | |
WO2023015866A1 (en) | Data writing method, apparatus and system, and electronic device and storage medium | |
CN112612799A (en) | Data synchronization method and terminal | |
CN114528255A (en) | Metadata management method, electronic device and computer program product | |
US7010650B2 (en) | Multiple data management method, computer and storage device therefor | |
CN117093145A (en) | Application restarting method and terminal | |
CN111694806A (en) | Transaction log caching method, device, equipment and storage medium | |
WO2023071043A1 (en) | File aggregation compatibility method and apparatus, computer device and storage medium | |
US9069821B2 (en) | Method of processing files in storage system and data server using the method | |
CN111090782A (en) | Graph data storage method, device, equipment and storage medium | |
CN114490540B (en) | Data storage method, medium, device and computing equipment | |
CN113157738B (en) | In-heap data cache synchronization method and device, computer equipment and storage medium | |
CN113934691B (en) | Method for accessing file, electronic device and readable storage medium | |
CN112231409B (en) | Database synchronization initialization loading method, device, equipment and storage medium | |
CN113051244B (en) | Data access method and device, and data acquisition method and device | |
CN115061630A (en) | Data migration method, device, equipment and medium | |
WO2022252322A1 (en) | Method for synchronizing memory database and relational database of feature tag-based power grid monitoring system |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |