Knative automatic capacity expansion method and system based on eBPF program
By using eBPF programs in knative to monitor the data flow of the Layer 4 proxy and synchronize information to the Autoscaler component, the problem of new request discovery is solved, and faster autoscale response and overall performance improvement is achieved.
Patent Information
- Application Number
- CN202411596220.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-11
- Publication Date
- 2025-02-18
- Estimated Expiration
- 2044-11-11
AI Technical Summary
In the prior art, the discovery of new requests requires passing through a seven-layer proxy, which is a long time and has been filtered by the network stack, affecting the autoscale response time and overall performance.
The knative automatic scaling method based on eBPF program is adopted to monitor the data flow of the fourth layer agent through the eBPF program, synchronize the data flow related information to the Autoscaler component, and decide whether to send expansion event announcements based on the available status, and optimize the scaling decision of the Autoscaler component.
Reducing new request discovery from layer seven to layer four significantly speeds up autoscale response time, improves overall performance, and reduces system complexity.
Smart Images

Figure CN119484546A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of cloud native serverless technology, and in particular to a knative automatic capacity expansion method and system based on an eBPF program. Background Art
[0002] Cloud native serverless technology represented by Knative monitors, proxies and caches the client's HTTP requests. When there are no requests, Knative can shut down the backend service container, thereby saving resources and flexibly scheduling. When a new request comes in, Knative will discover the new connection, cache it, and then pull up the backend service container. After the service container is pulled up, Knative will continue to send the cached request to the backend service container and complete the service. At present, the solutions for discovering connections, notifying the autoscaler component (the autoscaler component is a component of Knative, and its main function is to automatically control the number of container loads) and caching requests are all based on seven-layer proxies, such as Envoy (an open source high-performance proxy). However, these seven-layer proxies are generally located in user space, so when they perceive new connections, they have already been processed by the kernel network stack, so it takes a lot of time and is filtered by the network stack.
[0003] eBPF (extended Berkeley Packet Filter, a kernel bypass technology) allows externally loaded programs to be executed in the kernel, similar to a virtual machine running in the kernel, which can be loaded / unloaded in real time. At the same time, it can interact with user space in real time.
[0004] How to reduce the discovery of new requests from seven layers to four layers and speed up the autoscale response time and improve the overall performance is a technical problem that needs to be solved. Summary of the invention
[0005] The technical task of the present invention is to address the above shortcomings and provide a knative automatic expansion method and system based on the eBPF program to solve the technical problem of how to reduce the discovery of new requests from seven layers to four layers and speed up the autoscale response time and improve the overall performance.
[0006] In a first aspect, the present invention provides a knative automatic capacity expansion method based on an eBPF program, which implements automatic capacity expansion based on a knative specification based on an eBPF program, an Autoscaler component, and a user-state program, wherein the user-state program serves as a seventh-layer proxy of a node and has network proxy, load balancing, and service discovery functions, and includes the following steps:
[0007] Data flow monitoring: For kubernetes cluster nodes, each node operating system runs an eBPF program as a daemon process. The eBPF program monitors the data flow entering the fourth layer proxy of the node and the current network operation status as monitoring information. A data structure is created in the eBPF program to record the available status of the business load containers corresponding to the current backend services.
[0008] Data flow synchronization: When the eBPF program monitors the data flow entering the fourth-layer proxy, it synchronizes the data flow related information and monitoring information to the Autoscaler component, and determines whether there is a business load container of the backend service corresponding to the data flow through the record of the data structure. If not, it sends a capacity expansion event notification to the Autoscaler component;
[0009] Expansion decision: Based on data flow related information, monitoring information, expansion event notifications, and the current status of the business containers of each backend service, the Autoscaler component makes a decision on the expansion of the business load container and returns a response to the eBPF program. Based on the response, the eBPF program updates its local data structure.
[0010] Packet forwarding: When the data flow entering the fourth-layer proxy establishes a connection with the eBPF program, the eBPF program makes a decision on the forwarding of the packet based on the content recorded in the data structure, and forwards the packet directly to the corresponding business load container, or forwards the packet to the user state program and caches the packet through the user state program. When the Autoscaler component expands the business load container of the backend service related to the data flow and notifies the user state program that the business load container is available, the user state program forwards the packet to the business load container of the corresponding backend service.
[0011] Preferably, the eBPF program includes a kernel state program and a user state program;
[0012] The kernel state program is used to monitor the data flow entering the node's fourth layer proxy and monitor the current network operation status as monitoring information, and synchronize the data flow related information and monitoring information to the Autoscaler component;
[0013] The kernel-mode program creates a data structure locally, records the available status of the business load containers corresponding to the current backend services through the data structure, and determines whether there is a business load container of the backend service corresponding to the data flow based on the record of the local data structure. If not, a capacity expansion event notification is generated and the user-mode program is called. The user-mode program is used to send the capacity expansion event notification to the Autoscaler component based on the interface specification of the Autoscaler component;
[0014] When the data flow entering the fourth-layer proxy establishes a connection with the kernel-state program, the kernel-state program is used to make decisions on the forwarding of data packets based on the content recorded in the data structure, and call the user-state program based on the decision. The user-state program is used to forward the data packets directly to the corresponding business load container, or forward the data packets to the Envoy program.
[0015] Preferably, when a data packet reaches the kernel state program of the eBPF program, the kernel state program makes a decision on the forwarding of the data packet based on the recorded content of the data structure. If the business load container of the backend service corresponding to the data packet does not meet the service conditions, the kernel state program modifies the data packet, modifies the data packet header to a data packet reaching the Envoy program, and stores the original information in the data packet in the structure socketbuffer, and forwards the modified data packet to the user state program through the user state program of the eBPF program;
[0016] The user-state program caches the received data packets. When the user-state program receives the service load container availability notification sent by the Autoscaler component, it modifies the data packet header to reach the service load container of the corresponding backend service, and sends the modified data packet to the service load container of the corresponding backend service.
[0017] Preferably, the user-mode program uses the Envoy program, which is an open source high-performance proxy.
[0018] Preferably, the data stream is a TCP / UDP data stream.
[0019] In a second aspect, the present invention provides a knative automatic capacity expansion system based on an eBPF program, which is used to implement automatic capacity expansion based on a knative specification through a knative automatic capacity expansion method based on an eBPF program as described in any one of the first aspects, wherein the system includes an eBPF program component, an Autoscaler component, and a user-mode program component;
[0020] For kubernetes cluster nodes, each node operating system runs eBPF program components and user-mode program components. The user-mode program component serves as the node's seventh-layer proxy, with network proxy, load balancing, and service discovery functions. The eBPF program component serves as the node's fourth-layer proxy.
[0021] The eBPF program component is executed as follows through the eBPF program: monitoring the data flow entering the fourth layer proxy of the node, and monitoring the current network operation status as monitoring information, and creating a data structure in the eBPF program, and recording the available status of the business load container corresponding to each backend service through the data structure;
[0022] When the eBPF program monitors the data flow entering the fourth-layer proxy, the eBPF program component uses the eBPF program to perform the following: synchronize the data flow related information and monitoring information to the Autoscaler component, and determine whether there is a business load container of the backend service corresponding to the data flow through the record of the data structure. If not, send a capacity expansion event notification to the Autoscaler component; correspondingly, the Autoscaler component is used to perform the following: based on the data flow related information, monitoring information, capacity expansion event notification and the current state of the business responsible containers of each backend service, make a decision on the capacity expansion of the business load container, and return a response to the eBPF program component; correspondingly, the eBPF program component uses the eBPF program to update its local data structure based on the response;
[0023] When the data flow entering the fourth-layer proxy establishes a connection with the eBPF program, the eBPF program component uses the eBPF program to execute the following: make decisions on the forwarding of data packets based on the content recorded in the data structure, and forward the data packets directly to the corresponding business load container, or forward the data packets to the user-state program; correspondingly, the user-state program component uses the user-state program to execute the following: cache data packets, and when the Autoscaler component expands the business load container of the backend service related to the data flow and notifies the user-state program that the business load container is available, forward the data packet to the business load container of its corresponding backend service.
[0024] Preferably, the eBPF program includes a kernel state program and a user state program;
[0025] The kernel state program is used to monitor the data flow entering the node's fourth layer proxy and monitor the current network operation status as monitoring information, and synchronize the data flow related information and monitoring information to the Autoscaler component;
[0026] The kernel-mode program creates a data structure locally, records the available status of the business load containers corresponding to the current backend services through the data structure, and determines whether there is a business load container of the backend service corresponding to the data flow based on the record of the local data structure. If not, a capacity expansion event notification is generated and the user-mode program is called. The user-mode program is used to send the capacity expansion event notification to the Autoscaler component based on the interface specification of the Autoscaler component;
[0027] When the data flow entering the fourth-layer proxy establishes a connection with the kernel-state program, the kernel-state program is used to make decisions on the forwarding of data packets based on the content recorded in the data structure, and call the user-state program based on the decision. The user-state program is used to forward the data packets directly to the corresponding business load container, or forward the data packets to the Envoy program.
[0028] Preferably, when a data packet reaches the kernel state program of the eBPF program, the kernel state program makes a decision on the forwarding of the data packet based on the recorded content of the data structure. If the business load container of the backend service corresponding to the data packet does not meet the service conditions, the kernel state program modifies the data packet, modifies the data packet header to a data packet reaching the Envoy program, and stores the original information in the data packet in the structure socketbuffer, and forwards the modified data packet to the user state program through the user state program of the eBPF program;
[0029] The user-state program caches the received data packets. When the user-state program receives the service load container availability notification sent by the Autoscaler component, it modifies the data packet header to reach the service load container of the corresponding backend service, and sends the modified data packet to the service load container of the corresponding backend service.
[0030] Preferably, the user-mode program uses the Envoy program, which is an open source high-performance proxy.
[0031] Preferably, the data stream is a TCP / UDP data stream.
[0032] The knative automatic capacity expansion method and system based on the eBPF program of the present invention have the following advantages:
[0033] 1. The automatic expansion process of the business load container can be started when the fourth layer connection is established, which speeds up the response speed of the knative system and completes the same function with fewer components, reducing the complexity of the system;
[0034] 2. A data structure is established in the eBPF program, which records the available status of the business load containers corresponding to the current backend services. When the eBPF program monitors the data flow entering the fourth-layer proxy, it determines whether there is a business load container of the backend service corresponding to the data flow through the record of the data structure. If not, an expansion event notification is sent to the Autoscaler component. Based on the data flow-related information, monitoring information, expansion event notification and the current status of the business responsible containers of each backend service, the Autoscaler component makes a decision on the expansion of the business load container and returns a response to the eBPF program. Based on the response, the eBPF program updates its local data structure. This solution optimizes the storage capacity of the Autoscaler component and speeds up the expansion decision of the Autoscaler component. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, 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 invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0036] The present invention is further described below in conjunction with the accompanying drawings.
[0037] Figure 1 This is a flowchart of a knative automatic capacity expansion method based on an eBPF program in Example 1;
[0038] Figure 2 This is a block diagram of the working principle of a knative automatic capacity expansion system based on an eBPF program in Example 2. DETAILED DESCRIPTION
[0039] The present invention is further described below in conjunction with the accompanying drawings and specific embodiments so that those skilled in the art can better understand the present invention and implement it. However, the embodiments are not intended to limit the present invention. In the absence of conflict, the embodiments of the present invention and the technical features in the embodiments may be combined with each other.
[0040] The embodiments of the present invention provide a knative automatic capacity expansion method and system based on an eBPF program, which are used to solve the technical problem of how to reduce the discovery of new requests from seven layers to four layers and speed up the autoscale response time and improve the overall performance.
[0041] Embodiment 1:
[0042] The present invention discloses a knative automatic capacity expansion method based on an eBPF program, which realizes automatic capacity expansion based on a knative specification based on an eBPF program, an Autoscaler component and a user-state program, wherein the user-state program serves as a seventh-layer proxy of a node and has network proxy, load balancing and service discovery functions.
[0043] The method includes four steps: data flow monitoring, data flow synchronization, capacity expansion decision and data packet forwarding.
[0044] Step S100 data flow monitoring: For kubernetes cluster nodes, an eBPF program as a daemon process runs on each node operating system. The eBPF program monitors the data flow entering the fourth layer agent of the node and monitors the current network operation status as monitoring information. A data structure is created in the eBPF program to record the available status of the business load containers corresponding to the current backend services.
[0045] Step S200: Data flow synchronization: When the eBPF program monitors the data flow entering the fourth-layer proxy, it synchronizes the data flow related information and monitoring information to the Autoscaler component, and determines whether there is a business load container of the backend service corresponding to the data flow through the record of the data structure. If not, it sends a capacity expansion event notification to the Autoscaler component.
[0046] Step S300: Expansion decision: Based on data flow related information, monitoring information, expansion event notifications, and the current status of the business containers responsible for each backend service, the Autoscaler component makes a decision on the expansion of the business load container and returns a response to the eBPF program. Based on the response, the eBPF program updates its local data structure.
[0047] Step S400: Packet forwarding: When the data flow entering the fourth-layer proxy establishes a connection with the eBPF program, the eBPF program makes a decision on the forwarding of the data packet based on the content recorded in the data structure, and forwards the data packet directly to the corresponding business load container, or forwards the data packet to the user state program and caches the data packet through the user state program. When the Autoscaler component expands the business load container of the backend service related to the data flow and notifies the user state program that the business load container is available, the data packet is forwarded to the business load container of the corresponding backend service through the user state program.
[0048] As a specific implementation of the user state program, the user state program is the Envoy program. The data stream monitored by the fourth layer proxy is the TCP / UDP data stream.
[0049] As a specific implementation of the eBPF program, it includes an eBPF kernel-state program and an eBPF user-state program. The eBPF kernel-state program is used to monitor the data flow entering the fourth-layer proxy of the node and monitor the current network operation status as monitoring information, synchronize the data flow related information and the monitoring information to the Autoscaler component, and synchronize the data flow related information and the monitoring information to the Autoscaler component; the eBPF kernel-state program locally creates a data structure, records the available status of the business load container corresponding to each current backend service through the data structure, and determines whether there is a business load container of the backend service corresponding to the data flow according to the record of the local data structure. If not, a capacity expansion event notification is formed, and the eBPF user-state program is called. The eBPF user-state program is used to send a capacity expansion event notification to the Autoscaler component based on the interface specification of the Autoscaler component; when the data flow entering the fourth-layer proxy establishes a connection with the eBPF kernel-state program, the eBPF kernel-state program is used to make a decision on the forwarding of the data packet based on the content recorded in the data structure, and calls the eBPF user-state program based on the decision. The eBPF user-state program is used to directly forward the data packet to the corresponding business load container, or forward the data packet to the user-state program.
[0050] As a specific implementation of data forwarding, when a data packet reaches the eBPF kernel-state program of the eBPF program, the eBPF kernel-state program makes a decision on the forwarding of the data packet based on the recorded content of the data structure. If the business load container of the backend service corresponding to the data packet does not meet the service conditions, the eBPF kernel-state program modifies the data packet, modifies the data packet header to a data packet reaching the user-state program, and stores the original information in the data packet in the structure socketbuffer, and forwards the modified data packet to the user-state program through the eBPF user-state program; the user-state program caches the received data packets, and when the user-state program receives the business load container available notification sent by the Autoscaler component, it modifies the data packet header to a business load container reaching the corresponding backend business, and sends the modified data packet to the business load container of its corresponding backend service.
[0051] In this embodiment, the eBPF program runs as a daemon program running on the operating system of each k8s (kubernetes, an open source container orchestration platform) node. The eBPF program consists of an eBPF kernel state program and an eBPF user state program. The eBPF kernel state program monitors the 4-layer data flow entering the node, i.e., the TCP / UDP data flow, and completes data reporting when the data flow is established. The eBPF user state program will record as an intermediary and synchronize data between the eBPF kernel state program and the Autoscaler component.
[0052] For eBPF programs, eBPF kernel-mode programs and eBPF user-mode programs have the following functions:
[0053] (1) The eBPF kernel program monitors each newly established Layer 4 data flow, synchronizes with the Autoscaler component, and records it. When a service that does not have a load container on the backend is captured by the kernel program, the kernel program notifies the Autoscaler component of the TCP / UDP ack information of the data flow and triggers the container creation process of the Autoscaler component.
[0054] (2) The eBPF kernel-mode program also outputs the statistical information of the Layer 4 data flow to the Autoscaler component for dynamically adjusting the number of backend load containers;
[0055] (3) The eBPF kernel-mode program can choose to send the subsequent data stream to the user-mode program or directly to the backend business load container;
[0056] (4) The eBPF user-mode program notifies the Autoscaler component of various events based on the data type from the kernel-mode program and in accordance with the interface specification of the Autoscaler component.
[0057] There is a layer 7 proxy running in user mode. Take the Envoy program as an example, which exists as a queue-proxy component in the knative design. When the TCP / UDP ack packet of the layer 4 data flow connection arrives at the eBPF kernel program, the eBPF kernel program will modify the packet header to the packet arriving at the user-mode program Envoy, and save the original information in the kernel's information storage structure socketbuffer. The user-mode program Envoy will temporarily store the TCP / UDP ack packet based on the notification of the Autoscaler component, and modify the TCP / UDP ack packet to the correct information and send it to the correct business load container when the conditions are met.
[0058] Based on the data packet forwarding method disclosed in this embodiment, taking the TCP three-way handshake as an example, the steps of data packet forwarding are as follows:
[0059] (1) When the eBPF program monitors the first connection packet in the tcp sync three-way handshake, if the business load container corresponding to the current tcp connection is zero, the eBPF program forwards the current tcp sync data packet to the user-mode Envoy program for temporary storage;
[0060] (2) After the corresponding business load container is pulled up by the Autoscaler component, the Autoscaler component sends a notification of the pulling up of the corresponding business load container to the Envoy program. The Envoy program modifies the temporarily stored data packet to the correct target IP and target port, and then sends it to the pulled up business load container;
[0061] (3) After the Autoscaler component pulls up the corresponding business load container, the eBPF program can monitor that the corresponding business load container has been pulled up. After the subsequent eBPF program takes over the same tcp sync data packet based on the retry, it directly forwards the tcp sync data packet to the corresponding business load container that has been pulled up;
[0062] (4) All subsequent identical tcp sync data will be directly forwarded by the eBPF program to the backend load container without being forwarded to the Envoy program for caching.
[0063] The method of this embodiment uses the eBPF program to complete the function of the ingress gateway (a module in the knative function design) in the knatve design, and uses the gateway agent in the user state to complete the queue-proxy function. This method implements the automatic resource expansion capability of the Autoscaler component under the knative design framework. This method is based on the eBPF program, which can complete automatic expansion faster, reduce the required components, and reduce system complexity.
[0064] Embodiment 2:
[0065] A knative automatic capacity expansion system based on an eBPF program includes an eBPF program component, an Autoscaler component, and a user-mode program component.
[0066] For kubernetes cluster nodes, each node operating system runs eBPF program components and user-mode program components. The user-mode program component serves as the node's seventh-layer proxy, with network proxy, load balancing, and service discovery functions. The eBPF program component serves as the node's fourth-layer proxy.
[0067] The eBPF program component is executed through the eBPF program as follows: monitoring the data flow entering the fourth layer agent of the node, and monitoring the current network operation status as monitoring information, and creating a data structure in the eBPF program to record the available status of the business load containers corresponding to the current backend services through the data structure.
[0068] When the eBPF program monitors the data flow entering the fourth-layer proxy, the eBPF program component uses the eBPF program to execute the following: synchronize the data flow related information and monitoring information to the Autoscaler component, and determine whether there is a business load container of the backend service corresponding to the data flow through the record of the data structure. If not, send a capacity expansion event notification to the Autoscaler component; correspondingly, the Autoscaler component is used to execute the following: based on the data flow related information, monitoring information, capacity expansion event notification and the current state of the business responsible containers of each backend service, make a decision on the capacity expansion of the business load container, and return a response to the eBPF program component; correspondingly, the eBPF program component uses the eBPF program to update its local data structure based on the response.
[0069] When the data flow entering the fourth-layer proxy establishes a connection with the eBPF program, the eBPF program component uses the eBPF program to execute the following: make decisions on the forwarding of data packets based on the content recorded in the data structure, and forward the data packets directly to the corresponding business load container, or forward the data packets to the user-state program; correspondingly, the user-state program component uses the user-state program to execute the following: cache data packets, and when the Autoscaler component expands the business load container of the backend service related to the data flow and notifies the user-state program that the business load container is available, forward the data packet to the business load container of its corresponding backend service.
[0070] In this embodiment, as a specific implementation of the eBPF program, it includes an eBPF kernel state program and an eBPF user state program. The eBPF kernel state program is used to monitor the data flow entering the fourth layer proxy of the node and monitor the current network operation status as monitoring information, synchronize the data flow related information and monitoring information to the Autoscaler component, and synchronize the data flow related information and monitoring information to the Autoscaler component; the eBPF kernel state program locally creates a data structure, records the available status of the business load container corresponding to each backend service through the data structure, and determines whether there is a data flow according to the record of the local data structure. If the business load container corresponding to the backend service does not exist, a capacity expansion event notification is generated and the eBPF user-state program is called. The eBPF user-state program is used to send a capacity expansion event notification to the Autoscaler component based on the interface specification of the Autoscaler component. When the data flow entering the fourth-layer proxy establishes a connection with the eBPF kernel-state program, the eBPF kernel-state program is used to make decisions on the forwarding of data packets based on the content recorded in the data structure, and call the eBPF user-state program based on the decision. The eBPF user-state program is used to forward the data packet directly to the corresponding business load container, or forward the data packet to the user-state program.
[0071] As a specific implementation of data forwarding, when a data packet reaches the eBPF kernel-state program of the eBPF program, the eBPF kernel-state program makes a decision on the forwarding of the data packet based on the recorded content of the data structure. If the business load container of the backend service corresponding to the data packet does not meet the service conditions, the eBPF kernel-state program modifies the data packet, modifies the data packet header to a data packet reaching the user-state program, and stores the original information in the data packet in the structure socketbuffer, and forwards the modified data packet to the user-state program through the eBPF user-state program; the user-state program caches the received data packets, and when the user-state program receives the business load container available notification sent by the Autoscaler component, it modifies the data packet header to a business load container reaching the corresponding backend business, and sends the modified data packet to the business load container of its corresponding backend service.
[0072] As a specific implementation of the user state program, the user state program is the Envoy program. The data stream monitored by the fourth layer proxy is the TCP / UDP data stream.
[0073] As a specific implementation of the eBPF program, it includes an eBPF kernel-state program and an eBPF user-state program. The eBPF kernel-state program is used to monitor the data flow entering the fourth-layer proxy of the node and monitor the current network operation status as monitoring information, synchronize the data flow related information and the monitoring information to the Autoscaler component, and synchronize the data flow related information and the monitoring information to the Autoscaler component; the eBPF kernel-state program locally creates a data structure, records the available status of the business load container corresponding to each current backend service through the data structure, and determines whether there is a business load container of the backend service corresponding to the data flow according to the record of the local data structure. If not, a capacity expansion event notification is formed, and the eBPF user-state program is called. The eBPF user-state program is used to send a capacity expansion event notification to the Autoscaler component based on the interface specification of the Autoscaler component; when the data flow entering the fourth-layer proxy establishes a connection with the eBPF kernel-state program, the eBPF kernel-state program is used to make a decision on the forwarding of the data packet based on the content recorded in the data structure, and calls the eBPF user-state program based on the decision. The eBPF user-state program is used to directly forward the data packet to the corresponding business load container, or forward the data packet to the user-state program.
[0074] As a specific implementation of data forwarding, when a data packet reaches the eBPF kernel-state program of the eBPF program, the eBPF kernel-state program makes a decision on the forwarding of the data packet based on the recorded content of the data structure. If the business load container of the backend service corresponding to the data packet does not meet the service conditions, the eBPF kernel-state program modifies the data packet, modifies the data packet header to a data packet reaching the user-state program, and stores the original information in the data packet in the structure socketbuffer, and forwards the modified data packet to the user-state program through the eBPF user-state program; the user-state program caches the received data packets, and when the user-state program receives the business load container available notification sent by the Autoscaler component, it modifies the data packet header to a business load container reaching the corresponding backend business, and sends the modified data packet to the business load container of its corresponding backend service.
[0075] In this embodiment, the eBPF program runs as a daemon program running on the operating system of each k8s (kubernetes, an open source container orchestration platform) node. The eBPF program consists of an eBPF kernel state program and an eBPF user state program. The eBPF kernel state program monitors the 4-layer data flow entering the node, i.e., the TCP / UDP data flow, and completes data reporting when the data flow is established. The eBPF user state program will record as an intermediary and synchronize data between the eBPF kernel state program and the Autoscaler component.
[0076] For eBPF programs, eBPF kernel-mode programs and eBPF user-mode programs have the following functions:
[0077] (1) The eBPF kernel program monitors each newly established Layer 4 data flow, synchronizes with the Autoscaler component, and records it. When a service that does not have a load container on the backend is captured by the kernel program, the kernel program notifies the Autoscaler component of the TCP / UDP ack information of the data flow and triggers the container creation process of the Autoscaler component.
[0078] (2) The eBPF kernel-mode program also outputs the statistical information of the Layer 4 data flow to the Autoscaler component for dynamically adjusting the number of backend load containers;
[0079] (3) The eBPF kernel-mode program can choose to send the subsequent data stream to the user-mode program or directly to the backend business load container;
[0080] (4) The eBPF user-mode program notifies the Autoscaler component of various events based on the data type from the kernel-mode program and in accordance with the interface specification of the Autoscaler component.
[0081] The user-mode program Envoy exists as a queue-proxy component in the knative design. When the TCP / UDP ack packet of the layer 4 data flow connection reaches the eBPF kernel-mode program, the eBPF kernel-mode program will modify the packet header to the packet arriving at the user-mode program Envoy, and save the original information in the kernel's information storage structure socketbuffer. The user-mode program Envoy will temporarily store the TCP / UDP ack packet based on the notification of the Autoscaler component, and modify the TCP / UDP ack packet to the correct information and send it to the correct business load container when the conditions are met.
[0082] The system of this embodiment can execute the method disclosed in Example 1 to achieve automatic capacity expansion.
[0083] The present invention has been shown and described in detail above through the accompanying drawings and preferred embodiments. However, the present invention is not limited to these disclosed embodiments. Based on the above multiple embodiments, those skilled in the art can know that the means in the above different embodiments can be combined to obtain more embodiments of the present invention, and these embodiments are also within the protection scope of the present invention.
Claims
1. A knative automatic expansion method based on eBPF program, characterized in that: Automatic capacity expansion based on the knative specification is implemented based on the eBPF program, the Autoscaler component, and the user-mode program, wherein the user-mode program serves as the seventh-layer proxy of the node and has network proxy, load balancing, and service discovery functions, including the following steps: Data flow monitoring: For kubernetes cluster nodes, each node operating system runs an eBPF program as a daemon process. The eBPF program monitors the data flow entering the fourth layer proxy of the node and the current network operation status as monitoring information. A data structure is created in the eBPF program to record the available status of the business load containers corresponding to the current backend services. Data flow synchronization: When the eBPF program monitors the data flow entering the fourth-layer proxy, it synchronizes the data flow related information and monitoring information to the Autoscaler component, and determines whether there is a business load container of the backend service corresponding to the data flow through the record of the data structure. If not, it sends a capacity expansion event notification to the Autoscaler component; Expansion decision: Based on data flow related information, monitoring information, expansion event notifications, and the current status of the business containers of each backend service, the Autoscaler component makes a decision on the expansion of the business load container and returns a response to the eBPF program. Based on the response, the eBPF program updates its local data structure. Packet forwarding: When the data flow entering the fourth-layer proxy establishes a connection with the eBPF program, the eBPF program makes a decision on the forwarding of the packet based on the content recorded in the data structure, and forwards the packet directly to the corresponding business load container, or forwards the packet to the user state program and caches the packet through the user state program. When the Autoscaler component expands the business load container of the backend service related to the data flow and notifies the user state program that the business load container is available, the user state program forwards the packet to the business load container of the corresponding backend service.
2. The knative automatic capacity expansion method based on the eBPF program according to claim 1 is characterized in that: The eBPF program includes an eBPF kernel-mode program and an eBPF user-mode program; The eBPF kernel-mode program is used to monitor the data flow entering the node's fourth-layer proxy and monitor the current network operation status as monitoring information, and synchronize the data flow related information and monitoring information to the Autoscaler component; The eBPF kernel-mode program creates a data structure locally, records the available status of the business load containers corresponding to the current backend services through the data structure, and determines whether there is a business load container of the backend service corresponding to the data flow based on the record of the local data structure. If not, a capacity expansion event notification is generated and the eBPF user-mode program is called. The eBPF user-mode program is used to send a capacity expansion event notification to the Autoscaler component based on the interface specification of the Autoscaler component; When the data flow entering the fourth-layer proxy establishes a connection with the eBPF kernel-state program, the eBPF kernel-state program is used to make decisions on the forwarding of data packets based on the content recorded in the data structure, and call the eBPF user-state program based on the decision. The eBPF user-state program is used to forward the data packet directly to the corresponding business load container, or forward the data packet to the user-state program.
3. The knative automatic expansion method based on the eBPF program according to claim 1 is characterized in that: When the data packet reaches the eBPF kernel state program of the eBPF program, the eBPF kernel state program makes a decision on the forwarding of the data packet based on the recorded content of the data structure. If the business load container of the backend service corresponding to the data packet does not meet the service conditions, the eBPF kernel state program modifies the data packet, modifies the data packet header to the data packet reaching the user state program, and stores the original information in the data packet in the structure socketbuffer, and forwards the modified data packet to the user state program through the eBPF user state program; The user-state program caches the received data packets. When the user-state program receives the service load container availability notification sent by the Autoscaler component, it modifies the data packet header to reach the service load container of the corresponding backend service, and sends the modified data packet to the service load container of the corresponding backend service.
4. The knative automatic capacity expansion method based on the eBPF program according to claim 1 is characterized in that: The user-mode program uses the Envoy program, which is an open source high-performance proxy.
5. The knative automatic capacity expansion method based on the eBPF program according to claim 1 is characterized in that: The data stream is a TCP / UDP data stream.
6. A knative automatic expansion system based on eBPF program, characterized in that: Used to implement automatic capacity expansion based on knative specifications through a knative automatic capacity expansion method based on an eBPF program as described in any one of claims 1 to 5, the system comprising an eBPF program component, an Autoscaler component, and a user-mode program component; For kubernetes cluster nodes, each node operating system runs eBPF program components and user-mode program components. The user-mode program component serves as the node's seventh-layer proxy, with network proxy, load balancing, and service discovery functions. The eBPF program component serves as the node's fourth-layer proxy. The eBPF program component is executed as follows through the eBPF program: monitoring the data flow entering the fourth layer proxy of the node, and monitoring the current network operation status as monitoring information, and creating a data structure in the eBPF program, and recording the available status of the business load container corresponding to each backend service through the data structure; When the eBPF program monitors the data flow entering the fourth-layer proxy, the eBPF program component uses the eBPF program to perform the following: synchronize the data flow related information and monitoring information to the Autoscaler component, and determine whether there is a business load container of the backend service corresponding to the data flow through the record of the data structure. If not, send a capacity expansion event notification to the Autoscaler component; correspondingly, the Autoscaler component is used to perform the following: based on the data flow related information, monitoring information, capacity expansion event notification and the current state of the business responsible containers of each backend service, make a decision on the capacity expansion of the business load container, and return a response to the eBPF program component; correspondingly, the eBPF program component uses the eBPF program to update its local data structure based on the response; When the data flow entering the fourth-layer proxy establishes a connection with the eBPF program, the eBPF program component uses the eBPF program to execute the following: make decisions on the forwarding of data packets based on the content recorded in the data structure, and forward the data packets directly to the corresponding business load container, or forward the data packets to the user-state program; correspondingly, the user-state program component uses the user-state program to execute the following: cache data packets, and when the Autoscaler component expands the business load container of the backend service related to the data flow and notifies the user-state program that the business load container is available, forward the data packet to the business load container of its corresponding backend service.
7. The knative automatic capacity expansion system based on eBPF program according to claim 6 is characterized in that: The eBPF program includes an eBPF kernel-mode program and an eBPF user-mode program; The eBPF kernel-mode program is used to monitor the data flow entering the node's fourth-layer proxy and monitor the current network operation status as monitoring information, and synchronize the data flow related information and monitoring information to the Autoscaler component; The eBPF kernel-mode program creates a data structure locally, records the available status of the business load containers corresponding to the current backend services through the data structure, and determines whether there is a business load container of the backend service corresponding to the data flow based on the record of the local data structure. If not, a capacity expansion event notification is generated and the eBPF user-mode program is called. The eBPF user-mode program is used to send a capacity expansion event notification to the Autoscaler component based on the interface specification of the Autoscaler component; When the data flow entering the fourth-layer proxy establishes a connection with the eBPF kernel-state program, the eBPF kernel-state program is used to make decisions on the forwarding of data packets based on the content recorded in the data structure, and call the eBPF user-state program based on the decision. The eBPF user-state program is used to forward the data packet directly to the corresponding business load container, or forward the data packet to the user-state program.
8. The knative automatic expansion system based on eBPF program according to claim 6 is characterized in that: When the data packet reaches the eBPF kernel state program of the eBPF program, the eBPF kernel state program makes a decision on the forwarding of the data packet based on the recorded content of the data structure. If the business load container of the backend service corresponding to the data packet does not meet the service conditions, the eBPF kernel state program modifies the data packet, modifies the data packet header to the data packet reaching the user state program, and stores the original information in the data packet in the structure socketbuffer, and forwards the modified data packet to the user state program through the eBPF user state program; The user-state program caches the received data packets. When the user-state program receives the service load container availability notification sent by the Autoscaler component, it modifies the data packet header to reach the service load container of the corresponding backend service, and sends the modified data packet to the service load container of the corresponding backend service.
9. The knative automatic expansion system based on eBPF program according to claim 6, characterized in that: The user-mode program uses the Envoy program, which is an open source high-performance proxy.
10. The knative automatic capacity expansion system based on eBPF program according to claim 6, characterized in that: The data stream is a TCP / UDP data stream.
Citation Information
Patent Citations
EBPF-based cloud service topology self-discovery method and system, electronic equipment and storage medium
CN112564967A
Firewall management method and system based on eBPF
CN113949537A
Deployment method and device of single-core operating system in server-free framework based on edge-removed vehicle
CN117176568A
Construction method of universal container network data packet acquisition and forwarding system
CN118573597A
Network transport layer data processing method, and device and storage medium
WO2022257643A1