Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present application more apparent, the embodiments of the present application are described in further detail below with reference to the embodiments and the accompanying drawings. The exemplary embodiments and descriptions of the embodiments are provided to explain the embodiments and should not be construed as limiting the embodiments.
The following describes embodiments of the present application in further detail with reference to the accompanying drawings.
Referring to fig. 2, the application system start-up protection method according to the embodiment of the present application includes the following steps:
step S101, after a first application system initiates a request for acquiring and starting the dependent data to a second system, receiving the dependent data returned by the second system aiming at the request.
In the embodiment of the present application, the second system includes a second application system (i.e. other application system relative to the first application system), a file system and/or a database, etc. In addition, both the first application system and the second system in the embodiment of the present application may be a stand-alone system, or may be a clustered system (such as a distributed system).
In the embodiment of the present application, the startup dependent data described herein refers to dependent data stored in other systems that are required by the application system at the time of startup. For example, assume that the first application system is a, and when starting, it needs to acquire data B from the second application system B, data C from the file system C, and data D from the database D, in addition to the data a (such as some configuration information) that is stored by itself and depends on the start. If A initiates a request for calling the data depended on for starting to the second application system B, the data depended on for starting at the moment is B data, similarly, if A initiates a request for accessing the data depended on for starting to the file system C, the data depended on for starting at the moment is C data, and if A initiates a request for inquiring the data depended on for starting to the database D, the data depended on for starting at the moment is D data.
In the embodiment of the application, the time when the first application system initiates a request for acquiring the data relied for starting to the second system may be generally when the first application system is started; in addition, when the data depended on by the first application system in the second system for starting is updated, the first application system can also initiate a request for acquiring the data depended on by the starting to the second system.
And step S102, judging whether the dependency data returned by the second system aiming at the request is received in a set time range. If the dependency data returned by the second system for the request is received within a set time range, executing step S103; and if the dependency data returned by the second system for the request is not received within the set time range, executing step S104.
In this embodiment, the set time range may be a waiting time of the first application system after the request is issued. And the waiting time of the first application system after sending the request can be obtained by a notification mechanism and the like, and the notification mechanism can be realized by a callback function and the like.
And step S103, judging whether the dependent data conforms to a preset data format. Generally, the data format of the data relied on for starting is specified in the request for obtaining the data relied on for starting, which is initiated by the first application system to the second system. If the dependent data does not conform to the preset data format, step S104 is executed.
And step S104, calling the pre-stored corresponding data loaded by the last successful start of the first application system so as to load the first application system when the first application system is started at this time.
In the embodiment of the present application, the last successful start refers to the last successful start of the first application system. The last successful start of the first application system shows that the data loaded during the start is correct, and the application example returns the correct data to the first application system for the start loading of the first application system can certainly greatly improve the successful start probability of the first application system.
In other embodiments of the present application, if the dependency data conforms to the preset data format, the method for protecting the application system from starting may further include the following steps:
and step S105, comparing whether the dependency data is consistent with corresponding data loaded by the previous successful start of the first application system. If the dependency data is consistent with the corresponding data loaded by the previous successful start of the first application system, executing step S106; and if the dependent data is inconsistent with the corresponding data which is prestored and loaded by the last successful start of the first application system, executing the step S107.
In the embodiment of the present application, the corresponding data refers to: and the first application system may need to load multiple data at each starting, and one of the multiple data may be from the second system, so that the data from the second system is the corresponding data of the dependent data returned by the second system for the request. For example, the data x loaded by the last successful start of the first application system comes from the second system, and the dependent data in the response returned by the second system to the request this time is x ', so that the data x is the corresponding data of the data x ', that is, the comparison objects in this step are x and x '.
And S106, storing the dependent data, and marking the data loaded by the current start as the data loaded when the first application system is successfully started last time after the first application system finishes the start loading containing the dependent data. Wherein the saving is typically a local saving (e.g., saving to a local disk).
Step S107, storing the dependency data, and after the first application system finishes the starting and loading including the dependency data, checking whether the starting of the first application system is successful; wherein the saving is typically a local saving (e.g., saving to a local disk). If the starting of the first application system is successful, executing step S108; and if the starting of the first application system fails, skipping to execute the step S104, namely calling the pre-stored corresponding data loaded by the last successful starting of the first application system for the first application system to start and load again.
In the embodiment of the present application, the checking whether the current start of the first application system is successful may be a one-time detection. In another embodiment of the present application, the checking whether the current startup of the first application system is successful may further be checking whether the current startup of the first application system is successful for multiple times within a set time limit (for example, one hour after the first application system completes the startup loading including the dependency data), otherwise, the current startup of the first application system is considered as a failure. In some embodiments of the present application, the plurality of tests may be timed tests (e.g., tests performed every three minutes). In other embodiments of the present application, the plurality of tests may be random tests.
In addition, in the embodiment of the present application, the content of the check may include whether the system port is normal, whether the system responds to the outside normally, and/or whether the system can provide normal service. In another embodiment of the present application, it may further be determined whether the first application system is normally started by an event marking manner, where the first application system performs event marking (for example, writing a file) after the first application system is normally started, and if the event marking is received within a set time after the first application system is started, it indicates that the first application system is successfully started, otherwise, it indicates that the first application system is failed to be started.
And step S108, marking the data loaded in the current starting as the data loaded in the latest successful starting.
In the embodiment of the application, the significance of storing the data loaded when the first application system is successfully started last time is to provide convenience for subsequent starting of the first application system. In an embodiment of the present application, data loaded at the time of successful startup of multiple historical versions may be retained at the same time, and when there is a new version of data stored, data of an expired version (i.e. the earliest version) may be deleted. Of course, in another embodiment of the present application, in order to prevent the memory resources from being excessively occupied by the historical load data, only a few (e.g., three) versions of the data loaded at the time of successful boot need be generally reserved.
In some embodiments of the present application, as an optimization measure, if the dependent data is inconsistent with the corresponding data loaded by the last successful start of the first application system, the dependent data may be further marked as problem data and saved. The method aims to directly identify the data as problem data if the same data is received when the first application system initiates a request for acquiring the data depended on by starting to the second system next time, and the data is not preloaded so as to avoid wasting system resources. In other embodiments of the present application, if the dependent data is different from the corresponding data loaded by the last successful start of the first application system, the dependent data may also be directly deleted, so as to save the storage space.
While the process flows described above include operations that occur in a particular order, it should be appreciated that the processes may include more or less operations that are performed sequentially or in parallel (e.g., using parallel processors or a multi-threaded environment).
In the embodiment of the application, after a first application system initiates a request for acquiring and starting dependent data to a second system, whether the dependent data returned by the second system for the request is received within a set time range is judged; if the dependency data is not received within the set time range or the dependency data is received within the set time range but the format of the dependency data has a problem, calling the pre-stored corresponding data loaded by the last successful start of the first application system for loading when the first application system is started at this time. Because the corresponding data loaded by the last successful start of the application system is correct, even if the problems of network disconnection, downtime, network jitter or depending on data format errors and the like occur between the current application system and other related systems, the embodiment of the application can still ensure that the correct data which is depended on by the start can be loaded by the application system when the application system is started, thereby improving the success rate of the start of the application system.
In addition, if the dependency data received in the set time range conform to the preset data format, comparing whether the dependency data is consistent with the corresponding data loaded by the previous successful start of the first application system. If the data are consistent, the dependent data are saved and directly loaded; if not, the dependent data is stored, and whether the starting of the first application system is successful or not is checked after the first application system finishes the starting loading containing the dependent data. If the startup is successful, the data loaded by the startup is marked as the data loaded when the startup is successfully started last time. If the first application system fails, the pre-stored corresponding data loaded by the last successful start of the first application system is called, so that the first application system can be started and loaded again. Therefore, even if the content of the dependent data returned by other related systems has errors or is missing, the embodiment of the application can still ensure that the application system can be loaded with correct starting dependent data when being started, thereby further improving the starting success rate of the application system.
Referring to fig. 3, an application system start-up protection device according to an embodiment of the present application includes:
the data receiving module 31 is configured to determine whether to receive the dependent data returned by the second system for the request within a set time range after the first application system initiates a request for acquiring and starting the dependent data to the second system.
In the embodiment of the present application, the second system includes a second application system (i.e. other application system relative to the first application system), a file system and/or a database, etc. In addition, both the first application system and the second system in the embodiment of the present application may be a stand-alone system, or may be a clustered system (such as a distributed system).
In the embodiment of the present application, the startup dependent data described herein refers to dependent data stored in other systems that are required by the application system at the time of startup. For example, assume that the first application system is a, and when starting, it needs to acquire data B from the second application system B, data C from the file system C, and data D from the database D, in addition to the data a (such as some configuration information) that is stored by itself and depends on the start. If A initiates a request for calling the data depended on for starting to the second application system B, the data depended on for starting at the moment is B data, similarly, if A initiates a request for accessing the data depended on for starting to the file system C, the data depended on for starting at the moment is C data, and if A initiates a request for inquiring the data depended on for starting to the database D, the data depended on for starting at the moment is D data.
In the embodiment of the application, the time when the first application system initiates a request for acquiring the data relied for starting to the second system may be generally when the first application system is started; in addition, when the data depended on by the first application system in the second system for starting is updated, the first application system can also initiate a request for acquiring the data depended on by the starting to the second system.
In the embodiment of the application, the time when the first application system initiates a request for acquiring the data relied for starting to the second system may be generally when the first application system is started; in addition, when the data depended on by the first application system in the second system for starting is updated, the first application system can also initiate a request for acquiring the data depended on by the starting to the second system.
In this embodiment, the set time range may be a waiting time of the first application system after the request is issued. And the waiting time of the first application system after sending the request can be obtained by a notification mechanism and the like, and the notification mechanism can be realized by a callback function and the like.
The format determining module 30 is configured to determine whether the dependent data conforms to a preset data format when the data receiving module 31 receives the dependent data within the set time range. Generally, the data format of the data relied on for starting is specified in the request for obtaining the data relied on for starting, which is initiated by the first application system to the second system.
The first starting coordination module 32 is configured to, when the dependent data does not conform to the preset data format or the data receiving module 31 does not receive the dependent data within the set time range, call the pre-stored corresponding data loaded by the last successful start of the first application system, so that the corresponding data is loaded when the first application system is started this time.
The last successful start of the first application system shows that the data loaded during the start is correct, and the application example returns the correct data to the first application system for the start loading of the first application system can certainly greatly improve the successful start probability of the first application system.
In other embodiments of the present application, the application system start-up protection device may further include:
and a data comparison module 33, configured to, when the dependency data conforms to the preset data format, compare whether the dependency data is consistent with corresponding data that is pre-stored and loaded by the last successful start of the first application system.
In the embodiment of the present application, the corresponding data refers to: and the first application system may need to load multiple data at each starting, and one of the multiple data may be from the second system, so that the data from the second system is the corresponding data of the dependent data returned by the second system for the request. For example, the data x loaded by the last successful start of the first application system comes from the second system, and the dependent data in the response returned by the second system to the request this time is x ', so that the data x is the corresponding data of the data x ', that is, the comparison objects in this step are x and x '.
A second starting coordination module 35, configured to store the dependency data when the dependency data is inconsistent with corresponding data that is pre-stored and loaded in a last successful start of the first application system. Wherein the saving is typically a local saving (e.g., saving to a local disk).
A health check module 36, configured to check whether the current startup of the first application system is successful after the first application system completes the startup loading including the dependency data.
In the embodiment of the present application, the checking whether the current start of the first application system is successful may be a one-time detection. In another embodiment of the present application, the checking whether the current startup of the first application system is successful may further be checking whether the current startup of the first application system is successful for multiple times within a set time limit (for example, one hour after the first application system completes the startup loading including the dependency data), otherwise, the current startup of the first application system is considered as a failure. In some embodiments of the present application, the plurality of tests may be timed tests (e.g., tests performed every three minutes). In other embodiments of the present application, the plurality of tests may be random tests.
In addition, in the embodiment of the present application, the content of the check may include whether the system port is normal, whether the system responds to the outside normally, and/or whether the system can provide normal service. Since the above-mentioned inspection is a matter of routine skill in the art, it is not necessary to describe herein in detail. In another embodiment of the present application, it may further be determined whether the first application system is normally started by an event marking manner, where the first application system performs event marking (for example, writing a file) after the first application system is normally started, and if the event marking is received within a set time after the first application system is started, it indicates that the first application system is successfully started, otherwise, it indicates that the first application system is failed to be started.
A third starting coordination module 37, configured to, when the current starting of the first application system fails, call pre-stored corresponding data loaded by the last successful starting of the first application system, so as to allow the first application system to be restarted and loaded.
A fourth start coordination module 34, configured to, when the dependency data is consistent with corresponding data that is pre-stored and loaded in a last successful start of the first application system, store the dependency data, and after the first application system completes a start load that includes the dependency data, mark data loaded in the current start as data loaded in a last successful start. Wherein the saving is typically a local saving (e.g., saving to a local disk).
The first data marking module 38 is configured to mark, when the current start of the first application system is successful, the data loaded by the current start as the data loaded when the current start is successful.
In the embodiment of the application, the significance of storing the data loaded when the first application system is successfully started last time is to provide convenience for subsequent starting of the first application system. In an embodiment of the present application, data loaded at the time of successful startup of multiple historical versions may be retained at the same time, and when there is a new version of data stored, data of an expired version (i.e. the earliest version) may be deleted. Of course, in another embodiment of the present application, in order to prevent the memory resources from being excessively occupied by the historical load data, only a few (e.g., three) versions of the data loaded at the time of successful boot need be generally reserved.
And a second data marking module 39, configured to mark the dependent data as problem data when the current start of the first application system fails. In some embodiments of the present application, as an optimization measure, if the dependent data is inconsistent with the corresponding data loaded by the last successful start of the first application system, the dependent data may be further marked as problem data and saved. The method aims to directly identify the data as problem data if the same data is received when the first application system initiates a request for acquiring the data depended on by starting to the second system next time, and the data is not preloaded so as to avoid wasting system resources.
In another embodiment of the present application, as shown in fig. 4, the second data marking module 39 of the application system start-up protection device may be replaced with a data deleting module 39' without changing other modules. The data deleting module 39' is configured to delete the dependent data when the current start of the first application system fails, so as to save a storage space.
In the embodiment of the application, after a first application system initiates a request for acquiring and starting dependent data to a second system, a data receiving module judges whether the dependent data returned by the second system aiming at the request is received within a set time range; if the dependency data is not received within the set time range or the dependency data is received within the set time range but the format of the dependency data is in a problem, the first starting coordination module calls the pre-stored corresponding data loaded by the last successful starting of the first application system so as to load the first application system when the first application system is started at this time. Because the corresponding data loaded by the last successful start of the application system is correct, even if the problems of network disconnection, downtime, network jitter or depending on data format errors and the like occur between the current application system and other related systems, the embodiment of the application can still ensure that the correct data which is depended on by the start can be loaded by the application system when the application system is started, thereby improving the success rate of the start of the application system.
In addition, if the dependency data received in the set time range conform to the preset data format, the data comparison module compares whether the dependency data is consistent with the corresponding data loaded by the pre-stored last successful start of the first application system. If the data are consistent, the fourth starting coordination module saves the dependent data and directly loads the dependent data; and if not, the second starting coordination module stores the dependent data and checks whether the starting of the first application system is successful or not after the first application system finishes the starting loading containing the dependent data. If the data loading is successful, the first data marking module marks the data loaded by the current starting as the data loaded when the starting is successful last time. If the first application system fails, the third starting coordination module calls the pre-stored corresponding data loaded by the last successful starting of the first application system so as to be used for the first application system to start and load again. Therefore, even if the content of the dependent data returned by other related systems has errors or is missing, the embodiment of the application can still ensure that the application system can be loaded with correct starting dependent data when being started, thereby further improving the starting success rate of the application system.
For convenience of description, the above devices are described as being divided into various modules by functions, and are described separately. Of course, the functionality of the various modules may be implemented in the same one or more software and/or hardware implementations as the present application.
The device can be arranged in an application system as a part of the application system to realize the function of the application system. As another embodiment, the above apparatus may also be independently disposed between the first application system and the second system to implement its functions.
Referring to fig. 5, the application system of the embodiment of the present application is provided with an application system start-up protection device based on an original module, that is, the application system start-up protection device forms a part of the application system of the embodiment of the present application, and the application system start-up protection device interacts with the original module and a local disk of the application system to implement its function (for example, interacts with the local disk when data is stored, interacts with the original module of the application system when data is returned, and so on). Specifically, please refer to the above device embodiments, which are not described herein again.
The methods or apparatus described above in the embodiments of the present application may be embodied directly in a software module that is executable by a processor. A software module may be stored in RAM memory, flash memory, ROM memory, EPROM memory, EEPROM memory, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art. For example, a storage medium may be coupled to the processor such the processor can read information from, and write information to, the storage medium. In the alternative, the storage medium may be integral to the processor.
Those of skill would further appreciate that the various illustrative logical blocks and steps described in connection with the embodiments disclosed herein may be implemented as a combination of hardware and software, such as by implementing portions of the spectral analysis of the embodiments disclosed herein in hardware while other portions are implemented in software. Whether implemented in software or a combination of software and hardware depends upon the particular application and design requirements of the overall system. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the embodiments of the present application.
The above-mentioned embodiments are intended to illustrate the objects, technical solutions and advantages of the present application in further detail, and it should be understood that the above-mentioned embodiments are only examples of the embodiments of the present application and are not intended to limit the scope of the present application, and any modifications, equivalents, improvements and the like made within the spirit and principle of the present application should be included in the scope of the present application.