Traffic management method, device, electronic device and storage medium
By setting up auxiliary instances in the container, obtaining application information and determining the traffic cutting method, the traffic management problem of the Kubernetes platform in different environments is solved, unified standards and flexibility are achieved, and management difficulty and business interruption risks are reduced.
Patent Information
- Application Number
- CN202210766685.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-01
- Publication Date
- 2024-09-24
- Estimated Expiration
- 2042-07-01
AI Technical Summary
The Kubernetes platform has difficulties in container management and traffic management in different language or architecture environments, especially due to the limited load capacity of the load device, which results in inconsistent traffic cutoff processing, increasing management difficulty and possibly causing business interruption.
Set up an auxiliary instance in the container, obtain the target application information of the application instance through the auxiliary instance, determine the traffic cutting method and perform traffic cutting processing to achieve unified traffic management standards, reduce management difficulty and improve flexibility.
Implement container traffic management through auxiliary instances, unify traffic management in different languages and environments, improve the standardization of container management equipment, ensure the accuracy and flexibility of traffic cutoff, and avoid business interruption.
Smart Images

Figure CN116132366B
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of computer technology, and in particular to a traffic management method, device, electronic device, and storage medium. Background Art
[0002] Kubernetes (K8s for short) is an open source container management platform across host clusters. It can realize functions such as automatic deployment, automatic expansion and reduction, and maintenance of container clusters, and has been widely used.
[0003] The K8s platform can usually deploy multiple language or architecture environments, thereby realizing the management and scheduling of containers in different language or architecture environments. Correspondingly, the load device provides business traffic to the container running in the K8s platform so that the corresponding business can be executed through the container.
[0004] In the related art, due to the limited load capacity of the load device, in order to achieve load balancing of the load device, when starting a new container, the K8s platform needs to destroy the old container according to the operation status of the container and cut off the traffic supply of the load device to the container to be destroyed. For example, when the business execution corresponding to a container ends, the traffic of the container needs to be cut off. However, the different flow cutting processing methods in different language or architecture environments make the traffic management of the K8s platform more difficult. Summary of the invention
[0005] The embodiments of the present application provide a traffic management method, apparatus, electronic device, and storage medium to improve the standardization of container management devices, thereby reducing the difficulty of traffic management of container management devices.
[0006] In a first aspect, an embodiment of the present application provides a traffic management method, which is applied to a container management device, wherein a target container is deployed in the container management device, and an application instance and an auxiliary instance are deployed in the target container. The traffic management method includes:
[0007] In response to a first flow cutting request for a flow cutting interface of an auxiliary instance, target application information of an application instance corresponding to a target container is obtained through the auxiliary instance, the first flow cutting request being used to indicate cutting off the flow provided by the load device to the target container; a target flow cutting method is determined based on the target application information; and based on the target flow cutting method, the flow provided by the load device to the target container is cut off.
[0008] In a second aspect, an embodiment of the present application provides another traffic management method, which is applied to a load device. The traffic management method includes: in response to a second flow switching request sent by a container management device based on a target flow switching method, obtaining a processing result of a flow switching process on a target container; a target container is deployed in the container management device, and an application instance and an auxiliary instance are deployed in the target container; a processing result is sent to the container management device, and the processing result is used to instruct the container management device to determine the current flow information of the target container based on the processing result, and generate state information of the flow switching process corresponding to the target container according to the current flow information, and destroy the target container based on the state information;
[0009] Among them, the target flow switching method is determined by the container management device according to the target application information corresponding to the application instance in the target container; the target application information is obtained by the auxiliary instance in response to the first flow switching request of the flow switching interface of the auxiliary instance in the target container by the container management device; the processing result is used to determine the current flow information of the target container, and the flow information is used to indicate whether the target container currently has flow; the status information is used to indicate whether the flow of the target container is successfully cut off.
[0010] In a third aspect, an embodiment of the present application provides a traffic management device, which is applied to a container management device, in which a target container is deployed, and an application instance and an auxiliary instance are deployed in the target container; the traffic management device includes:
[0011] an acquisition unit, configured to respond to a first flow cutting request for a flow cutting interface of an auxiliary instance, and to acquire target application information of an application instance corresponding to a target container through the auxiliary instance, wherein both the auxiliary instance and the application instance are set in the target container, and the first flow cutting request is used to instruct to cut off the flow provided by the load device to the target container;
[0012] A determination unit, used for determining a target flow switching method according to target application information through an auxiliary instance;
[0013] The processing unit is used to cut off the flow provided by the load device to the target container based on the target flow cutting method through the auxiliary instance.
[0014] In a fourth aspect, an embodiment of the present application provides another flow management device, which is applied to a load device, and the flow management device includes:
[0015] An acquisition unit is used to obtain a processing result of performing a stream switching process on a target container in response to a second stream switching request sent by a container management device based on a target stream switching method; a target container is deployed in the container management device, and an application instance and an auxiliary instance are deployed in the target container;
[0016] a sending unit, configured to send a processing result to a container management device, wherein the processing result is used to instruct the container management device to determine current flow information of a target container based on the processing result, generate state information of a flow cutting process corresponding to the target container according to the current flow information, and perform a destruction process on the target container based on the state information;
[0017] Among them, the target flow switching method is determined by the container management device according to the target application information corresponding to the application instance in the target container; the target application information is obtained by the auxiliary instance in response to the first flow switching request of the flow switching interface of the auxiliary instance in the target container by the container management device; the processing result is used to determine the current flow information of the target container, and the flow information is used to indicate whether the target container currently has flow; the status information is used to indicate whether the flow of the target container is successfully cut off.
[0018] In a fifth aspect, an embodiment of the present application provides an electronic device, comprising: a memory and at least one processor, the memory being used to store a computer program, the processor being used to call the computer program in the memory, executing a traffic management method as in the first aspect, and / or executing a traffic management method as in the second aspect.
[0019] In a sixth aspect, an embodiment of the present application provides a computer-readable storage medium on which a computer program is stored; when the computer program is executed, the traffic management method of the first aspect is implemented, and / or the traffic management method of the second aspect is implemented.
[0020] In a seventh aspect, an embodiment of the present application provides a computer program product, comprising: a computer program, which, when executed by a processor, implements the traffic management method of the first aspect, and / or implements the traffic management method of the second aspect.
[0021] The embodiments of the present application provide a traffic management method, device, electronic device and storage medium. When an application instance is generated in a target container, an auxiliary instance is set, and the traffic management of the target container is implemented through the auxiliary instance. Specifically, in response to the first flow switching request of the flow switching interface of the auxiliary instance, the target application information corresponding to the application instance in the target container is obtained through the auxiliary instance. Further, the target flow switching method is determined according to the target application information, and finally the traffic provided by the load device to the target container is cut off based on the target flow switching method. It should be understood that by implementing the flow management of the container through the auxiliary instance, a unified flow management standard can be implemented for containers of different language types and different environment architectures, and the standardization of the container management device can be improved, thereby reducing the difficulty of flow management of the container management device. At the same time, the auxiliary instance can also use different flow switching methods to switch different containers according to the application information corresponding to the container, so as to ensure the flexibility of the container management device, thereby meeting the flow management needs in different scenarios in a differentiated manner. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art 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 drawings can be obtained based on these drawings without paying any creative work.
[0023] Figure 1 A schematic diagram of the principle of "rolling release" of the K8s platform provided in the embodiment of the present application;
[0024] Figure 2 A schematic diagram of a scenario of a traffic management method provided in an embodiment of the present application;
[0025] Figure 3 A flow chart of a flow management method provided in an embodiment of the present application;
[0026] Figure 4 A schematic diagram of signaling interaction in the traffic management process provided in an embodiment of the present application;
[0027] Figure 5 A schematic diagram of the principle of the traffic management method provided in the embodiment of the present application;
[0028] Figure 6 A schematic diagram of the structure of the flow management device provided in the embodiment of the present application Figure 1 ;
[0029] Figure 7 A schematic diagram of the structure of the flow management device provided in the embodiment of the present application Figure 2 ;
[0030] Figure 8 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0031] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0032] The terms "first" and "second" in the specification, claims and the above-mentioned drawings of the embodiments of the present application are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the implementation of the present application described herein can be implemented in an order other than the order shown or described. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0033] It should be understood that the term "and / or" used in this article is only a way to describe the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. " / " means the relationship of "or".
[0034] First, some of the terms involved in this application are explained:
[0035] K8s: A container management platform, an open source platform that can realize functions such as automated deployment, automatic expansion and reduction, and maintenance of container clusters.
[0036] Container (Pod): It is the smallest / simplest basic unit created or deployed by the container management platform. A container represents a process or an application instance running on the cluster. Each process contains IP address information.
[0037] Load Balancing (LB): is a cluster technology that shares specific services (network services, network traffic, etc.) to multiple network devices (such as servers, firewalls, etc.) or multiple links, thereby improving service processing capabilities and ensuring high service reliability.
[0038] Sidecar service: also known as "sidecar mode", adds a new abstraction layer to the original business logic to implement auxiliary functions.
[0039] K8s cluster: Layer 4 load balancing technology provided by K8s.
[0040] ingress-nginx: Layer 4 / 7 load balancing technology developed based on nginx and provided by K8s.
[0041] Eureka: provides a load balancing method for microservices. Microservices register multiple IP addresses to the corresponding service names of Eureka. Users access the services directly through the registered IP addresses. Each service IP address provided is calculated by Eureka to achieve load balancing.
[0042] Rolling release: Each time a program is released, one or more services are upgraded. After the upgrade is completed, it is added to the production environment and the cycle continues until all old versions in the cluster are replaced.
[0043] In the related technology, programs of different languages or architectures can be deployed on the K8s containerized platform, where languages include Java, Python, Go, PHP, etc., and architectures include Hibernate, Spring, Gin, etc.
[0044] In order to achieve load balancing of services, in the K8s environment, the "rolling release" method is usually used to manage containers. Figure 1 The schematic diagram of the principle of "rolling release" of the K8s platform provided in the embodiment of this application. It should be understood that Figure 1 Containers 1 to 9 are used as examples, but are not limited thereto in actual applications.
[0045] like Figure 1 As shown, containers 1 to 3 are currently running containers, containers 4 to 6 are destroyed containers, and containers 7 to 9 are newly started containers.
[0046] Among them, the running container (such as Figure 1 Containers 1 to 3 in the example will be connected to the load device, which will provide traffic for the application instance in the container. Only after one or more old containers are destroyed successfully can one or more new containers be started. Accordingly, the traffic of the container to be destroyed needs to be cut off, and traffic is provided to the newly started container through the load device, so as to achieve load balancing of the service. It should be understood that the number of new containers started should be less than or equal to the number of old containers destroyed.
[0047] In the related technology, publishing a program in K8s is actually the process of creating a container, and whether the container is running normally is mainly detected through two methods: liveness and readiness. Among them, liveness is used to detect whether the application started in the container is successful. If the program is successfully started, readiness is executed to check whether the application in the container can provide services normally. If the test result shows that the application can provide services normally, the IP of the container is added to the load device. In other words, when both liveness and readiness are detected successfully, it means that the container is started successfully. At this time, the container is added to the load device, and the load device provides traffic for the container.
[0048] It should be noted that the methods of adding containers to LB payload devices vary on different platforms, including but not limited to the following:
[0049] For K8s cluster, kube-proxy can be used to detect whether the container is started successfully. When the container is found to be started successfully, the latest data is injected into the load device through the iptabls rule.
[0050] For ingress, you can use the watch mechanism of the remote K8s API, combined with the servername provided by ingress-nginx, to write the container's IP information to the corresponding nginx configuration file, and then load it through the reload command;
[0051] For eureka, when the container is started, the IP address is registered to the corresponding key through the API interface to load the service.
[0052] Correspondingly, when the load device receives the information that the container has been successfully started, it will also implement traffic management based on different load technologies. For example, the load technology corresponding to K8s cluster is VIP differentiated service; the load technology corresponding to ingress is usually servername differentiated service; and the load technology corresponding to eureka is usually key / value differentiated service.
[0053] Similarly, the above three different load technologies have different corresponding flow cutting methods, including but not limited to the following methods:
[0054] For K8s cluster, load traffic management can be achieved through K8s built-in kube-proxy;
[0055] For ingress-nginx, you can obtain the container status through custom code and use nginx's reload technology to implement load flow management;
[0056] For eureka, load flow management can be achieved through the API interface provided by itself.
[0057] However, it can be seen from the above solutions that the traffic management methods corresponding to various platforms are not unified, and the decoupling of traffic management has not been achieved. The main difference lies in the inconsistent flow switching methods of different load devices, which will greatly increase the management difficulty of the container management platform and reduce the standardization of the container management platform.
[0058] Moreover, the above technology cannot accurately determine whether the flow switching has been completed, and it is also impossible to accurately destroy the container, which will affect the normal operation of the business. For example, in the process of flow switching based on K8s label, the K8s platform cannot achieve smooth destruction of containers. Therefore, it can only customize the interface response status for different applications or set an approximate waiting time to achieve container destruction, but cannot perceive the status of the business traffic itself. For business customers, there may be a temporary interruption of business customers' services, affecting user experience; for R&D personnel, false alarms that are not related to the business itself will appear.
[0059] In view of this, the embodiments of the present application provide a traffic management method, device, electronic device and storage medium. In addition to the application instance, an auxiliary instance will be synchronously injected into the container, and the traffic management of the container will be realized through the auxiliary instance. Specifically, when the container management platform determines to cut the flow of a certain container, it will send a flow cutting request to the auxiliary instance in the container. Correspondingly, the auxiliary instance will obtain the target application information of the application instance in the container, and determine the target flow cutting method based on the target application information, so as to perform flow cutting processing on the container based on the target flow cutting method.
[0060] In the embodiment of the present application, the flow management of the container is realized by the auxiliary instance set in the container, which can not only implement a unified flow management standard for containers of different language types and different environment architectures, but also improve the standardization of the container management platform and reduce the flow management difficulty of the container management platform. At the same time, different flow switching methods can be used to switch flows for different containers according to application information, so as to ensure the flexibility of the container management platform, thereby differentially meeting the flow management needs in different scenarios.
[0061] Next, the traffic management method is described in detail in conjunction with a specific embodiment. Figure 2 A schematic diagram of a scenario of a traffic management method provided in an embodiment of the present application. Figure 2 As shown, the scenario includes: a container management device, a load device, and at least one container ( Figure 2 Container 1 ... container n is shown as an example).
[0062] Among them, the container management device is used to realize the functions of automatic deployment, automatic expansion and reduction, maintenance, etc. of the container cluster to realize the management of the container; the load device is used to provide traffic for the operation of the application instance in the container.
[0063] In some embodiments, the container management device may be the aforementioned K8s platform, or may be other types of platforms. The embodiment of the present application takes the K8s platform as an example, but is not limited thereto.
[0064] In an embodiment of the present application, when each container is started, at least one auxiliary instance is injected into the container simultaneously with the application instance being injected into the container. For example, when container 1 is started, application instance 1 is injected into container 1, and auxiliary instance 1 is injected at the same time... When container n is started, auxiliary instance n is injected into container n, and application instance n is injected into container n.
[0065] It should be understood that the embodiment of the present application does not specifically limit the type of auxiliary instance. For example, the auxiliary instance can be a "sidecar control service". Also, there is no specific limitation on the number of load devices and the number of containers connected to each load device.
[0066] Among them, the auxiliary instance provides independent service port port, url interface service, interface call authentication service and other services for the K8s platform to call, such as the stream switching interface, through which the K8s platform can send the first stream switching request to the auxiliary instance.
[0067] In some embodiments, the auxiliary instance can implement various interfaces based on the Django web framework of Python.
[0068] Figure 3 It should be understood that the execution subject of the embodiment of the present application can be the device where the above-mentioned K8s platform is located, such as Figure 4 As shown, the traffic management method includes the following steps:
[0069] S301: In response to a first stream switching request of a stream switching interface of an auxiliary instance, obtaining target application information of an application instance corresponding to a target container through the auxiliary instance.
[0070] The auxiliary instance and the application instance are both set in the target container. Specifically, during the creation of the target container, the container management device can create the auxiliary instance and the application instance in the target container in response to the creation operation of the target container.
[0071] In the embodiment of the present application, the first flow cutting request is used to instruct to cut off the flow provided by the load device to the target container.
[0072] Specifically, when a certain container needs to be switched, the container management device (for example, the K8s platform) sends a first switching request to the switching interface of the auxiliary instance, thereby calling the auxiliary instance.
[0073] Accordingly, after receiving the first stream switching request, the auxiliary instance reads the target application information of the application instance in the same container as the auxiliary instance. Figure 2Taking container 1 as an example, the container management device will send a first stream switching request to the stream switching interface of auxiliary instance 1, and accordingly, auxiliary instance 1 will obtain the target application information of application instance 1.
[0074] The embodiments of the present application do not specifically limit the categories of target application information. For example, the target application information includes but is not limited to the following: the language type used by the application in the application instance, the application identifier, the load type of the target load that provides traffic for the target container, etc., where the application identifier can be the application name, application number, application type, etc.
[0075] S302: Determine a target flow switching method according to target application information.
[0076] It should be noted that different application information corresponds to different stream switching methods. The target stream switching method corresponding to the target application information can be determined based on the correspondence between the application information and the stream switching method. The specific content of the stream switching method is not limited here.
[0077] In some optional embodiments, the target flow cutting method may include but is not limited to one or more of the following:
[0078] Stream switching is achieved through the built-in kube-proxy of K8s;
[0079] Get the container status through custom code and use nginx's reload technology to switch traffic.
[0080] Stream switching is achieved through the API interface provided by the container itself.
[0081] S303: Cut off the flow provided by the load device to the target container based on the target flow cutting method.
[0082] In some embodiments, different flow switching methods correspond to different flow switching scripts. After obtaining the flow switching script, the auxiliary instance can run the flow switching script to cut off the flow provided by the load device to the target container to cut off the flow provided by the load device to the target container.
[0083] In the embodiment of the present application, the flow management of the container is realized by the auxiliary instance set in the container, which can not only implement a unified flow management standard for containers of different language types and different environment architectures, but also improve the standardization of container management equipment, thereby reducing the flow management difficulty of container management equipment. At the same time, different flow switching methods can be used to switch flows for different containers according to application information, ensuring the flexibility of container management equipment, thereby differentially meeting the flow management needs in different scenarios.
[0084] Next, the schemes implemented by each module in the process of traffic management are described in detail in conjunction with specific embodiments:
[0085] Figure 4 The following is a schematic diagram of signaling interaction in the flow management process provided by the embodiment of the present application. Figure 4 As shown, the process management method of the embodiment of the present application includes the following steps:
[0086] S401: The container management device sends a first stream switching request to a stream switching interface of an auxiliary instance.
[0087] S402: The auxiliary instance obtains target application information of the application instance corresponding to the target container.
[0088] It should be noted that steps S401 to S402 are Figure 3 The principles and implementation methods of steps S301 to S302 in the illustrated embodiment are similar and will not be described in detail here.
[0089] S403: The auxiliary instance determines a target flow switching method according to the target application information.
[0090] Specifically, the steps include:
[0091] (1) Assist the instance to read configuration information;
[0092] The configuration information includes the corresponding relationship between the application information and the flow switching method.
[0093] (2) Determine the target flow switching method corresponding to the target application information based on the corresponding relationship through the auxiliary instance.
[0094] In a specific implementation, Figure 5 The schematic diagram of the principle of the flow management method provided in the embodiment of the present application is as follows. Figure 5 As shown, taking auxiliary instance 1 as an example, after obtaining target application information, the auxiliary instance 1 can read configuration information from the configuration management center.
[0095] It should be noted that the configuration management center may be a service provided by a container management device, or may be a configuration service provided by other platforms or servers, which is not limited in the embodiments of the present application.
[0096] refer to Figure 5 The configuration management center stores configuration information, which includes a correspondence between at least one or more of the following information: language type, application name, flow switching script, load type, etc.
[0097] The switching method corresponding to the switching script is the switching method corresponding to one of the information indicated in the language type, application name, and load type; different switching methods can be implemented by executing different switching scripts. For example, the switching method corresponding to language 1, application name 1, or load type 1 is the switching method corresponding to "switching script 1"; the switching method corresponding to language n, application name n, or load type n is the switching method corresponding to "switching script n".
[0098] Correspondingly, after the target application information of the target container is acquired, the stream switching script (ie, the stream switching method) corresponding to the target application information can be determined according to the above correspondence.
[0099] Exemplarily, if the load type in the acquired target application information is type 1, the target flow switching method is determined to be the flow switching method corresponding to flow switching script 1.
[0100] S404: The auxiliary instance sends a second flow switching request to the load device based on the target flow switching method.
[0101] It should be noted that after obtaining the target flow switching method, the auxiliary instance can run the corresponding flow switching script to cut off the flow provided by the load device to the target container.
[0102] The second stream switching request is used to instruct the load device to obtain a processing result of performing stream switching processing on the target container.
[0103] S405: The load device obtains the processing result of the flow cutting processing on the target container.
[0104] S406: The load device sends the processing result to the auxiliary instance.
[0105] S407: The auxiliary instance obtains the current flow information of the target container according to the processing result, and generates the state information of the flow switching process corresponding to the target container according to the flow information.
[0106] The flow information is used to indicate whether the target container currently has flow.
[0107] Specifically, in response to the processing result that the traffic is cut off successfully, the auxiliary instance uses a detection tool to execute the detection script, thereby detecting the traffic information in the target container.
[0108] The detection script and detection tool are read from the configuration information according to the application information. Figure 5 As shown, the configuration information also includes detection scripts and detection tools, for example, detection script 1 and detection script n, and detection tool 1 and detection tool 2.
[0109] In an embodiment of the present application, the auxiliary instance can obtain the detection tool and detection script corresponding to the target container from the configuration information according to the target application information while obtaining the target flow switching method. For example, if the load type indicated in the target application information is "load type 1", the detection tool and detection script corresponding to the target container are "detection tool 1" and "detection script 1" respectively. As for the detection script and detection tool determination method corresponding to other types of target application information, it is similar to "load type" and will not be repeated here.
[0110] Furthermore, after the flow information is obtained, the state information of the target container can be obtained according to the flow information, and the state information can be written into the auxiliary instance.
[0111] The status information is used to indicate whether the flow of the target container is successfully cut off. In some embodiments, a first preset value may be used to indicate the status information corresponding to when the flow of the target container is successfully cut off, and a second preset value may be used to indicate the status information corresponding to when the flow of the target container is not successfully cut off. Exemplarily, taking the first preset value as 1 and the second preset value as 0 as an example, when the flow of the target container is successfully cut off, the status information may be written as "1"; when the flow of the target container is not successfully cut off, the status information may be written as "0".
[0112] S408: The container management device reads status information.
[0113] Specifically, the container management device can read the status information in the auxiliary instance through the stream switching interface.
[0114] S409: The container management device destroys the target container based on the status information.
[0115] Specifically, the container management device responds to the status information that the traffic is successfully cut off and destroys the target container. That is, if the status information read by the container management device is "1", it means that the traffic of the target container has been successfully cut off and the target container is no longer carrying business traffic. At this time, the target container can be destroyed.
[0116] In some optional implementations, if the status information indicates that the stream switching process is unsuccessful, the target container is not destroyed temporarily.
[0117] In the embodiment of the present application, the flow management of the container is realized by the auxiliary instance set in the container, which can not only implement a unified flow management standard for containers of different language types and different environment architectures, but also improve the standardization of container management equipment and reduce the flow management difficulty of container management equipment. At the same time, different flow switching methods can be used to switch flows for different containers according to application information, so as to ensure the flexibility of container management equipment and meet the flow management needs in different scenarios in a differentiated manner.
[0118] In addition, by detecting whether the container has completed the processing of the traffic through the auxiliary instance and writing the status information to the auxiliary instance for the container management device to read, the real-time flow cutting processing of the container can be accurately known. When it is ensured that the container is no longer carrying business traffic (that is, the traffic is cut off successfully), the container is destroyed. Compared with the existing technology, it can prevent the accidental destruction of the container and thus affect the operation of the application instance. For business customers, it can prevent temporary interruption of business customers' services, thereby ensuring user experience; for R&D personnel, it can prevent false alarms that are not related to the business itself.
[0119] Figure 6 A schematic diagram of the structure of the flow management device provided in the embodiment of the present application Figure 1 It should be understood that the flow management device provided in the embodiment of the present application is applied to a container management device, such as Figure 6 As shown, the traffic management device 600 includes:
[0120] An acquiring unit 601 is configured to acquire target application information of an application instance in a target container through the auxiliary instance in response to a first flow switching request for a flow switching interface of the auxiliary instance, wherein the first flow switching request is used to instruct to cut off the flow provided by the load device to the target container;
[0121] A determination unit 602, configured to determine a target flow switching method according to target application information;
[0122] The processing unit 603 is used to cut off the flow provided by the load device to the target container based on the target flow cutting method.
[0123] In some optional implementations, the determination unit 602 is specifically used to: read configuration information through an auxiliary instance, the configuration information including the correspondence between application information and the flow switching method, and determine the target flow switching method corresponding to the target application information through the auxiliary instance according to the correspondence.
[0124] In some optional implementations, the traffic management device 600 further includes: a sending unit 604, configured to send a second flow switching request to the load device based on the target flow switching method, wherein the second flow switching request is used to instruct the load device to obtain a processing result of performing flow switching processing on the target container;
[0125] The acquisition unit 601 is further used to acquire the processing result sent by the load device. If the processing result indicates that the flow is cut off successfully, the current flow information of the target container is obtained, and the state information of the flow cutting process corresponding to the target container is generated according to the current flow information. The flow information is used to indicate whether the target container currently has flow, and the state information is used to indicate whether the flow of the target container is cut off successfully.
[0126] The processing unit 603 is further configured to destroy the target container based on the status information.
[0127] In some optional implementations, the processing unit 603 is specifically used to: if the processing result indicates that the traffic is cut off successfully, use the detection tool to detect the current traffic information in the target container according to the detection script; wherein the detection script and the detection tool are read from the configuration information of the target container according to the target application information, and the configuration information is used to indicate the correspondence between the application information and the detection script and the detection tool.
[0128] In some optional implementations, the processing unit 603 is specifically used to: read the status information stored in the auxiliary instance in the target container through the flow cutting interface of the auxiliary instance in the target container; and destroy the target container in response to the status information indicating that the flow cutting of the target container is successful.
[0129] In some optional implementations, the determination unit 602 is specifically used to: read configuration information through an auxiliary instance in a target container, the configuration information including a correspondence between multiple groups of application information and a flow switching method; the multiple groups of application information correspond one-to-one to multiple application instances; the multiple application instances are deployed in the same container; or, the multiple application instances are deployed in multiple different containers; the multiple different containers include a target container; and determine a target flow switching method corresponding to the target application information in the target container based on the correspondence between the multiple groups of application information and the flow switching method.
[0130] In some optional implementations, the processing unit 603 is further configured to: in response to a creation operation of the target container, create an auxiliary instance and an application instance in the target container.
[0131] It should be noted that the traffic management device 600 provided in the above embodiments can be used to execute the steps in the traffic management method provided in the above embodiments of the container management device side. The specific implementation methods and technical effects are similar and will not be repeated here.
[0132] Figure 7 A schematic diagram of the structure of the flow management device provided in the embodiment of the present application Figure 2 It should be understood that the flow management device provided in the embodiment of the present application is applied to load devices, such as Figure 7 As shown, the traffic management device 700 includes:
[0133] The acquisition unit 701 is used to obtain a processing result of performing a stream switching process on a target container in response to a second stream switching request sent by the container management device based on the target stream switching method; the target container is deployed in the container management device, and the application instance and the auxiliary instance are deployed in the target container;
[0134] The sending unit 702 is used to send the processing result to the container management device to instruct the container management device to determine the current flow information of the target container based on the processing result, generate the state information of the flow switching process corresponding to the target container according to the current flow information, and destroy the target container based on the state information;
[0135] Among them, the target flow switching method is determined by the container management device according to the target application information corresponding to the application instance in the target container; the target application information is obtained by the auxiliary instance in response to the first flow switching request of the flow switching interface of the auxiliary instance in the target container by the container management device; the processing result is used to determine the current flow information of the target container, and the flow information is used to indicate whether the target container currently has flow; the status information is used to indicate whether the flow of the target container is successfully cut off.
[0136] It should be noted that the traffic management device 700 provided in the above embodiments can be used to execute the various steps in the traffic management method provided in the above embodiments on the load device side. The specific implementation methods and technical effects are similar and will not be repeated here.
[0137] Figure 8 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Figure 8 The electronic device shown may correspond to the aforementioned container management device or load device. The electronic device 800 includes: a processor 801 , a memory 802 , a communication interface 803 and a system bus 804 .
[0138] The memory 802 and the communication interface 803 are connected to the processor 801 through the system bus 804 and communicate with each other. The memory 802 is used to store computer programs, the communication interface 803 is used to communicate with other devices, and the processor 801 is used to call the computer program in the memory to execute the above Figure 3 The flow management method of the embodiment, and / or, executing the above Figure 4 The traffic management method performed by the load device in the embodiment.
[0139] Specifically, the processor 801 may include one or more processing units, for example, the processor 801 may be a central processing unit (CPU), a digital signal processor (DSP), an application specific integrated circuit (ASIC), etc. A general processor may be a microprocessor or the processor may be any conventional processor, etc. The steps of the method disclosed in the application may be directly embodied as being executed by a hardware processor, or may be executed by a combination of hardware and software modules in the processor.
[0140] The memory 802 can be used to store computer programs. The memory 802 may include a program storage area and a data storage area. Among them, the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, etc.), etc. The data storage area may store data created during the use of the electronic device 800 (such as audio data, etc.), etc. In addition, the memory 802 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc. The processor 801 executes various functional applications and data processing of the electronic device 800 by running the computer program stored in the memory 802.
[0141] The communication interface 803 can provide solutions for wireless communications including 2G / 3G / 4G / 80G applied to the electronic device 800. The communication interface 803 can receive electromagnetic waves through the antenna, filter, amplify and process the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The communication interface 803 can also amplify the signal modulated by the modulation and demodulation processor and convert it into electromagnetic waves for radiation through the antenna.
[0142] In some embodiments, at least some functional modules of the communication interface 803 may be disposed in the processor 801 .
[0143] In some embodiments, at least some functional modules of the communication interface 803 and at least some modules of the processor 801 may be arranged in the same device.
[0144] The system bus 804 may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The system bus 804 may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
[0145] It should be noted that the number of the memory 802 and the processor 801 is not limited in the embodiment of the present application, and they can be one or more. Figure 8 Taking one as an example for illustration; the memory 802 and the processor 801 can be connected by wire or wirelessly in various ways, such as through a bus connection.
[0146] In practical applications, the electronic device 800 may be various forms of computers or mobile terminals, wherein the computer may be, for example, a laptop computer, a desktop computer, a workbench, a server, a blade server, a mainframe computer, etc.; the mobile terminal may be, for example, a personal digital assistant, a cellular phone, a smart phone, a wearable device, and other similar computing devices.
[0147] The electronic device of this embodiment can be used to execute the technical solution in the above method embodiment. Its implementation principle and technical effect are similar and will not be described in detail here.
[0148] An embodiment of the present application also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed, a traffic management method as in any of the above embodiments is implemented.
[0149] An embodiment of the present application also provides a computer program product, including: a computer program, which, when executed by a processor, implements a traffic management method as in any of the above method embodiments.
[0150] The embodiment of the present application also provides a traffic management system, including the container management device and the load device provided in any of the above embodiments. In which, at least one target container is running in the container management device, and the load device is used to provide traffic for the operation of the target container. When the target container starts running, an auxiliary instance and an instance application are set in it.
[0151] In the above-mentioned embodiments, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of modules is only a logical function division, and there may be other division methods in actual implementation, such as multiple modules can be combined or integrated into another system, or some features can be ignored or not executed. Another point, the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or modules, which can be electrical, mechanical or other forms. In addition, each functional module in each embodiment of the present application can be integrated into a processing unit, or each module can exist physically separately, or two or more modules can be integrated into one unit. The unit composed of the above modules can be implemented in the form of hardware or in the form of hardware plus software functional units.
[0152] The above-mentioned integrated module implemented in the form of a software function module can be stored in a computer-readable storage medium. The above-mentioned software function module is stored in a storage medium, including a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor to perform some steps of the methods of various embodiments of the present application.
[0153] The above storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk, etc. The storage medium can be any available medium that can be accessed by a general or special-purpose computer.
[0154] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any modification, use or adaptation of the present application, which follows the general principles of the present application and includes common knowledge or customary techniques in the art that are not disclosed in the present application. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present application are indicated by the following claims.
[0155] It should be understood that the present application 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 application is limited only by the appended claims.
Claims
1. A traffic management method, characterized in that: Applied to a container management device, a target container is deployed in the container management device, an application instance and an auxiliary instance are deployed in the target container, and the traffic management method includes: In response to a first flow switching request for a flow switching interface of the auxiliary instance, obtaining target application information corresponding to the application instance in the target container through the auxiliary instance, wherein the first flow switching request is used to instruct to cut off the flow provided by the load device to the target container; Determine a target flow switching method according to the target application information; Based on the target flow cutting method, the flow provided by the load device to the target container is cut off; Acquire status information of a flow cutting process corresponding to the target container, where the status information is used to indicate whether the flow of the target container is cut off successfully; The target container is destroyed based on the status information.
2. The flow management method according to claim 1, characterized in that: The obtaining of the state information of the stream switching process corresponding to the target container includes: Based on the target flow switching method, a second flow switching request is sent to the load device, where the second flow switching request is used to instruct the load device to return a processing result of the flow switching processing performed on the target container; Obtaining the processing result sent by the load device; If the processing result indicates that the flow cutting is successful, the current flow information of the target container is obtained, and the state information of the flow cutting processing process corresponding to the target container is generated according to the current flow information, and the flow information is used to indicate whether the target container currently has flow.
3. The flow management method according to claim 2, characterized in that: If the processing result indicates that the flow cut-off is successful, obtaining the current flow information of the target container includes: If the processing result indicates that the flow is cut off successfully, using a detection tool to detect the current flow information in the target container according to a detection script; The detection script and the detection tool are read from the configuration information of the target container according to the target application information, and the configuration information of the target container is used to indicate the corresponding relationship between the target application information and the detection script and the detection tool.
4. The flow management method according to claim 2, characterized in that: The state information of the stream switching process corresponding to the target container is stored in the auxiliary instance of the target container; and the destroying process of the target container based on the state information includes: Reading the state information stored in the auxiliary instance in the target container through the stream switching interface of the auxiliary instance in the target container; In response to the state information indicating that traffic cutting of the target container is successful, destroying the target container.
5. The flow management method according to any one of claims 1 to 4, characterized in that: The method of determining a target flow switching method according to the target application information includes: Reading configuration information through the auxiliary instance in the target container, the configuration information including a correspondence between multiple sets of application information and a flow switching method; the multiple sets of application information correspond one-to-one to multiple application instances; the multiple application instances are all deployed in the same container; or the multiple application instances are deployed in multiple different containers; the multiple different containers include the target container; According to the correspondence between the multiple groups of application information and the stream switching methods, a target stream switching method corresponding to the target application information in the target container is determined.
6. The flow management method according to any one of claims 1 to 4, characterized in that: The method further comprises: In response to the creation operation of the target container, the auxiliary instance and the application instance are created in the target container.
7. A traffic management method, characterized in that: Applied to a load device, the traffic management method includes: In response to a second stream switching request sent by a container management device based on a target stream switching method, a processing result of stream switching processing on a target container is obtained; the container management device has a target container deployed therein, and the target container has an application instance and an auxiliary instance deployed therein; Sending the processing result to the container management device to instruct the container management device to determine the current flow information of the target container based on the processing result, generate state information of the flow switching process corresponding to the target container according to the current flow information, and destroy the target container based on the state information; Among them, the target flow cutting method is determined by the container management device according to the target application information corresponding to the application instance in the target container; the target application information is obtained by the auxiliary instance in response to the first flow cutting request of the flow cutting interface of the auxiliary instance in the target container by the container management device; the processing result is used to determine the current flow information of the target container, and the flow information is used to indicate whether the target container currently has flow; the status information is used to indicate whether the flow of the target container is successfully cut off.
8. A flow management device, characterized in that: Applied to a container management device, a target container is deployed in the container management device, an application instance and an auxiliary instance are deployed in the target container, and the traffic management device includes: an acquisition unit, configured to obtain target application information of an application instance in a target container through the auxiliary instance in response to a first flow switching request for a flow switching interface of the auxiliary instance, wherein the first flow switching request is used to instruct to cut off the flow provided by the load device to the target container; A determination unit, configured to determine a target flow switching method according to the target application information; A processing unit, configured to cut off the flow provided by the load device to the target container based on the target flow cutting method; The acquisition unit is further used to acquire status information of a flow cutting process corresponding to the target container, where the status information is used to indicate whether the flow of the target container is cut off successfully; The processing unit is further configured to destroy the target container based on the status information.
9. A flow management device, characterized in that: Applied to load equipment, the flow management device comprises: an acquisition unit, configured to acquire a processing result of performing a stream switching process on a target container in response to a second stream switching request sent by a container management device based on a target stream switching method; the target container is deployed in the container management device, and the target container is deployed with an application instance and an auxiliary instance; a sending unit, configured to send the processing result to the container management device, wherein the processing result is used to instruct the container management device to determine the current flow information of the target container based on the processing result, generate the state information of the flow switching process corresponding to the target container according to the current flow information, and destroy the target container based on the state information; Among them, the target flow cutting method is determined by the container management device according to the target application information corresponding to the application instance in the target container; the target application information is obtained by the auxiliary instance in response to the first flow cutting request of the flow cutting interface of the auxiliary instance in the target container by the container management device; the processing result is used to determine the current flow information of the target container, and the flow information is used to indicate whether the target container currently has flow; the status information is used to indicate whether the flow of the target container is successfully cut off.
10. An electronic device, characterized in that: include: A memory and at least one processor, the memory is used to store a computer program, the processor is used to call the computer program in the memory, execute the traffic management method as described in any one of claims 1 to 6, and / or execute the traffic management method as described in claim 7.
11. A computer-readable storage medium, characterized in that: A computer program is stored on the computer-readable storage medium; when the computer program is executed, it implements the traffic management method as described in any one of claims 1 to 6, and / or implements the traffic management method as described in claim 7.
