Universal traffic replication proxy service system
By designing a universal traffic replication proxy service system containing multiple modules, multiple limitations of existing mirror traffic proxy implementation are solved, flexible mirroring support for different protocols and multiple goals is achieved, real-time performance monitoring and analysis functions are provided, and system availability and security are improved.
Patent Information
- Application Number
- CN202411502990.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-25
- Publication Date
- 2025-03-18
AI Technical Summary
There are multiple restrictions in the existing mirror traffic proxy implementation, including only supporting HTTP protocol or specific TCP protocol, being unable to flexibly compatible with other services, lack of mirroring support for multiple targets, lack of front-end handshake and authentication support after connection establishment, lack of traffic filtering and grayscale publishing functions, online traffic and mirror connection concurrency number is not consistent, failure to count errors and time-consuming in real time, and not integrating the indicator monitoring system.
A universal traffic replication agent service system is designed, including a connection management module, a protocol resolution engine, a handshake authentication engine, a packet filtering module, a replication routing module, a mirror cache module, a response analysis module and an indicator monitoring. Through modular design, the system provides a scalable service provider interface, supports multi-protocol and multi-target mirroring, realizes traffic filtering and grayscale release, ensures connection consistency and traffic distribution, counts performance indicators in real time, and integrates an indicator monitoring system.
It realizes flexible mirroring support for different protocols and multiple goals, ensures the universality and scalability of the system, provides real-time performance monitoring and analysis functions, improves the availability and security of the system, and reduces the impact on online services.
Smart Images

Figure CN119652725A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the field of software technology, and in particular relates to a universal flow replication proxy service system. Background Art
[0002] In Internet applications, it is often necessary to mirror traffic requests in the production environment to the test environment or other monitoring systems for traffic analysis, performance monitoring, and security auditing. This function is particularly important for real-time monitoring and analysis of production traffic without affecting the main production services.
[0003] However, the existing mirror traffic proxy implementation has the following pain points: it only supports HTTP protocol or specific TCP protocol and cannot be flexibly compatible with other services; it lacks support for multiple target mirror services at the same time; it lacks front-end and back-end handshake and authentication support after the connection is established; it lacks traffic screening and grayscale publishing functions; the number of concurrent connections between online traffic and mirrors is not consistent, and different concurrency affects the comparison results; there is a lack of real-time error and time-consuming statistics, and the response to the mirror traffic cannot be parsed and counted; the indicator monitoring system is not integrated, and real-time monitoring and analysis of key performance indicators in the traffic mirroring process cannot be achieved.
[0004] These issues limit the services of existing mirror traffic proxies in different protocols, require the ability to simulate traffic analysis, and need further optimization and improvement to enhance their functionality and scalability. Summary of the invention
[0005] (I) Purpose of the invention
[0006] In order to overcome the above shortcomings, the purpose of the present invention is to provide a universal traffic replication proxy service system to solve the above technical problems.
[0007] (II) Technical solution
[0008] To achieve the above objectives, the technical solutions provided by this application are as follows:
[0009] A universal traffic replication proxy service system includes a connection management module, a protocol parsing engine, a handshake authentication engine, a data packet filtering module, a replication routing module, a mirror cache module, a response analysis module and an indicator monitoring module, wherein:
[0010] The connection management module is used to manage the front-end connection and the back-end connection to ensure the consistency of the number of connections and the one-to-one distribution of the traffic;
[0011] The protocol parsing engine mainly serves the handshake authentication engine, the data packet filtering module and the response analysis module, and provides an extensible service provider interface, allowing users to customize the implementation of protocol parsing to adapt to different protocol requirements;
[0012] The handshake authentication engine implements a complete handshake and authentication process, improving the versatility of the entire system to adapt to different database protocols;
[0013] The packet filter module supports common packet filter functions, including http header rewriting, http request body rewriting and proportional traffic discarding, providing basic support.
[0014] Preferably, the replication routing module is the core module of the proxy service system, which is used to forward the data packets received upstream to the online service and the mirror cache service at the same time. The replicated data packets have been processed by the protocol parsing engine and the data packet filtering module, and then asynchronously sent to the subsequent mirror cache module.
[0015] Preferably, under the Netty framework, the specific implementation of the replication routing module is only to modify the reference count of the data packet. When the image cache module actually sends it to each downstream service or discards it due to excessive delay, the reference count is reduced by one. When the reference count of the data packet is 0, the data packet can be released from the memory. The proxy service system will not actually copy multiple copies of the data packet in the memory, but use zero copy to improve system performance and reduce the impact on online services.
[0016] Preferably, the mirror cache module uses a circular array to cache data packets. The array maintains the latest position and consumption position of the data packet through two pointers, a write pointer and a mirror pointer. The write pointer is used to mark the latest data packet position. When it reaches the end of the array, it will wrap around to the starting position of the array, thereby forming a circular cache; when the write pointer catches up with the mirror pointer, the latest data packet is directly discarded until the mirror pointer position changes.
[0017] Preferably, the response analysis module performs function and performance statistics on the mirror service to assist in comparative analysis of the mirror service and the online service. The proxy service will perform some general statistics when sending requests to the downstream and receiving responses. The general statistics include response time analysis, request quantity statistics, and discarded request packet statistics. Users can obtain comprehensive performance data and visual reports to help achieve efficient system monitoring, performance optimization, and function verification.
[0018] Preferably, the response time analysis is to record and analyze the total response time, average response time, maximum response time and minimum response time of the data packets, which indicators are helpful to evaluate the response performance of the service and identify potential performance bottlenecks;
[0019] The request quantity statistics are the total number of data packet requests processed by the online service and the mirror service. These data provide basic information about the system load and traffic.
[0020] The discarded request packet statistics are statistics on the number of request packets discarded during the traffic mirroring process. This helps to understand the stability and reliability of the system when handling high loads.
[0021] Preferably, the indicator monitoring includes a monitoring program, an agent program aggregates indicator data in memory, and the monitoring program obtains information by regularly calling the indicator interface. Indicator monitoring can assist users in analyzing and comparing online services and mirror services, while identifying anomalies in the agent service itself, thereby promptly handling failures caused by resource or configuration problems and improving system availability.
[0022] Preferably, the connection management module limits the number of connection groups, and each connection group is allocated a cache of a fixed size.
[0023] Preferably, the packet filtering module provides an expandable SPI to achieve more refined traffic processing and control. Through the introduction of this module, the data mirroring traffic service can achieve higher flexibility and adaptability to cope with the ever-changing network environment and business needs.
[0024] Beneficial effects:
[0025] 1. System monitoring and performance analysis: Through the response analysis module and indicator monitoring, service performance is monitored in real time, including response time and number of requests, to promptly identify performance bottlenecks. At the same time, visual reports are provided to help users intuitively understand the system status and perform effective performance optimization.
[0026] 2. Resource optimization and efficient processing: Utilize zero-copy technology and circular cache mechanism to reduce memory usage and CPU usage and improve system performance. The packet filtering module supports refined traffic processing to ensure efficient management of network traffic.
[0027] 3. Flexibility and scalability: Provides an extensible service provider interface, allowing users to customize protocol parsing and handshake authentication, and achieve flexible functional expansion. The SPI plug-in mechanism enables users to easily add or replace implementations, enhancing system adaptability.
[0028] 4. High availability and stability: The connection management module ensures the consistency of the number of connections, limits the number of connection groups, and improves the stability of the connection. Indicator monitoring can identify anomalies in a timely manner, handle failures caused by resource or configuration problems, and ensure high availability of services.
[0029] 5. Security assurance: The handshake authentication engine implements a complete handshake and authentication process, ensuring that only authenticated connections can exchange data, thereby enhancing the security of the system. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] Figure 1is a view of the present invention;
[0031] Figure 2 is a deployment view according to an embodiment of the present invention; DETAILED DESCRIPTION
[0032] In order to make the purpose, technical solutions and advantages of the present invention more clear, the following is a detailed description of the present invention in conjunction with the specific implementation methods and with reference to the attached drawings. Figure 1-2 , the present invention is further described in detail. It should be understood that these descriptions are exemplary only and are not intended to limit the scope of the present invention. In addition, in the following description, descriptions of well-known structures and technologies are omitted to avoid unnecessary confusion of the concept of the present invention.
[0033] The present invention provides a universal traffic replication proxy service system, which is characterized by comprising a connection management module, a protocol parsing engine, a handshake authentication engine, a data packet filtering module, a replication routing module, a mirror cache module, a response analysis module and an indicator monitoring module.
[0034] The connection management module is used to manage the front-end connection and the back-end connection to ensure the consistency of the number of connections and the one-to-one distribution of the traffic; the connection management module limits the number of connection groups, and each connection group is allocated a fixed-size buffer.
[0035] The protocol parsing engine mainly serves the handshake authentication engine, the data packet filtering module and the response analysis module, and provides an extensible service provider interface, allowing users to customize the implementation of protocol parsing to adapt to different protocol requirements;
[0036] The handshake authentication engine implements a complete handshake and authentication process, improving the versatility of the entire system to adapt to different database protocols;
[0037] The packet filter module supports common packet filter functions, including http header rewriting, http request body rewriting and traffic proportional discarding, providing basic support. The packet filter module provides an extensible SPI to achieve more refined traffic processing and control. Through the introduction of this module, the data mirroring traffic service can achieve higher flexibility and adaptability to cope with the ever-changing network environment and business needs.
[0038] The replication routing module is the core module of the proxy service system, which is used to forward the data packets received from the upstream to the online service and the mirror cache service at the same time. The replicated data packets have been processed by the protocol parsing engine and the data packet filtering module, and then asynchronously sent to the subsequent mirror cache module.
[0039] In the Netty framework, the specific implementation of the replication routing module is only to modify the reference count of the data packet. When the image cache module actually sends it to each downstream service or discards it due to excessive delay, the reference count is reduced by one. When the reference count of the data packet is 0, the data packet can be released from the memory. The proxy service system will not actually copy multiple copies of the data packet in the memory, but use zero copy to improve system performance and reduce the impact on online services.
[0040] The mirror cache module handles the scenario where there is a performance difference between the online service and the mirror service. A circular array is used to cache data packets. The array uses two pointers, the write pointer and the mirror pointer, to maintain the latest position and consumption position of the data packet. The write pointer is used to mark the latest data packet position. When it reaches the end of the array, it will wrap around to the beginning of the array, thus forming a circular cache. When the write pointer catches up with the mirror pointer, the latest data packet is directly discarded until the mirror pointer position changes.
[0041] Data packets received from the upstream must be sent to all downstream services at the same time before they can be released, so an effective strategy must be designed to cache or discard data packets. A fixed-length cache array is maintained for each connection, and a pointer is maintained for each downstream mirror service connection. When the delayed data packet of the downstream mirror service with the lowest performance reaches the fixed length of the array, the write pointer will catch up with the consumption pointer, and we will discard the latest data packet. This design can avoid the unlimited growth of proxy memory usage and the impact on availability.
[0042] The response analysis module performs functional and performance statistics on the mirror service, assisting in comparative analysis of the mirror service and the online service. The proxy service will perform some general statistics when sending requests to the downstream and receiving responses. The general statistics include response time analysis, request quantity statistics, and discarded request packet statistics. Users can obtain comprehensive performance data and visual reports to help achieve efficient system monitoring, performance optimization, and functional verification. The indicator data is stored in memory according to certain dimensions and exposed to the outside in the form of an indicator interface. The monitoring system regularly collects aggregated data from the indicator interface.
[0043] The response time analysis is to record and analyze the total response time, average response time, maximum response time and minimum response time of data packets. These indicators are helpful to evaluate the response performance of the service and identify potential performance bottlenecks;
[0044] The request count statistics are the total number of data packet requests processed by online services and mirror services. These data provide basic information about system load and traffic. Online services refer to services that are processing actual requests and responses. They are services that are running in your production environment and are usually services that users actually access. For example, in a website, this may be a server that processes user requests and provides website content.
[0045] The discarded request packet statistics are statistics on the number of request packets discarded during the traffic mirroring process. This helps to understand the stability and reliability of the system when handling high loads.
[0046] The indicator monitoring includes a monitoring program. The agent program aggregates indicator data in memory. The monitoring program obtains information by regularly calling the indicator interface. Indicator monitoring can assist users in analyzing and comparing online services and mirror services, and identify anomalies in the agent service itself, so as to promptly handle failures caused by resource or configuration problems and improve system availability.
[0047] The mirror proxy service uses the netty network framework. By utilizing its Pipeline mechanism, we can flexibly write and assemble custom Handlers during implementation. In the protocol parsing module, we define the PacketCodecEngine interface and provide default implementations of protocols such as http and mysql. We parse the byte stream into objects and pass them to the downstream pipeline. In the handshake authentication module, we define the AuthenticationEngine interface and provide an implementation of the mysql handshake authentication protocol. Only the actual data packets after handshake authentication are passed to the downstream pipeline. Users can implement the protocol parsing and handshake authentication interfaces by themselves, and use custom implementations through SPI plug-ins to improve the scalability of the system.
[0048] System monitoring and performance analysis: Through the response analysis module and indicator monitoring, service performance is monitored in real time, including response time and number of requests, to promptly identify performance bottlenecks. At the same time, visual reports are provided to help users intuitively understand the system status and perform effective performance optimization.
[0049] Resource optimization and efficient processing: Utilize zero-copy technology and circular cache mechanism to reduce memory usage and CPU usage and improve system performance. The packet filtering module supports refined traffic processing to ensure efficient management of network traffic.
[0050] Flexibility and scalability: Provides an extensible service provider interface, allowing users to customize protocol parsing and handshake authentication, and achieve flexible functional expansion. The SPI plug-in mechanism enables users to easily add or replace implementations, enhancing system adaptability.
[0051] High availability and stability: The connection management module ensures the consistency of the number of connections, limits the number of connection groups, and improves the stability of the connection. Indicator monitoring can identify anomalies in a timely manner, handle failures caused by resource or configuration problems, and ensure high availability of services.
[0052] Security assurance: The handshake authentication engine implements a complete handshake and authentication process to ensure that only authenticated connections can exchange data, thereby enhancing the security of the system.
[0053] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0054] The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A universal traffic replication proxy service system, characterized in that: It includes connection management module, protocol parsing engine, handshake authentication engine, data packet filtering module, replication routing module, image cache module, response analysis module and indicator monitoring, among which: The connection management module is used to manage the front-end connection and the back-end connection to ensure the consistency of the number of connections and the one-to-one distribution of the traffic; The protocol parsing engine mainly serves the handshake authentication engine, the data packet filtering module and the response analysis module, and provides an extensible service provider interface, allowing users to customize the implementation of protocol parsing to adapt to different protocol requirements; The handshake authentication engine implements a complete handshake and authentication process, improving the versatility of the entire system to adapt to different database protocols; The packet filter module supports common packet filter functions, including http header rewriting, http request body rewriting and proportional traffic discarding, providing basic support.
2. A universal traffic replication proxy service system according to claim 1, characterized in that: The replication routing module is the core module of the proxy service system, which is used to forward the data packets received from the upstream to the online service and the mirror cache service at the same time. The replicated data packets have been processed by the protocol parsing engine and the data packet filtering module, and then asynchronously sent to the subsequent mirror cache module.
3. A universal traffic replication proxy service system according to claim 2, characterized in that: In the Netty framework, the specific implementation of the replication routing module is only to modify the reference count of the data packet. When the image cache module actually sends it to each downstream service or discards it due to excessive delay, the reference count is reduced by one. When the reference count of the data packet is 0, the data packet can be released from the memory. The proxy service system will not actually copy multiple copies of the data packet in the memory, but use zero copy to improve system performance and reduce the impact on online services.
4. A universal traffic replication proxy service system according to claim 1, characterized in that: The mirror cache module uses a circular array to cache data packets. The array maintains the latest position and consumption position of the data packet through two pointers, the write pointer and the mirror pointer. The write pointer is used to mark the latest data packet position. When it reaches the end of the array, it will wrap around to the starting position of the array, thus forming a circular cache; when the write pointer catches up with the mirror pointer, the latest data packet is directly discarded until the mirror pointer position changes.
5. A universal traffic replication proxy service system according to claim 1, characterized in that: The response analysis module performs function and performance statistics on the mirror service to assist in comparative analysis of the mirror service and the online service. The proxy service will perform some general statistics when sending requests to the downstream and receiving responses. The general statistics include response time analysis, request quantity statistics, and discarded request packet statistics. Users can obtain comprehensive performance data and visual reports to help achieve efficient system monitoring, performance optimization, and function verification.
6. A universal traffic replication proxy service system according to claim 5, characterized in that: The response time analysis is to record and analyze the total response time, average response time, maximum response time and minimum response time of data packets. These indicators are helpful to evaluate the response performance of the service and identify potential performance bottlenecks; The request quantity statistics are the total number of data packet requests processed by the online service and the mirror service. These data provide basic information about the system load and traffic. The discarded request packet statistics are statistics on the number of request packets discarded during the traffic mirroring process. This helps to understand the stability and reliability of the system when handling high loads.
7. A universal traffic replication proxy service system according to claim 1, characterized in that: The indicator monitoring includes a monitoring program. The agent program aggregates indicator data in memory. The monitoring program obtains information by regularly calling the indicator interface. Indicator monitoring can assist users in analyzing and comparing online services and mirror services, and identify anomalies in the agent service itself, so as to promptly handle failures caused by resource or configuration problems and improve system availability.
8. A universal traffic replication proxy service system according to claim 1, characterized in that: The connection management module limits the number of connection groups, and each connection group is allocated a buffer of a fixed size.
9. A universal traffic replication proxy service system according to claim 1, characterized in that: The packet filtering module provides an extensible SPI to achieve more refined traffic processing and control. Through the introduction of this module, the data mirroring traffic service can achieve higher flexibility and adaptability to cope with the ever-changing network environment and business needs.