A method and device for identifying a destroyed container instance

By using filters and timing task mechanisms in container instance monitoring devices, identifying and excluding destroyed container instances, the problem of container instance monitoring devices displaying destroyed container instance status information is solved, and the accuracy and user experience of monitoring devices are improved.

CN114265669BActive Publication Date: 2025-03-14SHENGDOUSHI SHANGHAI SCI & TECH DEV CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111658939.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-30
Publication Date
2025-03-14
Estimated Expiration
2041-12-30

AI Technical Summary

Technical Problem

When the container instance monitoring device displays the running status of the container instance, it may display the status information of the destroyed container instance, affecting the user's user experience.

Method used

By introducing filters and timing task mechanisms into container instance monitoring devices, duplicate status information is filtered out and destroyed container instances are identified by initial and terminated timing tasks.

Benefits of technology

Effectively identify and exclude destroyed container instances, improve the accuracy and user experience of container instance monitoring devices, while maintaining efficient packet processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114265669B_ABST
    Figure CN114265669B_ABST
Patent Text Reader

Abstract

The present specification provides a method and apparatus for identifying a destroyed container instance, which are applied to a container instance monitoring device. The method includes: inputting status information reported by all container instances in a current reporting period into a filter; wherein the filter is used to delete duplicate information in the status information of the container instances input into the filter; the status information of the container instances includes at least a survival flag of the container instance, and the survival flag is used to indicate that the container instance has not been destroyed; for each container instance, based on the survival flag of the container instance output by the filter, a set initial scheduled task, and a set termination scheduled task, the container instance is identified, and the container instance is determined to be a destroyed container instance according to the identification result.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer application technology, and more particularly to a method and device for identifying a destroyed container instance. Background Art

[0002] Container technology is an operating system layer virtualization technology. It can be used to virtualize multiple independent and non-interfering containers on a physical host. Each container provides an independent application operating environment for the application running in the container. Some business system technicians will host business systems through container instances deployed on cloud platforms.

[0003] In order to facilitate the management of multiple container instances of a business system, a device that monitors the running status of each container instance (hereinafter referred to as a container instance monitoring device) is generally configured. The container instance monitoring device summarizes and displays the running status of each container instance.

[0004] In the related art, when there are destroyed container instances, the status information displayed by the container instance monitoring device may be mixed with the destroyed container instances, which will affect the user experience of the user who uses the container monitoring device. Summary of the invention

[0005] This specification provides a method and device for identifying a destroyed container instance.

[0006] According to a first aspect of an embodiment of this specification, a method for identifying a destroyed container instance is provided, which is applied to a container instance monitoring device, and the method includes:

[0007] Input the status information reported by all container instances in the current reporting period into the filter; wherein the filter is used to delete duplicate information in the status information of the container instances input into the filter, and the duplicate information is the same status information as the existing information in the filter; the status information of the container instances at least includes a survival flag of the container instances, and the survival flag is used to indicate that the container instances have not been destroyed;

[0008] For each container instance, based on the survival flag of the container instance output by the filter, the set initial scheduled task and the set termination scheduled task, the container instance is identified, and the container instance is determined to be a destroyed container instance according to the identification result.

[0009] According to a second aspect of an embodiment of this specification, a destroyed container instance identification device is provided, which is applied to a container instance monitoring device, and the device includes:

[0010] A status information input module is used to input the status information reported by all container instances in the current reporting period into the filter; wherein the filter is used to delete duplicate information in the status information of the container instances input into the filter, wherein the duplicate information is the same status information as the existing information in the filter; the status information of the container instances at least includes a survival flag of the container instances, wherein the survival flag is used to indicate that the container instances have not been destroyed;

[0011] The identification module is used to identify each container instance based on the survival flag of the container instance output by the filter, the set initial scheduled task and the set termination scheduled task, and determine that the container instance is a destroyed container instance according to the identification result.

[0012] According to a third aspect of an embodiment of this specification, a container instance monitoring system is provided, the container instance monitoring system comprising a container instance monitoring device and a plurality of container instances; the container instance monitoring device executes the above method to realize the identification of destroyed container instances.

[0013] According to a fourth aspect of the embodiments of this specification, a computer-readable storage medium is provided, and when the program is executed by a processor, the above-mentioned method for identifying a destroyed container instance is implemented.

[0014] According to a fifth aspect of the embodiments of this specification, a computer device is provided, the computer device comprising:

[0015] one or more processors;

[0016] A memory for storing one or more programs;

[0017] When the one or more programs are executed by the one or more processors, the one or more processors implement the above-mentioned method for identifying a destroyed container instance.

[0018] The present specification provides a method and apparatus for identifying a destroyed container instance, which are applied to a container instance monitoring device. The method includes: inputting status information reported by all container instances in a current reporting period into a filter; wherein the filter is used to delete duplicate information in the status information of the container instances input into the filter; the status information of the container instances includes at least a survival flag of the container instance, and the survival flag is used to indicate that the container instance has not been destroyed; for each container instance, based on the survival flag of the container instance output by the filter, a set initial scheduled task, and a set termination scheduled task, the container instance is identified, and the container instance is determined to be a destroyed container instance according to the identification result.

[0019] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present specification. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the specification and, together with the description, serve to explain the principles of the specification.

[0021] Figure 1 The flowchart of a method for identifying a destroyed container instance is shown in this specification according to an exemplary embodiment.

[0022] Figure 2A This is a flowchart of a method for identifying a destroyed container instance according to a specific embodiment of the present specification.

[0023] Figure 2B This is a flowchart of another method for identifying a destroyed container instance according to a specific embodiment of the present specification.

[0024] Figure 2C This is a flowchart of another method for identifying a destroyed container instance according to a specific embodiment of this specification.

[0025] Figure 3 It is a block diagram of a device for identifying a destroyed container instance according to an exemplary embodiment of the present specification.

[0026] Figure 4 It is a hardware structure diagram of a computer device where a destroyed container instance identification device is located according to an exemplary embodiment of this specification. DETAILED DESCRIPTION

[0027] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The implementations described in the following exemplary embodiments do not represent all implementations consistent with this specification. Instead, they are merely examples of devices and methods consistent with some aspects of this specification as detailed in the appended claims.

[0028] The terms used in this specification are for the purpose of describing specific embodiments only and are not intended to limit this specification. The singular forms "a", "the" and "the" used in this specification and the appended claims are also intended to include plural forms unless the context clearly indicates otherwise. It should also be understood that the term "and / or" used herein refers to and includes any or all possible combinations of one or more associated listed items.

[0029] It should be understood that although the terms first, second, third, etc. may be used in this specification to describe various information, these information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of this specification, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the word "if" as used herein may be interpreted as "in the case of..." or "when..." or "in response to determining."

[0030] Container instances on the cloud platform can be deployed flexibly on demand. Business systems with large traffic changes over time are more suitable for implementation through container instances on the cloud platform. The business system deploys the software of the business system through container instances. Since each container instance has a certain traffic processing limit, resources can be saved by deploying more container instances during business peak hours and destroying some container instances during business trough hours.

[0031] When a large number of container instances are used in some business systems, a device is needed to monitor the operation status of each container instance to promptly respond to sudden traffic surges or to detect faults more quickly. This device is referred to as a container instance monitoring device in this specification.

[0032] Since all container instances that need to be monitored by the container instance monitoring device may belong to different business systems, due to differences in development languages ​​and development frameworks, different business systems cannot summarize the operating status of each container instance through the functions provided by each framework itself.

[0033] In the related art, the operating status of each container instance is generally summarized by having each container instance report a message of uniform specifications. These messages include the status information of the container instance, and the status information generally includes information used to describe the operating status of the container instance, such as CPU usage, the number of accesses to a certain interface, and data characterizing the survival status of the container. It should be noted that the reporting messages are generally reported according to a period (hereinafter referred to as the reporting period), and the reporting periods of different container instances may be the same or different, and the time when the container instance starts reporting may be the same or different. The container instance monitoring device displays the operating status of each container instance based on the received reported data. The operating status is hereinafter referred to as the status information of the container instance.

[0034] When actually using the container instance monitoring device, it is found that sometimes after some container instances have been destroyed because they no longer need to be destroyed or because a new version has been launched (for example, some container instances will be destroyed during off-peak hours to save resources; when upgrading services, in order not to interrupt the business, the old version of the container instance is destroyed and the new version of the container instance is deployed to complete the business upgrade), the container instance monitoring device will still display the status information of these container instances, which brings a lot of confusion to users (confused about why the destroyed container instances are still running).

[0035] Through analysis, it is known that after receiving the message, the container instance monitoring device does not directly parse the message to store the corresponding data, but first parses the message, inputs the multiple status information of each container instance obtained into the Bloom filter (it can also be other filters that can quickly filter duplicate information), and then stores the data output from the Bloom filter. Since the Bloom filter can filter out duplicate information, that is, if a status information (container instance A, container survival status is Alive) has entered the Bloom filter in the previous cycle, then when the same status information (container instance A, container survival status is Alive) is received in this cycle, after the status information is input into the Bloom filter, the Bloom filter will filter out this information, in other words, the Bloom filter will not output the status information. From the above description, it can be seen that if the same status information is reported in two adjacent reporting cycles (the status information includes the container instance to which it belongs, the name of the status information and the corresponding specific status value), then the Bloom filter will not output the status information of the next cycle. Similarly, if the same status information is reported in multiple consecutive cycles, then the Bloom filter will only output the status information reported in the first cycle. It should also be noted that, since the data will first reach the Bloom filter, the state information filtered out by the Bloom filter will not be stored in the persistent storage space, so the container instance monitoring device will consider that the state information has not been received.

[0036] The purpose of setting up a Bloom filter is to improve the efficiency of processing messages. Specifically, the Bloom filter determines whether a certain state information is a duplicate information not by accessing the persistent storage space (such as accessing the database storing the state information in the hard disk), but when the state information of the previous cycle arrives, if the state information is output, the index of the state information will be stored in the memory, so that only the index stored in the memory can be used to determine whether the newly received state information is a duplicate information. In the case of duplicate information, there is no need to store the duplicate information in the persistent storage space. Since the process of storing in the persistent storage space is relatively time-consuming, and the process of determining whether a certain state information is a duplicate through the memory is very fast, so with less consumption, many duplicate information can be saved without repeated storage, which improves the efficiency of processing messages.

[0037] Since the filtered data is not stored, the filtered data will not be displayed normally. In order to make the status information still display normally after being filtered, considering that the filtered status data are all duplicate information, when the container instance monitoring system needs to display the status information of the container instance, if the current status information cannot be obtained, the status information of the previous cycle in which the status information is stored will be used as the current status information. For example, the survival status of container instance A in the first reporting cycle is Alive, and the survival status of container instance A in the 2nd to 9th cycles is not recorded. When the survival status of container instance A in the 10th cycle needs to be displayed, the Alive reported in the first reporting cycle will be used as the survival status of container instance A in the 10th cycle. This will result in that the container instance monitoring device will not be able to know whether it is because the message is not received and not stored, or because it is filtered by the Bloom filter and not stored, if all the status information of a certain cycle is not stored. In this way, the container instance monitoring device will still display the running status of the destroyed container instance.

[0038] Therefore, there is a problem in the related art: how to quickly identify the destroyed container instance while ensuring the message processing efficiency (using Bloom filter or other filters).

[0039] In order to solve the above problems, this specification provides a method for identifying a destroyed container instance. The container instance monitoring device inputs the status information reported by all container instances in the current reporting period into a filter to filter out duplicate information. The status information at least includes a survival flag used to characterize the survival of the container instance. When the filter outputs the survival flag of a container instance, the survival flag of the container instance is added to the filter and the survival flag of the container instance is recorded; an initial timed task is set; and when there is a termination timed task corresponding to the container instance, the termination timed task is stopped; wherein the timing duration of the initial timed task is not less than the reporting period of the container instance; when the initial timed task expires, the survival flag of the container instance in the filter is deleted, and a termination timed task is set; when the termination timed task expires, the container instance corresponding to the termination timed task is identified as a destroyed container instance.

[0040] In this way, the survival flag in the filter is deleted after the initial timing task expires, so that when the container instance is not destroyed, the container instance monitoring device can receive the survival flag after a period of time to confirm whether the container instance is alive. When the container instance is destroyed, the container instance monitoring device can normally delete the destroyed container instance by terminating the timing task. And because the filter is still working, the message processing efficiency can still be improved. In addition, inputting the survival flag into the filter can make it unnecessary to identify and filter out the survival flag before the filter filtering; and because there is an initial timing task, during the time period of the initial timing task, since the survival flag will not change for a long time, then during the time of the initial timing task, there is no need to receive and store the survival flag; and if the survival flag is not input into the filter, then the initial timing task will not be set, only the termination timing task will be set, then it will be necessary to update the termination timing task or set a new termination timing task each time the survival flag is input, and by inputting the survival flag into the filter and setting the initial timing task, during the timing time of the initial timing task, the device does not need to make any operation on the survival flag (such as updating the termination timing task), it can be seen that the filter and the initial timing task can improve the processing efficiency.

[0041] Next, the embodiments of this specification are described in detail.

[0042] like Figure 1 As shown, Figure 1 This is a flowchart of a method for identifying a destroyed container instance according to an exemplary embodiment of the present specification, comprising the following steps:

[0043] Step 101: input the status information reported by all container instances in the current reporting period into a filter.

[0044] First of all, it should be noted that this method is applied to the container instance monitoring device. The container instance monitoring device is described above and will not be described here. This step is the same as the method in the related art. Both require the status information reported by the container instance in the current reporting period to be input into the filter. Inputting the filter can reduce the stored data, thereby improving the processing efficiency of the container monitoring instance.

[0045] Next, the terms appearing in step 101 are explained. The reporting period refers to the time between two reports of status information of the container instance. When the current reporting period arrives, the container instance monitoring device will receive messages sent by all container instances, and the messages contain the status information of the container instances. The reporting period can generally be set by the user of the container instance monitoring device, or the system default value can be used.

[0046] The status information can refer to the description above. It should be noted that the status information of the container instance at least includes a survival flag of the container instance (the survival flag is used to indicate that the container instance has not been destroyed). Since the survival flag does not change for a long time and can clearly indicate whether a container is alive, the survival flag can be used to more conveniently identify destroyed container instances.

[0047] As for the meaning of the survival flag, some container instances will inform the container instance monitoring device of their survival status by sending a survival flag when they are alive, but after being destroyed, the container instance monitoring device will not receive the survival flag, so as to determine whether a container instance has been destroyed by whether the survival flag is received within the timing time of terminating the scheduled task.

[0048] In addition, it should be noted that the status information input to the filter can be all the status information contained in the message. Taking into account that some status information changes frequently, since the filter identifies duplicate information through data stored in the memory, if the memory specification is not large, then it can be set not to input these frequently changing status information into the filter, and only allow some status information that does not change frequently to enter the filter, which can save memory resources.

[0049] Next, the filter will be explained. The filter is used to delete duplicate information in the state information of the container instance input to the filter. The duplicate information is the same state information as the existing information in the filter. Since the filter will add this data to the filter (in the space allocated to the filter in the memory) when it does not filter out certain data, when the filter receives certain data, it will match the received data with the existing data in the filter. If it matches any existing data in the filter, the data will be identified as duplicate information, and then the duplicate information will be deleted, and the duplicate information will not be output from the filter. In addition, within a reporting cycle after the state information is stored, if a certain data (except the information of the survival flag) in the filter has not been matched, the data in the filter will be deleted to prevent the mistaken filtering of some state information that should not be filtered.

[0050] From the above analysis, it can be known that duplicate information is the same state information as the state information received in the previous cycle. Through the above filter, when the state information of a container instance received in two adjacent cycles is the same, the filter will not output the same duplicate information, so the container instance monitoring device does not need to store the duplicate information. Since the state information is generally stored in a database, and the process of writing data to the database is relatively time-consuming, the filter can reduce the data written to the database and improve processing efficiency.

[0051] In addition, the above-mentioned filter may be a Bloom filter, or other filters having the above-mentioned characteristics, which is not limited in this specification.

[0052] Through step 101, the process of inputting the status information into the filter in the related art is retained, thereby ensuring the processing efficiency of the container instance monitoring device.

[0053] Step 103, for each container instance, based on the survival flag of the container instance output by the filter, the set initial scheduled task and the set termination scheduled task, the container instance is identified, and according to the identification result, the container instance is determined to be a destroyed container instance.

[0054] Next, the specific implementation of step 103 will be described.

[0055] Through the above analysis, it can be known that the present disclosure needs to realize the detection of the survival status of the container instance while ensuring the container instance monitoring system. Since duplicate information will be filtered by the filter, it is necessary to set an initial scheduled task to regularly detect the survival status of the container instance. Therefore, it is necessary to set the initial scheduled task when the filter outputs the survival flag of the container instance. At the same time, in order to ensure that the processing efficiency can be guaranteed within the timing of the initial scheduled task, it is necessary to add the survival flag of the container instance in the filter while setting the initial scheduled task, and record the survival flag of the container instance.

[0056] Regarding the above process, it should be explained that since the filter filters duplicate information, duplicate information refers to information that is the same as the existing information in the filter. In other words, if the filter outputs a certain information, it proves that the information does not exist in the filter. As for the survival flag, if the filter outputs the survival flag of the container instance, it proves that the survival flag of the container instance is not stored in the filter. Therefore, it is necessary to add the survival flag of the container instance in the filter to filter out the duplicate survival flag.

[0057] At the same time, if the survival flag is received, the survival flag of the container instance in this period also needs to be recorded so that the container instance monitoring device can normally display the information of the container instance. Of course, in order to reduce the writing of data to the persistent storage medium, the survival flag of the container instance can also be recorded only when the container instance monitoring device has not recorded the survival flag of the container instance.

[0058] In addition, you need to set the initial scheduled task. The initial scheduled task includes the scheduled duration, which means that the timer starts from the moment the initial scheduled task is set and waits until the scheduled duration is reached. After the scheduled duration has passed, the initial scheduled task will expire. When the initial scheduled task expires, that is, after the scheduled duration has passed, the action that should be performed when the initial scheduled task expires will be executed.

[0059] The purpose of setting the initial scheduled task is, on the one hand, after the initial scheduled task ends, it is necessary to delete the survival flag of the container instance that the filter already has, so that the survival flag can be received and stored, and then by judging whether the container instance monitoring device has received the survival flag during the time of the termination scheduled task, it is determined whether the reason why the survival flag was not received during the initial scheduled task time period is because the container was destroyed or because it was filtered. On the other hand, if the initial scheduled task is not set, and only the termination scheduled task is set, that is, the survival flag is not input into the filter, then the survival flag of the container instance of each cycle needs to be stored; and only by terminating the scheduled task, if the container instance is not destroyed, each reporting cycle will trigger the deletion or update of the termination scheduled task. In the case of a large number of container instances, the above method will greatly increase the working efficiency of the container instance monitoring device. In other words, by setting the initial scheduled task, the working efficiency of the container instance monitoring device can be improved.

[0060] After explaining the role of the initial timing task, it is also necessary to explain that the timing duration of the initial timing task is not less than the reporting period of the container instance. If the timing duration of the initial timing task is less than the reporting period of the container instance, then when the survival flag of a container instance is newly stored in the first cycle (that is, when step 103 is executed), since the timing duration of the initial timing task is shorter than the reporting period of the container instance, when the survival flag of the container instance is received in the second cycle, the action performed in step 103 will be performed again, which cannot achieve the above-mentioned advantage of improving processing efficiency.

[0061] The timing durations of the initial scheduled tasks corresponding to different container instances can be the same. In addition, considering that the abnormality of the physical machine where the container instance is located causes all container instances on the physical machine to restart, which in turn causes many container instances to start reporting at the same time, and these container instances have the same reporting period, then the container instance monitoring device will receive a lot of reporting messages when it reaches the reporting period of these container instances. In addition, due to the message backlog in the reporting message middleware, the container instance monitoring device will also process a large number of reporting messages at the same time. In this case, if the timing durations of the initial scheduled tasks corresponding to all container instances are the same, all initial scheduled tasks will expire at the same time (expiration means that the initial scheduled task has been waiting for such a long time as the timing duration), then the container instance monitoring device will have a greater processing pressure at the time of expiration.

[0062] In order to avoid reducing the problem of high processing pressure on the container instance monitoring device at a certain point in time, the timing duration of the initial scheduled task is the initial duration plus the random duration, and the initial duration is not less than the reporting period of the container instance. In addition, for convenience, the initial duration can be set to be no less than the longest reporting period among all container instances. In other words, the initial scheduled tasks corresponding to different container instances have the same initial duration, but the random duration is a random number generated within a certain range (the range can be set by a technician), and the random numbers corresponding to different container instances are different, so the timing durations corresponding to different container instances will be different, so that all container instances will not expire at the same time, dispersing the processing pressure of the container instance monitoring device.

[0063] After explaining the initial scheduled task, it is also necessary to explain the termination scheduled task. For the setting of the termination scheduled task, when the initial scheduled task expires, the survival flag of the container instance in the filter is deleted, and the termination scheduled task is set; wherein, the timing duration of the termination scheduled task is not less than the reporting period of the container instance. The stopping condition of the termination scheduled task of the container instance is: the filter outputs the survival flag of the container instance. After the termination scheduled task is stopped, when the termination scheduled task of the container instance expires, the container instance is identified to obtain an identification result indicating that the container instance has been destroyed.

[0064] In other words, the termination timed task is similar to the initial timed task. Both of them start from setting the termination timed task and waiting for the timing duration of the termination timed task, and then execute the actions that need to be performed after the termination timed task expires (identifying the destroyed container instance); unlike the initial timed task, the termination timed task can be stopped, that is, when the filter outputs the survival flag of the container instance, the termination timed task corresponding to the container instance is stopped.

[0065] Since the container instance monitoring device cannot receive the survival flag of a container instance within the timing duration of the initial scheduled task corresponding to a container instance, it will be impossible to determine whether the container instance is alive through the survival flag. In this case, by deleting the survival flag of the container instance in the filter when the initial scheduled task expires and setting a termination scheduled task, the destruction status of the container instance can be identified. Specifically, if the survival flag of the container instance is received within the timing duration of the termination scheduled task, it proves that the container instance is alive. If it is not received, it proves that the container instance has been destroyed. In this case, the container instance corresponding to the termination scheduled task needs to be identified as a destroyed container instance.

[0066] In addition, for the termination of scheduled tasks, the duration of the termination of scheduled tasks should not be less than the reporting period of the container instance. This is to accurately determine whether the reason why the reporting message was not received when the termination of the scheduled task expires is because the container instance has been destroyed, or because the duration is too short and the reported status information was not received. The duration of the termination of scheduled tasks should not be too short to avoid misidentifying the undestroyed container instance as a destroyed container instance due to network delays or network jitters.

[0067] From the above analysis, it can be seen that step 103 can be implemented by the following steps:

[0068] For each container instance, perform the following steps:

[0069] Step 1031, when the filter outputs the survival flag of the container instance, add the survival flag of the container instance in the filter; record the survival flag of the container instance; set the initial scheduled task; if there is a termination scheduled task corresponding to the container instance, stop the termination scheduled task.

[0070] Step 1032: When the initial scheduled task expires, the survival flag of the container instance in the filter is deleted, and the scheduled task is terminated.

[0071] Step 1033: When the termination scheduled task expires, the container instance corresponding to the termination scheduled task is identified as a destroyed container instance.

[0072] After step 103, in order to display normally, the container instance monitoring device will no longer display the status information of the destroyed container instance. In addition, in order to reduce the storage space occupied by useless information, all status information of the destroyed container instance can be deleted. If there is a need to review the operation of the container instance later, the destroyed container instance can be marked, and the container instance monitoring device will only display: the container instance that has not been marked as destroyed.

[0073] After explaining the termination timed task, the specific implementation of steps 1032 and 1033 will also be explained. In order to more efficiently execute steps 1032-1033, steps 1032 and 1033 can be implemented by two monitoring threads / processes respectively. In other words, the container instance monitoring device has an initial task monitoring module that monitors whether the initial scheduled task corresponding to each container instance has expired, and a termination task monitoring module that monitors whether the termination timed task corresponding to each container instance has expired.

[0074] Specifically, the container instance monitoring device is configured with an initial task monitoring module. Step 1032 specifically includes: the initial task monitoring module cyclically executes the following steps: determining whether there is an initial scheduled task that has expired; if there is an initial scheduled task that has expired, deleting the survival flag of the container instance corresponding to the initial scheduled task, and setting a termination scheduled task; if there is no initial scheduled task that has expired, waiting for a first preset time.

[0075] The purpose of waiting for the first preset time is mainly to prevent the initial task monitoring module from idling and to prevent the module from executing all the time: determining whether there is an initial scheduled task due, so as to reduce the occurrence of excessive CPU load.

[0076] In addition, the container instance monitoring device is configured with a termination task monitoring module. Step 1033 specifically includes: the termination task monitoring module cyclically executes the following steps: determining whether there is an expired termination timed task; if there is an expired termination timed task, identifying the container instance to obtain an identification result indicating that the container instance has been destroyed; if there is no expired termination timed task, waiting for a second preset time.

[0077] The purpose of waiting for the second preset time length in the above process is similar to that of waiting for the first preset time length, which will not be repeated here. The first preset time length and the second preset time length can be the same or different, and the specific value can be set according to the needs, which is not limited in this specification.

[0078] In addition to being implemented in the above manner, step 1033 can also be implemented in the following manner: the setting of the termination timed task includes: setting the termination timed task and starting the termination task monitoring module corresponding to the termination timed task. When the termination timed task of the container instance expires, the container instance is identified to obtain an identification result indicating that the container instance has been destroyed, including: the termination task monitoring module performs the following steps: after the termination task monitoring module is started, waits for the timing duration of the termination timed task to determine whether the termination timed task has stopped; when the termination timed task has not stopped, the container instance is identified to obtain an identification result indicating that the container instance has been destroyed (that is, the container instance corresponding to the termination timed task is identified as a destroyed container instance).

[0079] In other words, after the termination timed task is set, the termination task monitoring module corresponding to the termination timed task is started. The module does not need to monitor the termination timed task in real time. It only needs to determine whether the termination timed task has been stopped after waiting for the timing duration of the termination timed task. If it is stopped, the container instance corresponding to the termination timed task is identified as a destroyed container instance, thereby completing the purpose of step 1033.

[0080] The method shown in this specification will be described below through a specific embodiment.

[0081] A container instance monitoring device is responsible for monitoring all container instances deployed by the company on the cloud platform (different container instances may belong to different businesses). The container instance monitoring device is configured with an initial task monitoring module, a termination task monitoring module, and a status information processing module. Each module is executed independently to complete the identification of destroyed container instances. It should also be noted that after receiving the status information, the container instance monitoring device will store the status information that is not filtered by the Bloom filter in the database. When displaying the status of each container instance, the container instance monitoring device will only display the status information stored in the Bloom filter (that is, the container instance that is identified as destroyed needs to be deleted).

[0082] The status information processing module performs the following operations: Figure 2A Steps shown:

[0083] Step 201: Receive status information reported by a target container instance, and input the received status information into a Bloom filter.

[0084] It should be noted that the target container instance can refer to any container instance, and is referred to as the target container instance for the convenience of description. The module can perform the following steps according to the container instance, that is, first input all state information of a container instance into the Bloom filter, and perform steps 202-206 for the container instance.

[0085] Step 202: Determine whether the Bloom filter outputs a survival flag of the target container instance.

[0086] If not, it is proved that it is still within the time limit of the initial timed task, so the operation is terminated and steps 201-206 are continued for the next received state information of the container instance. If yes, step 203 is executed.

[0087] In addition, for the status information other than the survival flag, when the Bloom filter outputs other status information of the target container instance, the status information is stored in the database.

[0088] Step 203, determine whether the database has stored the past state information of the target container instance. If not, execute step 2041, if yes, execute step 2042.

[0089] Step 2041: Add a survival flag of the target container instance in the database.

[0090] Step 2042: Stop the termination timer task corresponding to the target container instance.

[0091] Past status information refers to the status information received in the past reporting cycle. Since the status information reported in the first cycle will inevitably be output by the Bloom filter, as long as the status information of the past reporting cycle is stored, it can be determined that the status information is not reported for the first time. In this way, there will be a termination timer task corresponding to the target container instance. Since the survival flag proves that the target container instance has not been destroyed, the termination timer task needs to be stopped to prevent the information of the target container instance in the database from being deleted by the termination timer task.

[0092] In addition, if the status information of the past reporting cycle is not stored, the survival flag of the target container instance needs to be stored in the database so that the status of the container instance can be displayed normally.

[0093] Step 205: Add a survival flag of the target container instance in the Bloom filter.

[0094] Step 206, setting an initial scheduled task, the scheduled duration is the initial duration + random duration.

[0095] Steps 205 and 206 are described above in detail and will not be repeated here.

[0096] The initial task monitoring module is executed as follows Figure 2B The following steps are shown:

[0097] Step 211, whether there is an expired initial scheduled task. If yes, execute step 212, if not, execute step 213.

[0098] Step 212, delete the survival flag of the container instance corresponding to the initial scheduled task in the Bloom filter, and set the scheduled task to be terminated. After executing step 212, return to step 201.

[0099] Step 213, waiting for a first preset time period.

[0100] Steps 212 and 213 are described above in detail and will not be repeated here.

[0101] Step 214, whether a system interrupt is received, if yes, then end, if not, return to step 211.

[0102] Among them, receiving a system interrupt means that the system notifies the program to end its operation, so it ends when the system interrupt is received.

[0103] The number of the above-mentioned status information processing module and initial task monitoring module is 1, each module is responsible for processing all information, and the termination task monitoring module corresponds to the termination timed task one by one. The termination task monitoring module is started when the termination timed task is set, and is responsible for monitoring the termination timed task. It should also be noted that the termination task monitoring module is only responsible for monitoring whether the termination timed task has expired, and is not responsible for stopping the termination timed task that needs to be stopped.

[0104] Specifically, the termination task monitoring module corresponding to the target container instance executes as follows Figure 2C The following steps are shown:

[0105] Step 221, the termination task monitoring module is started and waits for the timing duration of the termination timed task.

[0106] That is to say, the termination task monitoring module is started after the termination task is set, and needs to wait for the timing duration of the termination scheduled task.

[0107] Step 222, determine whether the termination timed task exists. If yes, execute step 223, if not, end.

[0108] In other words, if the task still exists after waiting for the scheduled time, it means that the survival flag of the target container instance has not been received during this period, then the target container instance is identified as a destroyed container instance, and all information about the target container instance in the database is deleted. If the task no longer exists after waiting for the scheduled time, it means that the task is deleted after the state information processing module receives the survival flag of the target container instance, then it means that the target container instance has not been destroyed, and the operation ends.

[0109] In addition, this specification also provides a container instance monitoring system, which includes a container instance monitoring device and several container instances; the container instance monitoring device executes the above method to realize the identification of destroyed container instances.

[0110] Corresponding to the embodiments of the aforementioned method, this specification also provides embodiments of an apparatus and a computer device to which it is applied.

[0111] like Figure 3 As shown, Figure 3 This is a block diagram of a destroyed container instance identification device according to an exemplary embodiment of the present specification, the device is applied to a container instance monitoring device, and includes:

[0112] The status information input module 310 is used to input the status information reported by all container instances in the current reporting period into the filter; wherein the filter is used to delete duplicate information in the status information of the container instances input into the filter, and the duplicate information is the same status information as the existing information in the filter; the status information of the container instance at least includes a survival flag of the container instance, and the survival flag is used to indicate that the container instance has not been destroyed.

[0113] The identification module 320 is used to identify each container instance based on the survival flag of the container instance output by the filter, the set initial scheduled task and the set termination scheduled task, and determine that the container instance is a destroyed container instance according to the identification result.

[0114] Among them, the above-mentioned identification module at least includes an initial scheduled task setting submodule (not shown in the figure), which is used to set the initial scheduled task when the filter outputs the survival flag of the container instance; add the survival flag of the container instance in the filter, and record the survival flag of the container instance; wherein the timing duration of the initial scheduled task is not less than the reporting period of the container instance.

[0115] The timing duration of the initial scheduled task is the initial duration plus the random duration, and the initial duration is not less than the reporting period of the container instance.

[0116] Among them, the above-mentioned identification module also includes a termination timed task setting submodule (not shown in the figure), which is used to delete the survival flag of the container instance in the filter and set the termination timed task when the initial timed task expires; wherein the timing duration of the termination timed task is not less than the reporting period of the container instance; the stopping condition of the termination timed task of the container instance is: the filter outputs the survival flag of the container instance.

[0117] Among them, the destroyed container instance identification device also includes an initial task monitoring module (not shown in the figure), which is used to: the initial task monitoring module cyclically executes the following steps: determine whether there is an initial scheduled task that has expired; if there is an expired initial scheduled task, delete the survival flag of the container instance corresponding to the initial scheduled task, and set the termination of the scheduled task; if there is no expired initial scheduled task, wait for a first preset time period.

[0118] Among them, the destroyed container instance identification device also includes a termination task monitoring module (not shown in the figure), which is used to: the termination task monitoring module cyclically executes the following steps: determine whether there is a termination timed task that has expired; if there is an expired termination timed task, identify the container instance to obtain an identification result indicating that the container instance has been destroyed; if there is no expired termination timed task, wait for a second preset time period.

[0119] The identification module 320 is specifically used to: when the termination timer task of the container instance expires, identify the container instance to obtain an identification result indicating that the container instance has been destroyed.

[0120] The destroyed container instance identification device further includes an initial task monitoring module (not shown in the figure), which is used to: for each container instance, when the initial timed task expires, delete the survival flag of the container instance in the filter; set a termination timed task, and start the termination task monitoring module corresponding to the termination timed task. The destroyed container instance identification device further includes a termination task monitoring module, which is used to: the termination task monitoring module performs the following steps: after the termination task monitoring module is started, wait for the timing duration of the termination timed task, and determine whether the termination timed task is stopped; if the termination timed task is not stopped, identify the container instance, and obtain an identification result indicating that the container instance has been destroyed.

[0121] Wherein, the filter is a Bloom filter.

[0122] The implementation process of the functions and effects of each module in the above-mentioned device is specifically described in the implementation process of the corresponding steps in the above-mentioned method, which will not be repeated here.

[0123] For the device embodiment, since it basically corresponds to the method embodiment, the relevant parts can refer to the partial description of the method embodiment. The device embodiment described above is only schematic, wherein the modules described as separate components may or may not be physically separated, and the components displayed as modules may or may not be physical modules, that is, they may be located in one place, or they may be distributed on multiple network modules. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this specification. A person of ordinary skill in the art can understand and implement it without paying creative labor.

[0124] like Figure 4 As shown, Figure 4 A hardware structure diagram of a computer device in which a destroyed container instance identification device is located in an embodiment is shown, and the device may include: a processor 1010, a memory 1020, an input / output interface 1030, a communication interface 1040, and a bus 1050. The processor 1010, the memory 1020, the input / output interface 1030, and the communication interface 1040 are connected to each other in communication within the device through the bus 1050.

[0125] The processor 1010 can be implemented by a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of this specification.

[0126] The memory 1020 may be implemented in the form of ROM (Read Only Memory), RAM (Random Access Memory), static storage device, dynamic storage device, etc. The memory 1020 may store an operating system and other application programs. When the technical solutions provided in the embodiments of this specification are implemented by software or firmware, the relevant program codes are stored in the memory 1020 and are called and executed by the processor 1010.

[0127] The input / output interface 1030 is used to connect the input / output module to realize information input and output. The input / output module can be configured in the device as a component (not shown in the figure), or it can be externally connected to the device to provide corresponding functions. The input device may include a keyboard, a mouse, a touch screen, a microphone, various sensors, etc., and the output device may include a display, a speaker, a vibrator, an indicator light, etc.

[0128] The communication interface 1040 is used to connect a communication module (not shown) to realize communication interaction between the device and other devices. The communication module can realize communication through a wired mode (such as USB, network cable, etc.) or a wireless mode (such as mobile network, WIFI, Bluetooth, etc.).

[0129] The bus 1050 includes a path that transmits information between the various components of the device (eg, the processor 1010, the memory 1020, the input / output interface 1030, and the communication interface 1040).

[0130] It should be noted that, although the above device only shows the processor 1010, the memory 1020, the input / output interface 1030, the communication interface 1040 and the bus 1050, in the specific implementation process, the device may also include other components necessary for normal operation. In addition, it can be understood by those skilled in the art that the above device may also only include the components necessary for implementing the embodiments of the present specification, and does not necessarily include all the components shown in the figure.

[0131] The embodiments of the present specification also provide a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the above-mentioned method for identifying a destroyed container instance is implemented.

[0132] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.

[0133] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0134] Those skilled in the art will readily appreciate other embodiments of the specification after considering the specification and practicing the invention claimed herein. The specification is intended to cover any variations, uses or adaptations of the specification that follow the general principles of the specification and include common knowledge or customary techniques in the art that are not claimed in the specification. The specification and examples are to be considered exemplary only, and the true scope and spirit of the specification are indicated by the following claims.

[0135] It should be understood that the present description is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present description is limited only by the appended claims.

[0136] The above description is only a preferred embodiment of this specification and is not intended to limit this specification. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of this specification should be included in the scope of protection of this specification.

Claims

1. A method for identifying a destroyed container instance, characterized in that: Applied to a container instance monitoring device, the method includes: Input the status information reported by all container instances in the current reporting period into the filter; wherein the filter is used to delete duplicate information in the status information of the container instances input into the filter; the status information of the container instances at least includes a survival flag of the container instances, and the survival flag is used to indicate that the container instances have not been destroyed; For each container instance, based on the survival flag of the container instance output by the filter, the set initial scheduled task, and the set termination scheduled task, the container instance is identified, and according to the identification result, the container instance is determined to be a destroyed container instance, including: In the case where the filter outputs the survival flag of the container instance, the survival flag of the container instance is added to the filter, the survival flag of the container instance is recorded, the initial scheduled task is set, and if there is a termination scheduled task corresponding to the container instance, the termination scheduled task is stopped; When the initial scheduled task expires, the survival flag of the container instance in the filter is deleted and the scheduled task is terminated; When the termination timed task expires, the container instance corresponding to the termination timed task is identified as a destroyed container instance.

2. The method according to claim 1, characterized in that The process of setting up the initial scheduled task for the container instance includes: The timing duration of the initial scheduled task is not less than the reporting period of the container instance.

3. The method according to claim 2, characterized in that The timing duration of the initial scheduled task is the initial duration plus the random duration, and the initial duration is not less than the reporting period of the container instance.

4. The method according to claim 2, characterized in that: The process of setting the termination timer task of the container instance includes: The timing duration of the termination timed task is not less than the reporting period of the container instance; the stopping condition of the termination timed task of the container instance is: the filter outputs the survival flag of the container instance.

5. The method according to claim 4, characterized in that The container instance monitoring device is configured with an initial task monitoring module; When the initial scheduled task expires, the survival flag of the container instance in the filter is deleted, and the scheduled task is terminated, including: The initial task monitoring module loops through the following steps: Determine whether there is an initial scheduled task due; In the case of an expired initial scheduled task, the survival flag of the container instance corresponding to the initial scheduled task is deleted and the scheduled task is terminated; When there is no expired initial scheduled task, wait for a first preset time period.

6. The method according to claim 4, characterized in that The identifying of the container instance includes: When the termination timer task of the container instance expires, the container instance is identified to obtain an identification result indicating that the container instance has been destroyed.

7. The method according to claim 6, characterized in that The container instance monitoring device is configured with a termination task monitoring module; When the termination timed task of the container instance expires, the container instance is identified to obtain an identification result indicating that the container instance has been destroyed, including: The termination task monitoring module loop executes the following steps: Determine whether there is a scheduled task that has expired; In the case where there is an expired termination scheduled task, the container instance is identified to obtain an identification result indicating that the container instance has been destroyed; When there is no expired scheduled task to be terminated, wait for a second preset time period.

8. The method according to claim 6, characterized in that The setting of terminating the scheduled task includes: Set a termination timer task and start the termination task monitoring module corresponding to the termination timer task; When the termination timed task of the container instance expires, the container instance is identified to obtain an identification result indicating that the container instance has been destroyed, including: The termination task monitoring module performs the following steps: After the termination task monitoring module is started, wait for the timing duration of the termination scheduled task to determine whether the termination scheduled task is stopped; When the termination timed task is not stopped, the container instance is identified to obtain an identification result indicating that the container instance has been destroyed.

9. The method according to any one of claims 1 to 8, characterized in that: The filter is a Bloom filter.

10. A device for identifying a destroyed container instance, characterized in that: Applied to a container instance monitoring device, the device comprises: A status information input module, used to input the status information reported by all container instances in the current reporting period into a filter; wherein the filter is used to delete duplicate information in the status information of the container instances input into the filter; the status information of the container instances at least includes a survival flag of the container instance, and the survival flag is used to indicate that the container instance has not been destroyed; The identification module is used to identify each container instance based on the survival flag of the container instance output by the filter, the set initial scheduled task and the set termination scheduled task, and determine that the container instance is a destroyed container instance according to the identification result, including: In the case where the filter outputs the survival flag of the container instance, the survival flag of the container instance is added to the filter, the survival flag of the container instance is recorded, the initial scheduled task is set, and if there is a termination scheduled task corresponding to the container instance, the termination scheduled task is stopped; When the initial scheduled task expires, the survival flag of the container instance in the filter is deleted and the scheduled task is terminated; When the termination timed task expires, the container instance corresponding to the termination timed task is identified as a destroyed container instance.

11. A container instance monitoring system, characterized in that: The container instance monitoring system includes a container instance monitoring device and a plurality of container instances; The container instance monitoring device executes the method according to any one of claims 1 to 9 to realize the identification of the destroyed container instance.

12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method for identifying a destroyed container instance according to any one of claims 1 to 9 is implemented.

13. A computer device, characterized in that: The computer device comprises: one or more processors; A memory for storing one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the destroyed container instance identification method according to any one of claims 1 to 9.

Citation Information

Patent Citations

  • Method and apparatus for service hosting for distributed storage system

    CN109120678A

  • Configuration modification method and device for container application, computer equipment and storage medium

    CN110262873A