CN110659106B - Container state inspection method and device - Google Patents
Container state inspection method and device Download PDFInfo
- Publication number
- CN110659106B CN110659106B CN201910866580.5A CN201910866580A CN110659106B CN 110659106 B CN110659106 B CN 110659106B CN 201910866580 A CN201910866580 A CN 201910866580A CN 110659106 B CN110659106 B CN 110659106B
- Authority
- CN
- China
- Prior art keywords
- time
- detection time
- application
- container
- end detection
- 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.)
- Active
Links
- 238000000034 method Methods 0.000 title claims abstract description 51
- 238000007689 inspection Methods 0.000 title claims abstract description 21
- 238000001514 detection method Methods 0.000 claims abstract description 283
- 230000036541 health Effects 0.000 claims abstract description 52
- 239000000523 sample Substances 0.000 claims description 82
- 230000004044 response Effects 0.000 claims description 38
- 238000012544 monitoring process Methods 0.000 claims description 10
- 230000008569 process Effects 0.000 description 23
- 238000004883 computer application Methods 0.000 description 13
- 241000282326 Felis catus Species 0.000 description 10
- 238000003745 diagnosis Methods 0.000 description 10
- 230000004083 survival effect Effects 0.000 description 5
- 230000008439 repair process Effects 0.000 description 3
- 230000000737 periodic effect Effects 0.000 description 2
- 238000013461 design Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 238000010586 diagram Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 238000002474 experimental method Methods 0.000 description 1
- 230000003862 health status Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000000750 progressive effect Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/455—Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
- G06F9/45533—Hypervisors; Virtual machine monitors
- G06F9/45558—Hypervisor-specific management and integration aspects
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/455—Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
- G06F9/45533—Hypervisors; Virtual machine monitors
- G06F9/45558—Hypervisor-specific management and integration aspects
- G06F2009/45575—Starting, stopping, suspending or resuming virtual machine instances
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/455—Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
- G06F9/45533—Hypervisors; Virtual machine monitors
- G06F9/45558—Hypervisor-specific management and integration aspects
- G06F2009/45591—Monitoring or debugging support
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Automatic Analysis And Handling Materials Therefor (AREA)
Abstract
The invention provides a method and a device for checking the state of a container, wherein the method comprises the following steps: determining whether the initial detection time and the end detection time meet preset requirements; if the initial detection time and the end detection time both meet the preset requirements, when the waiting time of the container reaches the initial detection time, checking whether the application is normally started before the end detection time is reached, if the application is determined to be normally started, setting new end detection time based on the time of the normal start of the application and the preset first delay time, and recording the health inspection state of the container; and if the application is not normally started, setting a new ending detection time based on the current ending detection time and the preset second delay time, and restarting the container. In the invention, the detection ending time is reset by determining whether the application is normally started, and the application starting time can be accurately estimated, so that the application can normally receive the service access request.
Description
Technical Field
The invention relates to the technical field of computer application, in particular to a container state inspection method and device.
Background
With the continuous development of computer technology, more and more computer applications are applied, and application data processed by a computer are continuously increased, so that the number of times of the application data generating the BUG is not increased continuously, and the computer application needs to be subjected to periodic health check and repair operation in the running process of the computer application in order to enable the computer application to be in normal running in real time.
In the prior art, the running process of a computer application is periodically subjected to health check and repair operation through Kubernets. According to the Kubernetes, the process condition of periodically accessing the computer application after the container is started for a long time is set, when the computer application is slowly started and cannot successfully respond within a specified number of times, the Kubernetes considers that the application has BUG and then automatically restarts the container, so that the application starting time cannot be accurately estimated, and the computer application is always in an un-ready state and cannot accept the service access request.
Disclosure of Invention
In view of this, embodiments of the present invention provide a method and an apparatus for checking a container status, so as to solve the problem in the prior art that a service access request cannot be accepted.
In order to achieve the above purpose, the embodiments of the present invention provide the following technical solutions:
the embodiment of the invention discloses a container state inspection method on one hand, which comprises the following steps:
reading configuration parameters in a pre-created configuration file, and determining initial detection time and end detection time;
determining whether the initial detection time and the end detection time meet preset requirements;
if the initial detection time and the end detection time both meet preset requirements, when the waiting time of a container reaches the initial detection time, checking whether the application is normally started before the end detection time is reached, wherein the waiting time of the container is used for indicating any time after the container is started until the container receives a probe response success message sent by the application;
if the application is determined to be normally started, setting new ending detection time based on the time for normally starting the application and the preset first delay time, and recording the health examination state of the container;
and if the application is not normally started, setting a new ending detection time based on the current ending detection time and a preset second delay time, and restarting the container.
Optionally, the determining whether the initial probing time and the end probing time meet preset requirements includes:
judging whether the detection ending time is greater than or equal to the initial detection time or not;
when the detection ending time is greater than or equal to the initial detection time, determining that the initial detection time is the initial detection time meeting the preset requirement, and judging whether the detection ending time is greater than the preset detection ending time or not;
and when the end detection time is greater than the pre-configured end detection time, setting the pre-configured end detection time as the end detection time meeting the preset requirement.
Optionally, the determining whether the end detection time is greater than a preconfigured end detection time further includes:
and when the end detection time is less than or equal to the pre-configured end detection time, determining the end detection time as the end detection time meeting the preset requirement.
Optionally, if it is determined that the application is normally started, setting a new end detection time based on the time of the normal start of the application and a preset first delay time, and recording a health check state of the container, including:
controlling the monitoring probe to issue a pre-configured detection command to the application;
judging whether a probe response success message sent by the application is received before the end probe time is reached;
if a message that the detection response sent by the application is successful is received before the detection ending time is reached, determining that the application is normally started;
recording the time from the start of the container to the time when the probe response success message sent by the application is received, setting the sum of the recorded time and the preset first delay time as a new end probe time, and recording the health check state of the container.
In another aspect, an embodiment of the present invention discloses a device for inspecting a container status, the device comprising: an examination time setter and a health examination controller;
the checking time setter is used for reading configuration parameters in a pre-established configuration file and determining initial detection time and ending detection time; determining whether the initial detection time and the end detection time meet preset requirements or not; if the application is determined to be normally started, setting new ending detection time based on the time for normally starting the application and the preset first delay time; if the application is determined not to be started normally, setting new end detection time based on the current end detection time and preset second delay time;
the health check controller is used for checking whether the application is normally started before the end detection time is reached when the waiting time of the container reaches the initial detection time if the initial detection time and the end detection time both meet preset requirements, wherein the waiting time of the container is used for indicating any time after the container is started until the container receives a probe response success message sent by the application; if the application is determined to be normally started, recording the health check state of the container; and if the application is not normally started, restarting the container.
Optionally, the check time setter is specifically configured to, in determining whether the initial probing time and the end probing time meet preset requirements:
judging whether the detection ending time is greater than or equal to the initial detection time or not; when the detection ending time is greater than or equal to the initial detection time, determining that the initial detection time meets a preset requirement, and judging whether the detection ending time is greater than a preset detection ending time or not; and when the end detection time is greater than the pre-configured end detection time, setting the pre-configured end detection time as the end detection time meeting the preset requirement.
Optionally, the check time setter further comprises:
and when the end detection time is less than or equal to the pre-configured end detection time, determining the end detection time as the end detection time meeting the preset requirement.
Optionally, the check time setter is specifically configured to, in setting a new end detection time based on the time when the application is normally started and a preset first delay time:
recording the time from the start of the container to the time when the probe response success message sent by the application is received, and setting the sum of the recorded time and the preset first delay time as a new end probe time.
Based on the container state inspection and device provided by the embodiment of the invention, the method comprises the following steps: reading configuration parameters in a pre-created configuration file, determining initial detection time and end detection time, and determining whether the initial detection time and the end detection time meet preset requirements; if the initial detection time and the end detection time both meet the preset requirements, when the waiting time of the container reaches the initial detection time, checking whether the application is normally started before the end detection time is reached, if the application is determined to be normally started, setting new end detection time based on the time of the normal start of the application and the preset first delay time, and recording the health inspection state of the container; and if the application is not normally started, setting a new ending detection time based on the current ending detection time and the preset second delay time, and restarting the container. In the embodiment of the invention, whether the container receives the message of successful detection response sent by the application before the end detection time is reached is judged, so that the new end detection time is reset, the application can be normally started, and the service access request can be accepted.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the provided drawings without creative efforts.
Fig. 1 is a schematic flow chart of a container status checking method according to an embodiment of the present invention;
fig. 2 is a schematic flowchart of a process for determining an initial probe time and an end probe time according to an embodiment of the present invention;
FIG. 3 is a schematic flow chart illustrating another process for determining satisfactory initial probe time and end probe time according to an embodiment of the present invention;
FIG. 4 is a flow chart illustrating a method for inspecting a container status according to an embodiment of the present invention;
fig. 5 is a block diagram of a container status check according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, 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 invention.
In this application, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
It is known from the background art to perform periodic health check and repair operations on computer application running processes via kubernets. According to the Kubernetes, the process condition of periodically accessing the computer application after the container is started for a long time is set, when the computer application is slowly started and cannot successfully respond within a specified number of times, the Kubernetes considers that the application has BUG and then automatically restarts the container, so that the application starting time cannot be accurately estimated, and the computer application is in an un-ready state and cannot accept the service access request.
Therefore, embodiments of the present invention provide a container status check and apparatus, which determine an application start status by determining whether a container receives a probe response success message sent by an application before an end probe time arrives. When the application is successfully started, the health check state of the container is recorded, so that the application can be normally started and can accept the service access request.
Referring to fig. 1, a schematic flow chart of a container status checking method provided in an embodiment of the present invention is applied to kubernets, and the method includes the following steps:
step S101: and reading configuration parameters in a pre-created configuration file, and determining an initial detection time and an end detection time.
In the process of implementing step S101, Kubernetes creates YAML configuration files in containers in pod in advance, and acquires initial probe time and end probe time when the containers are started.
It should be noted that the configuration parameters in the configuration file include, in addition to the initial probing time and the end probing time, other parameters that affect the health check, such as the time interval for executing the probing diagnosis command, and the application is not limited thereto.
It should be noted that, after the initial probe time initialDelaySecond is the start of the container, the cat/tmp/health command, that is, the delay time of the probe diagnosis command, is executed inside the container for the first time. The end detection time enddelayssecond is a time when execution is ended inside the container.
It should be noted that the pod is comprised of one or more containers.
Step S102: and determining whether the initial detection time and the end detection time meet preset requirements, and if the initial detection time and the end detection time both meet the preset requirements, executing step S103.
In the process of implementing step S102 specifically, the initial detection time and the end detection time are determined to meet the preset requirement by determining whether the end detection time is greater than the preset requirement or whether the end detection time is set.
Step S103: when the waiting time of the container reaches the initial detection time, checking whether the application is normally started before the ending detection time is reached, if the application is determined to be normally started, executing the step S104, and if the application is determined not to be normally started, executing the step S105.
In step S103, the waiting time of the container is used to indicate any time after the container is started until the container receives the probe response success message sent by the application.
In the process of implementing step S103 specifically, when the waiting time of the container reaches the initial detection time, a cat/tmp/health command, that is, a detection diagnosis command, is started to be executed on the application according to a preset time interval, and whether the application is normally started is checked before the end detection time reaches.
It should be noted that the probe diagnosis command is issued and executed by a survival monitoring probe defined by Kubernetes for a container in Pod.
Step S104: and setting a new ending detection time based on the time of the normal starting of the application and the preset first delay time, and recording the health examination state of the container.
In the process of implementing step S104, the health check of the application is continuously executed, and the event corresponding to the health check state of the application detected in each time interval is recorded.
Step S105: setting a new end detection time based on the current end detection time and a preset second delay time, and restarting the container.
In the process of implementing step S105, the container is restarted, a time interval is waited, it is determined that the container is restarted successfully, and then the health status of the application in the container is checked.
It should be noted that, the first delay time and the second delay time are empirical values preset through a plurality of experiments, and the values of the first delay time and the second delay time may be the same or different, which may be determined according to actual situations, and the present application is not limited thereto.
In the embodiment of the invention, the configuration parameters in the pre-created configuration file are read, the initial detection time and the end detection time are determined, and whether the initial detection time and the end detection time meet the preset requirements is determined; if the initial detection time and the end detection time both meet the preset requirements, when the waiting time of the container reaches the initial detection time, checking whether the application is normally started before the end detection time is reached, if the application is determined to be normally started, setting new end detection time based on the time of the normal start of the application and the preset first delay time, and recording the health inspection state of the container; and if the application is not normally started, setting a new ending detection time based on the current ending detection time and a preset second delay time, and restarting the container. In the embodiment of the invention, the starting state of the application is determined by judging whether the container receives a message that the probe response sent by the application succeeds before the end probe time arrives. When the application is successfully started, the new end detection time is reset, the health check state of the container is recorded, the application starting time can be estimated more accurately, and the application can receive the service access request.
Based on the container status checking method shown in fig. 1 in the embodiment of the present invention, in the process of executing step S102 to determine whether the initial detection time and the end detection time meet the preset requirements, as shown in fig. 2, the method includes the following steps:
step S201: determining whether the end detection time is greater than or equal to the initial detection time, and if the end detection time is greater than or equal to the initial detection time, executing step S202.
In the process of implementing step S201 specifically, the magnitudes of the initial probing time and the end probing time are checked, and it is determined whether the end probing time is greater than or equal to the initial probing time, if the end probing time is greater than or equal to the initial probing time, step S202 is executed.
Step S202: determining the initial detection time as an initial detection time meeting a preset requirement, and determining whether the end detection time is greater than a preconfigured end detection time, when the end detection time is greater than the preconfigured end detection time, executing step S203, and when the end detection time is less than or equal to the preconfigured end detection time, executing step S204.
Step S203: and setting the pre-configured end detection time as the end detection time meeting the preset requirement.
Step S204: and determining the end detection time as the end detection time meeting the preset requirement.
In the embodiment of the invention, the initial detection time and the end detection time which meet the requirements are determined according to the initial detection time and the end detection time, so that the starting state of the application is judged conveniently, the application can be normally started, and the service can be provided for the outside.
Based on the process of determining whether the initial detection time and the end detection time meet the preset requirements shown in fig. 2, as shown in fig. 3, the initial detection time and the end detection time can also be determined in the following manner, and the specific implementation process includes the following steps:
step S301: checking whether the end detection time is set, and if the end detection time is not set, namely the end search time is 0, executing step S302. If it is checked that the end probe time is set, it is determined whether the end probe time is greater than or equal to the initial probe time, and step S201 is executed.
It should be noted that, since the application needs to be initialized after the container is started, a certain delay time is required, and thus the initial detection time is not 0.
Step S302: and determining the pre-configured end detection time as the end detection time meeting the preset requirement, and determining the initial detection time as the initial detection time meeting the preset requirement.
The explanation is made based on the contents shown in the above step S302.
Such as: the preconfigured end detection time may be 1800 seconds, it is checked that the initial detection time is 10 seconds and the end detection time is 0 seconds, the preconfigured end detection time is 1800 seconds, which is determined as the end detection time meeting the preset requirement, and the initial detection time of 10 seconds is determined as the initial detection time meeting the preset requirement.
In the embodiment of the invention, the initial detection time and the end detection time which meet the requirements are determined by checking the setting condition of the end detection time, so that the starting state of the application is judged conveniently, the application can be normally started, and the service can be provided for the outside.
Based on the container status checking method shown in fig. 1 in the above embodiment of the present invention, if it is determined that the application is normally started in step S104, a new ending detection time is set based on the time of the normal start of the application and the preset first delay time, and a process of recording the health check status of the container is performed, as shown in fig. 4, including the following steps:
step S401: and controlling the monitoring probe to issue a pre-configured detection diagnosis command to the application.
It should be noted that the monitoring probes include a survival monitoring probe and a ready monitoring probe.
In the process of implementing step S401 specifically, when the waiting time of the container reaches the initial detection time, the survival monitoring probe is controlled to issue a preconfigured detection diagnosis command, i.e. a cat/tmp/health command, and execute the detection diagnosis command according to a preset time interval.
Step S402: judging whether a probe response success message sent by the application is received before the end detection time arrives, if the probe response success message sent by the application is received before the end detection time arrives, executing step S403, and if the probe response success message sent by the application is not received before the end detection time arrives, executing step S304.
In the process of implementing step S402 specifically, if the probe diagnosis instruction is issued for the first time before the end probe time is reached, and a message that the probe response sent by the application is successful is received, the waiting of the container is ended, and step S403 is executed; if the probe diagnosis instruction is issued for the first time before the end of the probe time is reached, and a message that the probe response sent by the application fails is received, the method enters waiting, and waits for the next time interval to execute the cat/tmp/health command, that is, the probe diagnosis instruction, on the application again until the message that the probe response sent by the application succeeds is received, the waiting time of the container is ended, and step S403 is executed. If the message that the probe response sent by the application fails is received before the end probe time is reached, step S404 is executed.
Step S403: determining that the application is normally started.
Step S404: recording the time from the start of the container to the time when the probe response success message sent by the application is received, setting the sum of the recorded time and the preset first delay time as a new end probe time, and recording the health check state of the container.
Step S404: and setting the sum of the current end detection time and the preset second delay time as a new end detection time, and restarting the container.
For better understanding of what is shown in fig. 4 above, the following explanation is made.
Such as: the preset time interval is 5 seconds, the initial detection time is 10 seconds, the end detection time is 60 seconds, the preset first delay time is 5 seconds, the preset second delay time is 7 seconds, and when the waiting time of the container reaches the initial detection time by 10 seconds, the survival monitoring probe is controlled to issue a cat/tmp/health command, and the cat/tmp/health command is executed every 5 seconds. If the cat/tmp/health command is issued for the first time before the end detection time is 60 seconds and when the waiting time of the container reaches 10 seconds after the initial detection time, receiving a message of successful detection response sent by the application, ending the waiting time of the container, recording the time from the start of the container to the reception of the message of successful detection response sent by the application to be 22 seconds, setting the sum of the recorded time 22 seconds and the first delay time 5 seconds as a new end detection time, and starting to record the health check state of the container; if the cat/tmp/health command is issued for the first time when the waiting time of the container reaches 10 seconds before the end detection time reaches 60 seconds and the message that the probe response sent by the application fails is received, waiting is entered, the cat/tmp/health command is executed again to the application when the waiting time of the container is 15 seconds, the message that the probe response sent by the application fails is received, waiting is entered until the cat/tmp/health command is executed again to the application when the waiting time of the container is 45 seconds, the message that the probe response sent by the application succeeds is received at this moment, the container waiting time is ended, the time from the start of the container to the time when the probe response success message sent by the application is received is recorded as 57 seconds, and the sum 63 of the recorded time 57 seconds and the first delay time of 5 seconds is set as a new end detection time, and begin to record the health check state of the container; and if the message of the probe response failure sent by the application is received before the end probe time 60 arrives, setting the sum 67 seconds of the current end probe time 60 seconds and the second delay time 7 seconds as a new end probe time, and controlling the container to restart.
In the embodiment of the invention, whether the application is normally started is determined by judging whether a probe response success message sent by the application is received before the end probe time is reached, if the application is determined to be normally started, a new end probe time is set so as to more accurately determine the normal start time of the application during the next container health check, and if the application cannot be normally started, the end probe time is reset so as to further determine the normal start time of the application during the next container health check, so that the application can accept the service access request.
Corresponding to the container state inspection method disclosed in the embodiment of the present invention, the embodiment of the present invention also discloses a container state inspection device, as shown in fig. 5, the container state inspection device includes: an inspection time setter 501 and an inspection controller 502.
The inspection time setter 501 is configured to read configuration parameters in a configuration file created in advance, determine an initial probing time and an end probing time, determine whether the initial probing time and the end probing time meet preset requirements, and send the initial probing time and the end probing time meeting the requirements to the health inspection controller 502. And if the application is determined to be normally started, setting new ending detection time based on the time for normally starting the application and the preset first delay time, and if the application is determined not to be normally started, setting new ending detection time based on the current ending detection time and the preset second delay time.
The health check controller 502 is configured to receive the initial probe time and the end probe time that are sent by the probe time setter 501 and meet the requirements, check whether the application is normally started before the end probe time is reached when the waiting time of the container reaches the initial probe time, record a health check state of the container if it is determined that the application is normally started, and restart the container if it is determined that the application is not normally started.
It should be noted that the waiting time of the container is used to indicate any time after the container is started until the container receives the probe response success message sent by the application.
It should be noted that, the specific principle and the implementation process of each unit in the container status inspection apparatus disclosed in the above embodiment of the present invention are the same as the container status inspection method disclosed in the above embodiment of the present invention, and reference may be made to corresponding parts in the container status inspection method disclosed in the above embodiment of the present invention, which are not described herein again.
In the embodiment of the invention, the configuration parameters in the pre-created configuration file are read by the check time setter, the initial detection time and the end detection time are determined, whether the initial detection time and the end detection time meet the preset requirements or not is determined, and the initial detection time and the end detection time meeting the requirements are sent to the health check controller. The health inspection controller receives initial detection time and ending detection time which meet requirements, when the waiting time of the container reaches the initial detection time, whether the application is normally started is checked before the ending detection time is reached, if the application is determined to be normally started, new ending detection time is set based on the time of normally starting the application and preset first delay time, and the health inspection state of the container is recorded; and if the application is not normally started, setting a new ending detection time based on the current ending detection time and a preset second delay time, and restarting the container. In the embodiment of the invention, the starting state of the application is determined by judging whether the container receives a message that the probe response sent by the application succeeds before the end probe time arrives. When the application is successfully started, the new ending detection time is reset so as to more accurately determine the normal starting time of the application during the next container health check and record the health check state of the container.
Based on the application status checking apparatus described in fig. 5, the checking time setter is specifically configured to, in determining whether the initial probing time and the end probing time meet preset requirements:
judging whether the detection ending time is greater than or equal to the initial detection time, determining that the initial detection time meets a preset requirement when the detection ending time is greater than or equal to the initial detection time, judging whether the detection ending time is greater than a preset detection ending time, and setting the preset detection ending time as the detection ending time meeting the preset requirement when the detection ending time is greater than the preset detection ending time.
In the embodiment of the invention, the initial detection time and the end detection time which meet the requirements are determined according to the initial detection time and the end detection time, so that the starting state of the application is judged conveniently, the application can be normally started, and the service can be provided for the outside.
Based on the application status checking apparatus described in fig. 5, the checking time setter 501 further includes:
and when the end detection time is less than or equal to the pre-configured end detection time, determining the end detection time as the end detection time meeting the preset requirement.
In the embodiment of the invention, the initial detection time and the end detection time which meet the requirements are determined by checking the setting condition of the end detection time, so that the starting state of the application is judged conveniently, the application can be normally started, and the service can be provided for the outside.
Based on the application status checking apparatus described in fig. 5, the health check controller is specifically configured to, in the event that it is determined that the application is normally started, record the health check status of the container:
and controlling the survival monitoring probe to issue a pre-configured detection command to an application, judging whether a detection response success message sent by the application is received before the end detection time is reached, and recording the health check state of the container if the detection response success message sent by the application is received before the end detection time is reached.
In the embodiment of the invention, whether the application is normally started is determined by judging whether the detection response success message sent by the application is received before the end detection time is reached, and if the application is determined to be normally started, the health state of the container is recorded, so that the application starting time can be accurately estimated, and the application can receive the service access request.
Based on the application status checking apparatus described in fig. 5, the checking time setter is specifically configured to set a new end detection time based on the time when the application is normally started and a preset first delay time, and to:
if the application is determined to be normally started, recording the time from the start of the container to the time when the probe response success message sent by the application is received, setting the sum of the recorded time and the preset first delay time as new end detection time, and if the application is determined not to be normally started, setting the sum of the current end detection time and the preset second delay time as the new end detection time.
In the embodiment of the invention, whether the application is normally started is determined, if the application is determined to be normally started, the new end detection time is set, so that the normal start time of the application in the next container health check can be more accurately determined, and if the application cannot be normally started, the end detection time is reset, so that the normal start time of the application in the next container health check can be further determined, and the application can receive the service access request.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, the system or system embodiments are substantially similar to the method embodiments and therefore are described in a relatively simple manner, and reference may be made to some of the descriptions of the method embodiments for related points. The above-described system and system embodiments are only illustrative, wherein 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.
Those of skill would further appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative components and steps have been described above generally in terms of their functionality in order to clearly illustrate this interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims (6)
1. A method of inspecting a condition of a container, the method comprising:
reading configuration parameters in a pre-created configuration file, and determining initial detection time and end detection time;
determining whether the initial detection time and the end detection time meet preset requirements;
if the initial detection time and the end detection time both meet preset requirements, when the waiting time of a container reaches the initial detection time, checking whether the application is normally started before the end detection time is reached, wherein the waiting time of the container is used for indicating any time after the container is started until the container receives a probe response success message sent by the application;
controlling the monitoring probe to issue a pre-configured detection command to the application;
judging whether a probe response success message sent by the application is received before the end probe time is reached;
if a probe response success message sent by the application is received before the end probe time is reached, determining that the application is normally started;
recording the time from the start of the container to the time when the probe response success message sent by the application is received, setting the sum of the recorded time and the preset first delay time as a new end detection time, and recording the health check state of the container;
and if the application is not normally started, setting a new ending detection time based on the current ending detection time and a preset second delay time, and restarting the container.
2. The method of claim 1, wherein the determining whether the initial probing time and the end probing time meet preset requirements comprises:
judging whether the detection ending time is greater than or equal to the initial detection time or not;
when the detection ending time is greater than or equal to the initial detection time, determining that the initial detection time is the initial detection time meeting the preset requirement, and judging whether the detection ending time is greater than the preset detection ending time or not;
and when the end detection time is greater than the pre-configured end detection time, setting the pre-configured end detection time as the end detection time meeting the preset requirement.
3. The method of claim 2, wherein the determining whether the end probe time is greater than a preconfigured end probe time further comprises:
and when the end detection time is less than or equal to the pre-configured end detection time, determining the end detection time as the end detection time meeting the preset requirement.
4. A container condition inspection device, characterized in that the device comprises: an examination time setter and a health examination controller;
the checking time setter is used for reading configuration parameters in a pre-established configuration file and determining initial detection time and ending detection time; determining whether the initial detection time and the end detection time meet preset requirements or not; if the application is determined to be normally started, recording the time from the start of the container to the time when the probe response success message sent by the application is received, and setting the sum of the recorded time and the preset first delay time as new end probe time; if the application is determined not to be started normally, setting new end detection time based on the current end detection time and the preset second delay time;
the health check controller is used for checking whether the application is normally started before the end detection time is reached when the waiting time of the container reaches the initial detection time if the initial detection time and the end detection time both meet preset requirements, wherein the waiting time of the container is used for indicating any time after the container is started until the container receives a probe response success message sent by the application; if the application is determined to be normally started, recording the health check state of the container; and if the application is not normally started, restarting the container.
5. The apparatus according to claim 4, wherein the check time setter is specifically configured to, in determining whether the initial probing time and the end probing time meet preset requirements:
judging whether the detection ending time is greater than or equal to the initial detection time or not; when the detection ending time is greater than or equal to the initial detection time, determining that the initial detection time meets a preset requirement, and judging whether the detection ending time is greater than a preset detection ending time or not; and when the end detection time is greater than the pre-configured end detection time, setting the pre-configured end detection time as the end detection time meeting the preset requirement.
6. The apparatus of claim 5, wherein the check time setter further comprises:
and when the end detection time is less than or equal to the pre-configured end detection time, determining the end detection time as the end detection time meeting the preset requirement.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910866580.5A CN110659106B (en) | 2019-09-12 | 2019-09-12 | Container state inspection method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910866580.5A CN110659106B (en) | 2019-09-12 | 2019-09-12 | Container state inspection method and device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN110659106A CN110659106A (en) | 2020-01-07 |
CN110659106B true CN110659106B (en) | 2022-03-22 |
Family
ID=69037139
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910866580.5A Active CN110659106B (en) | 2019-09-12 | 2019-09-12 | Container state inspection method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110659106B (en) |
Families Citing this family (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111506388B (en) * | 2020-03-23 | 2023-04-25 | 聚好看科技股份有限公司 | Container performance detection method, container management platform and computer storage medium |
CN112131130B (en) * | 2020-10-09 | 2025-07-11 | 腾讯科技(深圳)有限公司 | Detection method, device, equipment and computer readable storage medium |
CN112346817A (en) * | 2020-10-20 | 2021-02-09 | 北京健康之家科技有限公司 | Container starting method and device, storage medium and computer equipment |
CN114884840B (en) * | 2022-03-21 | 2024-01-19 | 新华三大数据技术有限公司 | Application health state checking method and electronic equipment |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108664291A (en) * | 2017-03-30 | 2018-10-16 | 中国移动通信集团山西有限公司 | The construction method and device of container group |
CN110009369A (en) * | 2018-12-20 | 2019-07-12 | 阿里巴巴集团控股有限公司 | Vessel examination method and device, electronic equipment |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20040040013A1 (en) * | 2002-08-26 | 2004-02-26 | Mohit Kalra | Time-based breakpoints in debuggers |
-
2019
- 2019-09-12 CN CN201910866580.5A patent/CN110659106B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108664291A (en) * | 2017-03-30 | 2018-10-16 | 中国移动通信集团山西有限公司 | The construction method and device of container group |
CN110009369A (en) * | 2018-12-20 | 2019-07-12 | 阿里巴巴集团控股有限公司 | Vessel examination method and device, electronic equipment |
Non-Patent Citations (1)
Title |
---|
Probe or Wait: Handling tail losses using Multipath;Kiran Yedugundla 等;《 2017 IFIP Networking Conference (IFIP Networking) and Workshops》;IEEE;20180123;第1-6页 * |
Also Published As
Publication number | Publication date |
---|---|
CN110659106A (en) | 2020-01-07 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110659106B (en) | Container state inspection method and device | |
CN110311831B (en) | Container cloud-based system resource monitoring method and related equipment | |
CN112099825B (en) | Method, device, equipment and storage medium for upgrading component | |
CN104850475B (en) | A kind of test method and device of equipment | |
CN111506388B (en) | Container performance detection method, container management platform and computer storage medium | |
CN105653318A (en) | Software upgrade method, device and system | |
CN110502399B (en) | Fault detection method and device | |
CN110297767B (en) | Automatic execution method, device, equipment and storage medium for test cases | |
CN113504932A (en) | Firmware data updating method and device | |
CN105373474A (en) | Business system-oriented test method and device | |
CN110618853B (en) | Detection method, device and equipment for zombie container | |
CN112805691B (en) | Exception handling method, terminal device and storage medium | |
CN102262573B (en) | Operating system startup protection method and device | |
CN106201787A (en) | Terminal control method and device | |
CN113918407A (en) | Method and device for managing service process and readable storage medium | |
CN113722181A (en) | BMC process monitoring method, device, system and medium of server | |
CN110134558B (en) | Method and device for detecting server | |
CN111382016A (en) | Method and device for connecting test terminal and computer | |
US20090083747A1 (en) | Method for managing application programs by utilizing redundancy and load balance | |
CN113656235A (en) | Server complete machine power consumption control test method, device, system and medium | |
CN103713966B (en) | Mobile terminal system starting protection method and apparatus | |
CN114625478B (en) | Application management method and device, electronic device and computer-readable storage medium | |
CN103713920B (en) | Portable device system starting protection method and apparatus | |
EP4481561A1 (en) | System switching method, and terminal device and storage medium | |
JP6802777B2 (en) | Methods, programs and systems for requesting execution of processing with improved fault tolerance and responding as a result. |
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 | ||
GR01 | Patent grant | ||
GR01 | Patent grant |