A micro-service adaptive data transmission method, device, medium and program product
By using aspect-oriented programming components to intercept microservice calls in the treasury system and dynamically selecting data transmission protocols, the performance problem of large data volume transmission during microservice calls was solved, achieving efficient data transmission and resource optimization.
Patent Information
- Application Number
- CN202611447733.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-17
- Publication Date
- 2026-11-24
AI Technical Summary
The existing treasury system faces issues such as memory overflow and inefficient parallel processing when making microservice calls, especially in scenarios with large data volumes where performance shortcomings are significant. Furthermore, the existing solution cannot dynamically adjust the transmission protocol according to the data volume.
When a business microservice calls a declarative interface, the component based on aspect-oriented programming intercepts the call, collects the decision context, and selects either a declarative lightweight data exchange serialization transmission scheme or a third-generation streaming protocol for data transmission based on the decision context, dynamically switching the transmission mode to adapt to different data volume scenarios.
It enables dynamic adjustment of the transmission protocol based on the amount of data without modifying the system, thereby improving the performance of microservice calls, avoiding memory overflow, taking into account hardware resource consumption, and solving the performance bottleneck of large data volume transmission between microservices.
Smart Images

Figure CN123164155A_ABST
Abstract
Description
Technical Field
[0001] This invention can be applied to the field of financial technology, and in particular relates to a microservice adaptive data transmission method, device, medium and program product. Background Technology
[0002] The existing treasury system's microservice calls mostly use a declarative HTTP (Hypertext Transfer Protocol) client + HTTP / 1.1 protocol + JSON (JavaScript Object Notation) serialization scheme. This scheme is suitable for small-volume real-time interaction scenarios such as account balance inquiries, single fund transaction inquiries, and basic information inquiries for a single entity, and can cover most of the daily business needs of the treasury system. However, it also has large-volume scenarios such as batch transaction synchronization, large-volume receipt retrieval, and multi-entity fund aggregation. In addition, the amount of data transmitted between some interface services varies with the size of the enterprise customer. For example, when the number of users is large and the business volume is high, the amount of data transmitted by the interface may greatly exceed the normal level.
[0003] Because the existing solution requires receiving the entire response message at once before parsing it, the data transmission scheme between microservices within the treasury system often results in memory overflow when large data interactions occur. This makes it impossible to work with the database's native batch write interface to achieve efficient parallel processing of large data. Summary of the Invention
[0004] This invention provides a microservice adaptive data transmission method, device, medium, and program product to solve the problem of significant performance shortcomings when the current treasury system makes microservice calls.
[0005] According to one aspect of the present invention, a microservice adaptive data transmission method is provided, comprising: When a business microservice calls a declarative interface, the component based on aspect-oriented programming intercepts the business microservice's call to the declarative interface and collects the declarative interface method. Parse the declarative interface methods to obtain the decision context; Based on the decision context and the traffic splitting criteria, either a declarative lightweight data exchange serialization transmission scheme or a third-generation streaming protocol is selected for data transmission.
[0006] According to another aspect of the present invention, a microservice adaptive data transmission apparatus is provided, comprising: The declarative interface interception module is used to intercept calls to declarative interfaces by business microservices based on aspect-oriented programming components, and to collect the declarative interface methods. The interface method parsing module is used to parse declarative interface methods to obtain the decision context; The data transmission module is used to select either a declarative lightweight data exchange serialization transmission scheme or a third-generation streaming protocol for data transmission based on the decision context and the traffic splitting conditions.
[0007] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising: At least one processor; and a memory communicatively connected to said at least one processor; The memory stores a computer program that can be executed by the at least one processor, which is then executed by the at least one processor to enable the at least one processor to execute the microservice adaptive data transmission method according to any embodiment of the present invention.
[0008] According to another aspect of the present invention, a computer-readable storage medium is provided, the computer-readable storage medium storing computer instructions for causing a processor to execute and implement the microservice adaptive data transmission method according to any embodiment of the present invention.
[0009] According to another aspect of the present invention, a computer program product is provided, the computer program product comprising a computer program that, when executed by a processor, implements the microservice adaptive data transmission method according to any embodiment of the present invention.
[0010] The technical solution of this invention intercepts calls to declarative interfaces by business microservices using aspect-oriented programming components, collects the declarative interface methods, parses them to obtain a decision context, and then selects either a declarative lightweight data exchange serialization transmission scheme or a third-generation streaming protocol for data transmission based on the decision context and traffic splitting conditions. The decision context in this solution accurately characterizes the amount of data interacting between microservices within the treasury system. Therefore, by using traffic splitting conditions and the decision context, the actual data volume level of the current data interaction scenario between microservices can be determined, and corresponding data transmission schemes can be allocated for different data volume interaction scenarios. This eliminates the need to independently build a remote procedure call framework service cluster, avoids maintaining two sets of interfaces and business implementations, improves microservice call performance while considering server hardware resource consumption, and solves the significant performance bottleneck problem of current treasury systems when making microservice calls. Without system modification, it automatically switches to the appropriate data transmission method for the transmission scenario, overcoming the performance bottleneck of large-volume data transmission between microservices.
[0011] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description
[0012] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0013] Figure 1 This is a flowchart of a microservice adaptive data transmission method provided in Embodiment 1 of the present invention; Figure 2 This is a flowchart of a microservice adaptive data transmission method provided in Embodiment 2 of the present invention; Figure 3 This is a schematic diagram of a complete data transmission execution process between microservices in a treasury system, provided in Embodiment 3 of the present invention. Figure 4 This is a schematic diagram of the structure of a microservice adaptive data transmission device provided in Embodiment 4 of the present invention; Figure 5 A schematic diagram of an electronic device that can be used to implement embodiments of the present invention is shown. Detailed Implementation
[0014] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0015] It should be noted that the terms "current," "target," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0016] Example 1 Figure 1 This is a flowchart of a microservice adaptive data transmission method provided in Embodiment 1 of the present invention. This embodiment is applicable to situations where high-volume and low-volume adaptive data transmission occurs between microservices. This method can be executed by a microservice adaptive data transmission device, which can be implemented in hardware and / or software and can be configured in an electronic device. Figure 1 As shown, the method includes: Step 110: When a business microservice calls a declarative interface, intercept the business microservice's call to the declarative interface based on the aspect-oriented programming component, and collect the declarative interface method.
[0017] Among these, business microservices can be microservices deployed within the treasury system. Microservices are a software architecture design pattern that refers to breaking down a large, monolithic application into a set of independent, autonomous, and lightweight small services according to business domain boundaries. Each service focuses on a single business capability, is independently developed, deployed, scaled, and maintained, and communicates and collaborates with other services through standardized interfaces (HTTP, Remote Procedure Call, message queues), collectively forming a complete business system. Aspect-Oriented Programming (AOP) components can be modular cross-cutting concern components within the Java enterprise application development framework AOP. Declarative interfaces can be declarative HTTP client interfaces, such as Feign (a declarative HTTP client that allows developers to initiate remote service calls as if calling local methods by defining interfaces and annotations). Declarative interface methods can be abstract methods defined in declarative interfaces. Remote Procedure Call (RPC) is a computer communication protocol and inter-process communication technology that allows programs to transparently call another computer or subroutines / services in different address spaces over a network, as if calling local functions, without requiring developers to explicitly code the complex details of underlying network communication, serialization, etc.
[0018] In this embodiment of the invention, when a business microservice calls a declarative interface annotated with a remote HTTP service, the business microservice's call to the declarative interface can be intercepted globally using an aspect-oriented programming component, so as to further collect the declarative interface methods defined in the declarative interface.
[0019] Step 120: Parse the declarative interface method to obtain the decision context.
[0020] The decision context can be a context used to decide how data is transmitted between microservices.
[0021] In this embodiment of the invention, declarative interface methods can be annotated and parameter parsed to obtain a decision context related to the decision on the data transmission method between microservices.
[0022] Step 130: Based on the decision context and the traffic splitting criteria, select either the declarative lightweight data exchange serialization transmission scheme or the third-generation streaming protocol for data transmission.
[0023] The traffic splitting criteria can be used to distinguish between different data volume interaction scenarios between microservices. Optionally, the traffic splitting criteria can be pre-defined for small data volume interaction scenarios and large data volume interaction scenarios. Small data volume interaction scenarios can be defined as the first data volume interaction scenario, and large data volume interaction scenarios can be defined as the second data volume interaction scenario. The declarative lightweight data exchange serialization transmission scheme can be a remote call combined communication mode that initiates calls through declarative interfaces, uses the underlying HTTP / 1.1 protocol, and transmits data serialized in JSON format. The third-generation streaming protocol can be a third-generation streaming binary protocol designed under the HTTP-based remote procedure call communication protocol specification, capable of supporting a binary server-side streaming communication mode for streaming remote procedure calls. The server-side streaming communication mode allows the server to continuously push binary shards to the client. The client receives the shards, performs incremental parsing, aggregates, and batch inserts them into the local database. JSON is a text format that requires complex string processing such as lexical analysis and type conversion character by character during parsing, which consumes a lot of CPU resources. Compared with binary protocols, the message size is larger for the same amount of business data. Relying solely on file compression programs can only reduce the transmission size, but cannot eliminate the CPU overhead caused by reflection serialization.
[0024] In this embodiment of the invention, the data transmission method between microservices can be determined according to the traffic splitting judgment conditions and the decision context. In the case of small data volume interaction scenarios, a declarative lightweight data exchange serialization transmission scheme can be selected for data transmission between microservices, or a third-generation streaming protocol can be selected for data transmission between microservices in the case of large data volume interaction scenarios. That is, in the first data volume interaction scenario, a declarative lightweight data exchange serialization transmission scheme can be selected, or in the second data volume interaction scenario, a third-generation streaming protocol can be selected for data transmission between microservices.
[0025] The technical solution of this invention intercepts calls to declarative interfaces by business microservices using aspect-oriented programming components, collects the declarative interface methods, parses them to obtain a decision context, and then selects either a declarative lightweight data exchange serialization transmission scheme or a third-generation streaming protocol for data transmission based on the decision context and traffic splitting conditions. The decision context in this solution accurately characterizes the amount of data interacting between microservices within the treasury system. Therefore, by using traffic splitting conditions and the decision context, the actual data volume level of the current data interaction scenario between microservices can be determined, and corresponding data transmission schemes can be allocated for different data volume interaction scenarios. This eliminates the need to independently build a remote procedure call framework service cluster, avoids maintaining two sets of interfaces and business implementations, improves microservice call performance while considering server hardware resource consumption, and solves the significant performance bottleneck problem of current treasury systems when making microservice calls. Without system modification, it automatically switches to the appropriate data transmission method for the transmission scenario, overcoming the performance bottleneck of large-volume data transmission between microservices.
[0026] Example 2 Figure 2 This is a flowchart of a microservice adaptive data transmission method provided in Embodiment 2 of the present invention. This embodiment is a specific embodiment based on the above embodiment, and provides a parsing declarative interface method to obtain specific optional implementation methods for the decision context. Figure 2 As shown, the method includes: Step 210: When a business microservice calls a declarative interface, intercept the business microservice's call to the declarative interface based on the aspect-oriented programming component, and collect the declarative interface method.
[0027] Step 220: Identify method annotations in declarative interface methods to obtain batch synchronization forced binary annotation identification results.
[0028] Among them, the batch synchronization forced binary annotation can be used to force data synchronization in binary mode when processing large amounts of data, and is used to force data objects to be stored or transmitted in binary mode.
[0029] In this embodiment of the invention, the declarative interface method can be identified by method annotations to determine whether a batch synchronization forced binary annotation has been added, and the identification result of the batch synchronization forced binary annotation can be obtained.
[0030] Step 230: Traverse the interface parameters in the declarative interface method and calculate the total number of records in the collection and the message byte size.
[0031] The interface input parameters can be a set of parameters written by the caller according to the interface conventions when calling the interface. For example, interface input parameters may include, but are not limited to, path parameters, query parameters, and request header parameters. The total number of records in the set can be the total number of elements included in the set container of the interface input parameters. The message size can be the total number of bytes in the message during a single interface call.
[0032] In this embodiment of the invention, the declarative interface method can be iterated through to obtain the total number of records in the set and the message byte size can be estimated.
[0033] Step 240: Based on the batch synchronization forced binary annotation recognition results, the total number of records in the set, and the message byte size, create a decision context and store the decision context in a thread-local variable.
[0034] Thread-local variables allow each thread to have its own independent copy of the variable. This is a mechanism provided by Java that allows each thread to independently store and access its own copy of data, and is often used to avoid multi-threaded contention.
[0035] In this embodiment of the invention, the batch synchronization forced binary annotation recognition results, the total number of records in the set, and the message byte size can be assembled into a context object to obtain a decision context, which is then stored in a thread-local variable. By assembling context objects, a decision context that accurately represents the amount of data interacting between microservices within the treasury system is generated, providing a data foundation for data transmission routing. Storing the decision context in a thread-local variable avoids multi-threaded contention.
[0036] Step 250: Based on the decision context and the traffic splitting criteria, select either the declarative lightweight data exchange serialization transmission scheme or the third-generation streaming protocol for data transmission.
[0037] In an optional embodiment of the present invention, selecting a declarative lightweight data exchange serialization transmission scheme or a third-generation streaming protocol for data transmission based on the decision context and the traffic splitting determination conditions may include: performing traffic splitting and tagging on the business microservice call request based on the decision context and the traffic splitting determination conditions; selecting a third-generation streaming protocol for data transmission when the traffic splitting tag of the business microservice call request is a binary streaming tag; and selecting a declarative lightweight data exchange serialization transmission scheme for data transmission when the traffic splitting tag of the business microservice call request is a default link tag.
[0038] Here, the business microservice call request can be a call request from a business microservice to a declarative interface. The traffic splitting tag can be an identifier written in the request header during traffic splitting tagging. The binary streaming identifier can be an identifier indicating that data transmission needs to be performed according to a third-generation streaming protocol. The default link identifier can be an identifier indicating that data transmission needs to be performed according to a declarative lightweight data exchange serialization transmission scheme.
[0039] In this embodiment of the invention, the data volume interaction scenario corresponding to the decision context can be determined based on the traffic splitting judgment conditions. Based on this scenario, the request headers of business microservice call requests are tagged for traffic splitting. When the data volume interaction scenario is the second data volume interaction scenario, a binary streaming identifier is written to the request header of the business microservice call request. When the data volume interaction scenario is the first data volume interaction scenario, a default link identifier is written to the request header. This ensures that when the traffic splitting tag identifier of the business microservice call request is identified as a binary streaming identifier, data transmission is performed based on the third-generation streaming protocol. When the traffic splitting tag identifier of the business microservice call request is identified as a default link identifier, data transmission is performed based on a declarative lightweight data exchange serialization transmission scheme. That is, small data volume transmissions between business microservices automatically use the original link, retaining the advantages of convenient debugging and a mature operation and maintenance ecosystem. Large data volume transmissions automatically switch to the binary streaming transmission link, improving transmission and parsing efficiency from the underlying layer.
[0040] In an optional embodiment of the present invention, selecting a third-generation streaming protocol for data transmission may include: terminating the construction of the Hypertext Transfer Protocol request for the business microservice call request, switching to a remote call client of the third-generation streaming protocol, and having the remote call client initiate a business microservice call request to the remote call server; based on the remote call server, converting the business data transmission object in the business microservice call request into a protocol buffer object; and after the protocol buffer object is fragmented, having the remote call server transmit the data via the third-generation streaming protocol.
[0041] In this context, the remote call server can be a server for remote procedure calls. The remote call client can be a client for remote procedure calls. The business data transmission object can be a data transmission object from the business layer. The protocol buffer object can be a language-independent and platform-independent data serialization format object.
[0042] Specifically, when determining to use the third-generation streaming protocol for inter-microservice data transmission, it is first necessary to terminate the construction of the Hypertext Transfer Protocol (HTTP) request for the business microservice call request, switch the declarative HTTP client to the remote invocation client of the third-generation streaming protocol, and have the remote invocation client initiate the business microservice call request to the remote invocation server. Further, based on the remote invocation server, the business data transmission object in the business microservice call request is converted into a protocol buffer object, which is then segmented. The segmented data fragments are then transmitted to the remote invocation client based on the third-generation streaming protocol, and the remote invocation client writes them to the target database. By splitting a large amount of data into data fragments before sending them to the remote invocation client, memory overflow and network congestion caused by excessively large single remote procedure call request bodies can be avoided.
[0043] In an optional embodiment of the present invention, while selecting the third-generation streaming protocol for data transmission, the method may further include: when a remote call server timeout, disconnection, or abnormal illegal instruction is detected, replacing the binary streaming identifier in the business microservice call request with the default link identifier.
[0044] Among them, abnormal and illegal instructions can refer to the detection of protocol control flags, illegal message type identifiers, and malformed message control instructions that do not conform to the third-generation streaming protocol and protocol buffer encoding specifications during the incremental parsing of binary data fragments pushed by the remote call client to the remote call server. This belongs to the application layer protocol parsing abnormality, which is different from the central processing unit hardware instruction abnormality.
[0045] In this embodiment of the invention, it is possible to monitor in real time whether the remote call server experiences call timeout, disconnection, or abnormal illegal instruction. If any of the above situations occur, the binary streaming identifier in the business microservice call request is replaced with the default link identifier, i.e., a degraded retry declarative lightweight data exchange serialization transmission scheme is implemented. This automatically switches to the backup scheme when an anomaly occurs in the transmission of data through the third-generation streaming protocol, avoiding financial compliance risks such as inconsistencies in reconciliation caused by the interruption of batch synchronization tasks.
[0046] In an optional embodiment of the present invention, after selecting a declarative lightweight data exchange serialization transmission scheme or a third-generation streaming protocol for data transmission based on the decision context and the flow determination conditions, the method may further include: encapsulating remote call receipt data into a declarative HTTP client standard response object; and clearing the context of thread-local variables based on the cleanup code block in the aspect-oriented programming component.
[0047] Specifically, remote call receipt data can be feedback data sent by the remote call server to the request sender after receiving a business microservice call request, used to indicate the success or failure of the request reception. The declarative format can be the declarative HTTP client standard. The cleanup block can be a keyword block in the exception handling mechanism of an aspect-oriented programming component that is always executed until the code is finished. The declarative HTTP client standard response object can be a Java object used by the declarative HTTP client to encapsulate the HTTP response.
[0048] In this embodiment of the invention, the receipt data returned by the remote call server after receiving the business microservice call request can be converted into a declarative HTTP client standard response object, ensuring that the upper-layer business is unaware of it, and the context of thread-local variables is cleared based on the cleanup code block in the aspect-oriented programming component to prevent memory leaks from thread pool reuse.
[0049] In an optional embodiment of the present invention, before encapsulating the remote call receipt data into a declarative HTTP client standard response object, the method may further include: using a remote call client, based on an incremental deserialization mechanism, parsing the data fragments of the protocol buffer object, and aggregating the data according to a preset number of data entries or a preset time window to obtain target aggregated data; and using a remote call client, after batch writing the target aggregated data into the target database, generating remote call receipt data.
[0050] The preset number of data rows can be the number of data rows required for a single data aggregation. The preset time window can be a preset time range. The target aggregation data can be the aggregation result of data sharding aggregation. The target database can be a relational database used in the information technology innovation industry.
[0051] In this embodiment of the invention, the remote call client can perform single-data parsing on the data fragments of the protocol buffer object sent by the business microservice according to the incremental deserialization mechanism, and write the parsed single data into a thread-safe buffer queue in memory. Then, according to a preset number of data entries or a preset time window, the data in the thread-safe buffer queue is aggregated to obtain target aggregated data, and the target aggregated data is written to the target database in batches. This can cooperate with the original batch write interface of the target database in the case of large-scale data interaction to achieve high-parallel processing of large data. After the target aggregated data is written to the target database in batches, remote call receipt data sent to the business microservice can also be generated.
[0052] The technical solution of this invention intercepts the calls to declarative interfaces by business microservices using aspect-oriented programming components, collects the declarative interface methods, identifies method annotations in the declarative interface methods, obtains batch synchronization forced binary annotation identification results, and then iterates through the interface parameters in the declarative interface methods to calculate the total number of collection records and the message byte size. Based on the batch synchronization forced binary annotation identification results, the total number of collection records, and the message byte size, a decision context is created and stored in a thread-local variable. Furthermore, based on the decision context and the flow determination conditions, a declarative lightweight data exchange serialization transmission scheme or a third-generation streaming protocol is selected for data transmission. The decision context in this solution can accurately characterize the amount of data exchanged between microservices within the treasury system. Therefore, by using the traffic splitting criteria and decision context, the actual data volume level of the current data interaction scenario between microservices can be determined, and corresponding data transmission schemes can be allocated for different data volume interaction scenarios. This eliminates the need to independently build a remote procedure call framework service cluster, avoids maintaining two sets of interfaces and business implementations, improves the performance of microservice calls, and takes into account the consumption of server hardware resources. It solves the problem of significant performance shortcomings when the current treasury system makes microservice calls. Without system modification, it automatically switches to the data transmission method that adapts to the transmission scenario, breaking through the performance bottleneck of large data volume data transmission between microservices.
[0053] Example 3 Embodiment 3 of the present invention provides an optional embodiment of an adaptive transmission and parsing method for large data volume calls between microservices in a treasury system oriented towards a domestic IT innovation environment. Specific implementation details can be found in the following embodiments. Technical terms that are the same as or corresponding to those in the above embodiments will not be repeated here.
[0054] The treasury system's microservice-to-microservice large-volume data call adaptive transmission and parsing method relies on aspect-oriented programming components and Feign's native request interceptor to achieve non-intrusive interception of business code. It constructs a thread-level decision context by collecting batch tags and input parameter data information of the microservice call interfaces through aspects. Then, a protocol decision engine automatically determines the communication link based on dynamically configured thresholds, using custom request headers as traffic routing tags. This constructs a three-layer decoupled architecture: the Feign global interception adaptation layer, the adaptive protocol intelligent decision engine, and the streaming incremental pipeline processing layer. The Feign native request interceptor is used to uniformly process common logic before request sending, such as dynamically adding HTTP headers.
[0055] By modifying the native Feign client, automatic traffic splitting is implemented. Small-volume query requests continue to use the original declarative lightweight data exchange serialization transmission link to ensure ease of development and maintenance. Large-volume data synchronization requests automatically switch to the binary streaming transmission channel. This is complemented by automatic mapping of data transmission objects to data serialization formats and automatic data fragmentation for transmission. The server-side constructs a three-layer high-performance concurrent queue framework with an asynchronous pipeline to achieve parallel database loading by receiving binary fragments, incrementally parsing data line by line, and calling the target database's batch interface. At the same time, a three-level automatic degradation mechanism is set up at the hardware instruction level, link level, and global channel. When the binary streaming link encounters CPU instruction incompatibility, network timeout, or service congestion failure, it can seamlessly switch back to the original link for retry. The entire process does not require modification of the Feign interface, business data transmission objects, or business logic of the existing project, taking into account the compatibility of the existing system, hardware adaptation capabilities, and performance of large-volume data synchronization transmission and parsing.
[0056] Figure 3 This is a schematic diagram of a complete data transmission execution process between microservices in a treasury system, provided in Embodiment 3 of the present invention. Figure 3 As shown: 1) Business microservices call remote interfaces marked with @FeignClient (an annotation in the Spring microservice framework of Java used to declaratively call remote HTTP services. Its core function is to turn a remote service interface into a Java interface, which can be called as if it were a local method), i.e., declarative interfaces.
[0057] 2) Aspect-oriented programming components globally intercept and collect decision context: The aspect-oriented programming component intercepts declarative interface methods, identifies method annotations for these methods, determines whether to add batch synchronization forced binary annotations, iterates through the interface parameters, counts the total number of collection records, and estimates the message size in bytes. It then assembles the identified method annotations, the total number of collection records, and the message size into a context and stores it in thread-local variables.
[0058] 3) Traffic splitting and tagging based on Feign interceptors and an adaptive protocol decision engine: Upon entering the Feign native request flow, a custom request interceptor is triggered; the thread-local decision context is read from the thread-local variable; the adaptive protocol decision engine's traffic splitting criteria are called to make a judgment, a traffic splitting tag is written to the request header, and the general business request header is passed through. The adaptive protocol decision engine is used to determine the transmission link that the current call should use based on the decision context and dynamically configurable traffic splitting thresholds.
[0059] The criteria for traffic splitting can be the presence of a forced binary annotation for synchronization, a total number of records in the set ≥ 10,000, or a message size ≥ 1MB. The thresholds for the total number of records in the set and the message size can be dynamically configured. If the decision context meets the traffic splitting criteria, the binary stream identifier "Adaptive-Protocol=TRIPLE_STREAM" will be written to the request header. If the decision context does not meet the traffic splitting criteria, the default link identifier "X-Adaptive-Protocol=FEIGN_JSON" will be written to the request header.
[0060] 4) Data transmission offloading between microservices When the traffic routing tag for business microservice call requests is a binary streaming identifier, a third-generation streaming protocol is used for data transmission. The specific process is as follows: the native HTTP request construction logic is terminated, the remote call client of the third-generation streaming protocol is switched, and the remote call client initiates a request to the remote call server; the remote call server automatically maps the business data transmission object to a protocol buffer object; the remote call server automatically segments a large number of protocol buffer objects and sends binary messages through a streaming long connection in the server-side streaming communication mode; the remote call client receives the protocol buffer object fragments, performs incremental parsing in a three-layer pipeline, writes them in batches to the target database, and provides streaming receipts of binary data formatted as a data sequence; the business microservice reverse maps the data sequence formatted object to a business data transmission object and returns it to the upper-layer business; the target database can be a domestic database with a native batch write interface.
[0061] If a remote call to the service server results in a timeout, disconnection, or illegal instruction exception, the degradation logic is triggered, the routing tag in the routing request header is cleared, and the default link is retried.
[0062] When the traffic routing tag for a business microservice call request is set to the default link identifier, data transmission is performed according to the declarative lightweight data exchange serialization transmission scheme.
[0063] 5) Return the result and release resources. The binary return result is encapsulated as a standard declarative HTTP client response object, which is not noticed by the upper-layer business logic; the cleanup code block in the aspect-oriented programming component clears the context within the thread-local variables to prevent memory leaks from being reused by the thread pool.
[0064] This solution implements a three-layer pipeline for incremental parsing and batch writing to the target database. At the access layer, server-side streaming supported by the third-generation streaming protocol is used. The data provider splits large amounts of data into multiple small packets, i.e. fragments, and continuously sends them to the data receiver through the multiplexing channel of Hypertext Transfer Protocol version 2, avoiding memory overflow and network congestion caused by excessively large single remote procedure call request bodies.
[0065] After receiving streaming data at the parsing layer data receiver, an incremental deserialization mechanism is employed to avoid loading the entire request body into memory. Each parsed data entry is written to a thread-safe buffer queue in memory and aggregated in batches (e.g., 1000 entries) or within a target time window (e.g., 50ms). The incremental parsing process can further enable SIMD (Single Instruction, Multiple Data) vectorized parsing based on the capabilities of domestic CPU hardware, improving the speed of fragmented parsing. When incompatible instructions are encountered, it automatically degrades to scalar parsing. This solution is compatible with domestically developed CPU hardware and can enable SIMD vectorized incremental parsing based on hardware characteristics, reducing CPU overhead during the parsing of large volumes of financial transactions.
[0066] At the disk write layer, a separate backend consumer thread pool retrieves data in batches from the buffer queue and calls the target database's native batch write interface to write it to disk all at once. Simultaneously, the remote call server's sharding and sending rate can be adjusted based on the database write throughput to achieve end-to-end backpressure balancing.
[0067] This solution features zero business intrusion and low risk of modifying existing systems: Leveraging the Java Spring microservice framework and native Feign extensions, it achieves transparent interception and switching without modifying existing Feign interfaces, data transfer objects, or business code; only annotations need to be added to batch interfaces, adapting to the strict change control requirements of the treasury system. Small data transfers between services automatically reuse the original link, retaining the advantages of convenient debugging and a mature operation and maintenance ecosystem. Large-volume fund synchronization automatically switches to binary streaming transmission, improving transmission and parsing efficiency from the ground up, adapting to intelligent dual-link traffic splitting, and balancing the advantages of both scenarios. It adopts a server-side streaming communication mode for fragmented transmission, coupled with a three-layer asynchronous pipeline, enabling data to be received, parsed incrementally line by line, and written to the database in batches simultaneously. This eliminates the need to load complete messages into memory, solving memory overflow issues in massive data scenarios, fully leveraging the database's batch write capabilities, and significantly reducing the resource consumption of the domestic IT server. In the event of instruction incompatibility anomalies, network timeouts, or service congestion in the binary link, it can seamlessly switch back to a mature link for retry, avoiding financial compliance risks such as inconsistencies in reconciliation caused by interruptions in batch synchronization tasks. It is compatible with the full-stack environment of domestic IT innovation, reducing the cost of operation and maintenance. All original operation and maintenance components such as authentication, encryption, link tracing, log monitoring, and bastion host auditing are reused without the need for secondary development and adaptation for binary links. It supports dynamic configuration of thresholds and canary traffic, and the deployment can be carried out in stages with canary volume release, and the iteration is stable and controllable.
[0068] In summary, this solution provides a system upgrade approach that offers a single-interface adaptive switching solution with zero business modifications. It addresses performance issues when transferring large amounts of data between internal services using an existing treasury system, ensuring system availability and stability. It eliminates the need for parallel deployment of independent remote procedure call clusters and the maintenance of two sets of interfaces and business code, avoiding a doubling of workload for domestic middleware, operations and maintenance, and security adaptation. It completely resolves the issues of high hardware resource consumption, high business restructuring risks, and the difficulty in implementing such solutions in treasury and financial systems. Furthermore, it addresses the problem of rigid and inflexible data transmission protocols between services, where the data transmission parsing protocol is statically selected during deployment and cannot be dynamically adjusted based on the data characteristics of a single request. This solution enables dynamic selection of the optimal strategy based on data characteristics, achieving low CPU overhead and low memory usage adaptive data transmission on domestically developed hardware.
[0069] Example 4 Figure 4 This is a schematic diagram of a microservice adaptive data transmission device provided in Embodiment 4 of the present invention. Figure 4 As shown, the device includes: The declarative interface interception module 310 is used to intercept calls to declarative interfaces by business microservices based on aspect-oriented programming components, and to collect the declarative interface methods. The interface method parsing module 320 is used to parse declarative interface methods to obtain the decision context. The data transmission module 330 is used to select either a declarative lightweight data exchange serialization transmission scheme or a third-generation streaming protocol for data transmission based on the decision context and the traffic splitting conditions.
[0070] The technical solution of this invention intercepts calls to declarative interfaces by business microservices using aspect-oriented programming components, collects the declarative interface methods, parses them to obtain a decision context, and then selects either a declarative lightweight data exchange serialization transmission scheme or a third-generation streaming protocol for data transmission based on the decision context and traffic splitting conditions. The decision context in this solution accurately characterizes the amount of data interacting between microservices within the treasury system. Therefore, by using traffic splitting conditions and the decision context, the actual data volume level of the current data interaction scenario between microservices can be determined, and corresponding data transmission schemes can be allocated for different data volume interaction scenarios. This eliminates the need to independently build a remote procedure call framework service cluster, avoids maintaining two sets of interfaces and business implementations, improves microservice call performance while considering server hardware resource consumption, and solves the significant performance bottleneck problem of current treasury systems when making microservice calls. Without system modification, it automatically switches to the appropriate data transmission method for the transmission scenario, overcoming the performance bottleneck of large-volume data transmission between microservices.
[0071] Optionally, the interface method parsing module 320 is used to identify the method annotations in the declarative interface method and obtain the batch synchronization forced binary annotation recognition result; traverse the interface input parameters in the declarative interface method, calculate the total number of collection records and the message byte size; create the decision context according to the batch synchronization forced binary annotation recognition result, the total number of collection records and the message byte size, and store the decision context in a thread-local variable.
[0072] Optionally, the data transmission module 330 is used to perform traffic splitting and tagging on the business microservice call request according to the decision context and traffic splitting judgment conditions; when the traffic splitting tag of the business microservice call request is a binary streaming tag, a third-generation streaming protocol is selected for data transmission; when the traffic splitting tag of the business microservice call request is a default link tag, a declarative lightweight data exchange serialization transmission scheme is selected for data transmission.
[0073] Optionally, the data transmission module 330 is used to terminate the construction of the Hypertext Transfer Protocol request for the business microservice call request, switch to the remote call client of the third-generation streaming protocol, and have the remote call client initiate the business microservice call request to the remote call server; based on the remote call server, convert the business data transmission object in the business microservice call request into a protocol buffer object; after the protocol buffer object is fragmented, the data is transmitted by the remote call server through the third-generation streaming protocol.
[0074] Optionally, the microservice adaptive data transmission device further includes a degradation transmission module, which is used to replace the binary streaming identifier in the business microservice call request with the default link identifier when the remote call server is detected to have timed out, disconnected, or has an abnormal illegal instruction.
[0075] Optionally, the microservice adaptive data transmission device also includes a post-transmission processing module for encapsulating remote call receipt data into a declarative HTTP client standard response object; and clearing the context of thread-local variables based on the cleanup code block in the aspect-oriented programming component.
[0076] Optionally, a remote call client is used to parse the data fragments of the protocol buffer object based on an incremental deserialization mechanism, and aggregate the data according to a preset number of data entries or a preset time window to obtain target aggregated data; after the target aggregated data is written to the target database in batches by the remote call client, the remote call receipt data is generated.
[0077] The microservice adaptive data transmission device provided in this embodiment of the invention can execute the microservice adaptive data transmission method provided in any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the method.
[0078] Example 5 Figure 5 A schematic diagram of an electronic device that can be used to implement embodiments of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.
[0079] like Figure 5As shown, the electronic device 10 includes at least one processor 11 and a memory, such as ROM 12, RAM 13, etc., communicatively connected to the at least one processor 11. The memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes based on the computer program stored in the ROM 12 or loaded into the RAM 13 from the storage unit 18. The RAM 13 can also store various programs and data required for the operation of the electronic device 10. The processor 11, ROM 12, and RAM 13 are interconnected via a bus 14. An I / O interface 15 is also connected to the bus 14. The ROM 12 is a read-only memory, the RAM 13 is a random access memory, and the I / O interface 15 is an input / output interface.
[0080] Multiple components in electronic device 10 are connected to I / O interface 15, including: input unit 16, such as keyboard, mouse, etc.; output unit 17, such as various types of displays, speakers, etc.; storage unit 18, such as disk, optical disk, etc.; and communication unit 19, such as network card, modem, wireless transceiver, etc. Communication unit 19 allows electronic device 10 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0081] Processor 11 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 11 performs the various methods and processes described above, such as the microservice adaptive data transfer method.
[0082] In some embodiments, the microservice adaptive data transfer method may be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or mounted on electronic device 10 via ROM 12 and / or communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the microservice adaptive data transfer method described above may be performed. Alternatively, in other embodiments, processor 11 may be configured to perform the microservice adaptive data transfer method by any other suitable means (e.g., by means of firmware).
[0083] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0084] Computer programs used to implement the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0085] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, RAM, ROM, erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0086] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0087] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or middleware components (e.g., application servers), or frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.
[0088] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS servers, such as high management difficulty and weak business scalability.
[0089] This application also discloses a computer program product, which includes a computer program that, when executed by a processor, implements the microservice adaptive data transmission method provided in any embodiment of this application. This program product shares the same inventive concept as the microservice adaptive data transmission method disclosed in the embodiments of this application, and therefore will not be described further here.
[0090] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.
[0091] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.
Claims
1. A microservice adaptive data transmission method, characterized in that, include: When a business microservice calls a declarative interface, the component based on aspect-oriented programming intercepts the business microservice's call to the declarative interface and collects the declarative interface method. Parse the declarative interface method to obtain the decision context; Based on the decision context and the traffic splitting criteria, either a declarative lightweight data exchange serialization transmission scheme or a third-generation streaming protocol is selected for data transmission.
2. The method according to claim 1, characterized in that, Parsing the declarative interface method yields the decision context, including: Identify method annotations in the declarative interface methods to obtain batch synchronous forced binary annotation identification results; Iterate through the interface parameters in the declarative interface method to calculate the total number of records in the set and the message size in bytes. Based on the batch synchronization forced binary annotation recognition result, the total number of records in the set, and the message byte size, the decision context is created and stored in a thread-local variable.
3. The method according to claim 2, characterized in that, Based on the decision context and traffic splitting criteria, a declarative lightweight data exchange serialization transmission scheme or a third-generation streaming protocol is selected for data transmission, including: Based on the decision context and the traffic splitting criteria, traffic splitting and tagging are performed on the business microservice call requests. When the traffic splitting tag of the business microservice call request is a binary streaming tag, the third-generation streaming protocol is selected for data transmission; When the traffic routing tagging identifier of the business microservice call request is the default link identifier, the declarative lightweight data exchange serialization transmission scheme is selected for data transmission.
4. The method according to claim 3, characterized in that, Selecting a third-generation streaming protocol for data transmission includes: The construction of the Hypertext Transfer Protocol request for the business microservice call request is terminated, and the system switches to the remote call client of the third-generation streaming protocol, and the remote call client initiates the business microservice call request to the remote call server. Based on the remote call server, the business data transmission object in the business microservice call request is converted into a protocol buffer object; After the protocol buffer object is fragmented, data is transmitted by the remote call server via the third-generation streaming protocol.
5. The method according to claim 4, characterized in that, In addition to selecting a third-generation streaming protocol for data transmission, it also includes: When the remote call server is detected to have timed out, disconnected, or to have an abnormal or illegal instruction, the binary stream identifier in the business microservice call request will be replaced with the default link identifier.
6. The method according to claim 4, characterized in that, After selecting either a declarative lightweight data exchange serialization transmission scheme or a third-generation streaming protocol for data transmission based on the decision context and traffic splitting criteria, the method further includes: Encapsulate remote call receipt data into a declarative HTTP client standard response object; Based on the cleanup block in the aspect-oriented programming component, the context of thread-local variables is cleared.
7. The method according to claim 6, characterized in that, Before encapsulating remote call receipt data into a declarative HTTP client standard response object, it also includes: The remote call client uses an incremental deserialization mechanism to parse the data fragments of the protocol buffer object and aggregates the data according to a preset number of data entries or a preset time window to obtain the target aggregated data. After the target aggregated data is written in batches to the target database in the remote call client, the remote call receipt data is generated.
8. An electronic device, characterized in that, The electronic device includes: At least one processor, and a memory communicatively connected to said at least one processor; The memory stores a computer program that can be executed by the at least one processor, which enables the at least one processor to perform the microservice adaptive data transfer method according to any one of claims 1-7.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that cause a processor to execute the microservice adaptive data transmission method according to any one of claims 1-7.
10. A computer program product, characterized in that, The computer program product includes a computer program that, when executed by a processor, implements the microservice adaptive data transmission method according to any one of claims 1-7.
