An internet bank distributed core business system transaction management method
Patent Information
- Application Number
- CN202211057061.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-31
- Publication Date
- 2026-10-09
- Estimated Expiration
- 2042-08-31
AI Technical Summary
该日志记录方案中存在的不足有:写日志易引起磁盘IO,耗时高;日志只能单机写,如果写分布式日志,实现方案复杂,代价昂贵
[0013]Compared with existing technologies, the beneficial effects of this invention include: setting a globally unique serial number in the data structure of transaction control information; based on this serial number, all participants report their status before business status changes and transitions are performed, ensuring that there are no partial successes when calling Redis and guaranteeing strong transaction consistency. Simultaneously, timeout settings are included in the APIs of the service initiation, confirmation, and commit phases. In timeout scenarios, the core business system proactively initiates transaction status queries, meeting the requirements of strong consistency and high transaction timeliness in the banking transaction system. This solution uses Redis for storage; compared to traditional disk writing, Redis write performance is higher and faster, thereby improving transaction timeliness. In the event of a system crash, the business manager can also quickly resume execution. In terms of robustness and fault tolerance, the Redis-based status recording solution is significantly stronger than a log system. This invention proposes a distributed transaction management solution designed based on the specific business scenarios of a bank's core system. This distributed core transaction management framework and functionality offer high transaction timeliness and guarantee strong transaction consistency.
Smart Images

Figure CN115437752B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of software system development technology, and more specifically, to a transaction management method for a distributed core business system of an internet bank. Background Technology
[0002] Traditional banking core systems adopt a monolithic architecture, with all business scenarios running on the same database. Transactions are completed using a single database transaction manager. The operational structure is simple, but business implementation is difficult and the architecture has poor scalability.
[0003] The rise of microservice architecture has provided a good solution for scaling massive monolithic applications. To handle massive internet traffic, core systems of internet banks often adopt a distributed architecture. The core business system is responsible for implementing functions such as accounting, registration, and calculation. The same accounting transaction within the core business system must guarantee transactionality to ensure the accurate implementation of business functions and the accuracy of bank accounts. For the core system, this polygonal distributed architecture of microservices means that the same business scenario may be distributed across multiple nodes in multiple subsystems, and the same service requires multiple resources across multiple nodes.
[0004] Traditional RDBMS XA Transactions solutions are time-consuming throughout the commit phase, lack timeout mechanisms, and cannot proactively query the status of each participant, failing to meet the strong consistency and high transaction efficiency requirements of bank transaction systems. Furthermore, the Business Activity Manager typically handles the reading and writing of transaction control information similar to traditional logging. This logging approach has drawbacks: writing logs easily causes disk I / O, resulting in high time consumption; logs can only be written to a single machine, and implementing distributed logging would be complex and costly. Summary of the Invention
[0005] The purpose of this invention is to provide a transaction management method for a distributed core business system of an internet bank, which is used to ensure the consistency, atomicity, isolation and durability of accounting transactions in a distributed environment.
[0006] To address the aforementioned technical issues, the present invention employs the following technical solution: a transaction management method for a distributed core business system of an internet bank, applied to a core infrastructure platform and a service center. The core infrastructure platform includes a core platform support module and a business activity manager. The core platform support module is configured with multiple core business systems. The service center includes a service discovery management module and a service registration management module. The method comprises the following steps: the core business systems publish services to the service center based on the core platform support module; the service registration management module registers services; a service requester sends an entry request to the service center, and calls the core business system based on the returned service entry information; the core business system sends a service discovery request to the service center, and the service discovery management module responds and returns service discovery information; transaction control information is generated based on the service discovery information and written to a Redis cluster; the business activity manager reads and writes the transaction control information, and sequentially calls the execution functions of each core business system to complete transaction management.
[0007] As a preferred embodiment, the step of generating transaction control information based on the service discovery information includes: the core business system transmitting the service discovery information to the business activity manager, and the business activity manager adding a global serial number, business type, and sub-transaction type to generate transaction control information.
[0008] As a preferred embodiment, the core business system is configured with one or more sub-transaction nodes. The execution functions include try, query, recovery, confirm, and cancel methods. The transaction management includes an initiation phase, a confirmation phase, and a rollback phase. In the initiation phase, the try method of each sub-transaction node is called sequentially, and each core business system pre-executes the request after receiving it. The system receives responses from each sub-transaction node. If any sub-transaction node fails to respond within the specified time, the core business system calls the query method of the corresponding sub-transaction node to query transaction information and transaction execution status. If the query fails, the recovery method is called to release resources. Simultaneously, the `cancel` method is called to indicate that the transaction has failed. If all sub-transaction nodes respond successfully, the core business system calls the `confirm` method of each sub-transaction node to enter the confirmation phase. In the confirmation phase, each sub-transaction node submits its local transaction and replies to the core business system. If all sub-transaction nodes respond successfully, the transaction process ends, and the entire transaction is successfully returned to the service requester. In the initiation and confirmation phases, if any service node replies with a status of failure, the core business system calls the `cancel` method of the sub-transaction node respectively, and the transaction fails. If a sub-transaction node does not receive a command from the core business system within the specified time, it enters the rollback phase and automatically rolls back its local transaction.
[0009] As a preferred embodiment, the pre-execution includes: completing all business checks and reserving business resources to achieve consistency and isolation guarantees.
[0010] As a preferred embodiment, the data structure of the service discovery information is: {serviceName: A, part: {0: {function: {ip: IPValue, port: PortValue, protocol: HTTP / RPC}}}}; where serviceName is the business service name, the part structure represents the components of the sub-transaction, the numerical sequence 0, 1 indicates the order in which the sub-transactions are called, and the corresponding sub-transactions are called in ascending order of numerical sequence. If the numerical sequence is the same, it indicates that the sub-transactions can be called concurrently. The function structure represents the specific sub-transaction system, including IP, port and protocol information.
[0011] As a preferred embodiment, the data structure of the transaction control information is: {SystemNodeId:globalTraceNo->{{TYPE:globalTraceNo->type},{MODEL:globalTraceNo->model},{TIME:globalTraceNo->time},SystemNodeId:BusinessType:BizType->[{current:0,List=0,1,2}]}; where SystemNodeId is the node number of each core business system, globalTraceNo is the global serial number, TYPE is the transaction type of the entity object, MODEL is the transaction object, TIME is the timestamp of the last operation, and the business sublist is a List structure where BusinessType is the business type and BizType is the subtype, which corresponds to the information described by the function in service discovery.
[0012] As a preferred embodiment, the business activity manager reads and writes transaction control information, including: instantiating a Trans object using a global serial number, transaction type, and transaction object; the core business system schedules the execution of the Trans object; the Trans object calls the phased tasks of TccTask sequentially according to the State object; and TccService can add or customize the storage of the current work context information according to the state of the Trans object.
[0013] Compared with existing technologies, the beneficial effects of this invention include: setting a globally unique serial number in the data structure of transaction control information; based on this serial number, all participants report their status before business status changes and transitions are performed, ensuring that there are no partial successes when calling Redis and guaranteeing strong transaction consistency. Simultaneously, timeout settings are included in the APIs of the service initiation, confirmation, and commit phases. In timeout scenarios, the core business system proactively initiates transaction status queries, meeting the requirements of strong consistency and high transaction timeliness in the banking transaction system. This solution uses Redis for storage; compared to traditional disk writing, Redis write performance is higher and faster, thereby improving transaction timeliness. In the event of a system crash, the business manager can also quickly resume execution. In terms of robustness and fault tolerance, the Redis-based status recording solution is significantly stronger than a log system. This invention proposes a distributed transaction management solution designed based on the specific business scenarios of a bank's core system. This distributed core transaction management framework and functionality offer high transaction timeliness and guarantee strong transaction consistency. Attached Figure Description
[0014] The disclosure of this invention is illustrated with reference to the accompanying drawings. It should be understood that the drawings are for illustrative purposes only and are not intended to limit the scope of protection of this invention. In the drawings, the same reference numerals are used to refer to the same parts. Wherein:
[0015] Figure 1 This is a schematic diagram of the core infrastructure platform and service center in an embodiment of the present invention;
[0016] Figure 2 This is a flowchart illustrating the transaction management method for a distributed core business system of an internet bank, according to an embodiment of the present invention.
[0017] Figure 3 This is a schematic diagram of the transaction management process according to an embodiment of the present invention;
[0018] Figure 4 This is a schematic diagram of the state transition in an embodiment of the present invention;
[0019] Figure 5 This is a schematic diagram of the transaction control information read / write interface according to an embodiment of the present invention. Detailed Implementation
[0020] It is readily understood that, based on the technical solution of this invention, those skilled in the art can propose various interchangeable structural methods and implementations without altering the essential spirit of the invention. Therefore, the following detailed embodiments and accompanying drawings are merely illustrative examples of the technical solution of this invention and should not be considered as the entirety of the invention or as limitations or restrictions on the technical solution of this invention.
[0021] According to one embodiment of the present invention, Figure 1 The following is illustrated: A transaction management method for a distributed core business system of an internet bank is applied to a core infrastructure platform and a service center. The core infrastructure platform includes a core platform support module and a business activity manager. The core platform support module is configured with multiple core business systems. The service center provides specific service query functions to query the specific functional combination of a transaction, including a service discovery management module and a service registration management module.
[0022] See Figure 2 The above method includes the following steps:
[0023] S101, the core business system publishes services to the service center based on the core platform support module, and the service registration management module registers the services.
[0024] S102, the service requester sends an entry request for service to the service center, and invokes the core business system based on the returned service entry information. The service requester is the specific transaction requester.
[0025] S103, the core business system sends a service discovery request to the service center, and the service discovery management module responds and returns service discovery information.
[0026] When calling a specific core business system, the core business call service center queries which sub-transaction functions make up the business transaction, and at the same time queries which machine nodes in the cluster provide these services. The query results support local caching.
[0027] Specifically, the data structure for service discovery information is as follows:
[0028] {serviceName: A, part: {0: {function: {ip: IPValue, port: PortValue, protocol: HTTP / RPC}}}}; where serviceName is the business service name, part represents the components of the sub-transaction, the number 0, 1 indicates the order in which the sub-transactions are called, and the corresponding sub-transactions are called in ascending order of the number. If the number is the same, it means that the sub-transactions can be called concurrently. The function represents the specific sub-transaction system, including the IP address, port, and protocol information.
[0029] S104: Generate transaction control information based on service discovery information and write the transaction control information to the Redis cluster.
[0030] Among them, the generation of transaction control information based on service discovery information includes: the core business system transmits service discovery information to the business activity manager, and the business activity manager adds global serial number, business type, and sub-transaction type to generate transaction control information.
[0031] Specifically, the data structure for transaction control information is as follows:
[0032] {SystemNodeId:globalTraceNo->{{TYPE:globalTraceNo->type},{MODEL:globalTraceNo->model},{TIME:globalTraceNo->time},SystemNodeId:BusinessType:BizType->[{current:0,List=0,1,2}]}; where SystemNodeId is the node number of each core business system, globalTraceNo is a globally unique serial number, TYPE is the transaction type of the entity object, MODEL is the transaction object, TIME is the timestamp of the last operation, and the business sublist is a List structure where BusinessType is the business type and BizType is the subtype, which corresponds to the information described by the function in service discovery.
[0033] S105, the business activity manager reads and writes transaction control information, and sequentially calls the execution functions of each core business system to complete transaction management.
[0034] The core business system is configured with one or more sub-transaction nodes. For example, in a scenario where a customer A of the bank transfers funds to a customer B of the same bank, there are at least two sub-transactions: deducting customer A's balance and increasing customer B's balance.
[0035] In this embodiment of the invention, the execution function includes the try, query, recovery, confirm, and cancel methods. The try method performs pre-execution of the sub-transaction; the query method performs information query and execution status query of the transaction, such as whether it is completed or whether the status is normal; the recovery method releases the resources locked by the try method; the confirm method commits the corresponding transaction after pre-execution is completed; and cancel releases all resources and terminates the process.
[0036] See Figure 3 The aforementioned transaction management includes the initiation phase, the confirmation phase, and the rollback phase.
[0037] During the initiation phase, the try method of each sub-transaction node is called sequentially, and each core business system performs pre-execution upon receiving the call request. Pre-execution includes: completing all business checks and reserving business resources to achieve consistency and isolation guarantees.
[0038] The system receives responses from each sub-transaction node. If any sub-transaction node fails to respond within the specified time, the core business system calls the query method of the corresponding sub-transaction node to query transaction information and transaction execution status. If the query fails, the recovery method is called to release resources, and the cancel method is called to indicate that the transaction has failed. If all sub-transaction nodes respond successfully, the core business system calls the confirm method of each sub-transaction node to enter the confirmation phase.
[0039] During the confirmation phase, each sub-transaction node submits its local transaction and replies to the core business system. If all sub-transaction nodes respond successfully, the transaction process ends, and the entire transaction is successfully returned to the service requester. During the initiation and confirmation phases, if any service node replies with a status of failure, the core business system calls the cancel method of the sub-transaction node respectively, and the transaction fails.
[0040] If a sub-transaction node does not receive an order from the core business system within the specified time, it will enter the rollback phase and automatically roll back the local transaction.
[0041] See Figure 4 In this embodiment of the invention, the specific execution status of the transaction includes PENDING (waiting to be executed), SUCCESS (success), FAIL (failure), PROCESSING (processing), and MISSING (lost, status unknown). In the MISSING state, the service function node automatically rolls back the transaction.
[0042] See Figure 5 This invention uses Redis to record the state of the business manager, and the data structure for storing business management information in Redis is designed as a hash structure. Specifically, the business activity manager reads and writes transaction control information, including the following steps:
[0043] (1) Instantiate a Trans object using the global serial number, transaction type, and transaction object;
[0044] (2) The core business system (i.e., TccContrlService) schedules the execution of Trans objects;
[0045] (3) The Trans object calls the phased tasks of TccTask (specific business state transitions) in sequence according to the State object;
[0046] (4) TccService can add or customize the current working context information based on the state of the Trans object.
[0047] In the above approach, global state control can be customized, and timeout or query mechanisms can be added; Tasks are independently encapsulated, allowing each business node to be developed in parallel and tested independently; when adding a new global state, Trans can be directly extended without changing the basic architecture and logic of the entire framework; the default try (including query and recovery), cancel, and confirm phase strategies during the entire transaction can be adjusted.
[0048] In summary, the beneficial effects of this invention include: proposing a distributed transaction management scheme designed based on the specific business scenarios of a bank's core system. This distributed core transaction management framework and functionality offer high transaction timeliness while ensuring strong transaction consistency. Instead of using a traditional log system to record the state of the business manager, this scheme uses Redis, improving recording speed. In the event of a system failure, the business manager can quickly resume execution. In terms of robustness and fault tolerance, the Redis-based state recording scheme is significantly superior to a log system.
[0049] It should be understood that if the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods of the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0050] The technical scope of this invention is not limited to the content described above. Those skilled in the art can make various modifications and variations to the above embodiments without departing from the technical concept of this invention, and all such modifications and variations should fall within the protection scope of this invention.
Claims
1. A transaction management method for a distributed core business system of an internet bank, applied to a core infrastructure platform and service center, characterized in that: The core infrastructure platform includes a core platform support module and a business activity manager. The core platform support module is configured with multiple core business systems. The service center includes a service discovery management module and a service registration management module. The method includes the following steps: The core business system publishes services to the service center based on the core platform support module, and the service registration management module registers services. The service requester sends an entry request to the service center, and invokes the core business system based on the returned service entry information; The core business system sends a service discovery request to the service center, and the service discovery management module responds and returns service discovery information. Transaction control information is generated based on the service discovery information, and the transaction control information is written to the Redis cluster; The business activity manager reads and writes transaction control information, and sequentially calls the execution functions of each core business system to complete transaction management; The core business system is configured with one or more sub-transaction nodes. The execution function includes try, query, recovery, confirm, and cancel methods. The transaction management includes an initiation phase, a confirmation phase, and a rollback phase. In the initiation phase, the try method of each sub-transaction node is called in sequence. Each core business system pre-executes the request after receiving it. The system receives responses from each sub-transaction node. If any sub-transaction node fails to respond within the specified time, the core business system calls the query method of the corresponding sub-transaction node to query transaction information and transaction execution status. If the query fails, the recovery method is called to release resources, and the cancel method is called to indicate that the transaction has failed. If all sub-transaction nodes respond successfully, the core business system calls the confirm method of each sub-transaction node to enter the confirmation phase. During the confirmation phase, each sub-transaction node submits its local transaction and replies to the core business system. If all sub-transaction nodes respond successfully, the transaction process ends, and the entire transaction is successfully returned to the service requester. During the initiation and confirmation phases, if any service node replies with a status of failure, the core business system calls the cancel method of the sub-transaction node, and the transaction fails. If a sub-transaction node does not receive a command from the core business system within the specified time, it enters the rollback phase and automatically rolls back its local transaction.
2. The transaction management method for a distributed core business system of an internet bank according to claim 1, characterized in that, The step of generating transaction control information based on the service discovery information includes: The core business system transmits service discovery information to the business activity manager, which adds a global serial number, business type, and sub-transaction type to generate transaction control information.
3. The transaction management method for a distributed core business system of an internet bank according to claim 1, characterized in that, The pre-execution includes: completing all business checks and reserving business resources to achieve consistency and isolation guarantees.
4. The transaction management method for a distributed core business system of an internet bank according to claim 1, characterized in that, The data structure of the service discovery information is: {serviceName: A, part: {0: {function: {ip: IPValue, port: PortValue, protocol: HTTP / RPC}}}}; Here, serviceName is the name of the business service, part structure represents the components of the sub-transaction, the number sequence 0, 1 indicates the order in which the sub-transactions are called, and the corresponding sub-transactions are called in ascending order of the number sequence. If the number sequence is the same, it means that the sub-transactions can be called concurrently. function structure represents the specific sub-transaction system, including IP, port and protocol information.
5. The transaction management method for a distributed core business system of an internet bank according to claim 1, characterized in that, The data structure of the transaction control information is: { SystemNodeId:globalTrace No->{{TYPE:globalTraceNo->type},{MODEL:globalTraceNo->model},{TIME:globalTraceNo->time}, SystemNodeId:BusinessType:BizType->[{current:0, List=0,1,2}]}; Among them, SystemNodeId is the node number of each core business system, globalTraceNo is the global serial number, TYPE is the transaction type of the entity object, MODEL is the transaction object, TIME is the timestamp of the last operation, and the business sublist is a List structure in which BusinessType is the business type and BizType is the subtype, which corresponds to the information described by the function in service discovery.
6. The transaction management method for a distributed core business system of an internet bank according to claim 5, characterized in that, The business activity manager reads and writes transaction control information, including: Instantiate a Trans object using the global serial number, transaction type, and transaction object; The core business system schedules the execution of Trans objects; The Trans object calls the phased tasks of TccTask sequentially based on the State object; TccService can add or customize the storage of current working context information based on the state of the Trans object.
Citation Information
Patent Citations
Real-time gridding transaction management system based on alternative service model
CN101661403A
Distributed transaction processing system
CN111651244A
Distributed transaction processing method and device, and storage medium
CN111880908A