Configuration hot update method and device, computer equipment and readable storage medium
By listening to Ingress resource changes in Nginx Ingress Controller and querying the annotation identification and overload delay of the service, configuration hot update processing is only performed under appropriate conditions, the resource consumption problems caused by frequent configuration file overloading are solved, and performance and stability are improved.
Patent Information
- Application Number
- CN202411758954.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-03
- Publication Date
- 2025-03-04
AI Technical Summary
When users operate Ingress resources, frequent Nginx configuration file overloading consumes a large amount of CPU and memory resources, affecting Nginx performance and reducing the stability of the entire cluster.
By monitoring Ingress resource changes, querying service annotation identification and overload delays, configuration hot update processing is only performed when the time interval is less than the preset time, reducing resource losses caused by frequent hot updates.
It effectively reduces resource loss, improves Nginx's performance, and improves gateway routing traffic and the stability of the entire cluster.
Smart Images

Figure CN119557015A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of distributed technology, and in particular to a configuration update method, apparatus, computer equipment, computer-readable storage medium, and computer program product. Background Art
[0002] Currently, when users operate Ingress resources, whether they modify the rule configuration in the configuration file nginx.conf, or delete or create new Ingress resources, it will trigger the reload operation of Nginx in the Ingress Controller. Frequent reloads will consume more CPU and memory resources, especially when processing a large number of connections or complex configurations. This may affect the performance of Nginx and thus the stability of the entire cluster. Summary of the invention
[0003] Based on this, it is necessary to provide a configuration hot update method, device, computer equipment, computer readable storage medium and computer program product that can reduce resource loss in response to the above technical problems.
[0004] In a first aspect, the present application provides a configuration hot update method, comprising:
[0005] When monitoring changes in Ingress resources, query the annotation identifier of the service where the Ingress resource changes occurred;
[0006] If the service has a pre-set annotation, determine the time interval between the time when the service's Ingress resource changes this time and the time when the Ingress resource changes last time;
[0007] When the time interval is less than the preset time interval, the reload delay set in advance for the service is obtained, and after waiting for the corresponding length of the reload delay, the corresponding configuration hot update processing is performed.
[0008] In one embodiment, the method further comprises:
[0009] In response to the setting operation on the Ingress resource configuration interface, the annotation identifier and reload delay are configured for the service in advance.
[0010] In one embodiment, the method further comprises:
[0011] Get the service node data corresponding to the service where the Ingress resource changes;
[0012] In the event that there is a difference between the service node data obtained this time and the service node data previously stored locally, the locally stored service node data is updated based on the service node data obtained this time.
[0013] In one embodiment, performing corresponding configuration hot update processing includes:
[0014] Get the hot update events corresponding to the changes in this Ingress resource and start accumulating the delay time;
[0015] In the case where the accumulated delay duration is not less than the maximum delay duration, the hot update events generated in the period corresponding to the accumulated delay duration are integrated to obtain an integrated event;
[0016] Based on the integration event, perform the corresponding configuration hot update processing.
[0017] In one embodiment, the method further comprises:
[0018] In the process of accumulating the delay time, if no new hot update event is continuously generated, obtain the corresponding silent time without generating any new hot update event;
[0019] In the case where the silence duration is not less than the minimum silence duration, the hot update events generated in the period corresponding to the accumulated delay duration are integrated to obtain an integrated event;
[0020] Based on the integration event, perform the corresponding configuration hot update processing.
[0021] In one embodiment, the method further comprises:
[0022] When the total number of hot update events accumulated after the start of accumulating delay duration reaches a preset number, the accumulated delay duration is less than the maximum delay duration, and the silence duration is less than the minimum silence duration, the difference between the minimum silence duration and the silence duration is updated to the accumulated delay duration.
[0023] In a second aspect, the present application also provides a configuration hot update device, comprising:
[0024] The query module is used to query the annotation identifier of the service where the Ingress resource changes when the Ingress resource changes are detected;
[0025] A determination module, used to determine the time interval between the time when the service's Ingress resource changes this time and the time when the Ingress resource changes last time, if the service has a pre-set annotation identifier corresponding to the service;
[0026] The execution module is used to obtain the pre-set reload delay corresponding to the service when the time interval is less than the preset time interval, and execute the corresponding configuration hot update processing after waiting for the corresponding length of the reload delay.
[0027] In a third aspect, the present application further provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:
[0028] When monitoring changes in Ingress resources, query the annotation identifier of the service where the Ingress resource changes occurred;
[0029] If the service has a pre-set annotation, determine the time interval between the time when the service's Ingress resource changes this time and the time when the Ingress resource changes last time;
[0030] When the time interval is less than the preset time interval, the reload delay set in advance for the service is obtained, and after waiting for the corresponding length of the reload delay, the corresponding configuration hot update processing is performed.
[0031] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the following steps are implemented:
[0032] When monitoring changes in Ingress resources, query the annotation identifier of the service where the Ingress resource changes occurred;
[0033] If the service has a pre-set annotation, determine the time interval between the time when the service's Ingress resource changes this time and the time when the Ingress resource changes last time;
[0034] When the time interval is less than the preset time interval, the reload delay set in advance for the service is obtained, and after waiting for the corresponding length of the reload delay, the corresponding configuration hot update processing is performed.
[0035] In a fifth aspect, the present application further provides a computer program product, including a computer program, which implements the following steps when executed by a processor:
[0036] When monitoring changes in Ingress resources, query the annotation identifier of the service where the Ingress resource changes occurred;
[0037] If the service has a pre-set annotation, determine the time interval between the time when the service's Ingress resource changes this time and the time when the Ingress resource changes last time;
[0038] When the time interval is less than the preset time interval, the reload delay set in advance for the service is obtained, and after waiting for the corresponding length of the reload delay, the corresponding configuration hot update processing is performed.
[0039] The above-mentioned configuration hot update method, device, computer equipment, computer-readable storage medium and computer program product may not directly perform the corresponding configuration hot update processing when the Ingress resource changes are monitored. Instead, it is first determined whether the service where the Ingress resource changes occur is pre-set with an annotation identifier. If the annotation identifier is pre-set, the time interval between the last two Ingress resource changes can be further obtained. If the time interval is less than the preset time interval, it means that the time interval between the last two Ingress resource changes of the service is short. Therefore, it is possible to wait for the corresponding length of the reload delay configured in advance for the service, and then perform the corresponding configuration hot update processing. Since the configuration file change of the Nginx Ingress Controller can be decoupled from the automatic reload, the dynamic modification configuration logic is retained, and the trigger logic after waiting for the corresponding length of the reload delay is added, the resource loss caused by frequent hot updates can be reduced, the performance of Nginx can be improved, and the gateway routing traffic and the stability of the entire cluster can be improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the drawings required for use in the embodiments of the present application or related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0041] FIG1 is a diagram of an application environment for configuring a hot update method in one embodiment;
[0042] FIG2 is a schematic diagram of a flow chart of a configuration hot update method in one embodiment;
[0043] FIG3 is a schematic diagram of a process for configuring an annotation mark in one embodiment;
[0044] FIG4 is a schematic diagram of a flow chart of a configuration hot update method in another embodiment;
[0045] FIG5 is a schematic diagram of a hot update de-jittering process in one embodiment;
[0046] FIG6 is a block diagram of a configuration of a hot update device in one embodiment;
[0047] FIG. 7 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0048] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0049] Before explaining the embodiments of the present application, the concepts of terms that may be involved in the embodiments of the present application are first explained.
[0050] Ingress: Kubernetes' Ingress is an API object, usually accessed through HTTP and HTTPS, to manage external access to services in the cluster. Ingress can provide functions such as load balancing, SSL termination, and name-based virtual hosting. The main components of Ingress include Ingress resources and Ingress Controller. Ingress resources can define routing rules, such as which external requests should be routed to which services. Ingress Controller is a component that processes Ingress resources and is responsible for applying the configuration of Ingress resources to the underlying load balancer (such as Nginx, Traefik) or the cloud provider's load balancer.
[0051] Nginx: It is a high-performance open source web server and reverse proxy server. It can also be used as a load balancer and HTTP cache, mainly to solve the problem of high concurrent connections. The main functions of Nginx include HTTP server, reverse proxy server, load balancer, HTTP cache and SSL / TLS termination.
[0052] Among them, HTTP server is used as a web server for static content, such as HTML, images and video files. Reverse proxy server is used to forward client requests to backend servers and return the responses of backend servers to clients. This is very useful for load balancing and caching. Load balancer is used to support multiple load balancing algorithms, such as Round Robin, Least Connections and IP Hash, to help distribute client requests to multiple backend servers, thereby improving application availability and performance. HTTP cache is used to cache the responses of backend servers to reduce the load on backend servers and speed up response time. SSL / TLS termination is used to handle SSL / TLS encryption and decryption to reduce the burden on backend servers.
[0053] Nginx hot update: allows reloading of Nginx configuration files without interrupting service; new configuration changes can be applied without affecting user access. Hot update can apply configuration changes without restarting the Nginx service, ensuring the availability of the website or application, that is, ensuring the minimum downtime. In addition, in a high-concurrency environment, even a short downtime may affect a large number of users. Hot update can avoid this situation and ensure high availability. At the same time, it allows administrators to quickly apply fixes when configuration problems are discovered without waiting for maintenance windows, thereby performing flexible configuration management. In cases where it is necessary to update SSL certificates, add new virtual hosts, modify load balancing policies, etc., configuration changes can take effect immediately to achieve seamless upgrades. Finally, new worker processes can be started with new configurations, and old worker processes can be shut down.
[0054] The main structures of Ingress are:
[0055] Ingress resource: defines how to route external HTTP and HTTPS traffic to services within the cluster. Ingress resources contain routing rules that specify which URL paths or host names should be mapped to which services.
[0056] Ingress Controller: This is a load balancer running in the Kubernetes cluster. It reads the Ingress resource and configures the underlying load balancer (such as Nginx, HAProxy, Traefik, etc.) to actually handle the traffic based on the defined rules.
[0057] Kubernetes Ingress manages external access to services within the cluster by defining Ingress resources and using Ingress Controller. Ingress Controller is responsible for parsing Ingress resources and configuring the underlying load balancer to handle traffic. This mechanism provides flexible traffic management capabilities for the cluster, which can achieve high availability and flexibility in the production environment.
[0058] In related technologies, Nginx Ingress updates Nginx gateway routing rules, which can directly correct domain names and paths to the nginx.conf configuration file. Nginx configuration needs to be updated and reloaded to take effect. When the application has a long connection, such as websocket, the reload operation will cause the business connection to be significantly disconnected after a period of time.
[0059] When users operate Ingress resources, whether they modify the rule configuration in the configuration file nginx.conf, or delete or create new Ingress resources, it will trigger the reload operation of Nginx in the Ingress Controller. After modifying the configuration file nginx.conf, a new worker process is regenerated, and requests are processed with the new configuration. Among them, new requests will be handed over to the new worker process, and the previous worker process can end after processing the previous request. In high-concurrency scenarios, frequent reloads may still cause request processing delays or losses. In addition, Nginx IngressController monitors resources in Kubernetes through the List and Watch mechanisms. Frequent reloads will consume more CPU and memory resources, especially when processing a large number of connections or complex configurations. This may affect the performance of Nginx, thereby affecting the stability of the entire cluster.
[0060] In response to the above problems, an embodiment of the present application provides a configuration hot update method, which can be applied in an application environment as shown in FIG. 1. Among them, the terminal 102 communicates with the server 104 through a network. The data storage system can store the data that the server 104 needs to process. The data storage system can be integrated on the server 104, or it can be placed on a cloud or other network server. The terminal 102 can send an update request for the Ingress resource to the server 104. When the server 104 monitors the change of the Ingress resource, it queries the annotation identifier corresponding to the service where the Ingress resource has changed. In the case where the service corresponds to a pre-set annotation identifier, determine the time interval between the change time of the service when the Ingress resource changes this time and the change time when the Ingress resource changes last time. In the case where the time interval is less than the preset duration, obtain the pre-set reload delay corresponding to the service, and after waiting for the corresponding duration of the reload delay, perform the corresponding configuration hot update processing.
[0061] The terminal 102 may be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, IoT devices, and portable wearable devices. The IoT devices may be smart speakers, smart TVs, smart air conditioners, smart car devices, projection devices, etc. Portable wearable devices may be smart watches, smart bracelets, head-mounted devices, etc. Head-mounted devices may be virtual reality (VR) devices, augmented reality devices, smart glasses, etc. The server 104 may be an independent physical server, or a server cluster or distributed system consisting of multiple physical servers, or a cloud server that provides cloud computing services.
[0062] In an exemplary embodiment, as shown in FIG2 , a configuration hot update method is provided, which is described by taking the method applied to the server in FIG1 as an example, and includes the following steps 202 to 206. Among them:
[0063] Step 202: When a change in the Ingress resource is detected, query the annotation identifier corresponding to the service where the Ingress resource change occurs.
[0064] Among them, service is a concept in Kubernetes, which defines an abstraction to logically represent a group of Pods and provides a way for users to access these Pods. Service provides a load balancing capability, through which user requests are distributed to multiple Pods on the backend. Users do not need to care about which specific Pods are providing services, but only need to access them through the IP address and port of the service.
[0065] Step 204: if the service has a pre-set annotation identifier, determine the time interval between the time when the current Ingress resource of the service changes and the time when the last Ingress resource of the service changes.
[0066] Among them, the annotation identifier can be configured in the configuration file. Users can configure the annotation identifier for some services in advance, and some services may not be configured in advance, which may depend on whether the service often has changes in Ingress resources. If a service often causes changes in Ingress resources, the annotation identifier can be configured for the service in advance. Therefore, after determining that a service is configured with an annotation identifier in advance, the time interval between two times when the Ingress resource changes occur can be further determined. Among them, the moment when the Ingress resource changes this time is the moment mentioned above when the Ingress resource changes are monitored.
[0067] Step 206, when the time interval is less than the preset time interval, obtain the pre-set reload delay corresponding to the service, and after waiting for the corresponding length of the reload delay, perform the corresponding configuration hot update process.
[0068] If the time interval is less than the preset time interval, it means that the interval between the time when the Ingress resource changes this time and the time when the Ingress resource changes last time is short. Therefore, the corresponding configuration hot update processing is not performed directly. Instead, the corresponding configuration hot update processing is performed after waiting for the corresponding length of the reload delay.
[0069] In the above configuration hot update method, when the change of Ingress resources is monitored, the corresponding configuration hot update processing may not be directly executed. Instead, it is first determined whether the service where the Ingress resource changes occur is pre-set with an annotation mark. If the annotation mark is pre-set, the time interval between the two recent Ingress resource changes can be further obtained. If the time interval is less than the preset time interval, it means that the time interval between the two recent Ingress resource changes of the service is short. Therefore, it is possible to wait for the corresponding length of the reload delay configured in advance for the service, and then perform the corresponding configuration hot update processing. Since the configuration file changes of Nginx Ingress Controller can be decoupled from automatic reload, the dynamic configuration modification logic is retained, and the trigger logic after waiting for the corresponding length of the reload delay is added, the resource loss caused by frequent hot updates can be reduced, the performance of Nginx can be improved, and the gateway routing traffic and the stability of the entire cluster can be improved.
[0070] In an exemplary embodiment, the method further comprises:
[0071] In response to the setting operation on the Ingress resource configuration interface, the annotation identifier and reload delay are configured for the service in advance.
[0072] Specifically, users can configure the annotation identifier and reload delay of the service through the Ingress resource configuration interface, and write the configuration into the configuration file.
[0073] In this embodiment, since the user can configure annotation identifiers and reload delays for the services in advance, it is possible to subsequently add trigger logic for some services after waiting for a corresponding length of time for the reload delay, thereby reducing resource loss caused by frequent hot updates, improving the performance of Nginx, and improving the stability of gateway routing traffic and even the entire cluster.
[0074] In an exemplary embodiment, the method further comprises:
[0075] Get the service node data corresponding to the service where the Ingress resource changes;
[0076] In the event that there is a difference between the service node data obtained this time and the service node data previously stored locally, the locally stored service node data is updated based on the service node data obtained this time.
[0077] Among them, service node data may refer to the configuration items of the service on the user side, such as the port and IP address of the service, etc., which are not specifically limited in the embodiments of the present application. Since the server providing the service may also store the configuration information of the Ingress resource locally, that is, the service node data. After the Ingress resource of the local service changes, the Ingress resource configuration of the local service may not be synchronized to the entire cluster, but the configuration information of the Ingress resource previously stored locally is updated, that is, the previously stored service node data is updated.
[0078] In this embodiment, since the local Ingress configuration can be updated to the latest configuration, the timeliness of the local Ingress configuration can be guaranteed to a certain extent.
[0079] In an exemplary embodiment, performing corresponding configuration hot update processing includes:
[0080] Get the hot update events corresponding to the changes in this Ingress resource and start accumulating the delay time;
[0081] In the case where the accumulated delay duration is not less than the maximum delay duration, the hot update events generated in the period corresponding to the accumulated delay duration are integrated to obtain an integrated event;
[0082] Based on the integration event, perform the corresponding configuration hot update processing.
[0083] Specifically, after waiting for the corresponding length of time for the reload delay, the corresponding configuration hot update processing may not be directly executed for the changes that occurred in the Ingress resources monitored this time. Instead, the changes that occurred in the Ingress resources this time can be regarded as a hot update event waiting for the configuration hot update processing to be executed. From this, the delay duration can be accumulated. It can be understood that this hot update event is the first hot update event that starts the accumulation of delay duration, and new hot update events may be generated later.
[0084] When the accumulated delay duration is not less than the maximum delay duration, it means that the process of accumulating hot update events has lasted for a long time. At this time, the hot update events generated in the corresponding accumulated period (that is, the period corresponding to the accumulated delay duration) can be integrated to obtain an integrated event. The integration process can be to merge specific configurations, such as a later configuration covering a previous similar configuration, etc.; the corresponding configuration hot update processing can be performed directly based on the integrated event.
[0085] In this embodiment, since the hot update events generated within a period of time can be integrated instead of executing the corresponding configuration hot update processing one by one, it is equivalent to adding a de-jitter processing process, which can reduce the resource loss caused by frequent hot updates, improve the performance of Nginx, and improve the gateway routing traffic and even the stability of the entire cluster.
[0086] In an exemplary embodiment, the method further comprises:
[0087] In the process of accumulating the delay time, if no new hot update event is continuously generated, obtain the corresponding silent time without generating any new hot update event;
[0088] In the case where the silence duration is not less than the minimum silence duration, the hot update events generated in the period corresponding to the accumulated delay duration are integrated to obtain an integrated event;
[0089] Based on the integration event, perform the corresponding configuration hot update processing.
[0090] It is understandable that in the process of accumulating delay time, a hot update event may occur, and then no new hot update events may continue to arrive. At this time, the corresponding silent time without the occurrence of new hot update events can be obtained, that is, the accumulated time without the arrival of new hot update events.
[0091] If the silence duration is not less than the minimum silence duration, it means that there has been no hot update event for a while since the last hot update event. At this point, it can be assumed that there will be no new hot update events in the short term, and the previously accumulated hot update events are still waiting to be processed. Thus, the hot update events generated in the period corresponding to the accumulated delay duration can be integrated to obtain an integrated event. Based on the integrated event, the corresponding configuration hot update processing is performed.
[0092] In this embodiment, since the hot update events generated within a period of time can be integrated when the corresponding silence period without new hot update events is not less than the minimum silence period, instead of executing the corresponding configuration hot update processing one by one, and the silent waiting will not be too long, the hot update events accumulated in the past can be processed in time, which is equivalent to adding a de-jitter processing process, which can reduce the resource loss caused by frequent hot updates, improve the performance of Nginx, and improve the gateway routing traffic and the stability of the entire cluster.
[0093] In an exemplary embodiment, the method further comprises:
[0094] When the total number of hot update events accumulated after the start of accumulating delay duration reaches a preset number, the accumulated delay duration is less than the maximum delay duration, and the silence duration is less than the minimum silence duration, the difference between the minimum silence duration and the silence duration is updated to the accumulated delay duration.
[0095] Among them, after the cumulative delay duration begins, the total number of accumulated hot update events can be counted by a counter. If the accumulated delay duration is less than the maximum delay duration (which means that the duration of the accumulated hot update events is not too long), the silence duration is less than the minimum silence duration (the duration of the continuous absence of new hot update events is not too long), and the total number of accumulated hot update events reaches the preset number (which means that the hot update events come more frequently), the difference between the minimum silence duration and the silence duration can be calculated (how much time is left to wait silently), and updated to the accumulated delay duration (the remaining time that can be waited silently is used as the accumulated delay duration, that is, the accumulated delay duration is adjusted to adapt the accumulated delay duration to the remaining silent time that can be waited, and no corresponding configuration hot update processing is performed, and accumulation continues on the basis of the adapted accumulated delay duration until the maximum delay duration is reached, and then the corresponding configuration hot update processing is performed in a centralized manner).
[0096] In this embodiment, since the total number of hot update events accumulated after the start of delay accumulation reaches a preset number, the accumulated delay is less than the maximum delay, and the silence is less than the minimum silence, the accumulated delay is updated according to the remaining silence that can be waited for, which is equivalent to adding a de-jittering process, which can reduce the resource loss caused by frequent hot updates, improve the performance of Nginx, and improve the stability of gateway routing traffic and even the entire cluster.
[0097] For ease of understanding, the complete method flow provided in the embodiment of the present application is now described, and the specific process is as follows:
[0098] (1) The user configures the Reload annotation signal, that is, configures the annotation identifier.
[0099] Among them, when users use Nginx ingress, they can install the Nginx-Ingress controller component. This component can modify the annotation identifier on the service resource configured by the Ingress resource, and identify it when processing the Ingress configuration synchronization internally to determine whether the Nginx hot update operation needs to be performed. In actual implementation, the user can configure the annotation identifier and reload delay of the service in the Ingress resource configuration interface. The above process can be specifically referred to Figure 3.
[0100] (2) ngress-controller identifies annotation identifiers and performs configuration hot update processing
[0101] After the Ingress-controller is started, it can continuously spin to select configuration update tasks from the task queue and execute them; at the same time, the event listener is turned on to monitor changes in Ingress resources. If the resources change, the generated task is put into the controller's queue. Similarly, the Ingress-controller can obtain service node data through the informer mechanism of k8s, and locally compare the differences between the new and old Ingress resources, and update the local Ingress to the latest configuration. In addition, it is also possible to determine whether the service corresponding to the change in the Ingress resource has an annotation identifier. If there is an annotation identifier, it can be compared with the time when the Ingress resource last changed to determine whether the time interval between the two is less than the preset time interval. If less than, the nginx configuration hot update process is performed according to the reload delay set by the user. The above process can be specifically referred to Figure 4.
[0102] (3) Nginx hot update de-jittering process
[0103] When Nginx is hot updated, de-jitter processing is added. De-jitter is mainly a self-spinning multi-type event monitoring and processing mechanism, which is divided into hot update event listeners and corresponding event handlers, delay time event listeners and event handlers, and exit signal handlers. When a hot update event is triggered, the total number of accumulated hot update events can be counted through an event counter. If the accumulated delay duration is not less than the maximum delay duration or the corresponding silence duration when no new hot update events are continuously generated is not less than the minimum silence duration, the hot update events generated in the period corresponding to the accumulated delay duration can be integrated to obtain an integrated event. Based on the integrated event, the corresponding configuration hot update processing is performed. On the contrary, when the total number of accumulated hot update events reaches a preset number, the difference between the minimum silence duration and the silence duration is updated to the accumulated delay duration. The above process can be specifically referred to Figure 5.
[0104] It should be understood that, although the steps in the flowcharts involved in the above embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above embodiments may include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0105] Based on the same inventive concept, the embodiment of the present application also provides a configuration hot update device for implementing the configuration hot update method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more configuration hot update device embodiments provided below can refer to the limitations on the configuration hot update method above, and will not be repeated here.
[0106] In an exemplary embodiment, as shown in FIG6 , a configuration hot update device is provided, including: a query module 602, a determination module 604 and an execution module 606, wherein:
[0107] The query module 602 is used to query the annotation identifier corresponding to the service where the Ingress resource change occurs when monitoring the change of the Ingress resource;
[0108] The determination module 604 is used to determine the time interval between the time when the service Ingress resource changes this time and the time when the Ingress resource changes last time when the service corresponds to a pre-set annotation identifier;
[0109] The execution module 606 is used to obtain the pre-set reload delay corresponding to the service when the time interval is less than the preset time interval, and execute the corresponding configuration hot update processing after waiting for the corresponding length of the reload delay.
[0110] In an exemplary embodiment, the execution module 606 is further configured to configure an annotation identifier and a reload delay for the service in advance in response to a setting operation on the Ingress resource configuration interface.
[0111] In an exemplary embodiment, the execution module 606 is also used to obtain the service node data corresponding to the service where the Ingress resource changes occur; when there is a difference between the service node data obtained this time and the service node data previously stored locally, the locally stored service node data is updated based on the service node data obtained this time.
[0112] In an exemplary embodiment, the execution module 606 is used to obtain the hot update event corresponding to the change of the Ingress resource this time, and start to accumulate the delay duration; when the accumulated delay duration is not less than the maximum delay duration, the hot update events generated in the time period corresponding to the accumulated delay duration are integrated to obtain an integrated event; based on the integrated event, the corresponding configuration hot update processing is performed.
[0113] In an exemplary embodiment, the execution module 606 is also used to obtain the corresponding silence time during which no new hot update event is generated in the process of accumulating the delay time; when the silence time is not less than the minimum silence time, the hot update events generated in the time period corresponding to the accumulated delay time are integrated to obtain an integrated event; based on the integrated event, the corresponding configuration hot update processing is performed.
[0114] In an exemplary embodiment, the execution module 606 is also used to update the difference between the minimum silence time and the silence time to the accumulated delay time when the total number of hot update events accumulated after the start of accumulating the delay time reaches a preset number, the accumulated delay time is less than the maximum delay time, and the silence time is less than the minimum silence time.
[0115] Each module in the above configuration hot update device can be implemented in whole or in part by software, hardware and a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module above.
[0116] In an exemplary embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be shown in FIG7. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. The processor, the memory and the input / output interface are connected via a system bus, and the communication interface is connected to the system bus via the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store Ingress resources. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a configuration hot update method is implemented.
[0117] Those skilled in the art will understand that the structure shown in FIG. 7 is merely a block diagram of a partial structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different arrangement of components.
[0118] In an exemplary embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented:
[0119] When monitoring changes in Ingress resources, query the annotation identifier of the service where the Ingress resource changes occurred;
[0120] If the service has a pre-set annotation, determine the time interval between the time when the service's Ingress resource changes this time and the time when the Ingress resource changes last time;
[0121] When the time interval is less than the preset time interval, the reload delay set in advance for the service is obtained, and after waiting for the corresponding length of the reload delay, the corresponding configuration hot update processing is performed.
[0122] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0123] In response to the setting operation on the Ingress resource configuration interface, the annotation identifier and reload delay are configured for the service in advance.
[0124] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0125] Get the service node data corresponding to the service where the Ingress resource changes;
[0126] In the event that there is a difference between the service node data obtained this time and the service node data previously stored locally, the locally stored service node data is updated based on the service node data obtained this time.
[0127] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0128] Get the hot update events corresponding to the changes in this Ingress resource and start accumulating the delay time;
[0129] In the case where the accumulated delay duration is not less than the maximum delay duration, the hot update events generated in the period corresponding to the accumulated delay duration are integrated to obtain an integrated event;
[0130] Based on the integration event, perform the corresponding configuration hot update processing.
[0131] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0132] In the process of accumulating the delay time, if no new hot update event is continuously generated, obtain the corresponding silent time without generating any new hot update event;
[0133] In the case where the silence duration is not less than the minimum silence duration, the hot update events generated in the period corresponding to the accumulated delay duration are integrated to obtain an integrated event;
[0134] Based on the integration event, perform the corresponding configuration hot update processing.
[0135] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0136] When the total number of hot update events accumulated after the start of accumulating delay duration reaches a preset number, the accumulated delay duration is less than the maximum delay duration, and the silence duration is less than the minimum silence duration, the difference between the minimum silence duration and the silence duration is updated to the accumulated delay duration.
[0137] In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
[0138] When monitoring changes in Ingress resources, query the annotation identifier of the service where the Ingress resource changes occurred;
[0139] If the service has a pre-set annotation, determine the time interval between the time when the service's Ingress resource changes this time and the time when the Ingress resource changes last time;
[0140] When the time interval is less than the preset time interval, the reload delay set in advance for the service is obtained, and after waiting for the corresponding length of the reload delay, the corresponding configuration hot update processing is performed.
[0141] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0142] In response to the setting operation on the Ingress resource configuration interface, the annotation identifier and reload delay are configured for the service in advance.
[0143] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0144] Get the service node data corresponding to the service where the Ingress resource changes;
[0145] In the event that there is a difference between the service node data obtained this time and the service node data previously stored locally, the locally stored service node data is updated based on the service node data obtained this time.
[0146] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0147] Get the hot update events corresponding to the changes in this Ingress resource and start accumulating the delay time;
[0148] In the case where the accumulated delay duration is not less than the maximum delay duration, the hot update events generated in the period corresponding to the accumulated delay duration are integrated to obtain an integrated event;
[0149] Based on the integration event, perform the corresponding configuration hot update processing.
[0150] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0151] In the process of accumulating the delay time, if no new hot update event is continuously generated, obtain the corresponding silent time without generating any new hot update event;
[0152] In the case where the silence duration is not less than the minimum silence duration, the hot update events generated in the period corresponding to the accumulated delay duration are integrated to obtain an integrated event;
[0153] Based on the integration event, perform the corresponding configuration hot update processing.
[0154] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0155] When the total number of hot update events accumulated after the start of accumulating delay duration reaches a preset number, the accumulated delay duration is less than the maximum delay duration, and the silence duration is less than the minimum silence duration, the difference between the minimum silence duration and the silence duration is updated to the accumulated delay duration.
[0156] In one embodiment, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the following steps:
[0157] When monitoring changes in Ingress resources, query the annotation identifier of the service where the Ingress resource changes occurred;
[0158] If the service has a pre-set annotation, determine the time interval between the time when the service's Ingress resource changes this time and the time when the Ingress resource changes last time;
[0159] When the time interval is less than the preset time interval, the reload delay set in advance for the service is obtained, and after waiting for the corresponding length of the reload delay, the corresponding configuration hot update processing is performed.
[0160] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0161] In response to the setting operation on the Ingress resource configuration interface, the annotation identifier and reload delay are configured for the service in advance.
[0162] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0163] Get the service node data corresponding to the service where the Ingress resource changes;
[0164] In the event that there is a difference between the service node data obtained this time and the service node data previously stored locally, the locally stored service node data is updated based on the service node data obtained this time.
[0165] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0166] Get the hot update events corresponding to the changes in this Ingress resource and start accumulating the delay time;
[0167] In the case where the accumulated delay duration is not less than the maximum delay duration, the hot update events generated in the period corresponding to the accumulated delay duration are integrated to obtain an integrated event;
[0168] Based on the integration event, perform the corresponding configuration hot update processing.
[0169] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0170] In the process of accumulating the delay time, if no new hot update event is continuously generated, obtain the corresponding silent time without generating any new hot update event;
[0171] In the case where the silence duration is not less than the minimum silence duration, the hot update events generated in the period corresponding to the accumulated delay duration are integrated to obtain an integrated event;
[0172] Based on the integration event, perform the corresponding configuration hot update processing.
[0173] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0174] When the total number of hot update events accumulated after the start of accumulating delay duration reaches a preset number, the accumulated delay duration is less than the maximum delay duration, and the silence duration is less than the minimum silence duration, the difference between the minimum silence duration and the silence duration is updated to the accumulated delay duration.
[0175] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.
[0176] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0177] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A configuration hot update method, characterized in that: The method comprises: When monitoring changes in Ingress resources, query the annotation identifier of the service where the Ingress resource changes occurred; In the case where the service corresponds to a pre-set annotation identifier, determining the time interval between the time when the current Ingress resource of the service changes and the time when the last Ingress resource changes; When the time interval is less than the preset time interval, the reload delay set in advance for the service is obtained, and after waiting for a corresponding length of the reload delay, the corresponding configuration hot update process is performed.
2. The method according to claim 1, characterized in that The method further comprises: In response to a setting operation on the Ingress resource configuration interface, an annotation identifier and a reload delay are configured for the service in advance.
3. The method according to claim 1, characterized in that The method further comprises: Get the service node data corresponding to the service where the Ingress resource changes; In the event that there is a difference between the service node data obtained this time and the service node data previously stored locally, the locally stored service node data is updated based on the service node data obtained this time.
4. The method according to claim 1, characterized in that: The performing of the corresponding configuration hot update process includes: Get the hot update events corresponding to the changes in this Ingress resource and start accumulating the delay time; In the case where the accumulated delay duration is not less than the maximum delay duration, the hot update events generated in the period corresponding to the accumulated delay duration are integrated to obtain an integrated event; Based on the integration event, a corresponding configuration hot update process is performed.
5. The method according to claim 4, characterized in that The method further comprises: In the process of accumulating the delay time, if no new hot update event is continuously generated, obtain the corresponding silent time without generating any new hot update event; In the case where the silence duration is not less than the minimum silence duration, the hot update events generated in the period corresponding to the accumulated delay duration are integrated to obtain an integrated event; Based on the integration event, a corresponding configuration hot update process is performed.
6. The method according to claim 5, characterized in that The method further comprises: When the total number of hot update events accumulated after the start of accumulating delay duration reaches a preset number, the accumulated delay duration is less than the maximum delay duration, and the silence duration is less than the minimum silence duration, the difference between the minimum silence duration and the silence duration is updated to the accumulated delay duration.
7. A configuration hot update device, characterized in that: The device comprises: The query module is used to query the annotation identifier of the service where the Ingress resource changes when the Ingress resource changes are detected; A determination module, used to determine the time interval between the time when the Ingress resource of the service changes this time and the time when the Ingress resource of the service changes last time, if the service corresponds to an annotation identifier set in advance; The execution module is used to obtain the pre-set reload delay corresponding to the service when the time interval is less than the preset time interval, and execute the corresponding configuration hot update processing after waiting for the corresponding length of the reload delay.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.