Data updating method and device, computer equipment and storage medium
By updating the execution interval time when an application is abnormal and restarting the application, the application load and parameter update delay caused by improper execution interval time setting is solved, and the application can be quickly restored and stable operation in an abnormal state is achieved.
Patent Information
- Application Number
- CN202411563021.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-04
- Publication Date
- 2025-03-25
AI Technical Summary
In the application system, setting the execution interval time too long or too short will cause the application load to increase or the service execution parameters cannot be updated in time, affecting the normal operation of the application, especially when a sudden abnormality occurs in a third-party service interface.
When the application running state is switched from normal to abnormal, the execution interval in the configuration table is updated, from a longer first time to a shorter second time, and restart the application so that the timing tasks are executed in a timely manner after restarting to obtain the latest business execution parameters.
By timely updating the execution interval time and restarting the application, the latest business execution parameters can be quickly obtained, ensuring that the application can quickly recover in an abnormal state, and improving the operation stability of the application.
Smart Images

Figure CN119690745A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a data updating method, device, computer equipment and storage medium. Background Art
[0002] In the current application system, when faced with business requests, in order to reduce the access to the database, people usually choose to use caching technology to write some business execution parameters related to the application operation into the local cache, and set up a scheduled task program in the application so that the application can refresh the latest parameters from the database at a certain execution interval, thereby ensuring the normal operation of the application.
[0003] Currently, most of the execution intervals configured in applications are written into the code layer of the application. However, if the execution interval is set to be short, the load of the application will increase, while if the execution interval is set to be long, the application, especially some applications that use third-party service interfaces as business execution parameters, will have to wait for a long execution interval to refresh the parameters when the third-party service interface suddenly fails to be called, thus affecting the normal operation of the application. Summary of the invention
[0004] In response to the above technical problems, embodiments of the present application provide a data updating method, apparatus, computer device and storage medium.
[0005] In a first aspect, an embodiment of the present application provides a data updating method, comprising:
[0006] When the running state of the application switches from normal to abnormal, updating the execution interval duration in the configuration table of the application from a first duration to a second duration, and restarting the application, wherein the second duration is less than the first duration;
[0007] During the restart process of the application, reading the execution interval duration in the configuration table;
[0008] The scheduled task of the application is executed according to the read execution interval duration, and the scheduled task is used to obtain the service execution parameters of the application.
[0009] In a second aspect, an embodiment of the present application provides a data updating device, including:
[0010] An updating module, configured to update the execution interval duration in the configuration table of the application from a first duration to a second duration, and restart the application when the running state of the application switches from normal to abnormal, wherein the second duration is less than the first duration;
[0011] A reading module, used for reading the execution interval duration in the configuration table during the restart process of the application;
[0012] An execution module is used to execute a scheduled task of the application according to the read execution interval duration, wherein the scheduled task is used to obtain a business execution parameter of the application.
[0013] In a third aspect, an embodiment of the present application further provides a computer device, comprising a processor and a memory, wherein the memory stores a plurality of instructions; the processor loads instructions from the memory to execute the data updating steps as described above.
[0014] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a plurality of instructions, wherein the instructions are suitable for a processor to load to execute the data updating steps as described above.
[0015] In a fifth aspect, an embodiment of the present application further provides a computer program product, wherein the computer program product comprises a computer program, and the computer program is executed by a processor to perform the steps of data updating as described above.
[0016] In the present application, when it is detected that the running state of the application switches from normal to abnormal, the execution interval time in the application configuration table will be updated from a longer first duration to a shorter second duration, and the application will be restarted, so that the application can read the updated execution interval time in the configuration table during the restart process, so that after the application is restarted, it can execute a scheduled task of the application after a shorter execution interval time to obtain the business execution parameters of the application. Compared with the related art, after the application detects an abnormality, it is still necessary to execute a scheduled task to obtain the business execution parameters of the application according to the execution interval time fixedly written in the application code. By adopting the solution of the embodiment of the present application, when facing an application abnormality, a scheduled task can be executed promptly and quickly to obtain the business execution parameters, so that the application can be quickly restored from the abnormal state using the latest acquired business execution parameters, thereby ensuring the stability of the application operation. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0018] Figure 1 A schematic diagram of a data updating method according to an embodiment of the present invention;
[0019] Figure 2 A schematic diagram of a process flow of synchronizing service execution parameters by synchronizing parameters provided in an embodiment of the present application;
[0020] Figure 3 A flowchart of a step of updating synchronization parameters to determine whether to synchronize service execution parameters is provided in an embodiment of the present application;
[0021] Figure 4 A schematic diagram of the steps of another data updating method provided in an embodiment of the present application;
[0022] Figure 5 A schematic diagram of the structure of a data updating device provided in an embodiment of the present application;
[0023] Figure 6 A schematic diagram of the structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0024] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without making creative work are within the scope of protection of the present application. At the same time, in the description of the embodiments of the present application, the terms "first", "second", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance. Thus, the features defined as "first" and "second" may explicitly or implicitly include one or more features. In the description of the embodiments of the present application, the meaning of "multiple" is two or more, unless otherwise clearly and specifically defined.
[0025] In order to better understand the data update method, device, computer equipment and storage medium provided by the present application, the relevant application background of the data update method is first described. The data update method provided by the present application is usually applied to an application system, especially a type of application system that uses cache technology to write some business execution parameters related to the application operation into the local cache of the application in order to reduce the access to the database, and sets a scheduled task program, so as to refresh the latest parameters from the database at a certain execution interval. For example, it is more common to take the credit business in the financial field as an example, which usually includes business programs such as face recognition, authentication, etc. In the face recognition process, the face recognition application may need to rely on the interface of the face recognition technology provided by a third party to realize the response to the face recognition business initiated by the user. Among them, since the magnitude of the business in different time periods is different, the business system may provide a plurality of third-party interfaces that meet the business needs of different time periods for the face recognition application, that is, the latest available third-party interface. This business execution parameter is usually updated in real time in the database of the business system. In order to avoid the face recognition application from having to read the third-party interface information used in real time from the database every time it receives a service request, the caching technology is usually used, that is, the third-party interface information is written into the local cache, and then a scheduled task is set for the face recognition application so that the face recognition application can refresh the database regularly to obtain the latest available third-party interface information according to the set execution interval. Similarly, for the authentication application, the authentication information required in the authentication process is usually also written into the database of the business system. In order to reduce the access to the database, the authentication application can write the authentication information into the local cache, so that when receiving the authentication service request, it can complete the cache based on the authentication information in the local cache, and set a scheduled task to regularly obtain the latest authentication information in the database to ensure the normal operation of the authentication application.
[0026] On the basis of the above-mentioned solution, since most of the execution intervals configured in the application are written into the code layer of the application, the requirements for the execution interval are relatively high. If the execution interval is set to be short, the application will frequently execute scheduled tasks to obtain parameters from the database, resulting in an increase in the application load. If the execution interval is set to be too long, the application, especially the aforementioned application with a third-party service interface as a business execution parameter, such as a face recognition application, will still have to wait for the execution interval of the scheduled task to update and obtain the latest parameters from the database when the third-party service interface suddenly fails and cannot be called, and the application cannot guarantee that the application updates the parameters in a timely and effective manner, thereby affecting the normal operation of the application.
[0027] Precisely to solve the above-mentioned problems, the present application provides a data updating method, apparatus, computer equipment and storage medium. When it is detected that the running state of an application switches from normal to abnormal, the execution interval time in the application configuration table is updated from a longer first duration to a shorter second duration, and the application is restarted, so that during the restart process, the application can read the updated execution interval time in the configuration table, so that after the application is restarted, a scheduled task of the application can be executed after a shorter execution interval time to obtain the business execution parameters of the application, thereby achieving that in the face of an application abnormality, a scheduled task can be executed promptly and quickly to obtain the business execution parameters, so that the application can be quickly restored from the abnormal state using the latest obtained business execution parameters, thereby ensuring the stability of the application operation.
[0028] For details, please refer to Figure 1 , Figure 1 A schematic flow chart of a data updating method provided in an embodiment of the present application includes steps S110 to S130:
[0029] S110, when the running state of the application switches from normal to abnormal, updating the execution interval duration in the configuration table of the application from the first duration to the second duration, and restarting the application.
[0030] In the embodiment of the present application, the running state of the application can usually be determined by monitoring the running indicators of the application. Among them, for applications in different scenarios, the corresponding running indicators for monitoring the running state of the application are different. For example, for face recognition applications, its running indicators can be the proportion or number of successful face recognition within a certain period, and for authentication applications, its running indicators can be set to the proportion or number of successful authentication within a certain period. Of course, for other applications, technicians can configure corresponding running monitoring indicators for the application based on actual experience. The embodiment of the present application does not limit the scheme for determining the running state of the application by monitoring the running indicators. Any scheme that can be used to identify that the running state of the application has switched from normal to abnormal is within the scope of protection claimed by this application.
[0031] The running status of an application usually includes multiple states. For example, the more common running status of an application usually includes two states, namely normal and abnormal. For example, taking the face recognition application as an example, when the proportion of successful face recognition within a certain period is greater than the preset ratio threshold, the running status of the application can be confirmed as normal operation. On the contrary, when the proportion of successful face recognition within a certain period is less than the preset ratio threshold, the running status of the application can be confirmed as abnormal, that is, the face recognition service cannot be completed. Similarly, for authentication applications, the running status of the application can also be determined based on the relationship between the proportion of successful authentication within a certain period and the preset ratio threshold. Of course, it should be noted that the implementation scheme provided above is only an explanation of a feasible implementation scheme for the above steps, and is not a limitation of the technical scheme of the present application.
[0032] On the basis of the above scheme, when it is detected that the running state of the application switches from normal to abnormal, for example, taking the face recognition application as an example, it may be that the third-party face recognition interface currently called suddenly has an abnormality, or taking the authentication application as an example, it may be that the authentication information currently called has an abnormality. At this time, it is often necessary to execute a scheduled task to obtain the latest business execution parameters from the server to restore the application to normal. Unlike the conventional method of directly writing the execution interval of the scheduled task into the underlying code of the application, the scheme provided in the embodiment of the present application will additionally introduce a configuration management end to realize the control of the task execution interval in the application.
[0033] Specifically, the configuration management end can be understood as the configuration table of the application. That is, when it is detected that the operating status of the application has changed, such as from normal operation to abnormality, or from abnormality to normal operation, the execution interval in the configuration table will be automatically updated from a longer first duration to a shorter second duration.
[0034] Furthermore, the first duration can be understood as the duration for the application to regularly obtain the latest business execution parameters when the application is running normally. For example, in common cases, the first duration can be set to 3 minutes, 5 minutes or 10 minutes, and the second duration can be understood as the duration for the application to promptly execute a scheduled task when an abnormality occurs. For example, the second duration can usually be set to 3 seconds, 5 seconds, etc. Of course, the execution interval time before and after the update provided above is only a feasible implementation scheme. The specific execution interval time can also be set based on the business execution parameters and the actual attribute information of the application. For example, compared with the business execution parameters that change frequently, the application with less business execution parameters changes in normal operation can have a higher set execution interval time. For example, for face recognition applications, when they are running normally, the set execution interval time, that is, the first duration, can be 1 minute. For authentication applications, since the authentication information is relatively uniform and will not change easily, the set execution interval time, that is, the first duration, can be 10 minutes. For applications in abnormal operation, the set execution interval time can also be related to the urgency of the application. For example, the higher the urgency of the application, the shorter the second duration can be. Of course, it is also feasible to set the execution interval time in other suitable ways, and the embodiments of the present application are not limited here.
[0035] After completing the update of the execution interval in the configuration table, in order to enable the application to execute the scheduled task according to the updated execution interval, the solution provided in the embodiment of the present application will restart the application so that the application loads the execution interval.
[0036] S120, during the restart process of the application, reading the execution interval duration in the configuration table.
[0037] In an embodiment of the present application, the application can load a JVM (Java Virtual Machine, an abstract computer that runs all Java programs) during the restart process, thereby reading the real-time execution interval from the configuration table, so as to subsequently execute at least one scheduled task based on the execution interval, thereby obtaining updated business execution parameters based on different execution intervals when the application's running status is different.
[0038] S130: Execute a scheduled task of the application according to the read execution interval duration, where the scheduled task is used to obtain a service execution parameter of the application.
[0039] Through the implementation scheme provided above, after the application is restarted and the real-time execution interval in the configuration table is read, the application's scheduled tasks will be executed according to the read execution interval to obtain the application's business execution parameters from the database, such as the updated third-party face recognition service interface mentioned above or the authentication information used for authentication, etc., to restore the normal operation of the application. Of course, when the business execution parameters in the database are not updated, the application will also repeatedly execute the scheduled tasks according to the real-time execution interval until the application resumes normal operation.
[0040] Specifically, after the application resumes normal operation, for example, when the running status of the application is detected to be switched from abnormal to normal through the running indicators, that is, the face recognition interface can be called normally to complete face recognition or authentication can be completed normally, at this time, the execution interval in the configuration table can be updated again, for example, the second shorter duration is updated to a third longer duration, wherein the third duration can be the same as the first duration, for example, it can be 3 minutes, 5 minutes, 10 minutes, etc., and the application can be restarted to restore the initial execution interval to execute the scheduled task in the normal running state. Specifically, as another feasible embodiment of the present application, the data update method also includes:
[0041] When the running state of the application is switched from abnormal to normal, the execution interval in the configuration table is updated from the second duration to a third duration, and the third duration is greater than the second duration.
[0042] In the present application, when it is detected that the running state of the application switches from normal to abnormal, the execution interval time in the application configuration table will be updated from a longer first duration to a shorter second duration, and the application will be restarted, so that the application can read the updated execution interval time in the configuration table during the restart process, so that after the application is restarted, it can execute a scheduled task of the application after a shorter execution interval time to obtain the business execution parameters of the application. Compared with the related art, after the application detects an abnormality, it is still necessary to execute a scheduled task to obtain the business execution parameters of the application according to the execution interval time fixedly written in the application code. By adopting the solution of the embodiment of the present application, when facing an application abnormality, a scheduled task can be executed promptly and quickly to obtain the business execution parameters, so that the application can be quickly restored from the abnormal state using the latest acquired business execution parameters, thereby ensuring the stability of the application operation.
[0043] Of course, in actual application systems, in order to meet the scenario of high-concurrency business requests, usually, based on the idea of distributed systems, the application will be run on multiple server instances. For example, multiple instances can be deployed in cloud computing platforms, virtualization environments, containerized platforms, and other environment platforms to run the application, that is, the application is running on at least the first server and the second server. At this time, in order to better manage the application, in addition to the execution interval, the configuration table usually also includes synchronization parameters. Specifically, the synchronization parameter can be used to indicate whether an application on a server chooses to synchronize the business execution parameters to applications on other servers after obtaining them through the aforementioned method. That is to say, after an application on a separate server is restarted, the synchronization parameters in the configuration table can be synchronously loaded during the restart process to synchronize the obtained updated business execution parameters to applications running on other servers. For details, please refer to Figure 2 , Figure 2 A schematic flow chart of steps for synchronizing service execution parameters through synchronization parameters provided in an embodiment of the present application, specifically, comprising steps S210 to S230:
[0044] S210: When the running state of the application on the first server changes, update the synchronization parameters in the configuration table.
[0045] In the embodiment of the present application, similar to the aforementioned update of the execution interval time in the preset configuration table, when it is detected that the running state of the application on the first server has changed, for example, switching from a normal state to an abnormal state or from an abnormal state to a normal state, the synchronization parameters in the configuration table will be updated, wherein the synchronization parameters include a plurality of values, which are respectively used to indicate that the business execution parameters are synchronized to applications running on other servers, or to choose not to synchronize the business execution parameters to applications running on other servers, and only choose to use the business execution parameters on this application.
[0046] S220, during the restart process of the application, reading the synchronization parameters in the configuration table.
[0047] In the embodiment of the present application, since the synchronization parameters are the same as the execution interval time and are both written into the configuration table, the synchronization parameters in the configuration table can be synchronously read during the process of executing the restart of the application on the first server.
[0048] S230: Synchronize the service execution parameters obtained by executing the scheduled task to the application on the second server according to the read synchronization parameters.
[0049] In the embodiment of the present application, combined with the foregoing related description, it can be seen that since the synchronization parameters can be used to indicate whether an application running on a certain server should synchronize the latest business execution parameters to applications running on other servers after obtaining them independently, the business execution parameters obtained by executing the scheduled task can be synchronized to other servers, such as the application on the second server, based on the read synchronization parameters.
[0050] Specifically, synchronizing the business execution parameters obtained by executing the scheduled task to the applications running on other servers can be achieved through a cache middleware solution. For example, it can be based on redis (Remote DictionaryServer, a remote dictionary service that can be used as a cache middleware technology), that is, caching the updated business execution parameters in redis, and then the applications running on other servers can read the latest business execution parameters cached by the application running on the aforementioned server, that is, the application on the first server, from redis, thereby avoiding the need to restart the applications running on each server separately to read the latest business execution parameters from the database, greatly improving the stable operation of applications in distributed systems.
[0051] For more information, please refer to Figure 3 , Figure 3 A flowchart of a step of updating a global synchronization parameter to determine whether to synchronize a service execution parameter is provided in an embodiment of the present application, specifically, including steps S310 to S330:
[0052] S310: When the running state of the application on the first server is switched from normal to abnormal, the synchronization parameter in the configuration table is updated from the first parameter to the second parameter.
[0053] S320: When the operation status of the first server is switched from abnormal to normal, the synchronization parameter in the configuration table is updated from the second parameter to the first parameter.
[0054] In combination with the foregoing relevant description, it can be seen that in a distributed system, when it is necessary to restart the application running on each server due to a sudden exception in the third-party service interface, the solution provided in the embodiment of the present application can control the restart of the application running on a separate server through synchronization parameters, and the latest business execution parameters obtained can be synchronized to the applications running on other servers through the cache middleware or other means. Therefore, when it is detected that the running state of the application on the first server is switched from normal to abnormal, the synchronization parameter in the configuration table can be updated from the first parameter to the second parameter, wherein the first parameter can be understood as turning off the synchronization function, that is, it is used to indicate that the business execution parameter is selected to be executed on the application on the server alone without synchronizing it to the applications on other servers, and the second parameter can be understood as enabling the synchronization function, that is, it is used to indicate that the latest business execution parameters obtained by the application on the server are synchronized to the applications running on other servers.
[0055] Of course, corresponding to the above, when it is detected that the operating status on the first server is switched from abnormal to normal, the synchronization parameter in the configuration table can be further updated from the second parameter to the first parameter, that is, the global synchronization function, so as to avoid the situation where, when the application is running normally, the application running on each server chooses to synchronize the obtained business execution parameters to the applications running on other servers in a cached manner after querying the business execution parameters, thereby increasing the application load.
[0056] S330: When the read synchronization parameter is the second parameter, synchronize the service execution parameter obtained by executing the scheduled task to the application on the second server.
[0057] In the embodiment of the present application, combined with the above-mentioned definitions of the first parameter and the second parameter, it can be known that when an application is determined to be abnormal, at this time, by restarting a certain server, for example, the application running on the first server and determining that the synchronization parameter is the second parameter, the application running on the server will choose to synchronize the business execution parameter to the applications running on other servers after obtaining the updated business execution parameter according to the read execution interval, for example, by writing to the cache middleware to achieve synchronization of business execution parameters. Correspondingly, when it is determined that the application can run normally, at this time, when the synchronization parameter read is the first parameter, the application running on each server will only execute on its own application after obtaining the updated business execution parameter separately.
[0058] Through the implementation scheme of configuring synchronization parameters in the configuration table provided above, in the current distributed system, for example, in the application running on multiple servers, when an application exception is detected, the application can be run by restarting only a single server to obtain updated business execution parameters, and the business execution parameters can be synchronized to the applications running on other servers, thereby avoiding restarting the applications running on each server. At the same time, when the application is running normally, all synchronization functions are turned off to reduce the application load and ensure the operation effect of the application.
[0059] In addition, it can be understood that the data update provided above is only illustrated by taking a single application as an example. In fact, for a complete business system, it usually includes multiple application processes that are executed in sequence, such as face recognition and authentication in credit business. The data update method provided in the embodiment of the present application can also synchronously implement data update management for multiple applications through a configuration table. That is to say, the configuration table can include identification information of multiple different applications, as well as execution interval time and synchronization parameters for each application, so that when the running state of the application changes, when the configuration table has execution interval time and synchronization parameters of multiple applications, the execution interval time and synchronization parameters associated with the identification information in the configuration table can be updated according to the identification information of the application. Specifically, as another feasible embodiment of the present application, the configuration table includes the execution interval time of multiple applications and the identification information of each application; when the running state of the application switches from normal to abnormal, the execution interval time in the configuration table of the application is updated from the first time to the second time, including:
[0060] When the running state of the target application switches from normal to abnormal, the execution interval duration associated with the identification information in the configuration table is updated from the first duration to the second duration according to the identification information of the target application.
[0061] In addition, it should be noted that the data update method provided in the embodiment of the present application is particularly suitable for applications in which a third-party service interface is set as a business execution parameter, especially in scenarios where a sudden exception may occur in the third-party service interface, resulting in the application being unable to call the interface normally to respond to the user's business request, and it is urgent to update the third-party service interface to restore the normal operation of the application. Therefore, to facilitate understanding of the above content, the following will take the third-party service interface as a business execution parameter as an example to provide a step flow diagram of another data update method. For details, please refer to FIG. Figure 4 A schematic flow chart of another data updating method provided in an embodiment of the present application, specifically including steps S410 to S450:
[0062] S410, when the running state of the application calling the third-party service interface changes from normal to abnormal, the execution interval duration in the configuration table of the application is updated from the first duration to the second duration, and the application is restarted.
[0063] S420: During the restart process of the application, read the execution interval duration in the configuration table.
[0064] S430: Execute the scheduled task of the application according to the read execution interval duration.
[0065] S440: Write the third-party service interface obtained by executing the scheduled task into the local cache of the application.
[0066] S450, in response to the received service request, read the third-party service interface from the local cache, and respond to the service request by calling the third-party service interface.
[0067] In the embodiment of the present application, the technical solution provided by the present application is specifically explained by taking the acquisition of a third-party service interface as an example. Due to a sudden failure in the third-party service interface, there is an urgent need to update the third-party service interface to restore the normal operation of the application. Therefore, the data update method provided by the present application can effectively reduce the application load while also meeting the requirement that when a sudden exception occurs in the third-party service interface called by the application, the called third-party service interface information can be updated in time to ensure the normal operation of the application.
[0068] In order to more clearly understand the complete implementation process of the data updating method provided in the embodiment of the present application, the following will be combined with the aforementioned Figure 1 to Figure 4 The content provided takes the face recognition application and authentication application in the credit business as an example, and provides a complete implementation step of a data update method, specifically including the following contents:
[0069] (1) In the face recognition application and authentication application, the scheduled task of each application is configured through the management background, as well as the execution interval and global synchronization parameters of the scheduled task. For example, for updating authentication data, since the authentication information is unified and will not change easily, the task execution interval can be set to 10 minutes, and for the scheduled task of calling the interface in the face recognition application, the task execution interval can be set to 1 minute. After each scheduled task is executed, the information obtained from the database will be cached in the local cache;
[0070] (2) When the face recognition application or the authentication application receives a service request from the user, for example, after the face recognition application obtains the face image input by the user, it will read the corresponding third-party service interface from the local cache, and process the face image input by the user by calling the interface, and output the corresponding response result. At the same time, in this process, the business monitoring indicators of the application are counted, such as the proportion of successfully recognized face images in each cycle, so as to determine whether the application is running normally;
[0071] (3) When the proportion of successfully recognized face images within a period does not meet the requirement due to a sudden failure of the third-party service interface, it can be determined that the running state of the face recognition application is abnormal. At this time, the task execution interval parameter of the face recognition application in the management background, that is, the preset configuration table, will be automatically updated, for example, from 1 minute to 3 seconds. Then, by restarting the application, the application loads the program context during the initialization of the JVM to read the corresponding task execution interval parameter from the preset configuration table, for example, 3 seconds, so that after the task execution interval, a scheduled task is executed, that is, a scheduled task is executed immediately after 3 seconds. Therefore, after a sudden failure of the third-party service interface, the application can also read the updated third-party service interface from the database, that is, the backup service information, so as to quickly recover from the abnormal running state without waiting for the preset task execution interval, for example, 1 minute before being able to quickly recover from the abnormal running state, thereby improving the running stability of the application;
[0072] (4) If a distributed system is used, that is, applications are deployed on multiple instances, the single instance application can be restarted and the updated third-party service interface can be read from the database. Then, when the global synchronization parameter in the preset configuration table indicates that the global synchronization function is turned on, the updated third-party service interface obtained is synchronized to the applications on other instances through the cache middleware, thereby avoiding restarting the applications on multiple instances.
[0073] (5) When the application resumes normal operation, the task execution interval parameter in the preset configuration table will be called back and updated. For example, when the face recognition task is running normally, the task execution interval parameter in the preset configuration table will be readjusted from 3 seconds to 1 minute. At the same time, the local synchronization parameter indication is updated to turn off the global synchronization function, so that the application on each instance will not synchronize the updated business execution parameter to the application on other instances after obtaining the updated business execution parameter, thereby reducing application overhead.
[0074] In addition, when the application is running normally, since the scheduled tasks are not written in the application code, in order to enable the application to execute the scheduled tasks normally, the task execution interval parameters in the preset configuration table are used to determine the need to execute the scheduled tasks each time. For example, when the time interval between the last execution of the scheduled task reaches the task execution interval in the preset configuration table, it is determined that the application needs to execute a scheduled task. At this time, the application will also be restarted, so that the application loads the program context during the process of initializing the JVM, so as to read the corresponding task execution interval parameters from the preset configuration table and execute a scheduled task. The task execution interval parameters can also be used as prerequisite information for the next execution of the scheduled task.
[0075] Through the implementation scheme provided above, when the third-party service interface is abnormal and the business execution parameters of the application need to be updated, a scheduled task can be executed immediately to obtain the updated business execution parameters and update them to other instances. At the same time, it also ensures that when the application is running normally, the scheduled task can be executed according to the preset task execution interval to obtain the business execution parameters. While effectively reducing the application load, it also meets the need to update the parameters in time to ensure the normal operation of the application when the application suddenly fails.
[0076] In order to better implement the data updating method provided in the embodiment of the present application, the present embodiment further provides a data updating device, which can be integrated in the server. Figure 5 As shown, the data updating device may include:
[0077] An updating module 510, configured to update the execution interval duration in the configuration table of the application from a first duration to a second duration, and restart the application when the running state of the application switches from normal to abnormal, wherein the second duration is less than the first duration;
[0078] A reading module 520, configured to read the execution interval duration in the configuration table during the restart process of the application;
[0079] The execution module 530 is used to execute the scheduled task of the application according to the read execution interval duration, and the scheduled task is used to obtain the business execution parameters of the application.
[0080] In some embodiments of the present application, the update module 510 is also used to update the execution interval time in the configuration table from the second duration to a third duration when the running state of the application switches from abnormal to normal, and the third duration is greater than the second duration.
[0081] In some embodiments of the present application, the execution module 530 is also used to update the synchronization parameters in the configuration table when the running state of the application on the first server changes; during the restart process of the application, read the synchronization parameters in the configuration table; and synchronize the business execution parameters obtained by executing the scheduled task to the application on the second server according to the read synchronization parameters.
[0082] In some embodiments of the present application, the execution module 530 is also used to update the synchronization parameter in the configuration table from the first parameter to the second parameter when the running state of the application on the first server is switched from normal to abnormal; when the running state on the first server is switched from abnormal to normal, update the synchronization parameter in the configuration table from the second parameter to the first parameter; when the read synchronization parameter is the second parameter, synchronize the business execution parameter obtained by executing the scheduled task to the application on the second server.
[0083] In some embodiments of the present application, the execution module 530 is also used to write the third-party service interface obtained by executing the scheduled task into the local cache of the application; in response to a received business request, read the third-party service interface from the local cache, and respond to the business request by calling the third-party service interface.
[0084] In some embodiments of the present application, the update module 510 is also used to update the execution interval duration associated with the identification information in the configuration table from a first duration to a second duration according to the identification information of the target application when the running state of the target application switches from normal to abnormal.
[0085] By adopting the scheme of the embodiment of the present application, when it is detected that the running state of the application switches from normal to abnormal, the execution interval time in the application configuration table will be updated from a longer first duration to a shorter second duration, and the application will be restarted, so that during the restart process, the application can read the updated execution interval time in the configuration table, so that after the application is restarted, it can execute a scheduled task of the application after a shorter execution interval time to obtain the business execution parameters of the application. Compared with the related art, after the application detects an abnormality, it is still necessary to execute a scheduled task to obtain the business execution parameters of the application according to the execution interval time fixedly written in the application code. By adopting the scheme of the embodiment of the present application, in the face of an application abnormality, a scheduled task can be executed promptly and quickly to obtain the business execution parameters, so that the application can be quickly restored from the abnormal state using the latest obtained business execution parameters, thereby ensuring the stability of the application operation.
[0086] Based on the same inventive concept, the embodiment of the present application also provides a computer device, which may be a server or a terminal device, and includes a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the steps of the above-mentioned model evaluation method or model training method are implemented. Various functions are implemented, such as executing the following steps:
[0087] When the running state of the application switches from normal to abnormal, updating the execution interval duration in the configuration table of the application from a first duration to a second duration, and restarting the application, wherein the second duration is less than the first duration;
[0088] During the restart process of the application, reading the execution interval duration in the configuration table;
[0089] The scheduled task of the application is executed according to the read execution interval duration, and the scheduled task is used to obtain the service execution parameters of the application.
[0090] By adopting the scheme of the embodiment of the present application, when it is detected that the running state of the application switches from normal to abnormal, the execution interval time in the application configuration table will be updated from a longer first duration to a shorter second duration, and the application will be restarted, so that during the restart process, the application can read the updated execution interval time in the configuration table, so that after the application is restarted, it can execute a scheduled task of the application after a shorter execution interval time to obtain the business execution parameters of the application. Compared with the related art, after the application detects an abnormality, it is still necessary to execute a scheduled task to obtain the business execution parameters of the application according to the execution interval time fixedly written in the application code. By adopting the scheme of the embodiment of the present application, in the face of an application abnormality, a scheduled task can be executed promptly and quickly to obtain the business execution parameters, so that the application can be quickly restored from the abnormal state using the latest obtained business execution parameters, thereby ensuring the stability of the application operation.
[0091] In one embodiment, the computer device is a terminal device, for example, its internal structure diagram can be as follows: Figure 6As shown. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit and an input device. Among them, the processor, the memory and the input / output interface are connected through a system bus, and the communication interface, the display unit and the input device are connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be implemented through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, a data update method is implemented. The display unit of the computer device is used to form a visually visible image, and can be a display screen, a projection device or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen. The input device of the computer device can be a touch layer covered on the display screen, or a button, trackball or touchpad set on the computer device casing, or an external keyboard, touchpad or mouse, etc.
[0092] Those skilled in the art will understand that Figure 6 The structure shown is only a block diagram of a portion of the structure related to the present application scheme, and does not constitute a limitation on the computer device to which the present application scheme is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different component arrangement.
[0093] Based on the same inventive concept, an embodiment of the present application also provides a computer-readable storage medium, which may include: a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk, etc.
[0094] Since the computer program stored in the computer-readable storage medium can execute any data updating method provided in the embodiments of the present application, the beneficial effects that can be achieved by any data updating method provided in the embodiments of the present application can be achieved. Please refer to the previous embodiments for details and will not be repeated here.
[0095] By adopting the scheme of the embodiment of the present application, when it is detected that the running state of the application switches from normal to abnormal, the execution interval time in the application configuration table will be updated from a longer first duration to a shorter second duration, and the application will be restarted, so that during the restart process, the application can read the updated execution interval time in the configuration table, so that after the application is restarted, it can execute a scheduled task of the application after a shorter execution interval time to obtain the business execution parameters of the application. Compared with the related art, after the application detects an abnormality, it is still necessary to execute a scheduled task to obtain the business execution parameters of the application according to the execution interval time fixedly written in the application code. By adopting the scheme of the embodiment of the present application, in the face of an application abnormality, a scheduled task can be executed promptly and quickly to obtain the business execution parameters, so that the application can be quickly restored from the abnormal state using the latest obtained business execution parameters, thereby ensuring the stability of the application operation.
[0096] Based on the same inventive concept, the embodiment of the present application further provides a computer program product or a computer program, which includes a computer instruction, and the computer instruction is stored in a computer-readable storage medium. The processor of the computer device reads the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the computer device executes the method provided in various optional implementations in the above embodiments.
[0097] It should be noted that the object data (including but not limited to user device information, user personal information, etc.) and conversation data involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data need to comply with relevant laws, regulations and standards of relevant countries and regions. A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods.
[0098] Any reference to the memory, database or other media used in the embodiments provided in the present application may include at least one of non-volatile and volatile memory. Non-volatile memory may include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (Re RAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory may include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM may be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc.
[0099] The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. The non-relational database may include a distributed database based on blockchain, etc., but is not limited thereto. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but is not limited thereto.
[0100] In the above data updating device, computer equipment, computer readable storage medium, and computer program product embodiments, the description of each embodiment has its own emphasis. For parts not described in detail in a certain embodiment, reference can be made to the relevant description of other embodiments. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working process and beneficial effects of the above-described data updating device, computer readable storage medium, computer program product, computer equipment and its corresponding units can refer to the description of the data updating method in the above embodiment, and will not be repeated here.
[0101] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0102] The above is a detailed introduction to a data updating method, device, computer equipment and storage medium provided in an embodiment of the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for technical personnel in this field, according to the idea of the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A data updating method, characterized in that: include: When the running state of the application switches from normal to abnormal, updating the execution interval duration in the configuration table of the application from a first duration to a second duration, and restarting the application, wherein the second duration is less than the first duration; During the restart process of the application, reading the execution interval duration in the configuration table; The scheduled task of the application is executed according to the read execution interval duration, and the scheduled task is used to obtain the service execution parameters of the application.
2. The method according to claim 1, characterized in that The method further comprises: When the running state of the application is switched from abnormal to normal, the execution interval in the configuration table is updated from the second duration to a third duration, and the third duration is greater than the second duration.
3. The method according to claim 1, characterized in that The application runs at least on the first server and the second server; the configuration table also includes synchronization parameters; The method further comprises: When the running state of the application on the first server changes, updating the synchronization parameters in the configuration table; During the restart of the application, reading the synchronization parameters in the configuration table; The service execution parameters obtained by executing the scheduled task are synchronized to the application on the second server according to the read synchronization parameters.
4. The method according to claim 3, characterized in that When the running state of the application on the first server changes, updating the synchronization parameters in the configuration table includes: When the running state of the application on the first server is switched from normal to abnormal, updating the synchronization parameter in the configuration table from the first parameter to the second parameter; When the operation status of the first server is switched from abnormal to normal, updating the synchronization parameter in the configuration table from the second parameter to the first parameter; The step of synchronizing the service execution parameters obtained by executing the scheduled task to the application on the second server according to the read synchronization parameters includes: When the read synchronization parameter is the second parameter, the service execution parameter obtained by executing the scheduled task is synchronized to the application on the second server.
5. The method according to claim 1, characterized in that The service execution parameter is associated with the running of the application.
6. The method according to claim 5, characterized in that The business execution parameter is a third-party service interface; after executing the scheduled task of the application according to the read execution interval, the method further includes: Writing the third-party service interface obtained by executing the scheduled task into the local cache of the application; In response to the received service request, the third-party service interface is read from the local cache, and the service request is responded to by calling the third-party service interface.
7. The data updating method according to any one of claims 1 to 6, characterized in that: The configuration table includes the execution intervals of multiple applications and identification information of each application; When the running state of the application is switched from normal to abnormal, updating the execution interval duration in the configuration table of the application from a first duration to a second duration includes: When the running state of the target application switches from normal to abnormal, the execution interval duration associated with the identification information in the configuration table is updated from the first duration to the second duration according to the identification information of the target application.
8. A data updating device, characterized in that: include: An updating module, configured to update the execution interval duration in the configuration table of the application from a first duration to a second duration, and restart the application when the running state of the application switches from normal to abnormal, wherein the second duration is less than the first duration; A reading module, used for reading the execution interval duration in the configuration table during the restart process of the application; The execution module is used to execute the scheduled task of the application according to the read execution interval duration, and the scheduled task is used to obtain the business execution parameters of the application.
9. A computer device, characterized in that: It comprises a processor and a memory, wherein the memory stores a plurality of instructions; the processor loads instructions from the memory to execute the steps of the data updating method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a plurality of instructions, and the instructions are suitable for being loaded by a processor to execute the steps of the data updating method according to any one of claims 1 to 7.