Transaction closed-loop processing method and system based on double-end collaborative hot update and containerization

By employing a dual-end collaborative hot update and containerized transaction closed-loop processing method, the problems of weak management functionality and performance bottlenecks are solved, achieving efficient and secure real-time transaction processing and dynamic scaling, optimizing the call chain, and improving user experience and resource utilization.

CN121092267APending Publication Date: 2025-12-09ANHUI YACHUANG ELECTRONICS TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511193150.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-08-25
Publication Date
2025-12-09

AI Technical Summary

Technical Problem

In a distributed deployment environment, the management end has weak functions, serious performance bottlenecks, inflexible scaling, complex cross-process or cross-container transaction management, and traditional compensation mechanisms increase latency, affecting user experience.

Method used

It adopts a transaction closed-loop processing method based on dual-end collaborative hot update and containerization, uses AES encrypted storage scripts, compiles and manages instance pools in real time, dynamically expands and shrinks, and optimizes the call chain by utilizing JVM memory sharing and local transaction processing.

Benefits of technology

It improves the security and efficiency of the management terminal, reduces transaction processing time, enhances resource utilization and user experience, and reduces distributed transaction coordination overhead.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121092267A_ABST
    Figure CN121092267A_ABST
Patent Text Reader

Abstract

The invention discloses a transaction closed-loop processing method and system based on double-end collaborative hot update and containerization, and the method comprises the steps: carrying out the encryption storage of a script based on a management end, and pushing the encrypted script to a server; after receiving the script based on the server side, executing decryption and real-time compiling, generating an executable instance and storing the executable instance into a pre-compilation instance pool; the instance is automatically released by the JVM when the reference count returns to zero; the server side is deployed in a Kubernetes cluster in a containerization manner, and the capacity is dynamically expanded and shrunk; the method comprises the following steps of: performing closed-loop processing on a service request by the same server instance: completing multi-step operation through a local database transaction; realizing cross-method state transfer by using JVM memory sharing; the call link depth is constantly a preset value and is directly referenced and executed through a memory. According to the method, the management end pushes the script to the server end, the server end compiles in real time, and Kubernetes containerization capacity expansion and contraction are combined, so that service request closed-loop processing is realized, distributed transaction coordination is eliminated through local transaction and memory sharing, and transaction time consumption is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of transaction closed-loop processing technology, and in particular to a transaction closed-loop processing method and system based on dual-end collaborative hot update and containerization. Background Technology

[0002] Traditional server-side development frameworks, especially in distributed deployment environments, present several key challenges. First, existing management functionalities are generally weak, lacking centralized script encryption storage, version management, and secure push capabilities. This makes management components and deployment processes inefficient and insecure. Second, the server faces performance bottlenecks. In high-concurrency scenarios, the coupling between script compilation and API calls increases response time, impacting user experience. Finally, existing technologies struggle to provide flexible adaptability when scaling up or down services, particularly in containerized deployments. They cannot quickly adjust the number of service instances based on real-time traffic demands, making it difficult to handle sudden traffic fluctuations.

[0003] Furthermore, microservice architectures present even more complex challenges. For instance, while Remote Procedure Call (RPC)-based inter-service communication simplifies service construction and deployment, cross-process or cross-container transaction management becomes exceptionally complex. Traditional compensation mechanisms like the Saga pattern, while capable of handling distributed transactions, introduce additional latency during implementation, sometimes reaching 300-500 milliseconds, severely impacting system response speed and user experience. Simultaneously, the complex, layered call chains further exacerbate latency issues, causing the overall system response time to increase exponentially. This poses a significant challenge for applications requiring high reliability and low latency. Summary of the Invention

[0004] The purpose of this invention is to overcome the shortcomings of the existing technology. To achieve the above objectives, a transaction closed-loop processing method and system based on dual-end collaborative hot update and containerization is adopted to solve the problems mentioned in the background technology.

[0005] A transaction closed-loop processing method and system based on dual-end collaborative hot update and containerization includes the following steps: S1. The script is stored with AES encryption on the management end and pushed to the server via the WSS protocol; S2. After receiving the script, the server performs decryption and real-time compilation to generate an executable instance and store it in the pre-compiled instance pool. S3. The instance pool is managed using the singleton pattern. After a new version instance is loaded, the old version instance is automatically released by the JVM when the reference count reaches zero. S4. The server is deployed in a containerized Kubernetes cluster and dynamically scales up and down based on CPU utilization using HPA. S5. Business requests are processed in a closed loop by the same server instance, and the steps are as follows: Multi-step operations can be completed through local database transactions; Use JVM memory sharing to achieve cross-method state transfer; The call chain depth is kept constant at a preset value, and execution is performed directly through memory references.

[0006] As a further aspect of the present invention: the real-time compilation uses the Groovy engine and JDK8, and the compiled instance is warmed up before its first call.

[0007] As a further aspect of the present invention: the instance pool is managed using a static factory pattern in S3, and the consistency of the script is ensured by verifying the version number and hash value.

[0008] As a further aspect of the present invention: the management terminal in S1 supports script version rollback, and the rollback operation triggers the server to switch to the historical version instance within 150ms.

[0009] As a further aspect of the present invention: the triggering condition for HPA scaling up or down in S4 is that the CPU utilization rate is ≥70%, and the newly scaled Pod automatically loads the script from the database and compiles it.

[0010] As a further aspect of the present invention: the encryption script in S1 adopts a block transmission mechanism, and each block of data does not exceed 1MB.

[0011] As a further aspect of the present invention: in S5, local transactions are declared through annotations, and database connections are reused in the connection pool.

[0012] As a further aspect of the present invention, the cross-method state sharing is guaranteed to have strong consistency through JVM memory-level locks.

[0013] As a further aspect of the present invention: the multi-service operation of the business request is completed within a single instance through atomic transaction submission.

[0014] The second aspect of the technical solution: A system employing a transaction closed-loop processing method based on dual-end collaborative hot update and containerization as described in any of the above, the system comprising a management end and a server end: The management terminal includes a script management module, a monitoring module, and a communication module; The script management module is used to support script uploading, AES encrypted storage, and version control; The monitoring module is used to collect server CPU / memory data in real time; The communication module is used to push encrypted scripts to the server via the WSS protocol; The server-side includes a compilation engine, an instance management module, a transaction execution module, and a containerized deployment module; The compilation engine is used to perform real-time Groovy compilation on the decrypted script; The instance management module is used to maintain the pre-compiled instance pool, and adopts the singleton pattern and reference counting mechanism; The transaction execution module is used to process requests in a closed loop within a single instance, and to achieve atomic operations through local transactions and memory sharing. The containerized deployment module is used to automatically scale Pods up and down based on CPU utilization using Kubernetes HPA.

[0015] Compared with the prior art, the present invention has the following technical advantages: Using the above technical solution, the management end stores the script with AES encryption and securely pushes it to the server based on the WSS protocol. After the server performs real-time compilation, the executable instance is stored in a pre-compiled instance pool, and the instance lifecycle is managed using a singleton pattern and reference counting mechanism. The server is deployed on a Kubernetes cluster and dynamically scales up and down based on CPU utilization using HPA. Business requests are processed in a closed loop by the same server instance, using local database transactions to complete multi-step operations, passing state through JVM memory sharing, and methods are executed through direct memory references, achieving a constant call chain depth. Local transactions replace distributed coordination, reducing transaction time. Call chain depth is compressed, reducing method call time. Automatic scaling handles traffic peaks, improving resource utilization. Attached Figure Description

[0016] The specific embodiments of the present invention will now be described in detail with reference to the accompanying drawings: Figure 1 This is a schematic diagram illustrating the steps of the transaction closed-loop processing method according to an embodiment of this application; Figure 2 This is a timing diagram for script management in an embodiment of this application. Figure 3 This is a transaction control timing diagram of an embodiment disclosed in this application; Figure 4 This is a timing diagram of conventional microservice transaction control in an embodiment of this application. Detailed Implementation

[0017] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. 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 are within the scope of protection of the present invention.

[0018] Please refer to Figure 1 In this embodiment of the invention, a transaction closed-loop processing method based on dual-end collaborative hot update and containerization includes the following steps: S1. The script is stored with AES encryption on the management end and pushed to the server via the WSS protocol; In this embodiment, the management terminal in S1 supports script version rollback. The rollback operation triggers the server to switch to the historical version instance within 150ms.

[0019] Encrypted storage using scripts: like Figure 2 As shown, the diagram is a sequence diagram for script management; Specifically, the script file is encrypted using the AES-256-CBC algorithm; The version snapshot mainly includes: encryption script, compilation parameters, dependency library list, and digital signature (SHA-256).

[0020] In this embodiment, the encryption script in S1 adopts a block transmission mechanism, and each block of data does not exceed 1MB.

[0021] Specifically, configure a secure push protocol: Data transmission is based on the WSS security protocol; Data transmission is encrypted in blocks (1MB each) to avoid timeouts during large file transfers.

[0022] S2. After receiving the script, the server performs decryption and real-time compilation to generate an executable instance and store it in the pre-compiled instance pool. In this embodiment, real-time compilation uses the Groovy engine and JDK8, and the compiled instance is warmed up before its first call.

[0023] S3. The instance pool is managed using the singleton pattern. After a new version instance is loaded, the old version instance is automatically released by the JVM when the reference count reaches zero. In this embodiment, the instance pool is managed using a static factory pattern in S3, and the consistency of the script is ensured by verifying the version number and hash value.

[0024] S4. The server is deployed in a containerized Kubernetes cluster and dynamically scales up and down based on CPU utilization using HPA. In this embodiment, the trigger condition for HPA scaling up or down in S4 is that the CPU utilization rate is ≥70%, and the newly expanded Pod automatically loads the script from the database and compiles it.

[0025] S5. Business requests are processed in a closed loop by the same server instance, and the steps are as follows: Multi-step operations can be completed through local database transactions; Use JVM memory sharing to achieve cross-method state transfer; The call chain depth is kept constant at a preset value, and execution is performed directly through memory references.

[0026] like Figure 3 As shown, the diagram is a transaction control sequence diagram; In this embodiment, local transactions in S5 are declared through annotations, and database connections are reused in the connection pool.

[0027] In this embodiment, cross-method state sharing ensures strong consistency through JVM memory-level locks.

[0028] In this embodiment, the multi-service operation of the business request is completed within a single instance through atomic transaction submission.

[0029] Specifically: 1. Real-time compilation and instance pools: The management console pushes scripts to the server. The server compares the scripts and, if any changes are found, recompiles the script, creates a new instance, and adds it to the instance pool. New requests can then utilize the new instance. 2. Containerized scaling design: HPA dynamically adjusts the number of Pods based on CPU utilization collected by metrics-server (target utilization 70%).

[0030] 3. Transaction localization: The script instance declares a local transaction using the @Transactional annotation (Spring compatible). Database connection pool reuse (HikariCP) avoids the overhead of connection rebuilding during RPC calls. 4. Call chain optimization: Method calls were changed to direct references within the JVM (compared to Dubbo RPC, time decreased from 15ms to 0.5ms). 5. State sharing: Use ConcurrentHashMap to achieve cross-method memory sharing.

[0031] In this embodiment, a version rollback mechanism is set; The management side triggers a rollback command → the server decrypts the version snapshot and loads the historical version script → the instance pool switches to the old version instance; Atomic switching: Achieve zero-downtime rollback by updating load balancer weights (such as Nginx upstream configuration).

[0032] The second aspect of the technical solution: A system employing a transaction closed-loop processing method based on dual-end collaborative hot update and containerization as described in any of the above, the system comprising a management end and a server end: The management terminal includes a script management module, a monitoring module, and a communication module; The script management module is used to support script uploading, AES encrypted storage, and version control; The script management module enables script uploading, push / version management, and encrypted script storage (AES algorithm). The monitoring module is used to collect server CPU / memory data in real time; The communication module is used to push encrypted scripts to the server via the WSS protocol; The server-side includes a compilation engine, an instance management module, a transaction execution module, and a containerized deployment module; The compilation engine is used to perform real-time Groovy compilation on the decrypted script; Specifically, it involves script decryption and real-time compilation (Groovy + JDK8). The instance management module is used to maintain the pre-compiled instance pool, and adopts the singleton pattern and reference counting mechanism; Specifically, set up an instance pre-compilation pool to avoid compilation at the time of invocation; The transaction execution module is used to process requests in a closed loop within a single instance, and to achieve atomic operations through local transactions and memory sharing. The containerized deployment module is used to automatically scale Pods up and down based on CPU utilization using Kubernetes HPA.

[0033] In this embodiment, different effects are achieved through the above steps, methods, and systems; 1. Dual-end collaborative hot update system: The management terminal pushes an encrypted script package → the server decrypts it → triggers real-time compilation → a new instance is generated and added to the instance pool; Script consistency is ensured by verifying the version number and hash value.

[0034] 2. Containerized elastic expansion and contraction: The server is deployed in Docker containers and automatically scales up and down based on CPU utilization using Kubernetes HPA (Horizontal Pod Autoscaler). The compiled script instance is stored in JVM memory.

[0035] 3. Memory-safe Singleton pattern: The script instances are managed using a static factory pattern. When the reference count of an older instance reaches zero, the JVM garbage collector automatically releases the memory.

[0036] 4. Single-instance transaction closed-loop control technology: Each business request is processed in a closed loop by the same server instance. Distributed transactions are replaced by shared memory and local transactions, eliminating the coordination overhead of distributed transactions. Transaction control: Local database connection + atomic operations (no XA protocol required), transaction commit time reduced by 85%+; Call chain: Method calls within a single instance (time reduced by 80%+), call chain depth is constant at 1 (traditional microservices average 5-7 layers), such as Figure 4 As shown, the diagram illustrates the sequence diagram for traditional microservice transaction control. State consistency: JVM memory-level locks guarantee strong consistency.

[0037] Example 2: Flexible expansion and contraction in a hospital setting; During the morning peak patient flow at the hospital, CPU utilization reached 85%. Kubernetes HPA automatically scales up 3 server Pods; The new Pod loads and compiles script instances from the database; When traffic drops, the system automatically shrinks to 2 Pods, saving resource costs.

[0038] Example 3: Fast rollback in case of interface failure; The new version of the script has caused the timeout rate of the payment interface to rise to 10% due to a logic error. The operations and maintenance personnel log in to the management terminal, select the previous version, and execute the rollback; The server switched to the old version instance within 150ms, and the payment success rate was restored to 99.99%.

[0039] Example 4: Optimization of ward order transmission transactions in a hospital setting; Traditional approach: Prescription service → Medication service → Examination service → Laboratory service → Material service → Payment service (5 RPCs) In this plan: All logic executes within the same JVM. The processes of deducting drug and material inventory, creating inspection and testing items, creating payment orders, and making account payments are all completed within the same database transaction. Payment status is marked via local cache (eventual consistency); Effect: The time taken to transmit medical orders has been reduced from 30+ seconds to 3 seconds, and the success rate has increased from 75% to 99.9%. Distributed transaction failures caused by timeouts have been completely eliminated.

[0040] Beneficial effects: Performance data: Real-time compilation time: <200ms (Groovy script <1000 lines); Instance pool warm-up time: zero latency for subsequent requests after the initial compilation; Version rollback time: <5s (traditional microservices >30min) Script deployment time: <5s (traditional microservices >30min) Safety and compliance: Compliant with GDPR requirements, the plaintext script exists in memory for no more than 5 seconds; Supports the replacement of AES-256-CBC with the national cryptographic SM4 algorithm.

[0041] Disaster recovery design The management system adopts a multi-active architecture, and the server supports deployment across availability zones.

[0042] The interface efficiency is shown in the table below:

[0043] Although embodiments of the invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention. The scope of the invention is defined by the appended claims and their equivalents, all of which should be included within the scope of protection of the invention.

Claims

1. A transaction closed-loop processing method based on dual-end collaborative hot update and containerization, characterized in that, Includes the following steps: S1. The script is stored with AES encryption on the management end and pushed to the server via the WSS protocol; S2. After receiving the script, the server performs decryption and real-time compilation to generate an executable instance and store it in the pre-compiled instance pool. S3. The instance pool is managed using the singleton pattern. After a new version instance is loaded, the old version instance is automatically released by the JVM when the reference count reaches zero. S4. The server is deployed in a containerized Kubernetes cluster and dynamically scales up and down based on CPU utilization using HPA. S5. Business requests are processed in a closed loop by the same server instance, and the steps are as follows: Multi-step operations can be completed through local database transactions; Use JVM memory sharing to achieve cross-method state transfer; The call chain depth is kept constant at a preset value, and execution is performed directly through memory references.

2. The transaction closed-loop processing method based on dual-end collaborative hot update and containerization according to claim 1, characterized in that, The real-time compilation uses the Groovy engine and JDK8, and the compiled instance is warmed up before its first call.

3. The transaction closed-loop processing method based on dual-end collaborative hot update and containerization according to claim 1, characterized in that, The S3 uses a static factory pattern to manage the instance pool and ensures script consistency through version number and hash value verification.

4. The transaction closed-loop processing method based on dual-end collaborative hot update and containerization according to claim 1, characterized in that, The management terminal in S1 supports script version rollback. The rollback operation triggers the server to switch to the historical version instance within 150ms.

5. The transaction closed-loop processing method based on dual-end collaborative hot update and containerization according to claim 1, characterized in that, The trigger condition for HPA scaling in S4 is that the CPU utilization rate is ≥70%, and the newly scaled Pod automatically loads the script from the database and compiles it.

6. The transaction closed-loop processing method based on dual-end collaborative hot update and containerization according to claim 1, characterized in that, The encryption script in S1 uses a block transmission mechanism, and each block of data does not exceed 1MB.

7. The transaction closed-loop processing method based on dual-end collaborative hot update and containerization according to claim 1, characterized in that, In S5, local transactions are declared through annotations, and database connections are reused in the connection pool.

8. The transaction closed-loop processing method based on dual-end collaborative hot update and containerization according to claim 7, characterized in that, The cross-method state sharing is guaranteed to have strong consistency through JVM memory-level locks.

9. The transaction closed-loop processing method based on dual-end collaborative hot update and containerization according to claim 7, characterized in that, The multi-service operations of the aforementioned business request are completed within a single instance through atomic transaction commit.

10. A system employing a transaction closed-loop processing method based on dual-end collaborative hot update and containerization as described in any one of claims 1 to 9, characterized in that, The system includes a management terminal and a server terminal: The management terminal includes a script management module, a monitoring module, and a communication module; The script management module is used to support script uploading, AES encrypted storage, and version control; The monitoring module is used to collect server CPU / memory data in real time; The communication module is used to push encrypted scripts to the server via the WSS protocol; The server-side includes a compilation engine, an instance management module, a transaction execution module, and a containerized deployment module; The compilation engine is used to perform real-time Groovy compilation on the decrypted script; The instance management module is used to maintain the pre-compiled instance pool, and adopts the singleton pattern and reference counting mechanism; The transaction execution module is used to process requests in a closed loop within a single instance, and to achieve atomic operations through local transactions and memory sharing. The containerized deployment module is used to automatically scale Pods up and down based on CPU utilization using Kubernetes HPA.