CN112596946A - Service running state control method and device, electronic equipment and storage medium - Google Patents
Service running state control method and device, electronic equipment and storage medium Download PDFInfo
- Publication number
- CN112596946A CN112596946A CN202011455680.8A CN202011455680A CN112596946A CN 112596946 A CN112596946 A CN 112596946A CN 202011455680 A CN202011455680 A CN 202011455680A CN 112596946 A CN112596946 A CN 112596946A
- Authority
- CN
- China
- Prior art keywords
- service
- running state
- configuration file
- application program
- determining
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 39
- 230000006870 function Effects 0.000 claims description 57
- 238000011084 recovery Methods 0.000 claims description 46
- 238000012545 processing Methods 0.000 claims description 33
- 238000012360 testing method Methods 0.000 claims description 22
- 238000004590 computer program Methods 0.000 claims description 10
- 238000001514 detection method Methods 0.000 claims description 2
- 230000000977 initiatory effect Effects 0.000 claims 1
- 230000002159 abnormal effect Effects 0.000 description 10
- 238000011161 development Methods 0.000 description 8
- 230000007246 mechanism Effects 0.000 description 6
- 244000035744 Hura crepitans Species 0.000 description 5
- 238000010586 diagram Methods 0.000 description 5
- 230000006854 communication Effects 0.000 description 4
- 230000008901 benefit Effects 0.000 description 3
- 238000004891 communication Methods 0.000 description 3
- 230000003287 optical effect Effects 0.000 description 2
- 230000008569 process Effects 0.000 description 2
- 238000013024 troubleshooting Methods 0.000 description 2
- 230000005856 abnormality Effects 0.000 description 1
- 238000003491 array Methods 0.000 description 1
- 230000008878 coupling Effects 0.000 description 1
- 238000010168 coupling process Methods 0.000 description 1
- 238000005859 coupling reaction Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 238000009434 installation Methods 0.000 description 1
- 239000004973 liquid crystal related substance Substances 0.000 description 1
- 230000005055 memory storage Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000002093 peripheral effect Effects 0.000 description 1
- 210000001525 retina Anatomy 0.000 description 1
- 230000003068 static effect Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/07—Responding to the occurrence of a fault, e.g. fault tolerance
- G06F11/14—Error detection or correction of the data by redundancy in operation
- G06F11/1402—Saving, restoring, recovering or retrying
- G06F11/1415—Saving, restoring, recovering or retrying at system level
- G06F11/1438—Restarting or rejuvenating
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Quality & Reliability (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Stored Programmes (AREA)
Abstract
The embodiment of the application provides a service running state control method and device, electronic equipment and a storage medium. The method for controlling the running state of the service is applied to an application program developed by adopting a micro-service architecture, the application program comprises at least one service, and the method comprises the following steps: determining a target operation environment of an application program; acquiring a configuration file of a target operation environment, wherein the configuration file comprises configuration parameters of at least one service; starting and configuring at least one service in the target operation environment according to the configuration file; detecting whether the current running state of at least one service is consistent with respective configuration parameters; and controlling the service to be recovered to the configured running state aiming at any service with the current running state inconsistent with the corresponding configuration parameter. The technical scheme provided by the embodiment of the application can ensure the reliability of the business function of each service of the application program.
Description
Technical Field
The embodiment of the application relates to the technical field of computers, in particular to a service running state control method and device, electronic equipment and a storage medium.
Background
Currently, more and more applications are developed using microservice architectures. The microservice architecture is a distributed architecture with a loose coupling between services, a high degree of autonomy between each service, and a sustainable integrated deployment that communicates using lightweight protocols. The application program developed by adopting the micro-service architecture comprises at least one service, the business function of one service may need to directly or indirectly call a plurality of other services, and a plurality of services called mutually form a calling chain. If a service is unavailable due to some external factors, the implementation of the business functions of other services is affected.
Disclosure of Invention
The embodiment of the application provides a method and a device for controlling the running state of a service, an electronic device and a storage medium, which are used for solving the problem of ensuring the reliability of the business function of each service of an application program developed by adopting a micro-service architecture.
The embodiment of the application provides a service running state control method, which is applied to an application program developed by adopting a micro-service architecture, wherein the application program comprises at least one service, and the method comprises the following steps:
determining a target operating environment of the application program; obtaining a configuration file of the target operating environment, wherein the configuration file comprises configuration parameters of the at least one service; starting to configure the at least one service in the target operation environment according to the configuration file; detecting whether the current running state of the at least one service is consistent with respective configuration parameters; and controlling the service to be recovered to the configured running state aiming at any service with the current running state inconsistent with the corresponding configuration parameter.
An embodiment of the present application further provides a device for controlling an operating state of a service, including:
the determining module is used for determining a target running environment of the application program, wherein the application program is developed and generated by adopting a micro-service architecture, and the application program comprises at least one service; an obtaining module, configured to obtain a configuration file of the target operating environment, where the configuration file includes configuration parameters of the at least one service; the starting module is used for starting and configuring the at least one service in the target operation environment according to the configuration file; the detection module is used for detecting whether the current running state of the at least one service is consistent with respective configuration parameters; and the control module is used for controlling the service to be recovered to the configured running state aiming at any service with the current running state inconsistent with the corresponding configuration parameter.
The embodiment of the application also provides electronic equipment, which comprises a storage component and a processing component; the storage component stores one or more computer program instructions; the one or more computer program instructions for invocation and execution by the processing component;
the processing component is to:
determining a target operating environment of the application program, wherein the application program is developed and generated by adopting a micro service architecture, and the application program comprises at least one service; obtaining a configuration file of the target operating environment, wherein the configuration file comprises configuration parameters of the at least one service; starting to configure the at least one service in the target operation environment according to the configuration file; detecting whether the current running state of the at least one service is consistent with respective configuration parameters; and controlling the service to be recovered to the configured running state aiming at any service with the current running state inconsistent with the corresponding configuration parameter.
The embodiments of the present application also provide a computer-readable storage medium storing a computer program, which, when executed by a processor, causes the processor to implement the steps in the running state control method of the service.
According to the service running state control method and device, the electronic equipment and the storage medium, aiming at the application program developed by adopting a micro-service architecture, the configuration file corresponding to the target running environment is adopted to start the service of the application program and monitor the running state of the service of the application program in real time, so that any service of the application program can be prevented from being in an abnormal state for a long time, the service is automatically and quickly restored to a normal state, the occurrence of the situation that the business function of other services cannot be realized due to one abnormal service is greatly reduced, and the reliability of the business function of each service of the application program is ensured.
These and other aspects of the present application will be more readily apparent from the following description of the embodiments.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative efforts.
FIG. 1 illustrates a flow diagram of a method for controlling an operational state of a service according to one embodiment of the present application;
FIG. 2 is a schematic structural diagram illustrating an embodiment of an operation state control apparatus for a service provided in the present application;
fig. 3 shows a schematic structural diagram of an embodiment of an electronic device according to the application.
Detailed Description
In order to make the technical solutions better understood by those skilled in the art, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application.
In some of the flows described in the specification and claims of this application and in the above-described figures, a number of operations are included that occur in a particular order, but it should be clearly understood that these operations may be performed out of order or in parallel as they occur herein, the number of operations, e.g., 101, 102, etc., merely being used to distinguish between various operations, and the number itself does not represent any order of performance. Additionally, the flows may include more or fewer operations, and the operations may be performed sequentially or in parallel. It should be noted that, the descriptions of "first", "second", etc. in this document are used for distinguishing different messages, devices, modules, etc., and do not represent a sequential order, nor limit the types of "first" and "second" to be different.
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The technical solutions provided by the embodiments of the present application are described in detail below with reference to the accompanying drawings.
The method for controlling the running state of the service provided in the embodiment of the present Application may be applied to an Application (APP), a browser (browser), and an applet, but is not limited thereto. The applet is a light-weight application program (light application for short) which can be used without downloading and installation, and the light application is usually characterized by easy implementation, simple and efficient functions, convenient use and the like. With the development of computer technology, a new application development mode is brought, for example, a provider of large platform application services provides an efficient development framework for developers besides providing own services for end users based on own platform applications, and a functional module of the platform itself or third-party service applications can be developed and deployed in a very efficient manner through the provided development framework and access to a platform main application with good compatibility and stability. The application developed in the development mode can realize the advantages, and can also realize the situation of mutual benefit among multiple parties by depending on the advantages of brands, users and the like of the application platform, for example, on one hand, the access of the application enriches the services of the platform, on the other hand, the popularization cost of the accessed application is saved, more importantly, the access time of the user is saved, and the reaching efficiency of the application is improved. The light application can run depending on the main application, that is, the main application is used as a running container to run, for example, the light application can be started from an interface provided in the main application, the main application distributes a running environment and the like, and meanwhile, certain independence is kept on functions, running characteristics and the like.
Fig. 1 is a flowchart illustrating an embodiment of a method for controlling an operating state of a service provided by the present application. As shown in fig. 1, the operation state control method of the service may include the steps of:
In the embodiment of the application, the application is an application developed by adopting a micro-service architecture, and comprises at least one service, the business function of one service may need to directly or indirectly call a plurality of other services, and the plurality of services mutually called form a call chain. For example, the application provides at least one service of a shopping cart service, an order service, a user service, and the like. The business function of the shopping cart service is the shopping cart function, the business function of the order service is order creation, and the business function of the user service is user data provision. When the shopping cart service is used to meet the shopping requirements of the user, the shopping cart service calls an order service to create an order, and the order service calls the user service to acquire user data required for creating the order. At this time, the nodes on the calling chain for realizing the shopping cart function sequentially serve the shopping cart, the order service and the user according to the calling sequence.
As another example, in an after-market scenario, the application includes at least one service of an after-market service, an order service, a lead service, a merchant service, and/or the like. When a customer contacts with an after-sales service professional through a telephone or an on-line customer service way and other contact ways, the after-sales service professional uses after-sales appeal of the after-sales service customer, in the communication process, the after-sales service professional needs to inquire order information of the customer, at the moment, the after-sales service calls order service to obtain the order information of the customer, the order service needs to call a clue service to inquire the matching relation between the customer and a merchant, and after a merchant id related to the customer is determined, the order service calls the merchant service to obtain merchant information of the merchant related to the customer. If the service of the merchant is abnormal, after-sale customer service special staff can not acquire the merchant information related to the customer when communicating with the customer service. At the moment, the nodes on the calling chain for realizing the after-sales function sequentially serve the after-sales service, the order service, the clue service and the merchant according to the calling sequence.
In the embodiment of the application, the target running environment is any running environment of the application program. The application program needs to run in different running environments in the whole life cycle from development to online. The operating environment is, for example, a development environment, a test environment, a sandbox environment, an online environment. Of course, the operating environment is divided according to actual service requirements, and is not limited to the above example.
In practical applications, the number of services started in the target operating environment may be determined according to specific business requirements. For example, in some execution environments, the service of the whole application is started, and in other execution environments, the service of the part of the application is started. If a service that needs to be started but is not started occurs, or a service that cannot be started but is started occurs, it is likely that the service functions of other services cannot be realized. For example, for each service in a certain operating environment, if the service is unavailable due to some external reasons (such as insufficient memory storage space, incorrect operation, etc.), the normal use of other services under the micro-service architecture will be affected. However, since services under the micro-service architecture are mutually called, it is necessary to check whether each service is unavailable or not one by one depending on a calling chain, the checking work is complicated, the time consumption is long, and particularly, when the chain of the calling chain is long or the calling relationship is complicated. For another example, the application program sequentially performs tests in the order of development environment, test environment, sandbox environment, and online environment, where the sandbox environment needs to stop part of the services, and the other operating environments except the sandbox environment need to start the entire services. When entering the testing stage of the sandbox environment, if partial service is not stopped, abnormal data may be generated, much time is needed to troubleshoot fault reasons, the testing progress is influenced, and the utilization rate of the operating environment is reduced.
Therefore, in order to ensure the reliability of the service function of each service of the application program, a configuration file corresponding to the target operating environment may be set, and the configuration file corresponding to the target operating environment is used to start the service and monitor the operating state of the service of the application program in real time.
In practical application, the application programs have different test requirements under different operating environments, and the different test requirements correspond to different configuration files. Therefore, before the configuration file of the target operating environment is obtained, the test requirement of the application program for the target operating environment can be determined; determining configuration parameters of at least one service in a target operation environment according to the test requirements; and finally, generating and storing a configuration file of the target operation environment according to the configuration parameters of at least one service in the target operation environment. In this way, when there is a need to obtain the configuration file of the target operating environment, the stored configuration file of the target operating environment is obtained.
And 103, starting and configuring at least one service in the target operation environment according to the configuration file.
In the embodiment of the application, for any service of an application program, if a configuration parameter of the service in a configuration file is in an available state, the service needs to be started in a target running environment; if the configuration parameters of the service in the configuration file are in an unavailable state, the service needs to be prohibited from being started in the target running environment. Thereby, the reliability of the business function of each service of the application program is ensured.
Therefore, in a possible implementation manner, the configuration parameter includes an available state or an unavailable state, and the specific implementation manner of step 103 is: and starting the service configured to be in the usable state in the target running environment according to the configuration file, or forbidding starting the service configured to be in the unusable state.
And 105, controlling the service to be recovered to the configured running state aiming at any service with the current running state inconsistent with the corresponding configuration parameter.
In the embodiment of the application, after the application runs in the target running environment, the service included in the application may have a running state different from the configuration parameter of the application due to some external factors. For example, a service with an available configuration parameter is abnormal, and its actual operation state is unavailable; or, the service with the configuration parameter in the unavailable state is abnormal, and the actual operation state of the service is available. Therefore, in order to ensure the reliability of the functions of the respective services of the application, the current operating state of the respective services of the application should be monitored after the application is operated in the target operating environment. For any service whose current operating state is inconsistent with the corresponding configuration parameter, the current operating state of the service is not as expected, and the service may affect the implementation of the service function of other services, so an automatic recovery mechanism needs to be started for the service, that is, the current operating state of the service is automatically recovered to the configured operating state. For any service with the current operation state consistent with the corresponding configuration parameters, the current operation state of the service is in accordance with expectations, and the service does not influence the realization of the business functions of other services.
It can be understood that, because the current running state of the service of the application program is monitored in real time to determine whether the current running state of the service of the application program meets the expectation, and the current running state of the service which does not meet the expectation is timely met to the expected running state, the service can be timely prevented from being in an abnormal state for a long time, the service is automatically and quickly recovered to a normal state, the influence of the service on the service functions of other services is reduced, and the reliability of the service functions of each service of the application program is ensured. Of course, the probability of failure problems and the time taken to troubleshoot the failure may also be reduced.
In addition, since the services under the micro-service architecture are mutually called, whether the services are unavailable or not needs to be checked one by one depending on the calling chain, the checking work is complex, the time consumption is long, and particularly when the chain of the calling chain is long or the calling relationship is complex. Therefore, when the occurrence probability of the trouble problem is lowered, it takes less time to troubleshoot the trouble problem. Particularly, when the application program of the micro-service architecture is tested in the target running environment, the testing progress can be ensured, and the utilization rate of the running environment is improved, namely, most of the time is used for processing the related matters of the testing work, and the time of testing personnel is not wasted on troubleshooting the service failure problem.
The service running state control method provided by the embodiment of the application adopts the configuration file corresponding to the target running environment to start the service of the application and monitor the running state of the service of the application in real time aiming at the application developed by adopting the micro-service architecture, so that any service of the application can be timely prevented from being in an abnormal state for a long time, the service can be automatically and quickly recovered to a normal state, the occurrence of the situation that the business functions of other services cannot be realized due to one service abnormality is greatly reduced, and the reliability of the business functions of each service of the application is ensured.
In practical applications, a certain service may not be successfully restored once by means of an automatic restoration mechanism, and the service should be automatically restored again. Of course, if the service still fails to be recovered after multiple automatic recoveries, it indicates that the automatic recovery mechanism fails to work with the service, i.e., the current running state of the service cannot be recovered to the configured configuration parameters by the automatic recovery mechanism.
Therefore, in some embodiments of the present application, optionally, after controlling the service to be restored to its configured operating state, the following steps may be further included: if the running state of the service fails to recover, judging whether the recovery frequency of the service is less than a preset recovery frequency; and if the recovery times are less than the preset recovery times, controlling the service to recover to the configured running state again. Of course, if the recovery frequency is not less than the preset recovery frequency, the automatic recovery mechanism is not started to automatically recover the running state of the service.
In the embodiment of the present application, the preset recovery frequency is not set too much or too little, and is specifically set according to an actual situation, for example, the preset recovery frequency is 3 times.
In some embodiments of the present application, optionally, if the recovery times are not less than the preset recovery times, generating a prompt message; and providing prompt information to the tester to prompt the tester to recover the running state of the service in a manual intervention mode.
Specifically, if the automatic recovery mechanism fails to work on a certain service, the running state of the service can be recovered by adopting a manual intervention mode, so as to further guarantee the reliability of the business function of each service of the application program.
In practical application, in order to enable a tester to visually know the severity of a fault caused by each service, when the prompt information is generated, the information prompt level of the service can be determined first, and the prompt information is generated according to the information prompt level of the service. When the tester checks the prompt information, the severity of the fault caused by each service can be determined according to the information prompt level, so that the tester can reasonably arrange the test work of the tester, and the running state of the service with the higher information prompt level is preferably interfered, so that the problem that the application program has more serious faults is avoided. For example, the information presentation level is a first level, a second level, a third level, and the like in order from high to low. The tester can intervene in the operation state of each service in sequence according to the first level, the second level and the third level.
Preferably, when the prompting message is presented, the message prompting level is highlighted to more intuitively prompt the testing person. For example, the informational cue level may be highlighted or the informational cue level may be watermarked to more intuitively cue the test person.
Several exemplary ways of generating the reminder information are described below:
in an optional implementation manner, for a service whose recovery times are not less than a preset recovery time, when generating a prompt message, a call chain that can be affected by the service may be determined first; determining the information prompt level of the service according to the number of call chains which can be influenced by the service and/or the number of the services forming the call chains; and generating prompt information according to the information prompt level.
It will be appreciated that the number of call chains that a service may affect is directly proportional to the severity to which the service may cause a failure. The more the number of call chains which can be influenced by the service is, the more serious fault possibility is, and the higher the corresponding information prompt level is; the fewer the number of call chains that the service may affect, the less likely a more severe failure will occur, i.e., a more minor failure will occur with a greater likelihood and the lower the corresponding level of information presentation. For example, services associated with 5 call chains may cause a higher severity of failure than services associated with 3 call chains.
It will be appreciated that the number of services forming a call chain is directly proportional to the severity of the fault that the services may cause. The more the number of services forming the call chain is, the more serious the possibility of the fault is, and the higher the corresponding information prompt level is; the smaller the number of services forming the call chain, the less likely a more serious fault will occur, i.e. a less severe fault will occur with a greater probability and the lower the corresponding information presentation level. For example, some call chains include 5 services, some call chains include 3 services, and the greater the number of services that a call chain includes, the higher the corresponding severity that can cause a failure.
In actual application, the corresponding relationship between the number of call chains that can be affected by the service and the information prompt level may be preset, or the corresponding relationship between the number of services forming the call chains and the information prompt level may be preset. And rapidly and directly determining the information prompt level of the service with the recovery times not less than the preset recovery times according to the corresponding relation.
Of course, the number of call chains that can be affected by the service, the correspondence between the number of services forming the call chains and the information prompt level may also be set according to the actual situation. That is, in the case where the number of call chains that can be influenced by the service is the same, the number of services forming the call chain differs, and the information presentation level also differs.
In yet another optional implementation manner, for a service whose recovery number is not less than a preset recovery number, the importance level and/or the number of the service functions that may be affected by the service may be determined; determining the information prompt level of the service according to the importance level and/or the number of the service functions which can be influenced by the service; and generating prompt information according to the information prompt level.
And during actual application, determining the importance level of the business function of each service according to the business requirement of the application program. For example, the importance levels of the service functions are high level, middle level and low level in sequence from high to low.
It can be understood that the important level of the service function which can be influenced by the service with the recovery times not less than the preset recovery times is in direct proportion to the information prompting level, and the higher the important level of the service function which can be influenced is, the higher the information prompting level is; the lower the importance level of the service function that can be affected, the lower the level of the information cue.
It can be understood that the number of service-influenceable service functions whose recovery times are not less than the preset recovery times is proportional to the information prompting level, and the more the number of influenceable service functions, the higher the information prompting level; the fewer the number of business functions that can be affected, the lower the level of information prompting.
In practical application, the corresponding relationship between the importance level of the influenceable service function and the information prompting level or the corresponding relationship between the number of the influenceable service functions and the information prompting level may be preset. And rapidly and directly determining the information prompt level of the service with the recovery times not less than the preset recovery times according to the corresponding relation.
Of course, the importance level of the influenceable service functions, the number of influenceable service functions and the corresponding relationship between the information prompting levels can also be set according to the actual situation. That is, in the case where the same importance level of the influenceable business function is set, the number of influenceable business functions is different and the information presentation level is also different.
In yet another alternative implementation, in order to determine the information prompting level more scientifically and objectively, the information prompting level of the service may be determined in combination with the number of call chains that the service may affect, the number of services forming the call chains, the importance level of the business function that the service may affect, and the number of business functions that the service may affect.
Specifically, a weight is respectively assigned to the number of call chains that can be influenced by the service, the number of services forming the call chains, the importance level of the business function that can be influenced by the service, and the number of business functions that can be influenced by the service; setting a corresponding relation between the number of call chains which can be influenced by the service and the information prompt level, forming a corresponding relation between the number of the services of the call chains and the information prompt level, forming a corresponding relation between the importance level of the business function which can be influenced by the service and the information prompt level, and setting a corresponding relation between the number of the business function which can be influenced by the service and the information prompt level; and setting a score corresponding to each information prompt level. Of course, when setting each correspondence, the number of call chains that can be affected by the service is directly proportional to the severity of the failure that can be caused by the service; the number of services forming a call chain is proportional to the severity of the failure that the services may cause; the importance level of the service function which can be influenced by the service is in direct proportion to the information prompt level; the number of business functions that a service may affect is proportional to the level of information prompting.
In actual application, the information prompt level S1 and its score corresponding to the number of call chains that can be affected by the service can be determined according to the correspondence; determining an information prompt level S2 corresponding to the number of the services forming the call chain and the score thereof according to the corresponding relation; determining an information prompt level S3 corresponding to the importance level of the service function which can be influenced by the service and the score thereof according to the corresponding relation; and determining the information prompt level S4 corresponding to the number of the service functions which can be influenced by the service and the score thereof according to the corresponding relation. And the four scores are weighted and summed to obtain a total score. Since the score corresponding to each information presentation level is set, the final information presentation level of the service is determined according to the total score.
In some embodiments of the present application, optionally, a notification manner of the prompt message may be further set according to the message prompt level. The higher the information prompt level is, the richer the notification mode is, so as to ensure that the tester can timely know the prompt information from various channels. For example, the notification method is a short message notification method, a mail notification method, or a notification method using instant chat software for notification. When the information prompt level is low, the tester can be notified by adopting the above notification mode; and when the information prompt level is high, notifying the tester by adopting three notification modes.
In some embodiments of the present application, optionally, after providing the prompt information to the tester, the following steps may be further included: and if the processing result sent by the tester is not received within the preset time length, controlling all the services of the application program to stop running, wherein the processing result is used for indicating that the running state of the service is successfully recovered.
Specifically, the preset time period is set according to actual situations, and is 10 minutes, for example. If the processing result of the indication sent by the testing personnel and successfully recovering the running state of the service is not received within the preset time length, the abnormal service cannot be recovered to the configured running state in a manual intervention mode for a long time. At this time, all services of the application should be controlled to stop running, so as to avoid generating a large amount of abnormal data to cause a large amount of fault problems, and increase the difficulty of troubleshooting. Of course, after all the services of the control application stop running, the cause of the failure occurrence may be checked based on the log information and call chain of the services.
Fig. 2 is a schematic structural diagram illustrating an embodiment of an operation state control apparatus for a service provided in the present application. The device for controlling the running state of the service is an execution main body of the method for controlling the running state of the service, can be realized by software and/or hardware, and can be configured in electronic equipment such as a mobile phone, a tablet computer, wearable equipment and the like. As shown in fig. 2, the operation state control means of the service may include:
the system comprises a determining module 10, a processing module and a processing module, wherein the determining module is used for determining a target operating environment of an application program, the application program is developed and generated by adopting a micro service architecture, and the application program comprises at least one service;
an obtaining module 20, configured to obtain a configuration file of a target operating environment, where the configuration file includes configuration parameters of at least one service;
a starting module 30, configured to start and configure at least one service in the target operating environment according to the configuration file;
a detecting module 40, configured to detect whether a current operating state of at least one service is consistent with respective configuration parameters;
and the control module 50 is configured to control, for any service whose current operating state is inconsistent with the corresponding configuration parameter, the service to be restored to its configured operating state.
Further, the configuration parameters include an available state or an unavailable state, and the starting module 30 starts to configure at least one service in the target operating environment according to the configuration file specifically includes:
and starting the service configured to be in the usable state in the target running environment according to the configuration file, or forbidding starting the service configured to be in the unusable state.
Further, before acquiring the configuration file of the target operating environment, the acquiring module 20 is further configured to:
determining the testing requirement of the application program for the target operation environment;
determining configuration parameters of at least one service in a target operation environment according to the test requirements;
generating and storing a configuration file of a target operation environment according to configuration parameters of at least one service in the target operation environment;
the obtaining module 20 specifically obtains the configuration file of the target operating environment by:
and acquiring a stored configuration file of the target operating environment.
Further, after controlling the service to be restored to the configured running state, the control module 50 is further configured to:
if the running state of the service fails to recover, judging whether the recovery frequency of the service is less than a preset recovery frequency;
and if the recovery times are less than the preset recovery times, controlling the service to recover to the configured running state again.
Further, the control module 50 is further configured to:
when the recovery times are not less than the preset recovery times, generating prompt information;
and providing prompt information to the tester to prompt the tester to recover the running state of the service in a manual intervention mode.
Further, the specific steps of the control module 50 generating the prompt message are:
determining a call chain that the service can affect;
determining the information prompt level of the service according to the number of call chains which can be influenced by the service and/or the number of the services forming the call chains;
and generating prompt information according to the information prompt level.
Further, the specific steps of the control module 50 generating the prompt message are:
determining a level of importance and/or a number of business functions that the service may affect;
determining the information prompt level of the service according to the importance level and/or the number of the service functions which can be influenced by the service;
and generating prompt information according to the information prompt level.
Further, the control module 50, after providing the prompt to the tester, is further configured to:
and if the processing result sent by the tester is not received within the preset time length, controlling all the services of the application program to stop running, wherein the processing result is used for indicating that the running state of the service is successfully recovered.
The specific manner in which each module and unit of the service operation state control device in the above embodiments perform operations has been described in detail in the embodiments related to the method, and will not be described in detail here.
Fig. 3 shows a schematic structural diagram of an embodiment of an electronic device according to the application. As shown in fig. 3, the electronic apparatus includes: a storage component 11 and a processing component 12; the storage component 11 stores one or more computer program instructions; one or more computer program instructions for invocation and execution by the processing component 12;
the processing assembly 12 is configured to:
determining a target operation environment of an application program, wherein the application program is developed and generated by adopting a micro-service architecture, and the application program comprises at least one service;
acquiring a configuration file of a target operation environment, wherein the configuration file comprises configuration parameters of at least one service;
starting and configuring at least one service in the target operation environment according to the configuration file;
detecting whether the current running state of at least one service is consistent with respective configuration parameters;
and controlling the service to be recovered to the configured running state aiming at any service with the current running state inconsistent with the corresponding configuration parameter.
Further, the configuration parameter includes an available state or an unavailable state, and the starting and configuring, by the processing component 12, at least one service in the target runtime environment according to the configuration file specifically includes:
and starting the service configured to be in the usable state in the target running environment according to the configuration file, or forbidding starting the service configured to be in the unusable state.
Further, before obtaining the configuration file of the target operating environment, the processing component 12 is further configured to:
determining the testing requirement of the application program for the target operation environment;
determining configuration parameters of at least one service in a target operation environment according to the test requirements;
generating and storing a configuration file of a target operation environment according to configuration parameters of at least one service in the target operation environment;
the specific steps of the processing component 12 obtaining the configuration file of the target operating environment are:
and acquiring a stored configuration file of the target operating environment.
Further, the processing component 12, after controlling the service to resume its configured operational state, is further configured to:
if the running state of the service fails to recover, judging whether the recovery frequency of the service is less than a preset recovery frequency;
and if the recovery times are less than the preset recovery times, controlling the service to recover to the configured running state again.
Further, the processing assembly 12 is also configured to:
when the recovery times are not less than the preset recovery times, generating prompt information;
and providing prompt information to the tester to prompt the tester to recover the running state of the service in a manual intervention mode.
Further, the processing component 12 generates the prompt message specifically as follows:
determining a call chain that the service can affect;
determining the information prompt level of the service according to the number of call chains which can be influenced by the service and/or the number of the services forming the call chains;
and generating prompt information according to the information prompt level.
Further, the processing component 12 generates the prompt message specifically as follows:
determining a level of importance and/or a number of business functions that the service may affect;
determining the information prompt level of the service according to the importance level and/or the number of the service functions which can be influenced by the service;
and generating prompt information according to the information prompt level.
Further, the processing component 12, after providing the prompt to the tester, is further configured to: and if the processing result sent by the tester is not received within the preset time length, controlling all the services of the application program to stop running, wherein the processing result is used for indicating that the running state of the service is successfully recovered.
Wherein the processing component 12 may include one or more processors to execute computer instructions to perform all or some of the steps of the methods described above. Of course, the processing component 12 may also be implemented as one or more Application Specific Integrated Circuits (ASICs), Digital Signal Processors (DSPs), Digital Signal Processing Devices (DSPDs), Programmable Logic Devices (PLDs), Field Programmable Gate Arrays (FPGAs), controllers, micro-controllers, microprocessors or other electronic components configured to perform the above-described methods.
The storage component 11 is configured to store various types of data to support operations at the terminal. The storage component 11 may be implemented by any type or combination of volatile or non-volatile memory devices, such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disks.
The electronic device may further include a display component 13, and the display component 13 may be an Electroluminescent (EL) element, a liquid crystal display or a micro display having a similar structure, or a retina directly displayable or similar laser scanning type display.
Of course, a computing device may also necessarily include other components, such as input/output interfaces, communication components, and so forth.
The input/output interface provides an interface between the processing component 12 and peripheral interface modules, which may be output devices, input devices, etc.
The communication component is configured to facilitate wired or wireless communication between the computing device and other devices, and the like.
An embodiment of the present application further provides a computer-readable storage medium, which stores a computer program, and when the computer program is executed by a computer, the method for controlling the running state of the service according to the embodiment shown in fig. 1 may be implemented.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
The above-described embodiments of the apparatus are merely illustrative, and the units described as separate parts may or may not be physically separate, and the parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware. With this understanding in mind, the above-described technical solutions may be embodied in the form of a software product, which can be stored in a computer-readable storage medium, such as ROM/RAM, magnetic disk, optical disk, etc., and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the methods of the various embodiments or some parts of the embodiments.
Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present application, and not to limit the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions in the embodiments of the present application.
Claims (11)
1. A method for controlling the running state of a service, which is applied to an application program developed by adopting a micro service architecture, wherein the application program comprises at least one service, and the method comprises the following steps:
determining a target operating environment of the application program;
obtaining a configuration file of the target operating environment, wherein the configuration file comprises configuration parameters of the at least one service;
starting to configure the at least one service in the target operation environment according to the configuration file;
detecting whether the current running state of the at least one service is consistent with respective configuration parameters;
and controlling the service to be recovered to the configured running state aiming at any service with the current running state inconsistent with the corresponding configuration parameter.
2. The method of claim 1, wherein the configuration parameters comprise an available state or an unavailable state, and wherein initiating configuration of the at least one service in the target runtime environment according to the configuration file comprises:
and starting the service configured to be in the usable state in the target running environment according to the configuration file, or forbidding starting the service configured to be in the unusable state.
3. The method of claim 1, prior to obtaining the configuration file for the target operating environment, further comprising:
determining the testing requirement of the application program for the target operation environment;
determining configuration parameters of the at least one service under the target operation environment according to the test requirements;
generating and storing a configuration file of the target operation environment according to the configuration parameters of the at least one service in the target operation environment;
the obtaining of the configuration file of the target operating environment includes:
and acquiring the stored configuration file of the target operating environment.
4. The method of claim 1, further comprising, after controlling the service to revert to its configured operational state:
if the running state of the service fails to recover, judging whether the recovery frequency of the service is less than a preset recovery frequency;
and if the recovery times are less than the preset recovery times, controlling the service to recover to the configured running state again.
5. The method of claim 4, further comprising:
if the recovery times are not less than the preset recovery times, generating prompt information;
and providing the prompt information for a tester to prompt the tester to recover the running state of the service in a manual intervention mode.
6. The method of claim 5, wherein generating the hint information comprises:
determining a call chain that the service can affect;
determining the information prompt level of the service according to the number of call chains which can be influenced by the service and/or the number of the services forming the call chains;
and generating prompt information according to the information prompt level.
7. The method of claim 5, wherein generating the hint information comprises:
determining a level of importance and/or a number of business functions that the service may affect;
determining the information prompt level of the service according to the importance level and/or the number of the service functions which can be influenced by the service;
and generating prompt information according to the information prompt level.
8. The method of any of claims 5 to 7, further comprising, after providing the prompt to a tester:
and if the processing result sent by the tester is not received within the preset time length, controlling all the services of the application program to stop running, wherein the processing result is used for indicating that the running state of the service is successfully recovered.
9. An operation state control device for a service, comprising:
the determining module is used for determining a target running environment of the application program, wherein the application program is developed and generated by adopting a micro-service architecture, and the application program comprises at least one service;
an obtaining module, configured to obtain a configuration file of the target operating environment, where the configuration file includes configuration parameters of the at least one service;
the starting module is used for starting and configuring the at least one service in the target operation environment according to the configuration file;
the detection module is used for detecting whether the current running state of the at least one service is consistent with respective configuration parameters;
and the control module is used for controlling the service to be recovered to the configured running state aiming at any service with the current running state inconsistent with the corresponding configuration parameter.
10. An electronic device comprising a storage component and a processing component; the storage component stores one or more computer program instructions; the one or more computer program instructions for invocation and execution by the processing component;
the processing component is to:
determining a target operating environment of the application program, wherein the application program is developed and generated by adopting a micro service architecture, and the application program comprises at least one service;
obtaining a configuration file of the target operating environment, wherein the configuration file comprises configuration parameters of the at least one service;
starting to configure the at least one service in the target operation environment according to the configuration file;
detecting whether the current running state of the at least one service is consistent with respective configuration parameters;
and controlling the service to be recovered to the configured running state aiming at any service with the current running state inconsistent with the corresponding configuration parameter.
11. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, causes the processor to carry out the steps of the method according to any one of claims 1 to 8.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011455680.8A CN112596946A (en) | 2020-12-10 | 2020-12-10 | Service running state control method and device, electronic equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011455680.8A CN112596946A (en) | 2020-12-10 | 2020-12-10 | Service running state control method and device, electronic equipment and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN112596946A true CN112596946A (en) | 2021-04-02 |
Family
ID=75192642
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202011455680.8A Pending CN112596946A (en) | 2020-12-10 | 2020-12-10 | Service running state control method and device, electronic equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112596946A (en) |
Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102713854A (en) * | 2012-03-15 | 2012-10-03 | 华为技术有限公司 | Method and apparatus for saving and restoring container state |
CN105550012A (en) * | 2015-12-07 | 2016-05-04 | 国云科技股份有限公司 | Method for custom recovery of malfunctioning virtual machine |
CN106201811A (en) * | 2016-07-06 | 2016-12-07 | 青岛海信宽带多媒体技术有限公司 | The fault recovery method of application program and terminal |
CN106227652A (en) * | 2016-07-12 | 2016-12-14 | 合网络技术(北京)有限公司 | Automated testing method and system |
CN106331150A (en) * | 2016-09-18 | 2017-01-11 | 北京百度网讯科技有限公司 | Method and device for scheduling cloud servers |
US20170242784A1 (en) * | 2016-02-19 | 2017-08-24 | International Business Machines Corporation | Failure recovery testing framework for microservice-based applications |
CN109474685A (en) * | 2018-11-16 | 2019-03-15 | 中国银行股份有限公司 | Service monitoring method and system under a kind of framework based on micro services |
CN111324412A (en) * | 2018-12-13 | 2020-06-23 | 阿里巴巴集团控股有限公司 | Service deployment method, device and storage medium |
CN111813601A (en) * | 2020-07-09 | 2020-10-23 | 中国工商银行股份有限公司 | Micro-service rollback method and device for stateful distributed cluster |
-
2020
- 2020-12-10 CN CN202011455680.8A patent/CN112596946A/en active Pending
Patent Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102713854A (en) * | 2012-03-15 | 2012-10-03 | 华为技术有限公司 | Method and apparatus for saving and restoring container state |
CN105550012A (en) * | 2015-12-07 | 2016-05-04 | 国云科技股份有限公司 | Method for custom recovery of malfunctioning virtual machine |
US20170242784A1 (en) * | 2016-02-19 | 2017-08-24 | International Business Machines Corporation | Failure recovery testing framework for microservice-based applications |
CN106201811A (en) * | 2016-07-06 | 2016-12-07 | 青岛海信宽带多媒体技术有限公司 | The fault recovery method of application program and terminal |
CN106227652A (en) * | 2016-07-12 | 2016-12-14 | 合网络技术(北京)有限公司 | Automated testing method and system |
CN106331150A (en) * | 2016-09-18 | 2017-01-11 | 北京百度网讯科技有限公司 | Method and device for scheduling cloud servers |
CN109474685A (en) * | 2018-11-16 | 2019-03-15 | 中国银行股份有限公司 | Service monitoring method and system under a kind of framework based on micro services |
CN111324412A (en) * | 2018-12-13 | 2020-06-23 | 阿里巴巴集团控股有限公司 | Service deployment method, device and storage medium |
CN111813601A (en) * | 2020-07-09 | 2020-10-23 | 中国工商银行股份有限公司 | Micro-service rollback method and device for stateful distributed cluster |
Non-Patent Citations (1)
Title |
---|
陈圣超: "基于区块链的软件交付过程管理***的设计与实现", 《中国优秀硕士学位论文全文数据库 信息科技辑》, no. 7, 15 July 2019 (2019-07-15), pages 138 - 441 * |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11683671B2 (en) | System, method, apparatus, and computer program product for providing mobile device support services | |
US20230224697A1 (en) | System, method, apparatus, and computer program product for providing mobile device support services | |
US7788540B2 (en) | Tracking down elusive intermittent failures | |
AU2018232915A1 (en) | System and method for introducing functionality to an application for use with a network service | |
CN106294051B (en) | A kind of motor detecting method and terminal | |
CN106980565B (en) | Upgrading process monitoring method and device | |
US20240039821A1 (en) | Mitigating failure in request handling | |
CN110581785B (en) | Reliability evaluation method and device | |
CN110502324B (en) | Processing method, system and storage medium for restart data of cloud mobile phone game | |
CN112965896A (en) | Test environment fault detection method and device based on dynamic byte codes | |
CN112596946A (en) | Service running state control method and device, electronic equipment and storage medium | |
CN112596750B (en) | Application testing method and device, electronic equipment and computer readable storage medium | |
CN112286797B (en) | Service monitoring method and device, electronic equipment and storage medium | |
CN112597001B (en) | Interface test method and device, electronic equipment and storage medium | |
CN113377451B (en) | Application restarting method, device, computer equipment and readable storage medium | |
CN112187841B (en) | Service hosting method and device based on SaaS platform, electronic equipment and storage medium | |
CN114217926A (en) | Multi-process service instance deployment method, device, equipment and readable storage medium | |
CN114625478A (en) | Application program management method and device, electronic equipment and computer readable storage medium | |
CN112099998A (en) | Processing method and device for applet loading failure, electronic equipment and storage medium | |
US20200259957A1 (en) | Systems and methods for monitoring and remediating trouble conditions using machine learning techniques | |
CN118170678A (en) | Microcomputer automatic test method, device, computer equipment and storage medium | |
CN115525529A (en) | Business object testing method and device and electronic equipment | |
CN117234601A (en) | System starting method and device, electronic equipment and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |