CN108958894A - A kind of distributed transaction processing method, system, task manager and terminal device - Google Patents

A kind of distributed transaction processing method, system, task manager and terminal device Download PDF

Info

Publication number
CN108958894A
CN108958894A CN201810614040.3A CN201810614040A CN108958894A CN 108958894 A CN108958894 A CN 108958894A CN 201810614040 A CN201810614040 A CN 201810614040A CN 108958894 A CN108958894 A CN 108958894A
Authority
CN
China
Prior art keywords
subtransaction
distributed transaction
transaction
response results
distributed
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201810614040.3A
Other languages
Chinese (zh)
Other versions
CN108958894B (en
Inventor
张森
郎晓东
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Advanced New Technologies Co Ltd
Original Assignee
Alibaba Group Holding Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Alibaba Group Holding Ltd filed Critical Alibaba Group Holding Ltd
Priority to CN201810614040.3A priority Critical patent/CN108958894B/en
Publication of CN108958894A publication Critical patent/CN108958894A/en
Application granted granted Critical
Publication of CN108958894B publication Critical patent/CN108958894B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/466Transaction processing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/4881Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/50Indexing scheme relating to G06F9/50
    • G06F2209/5018Thread allocation

Abstract

This specification embodiment provides a kind of distributed transaction processing method, system, task manager and terminal device, more with the execution link for solving distributing real time system in the prior art, the longer problem of total time-consuming.The distributed transaction processing method includes: the request operation in response to distributed transaction, the preparation operation requests of the subtransaction of the distributed transaction, the implementing result for preparing operation requests and being used for the resource of the corresponding subtransaction of request confirmation are sent to multiple resource managers respectively;Based on the multiple resource manager to the response results of the preparation operation requests of the subtransaction of the distributed transaction, the corresponding transaction operation of the response results is executed to the distributed transaction by asynchronous system.

Description

A kind of distributed transaction processing method, system, task manager and terminal device
Technical field
This specification embodiment is related to distributed transaction processing field more particularly to a kind of distributing real time system side Method, system, task manager and terminal device.
Background technique
Distributed transaction refers to the participant of affairs, supports server, resource manager and the task manager of affairs It is located on the different nodes of different distributed systems.Affairs are an indivisible work unit, a distribution Formula affairs generally comprise multiple local matters, each local matter or are carried out or do not execute.For example, it is assumed that data The operation 2 in operation 1, database B on the A of library, the operation 3 on database C are a distributed transaction, only operate 1, operation 2 are carried out success with 3 these three operations of operation, the execution of this distributed transaction just success.
When most distributing real time systems, two-phase commitment protocol (Two Phase Commitment is usually followed Protocol, 2PC).2PC is the basic agreement of distributed transaction, and the stage in 2PC is voting stage, all resource managements The feedback result of this affairs success is all sent to task manager by device;Two-stage in 2PC is execution stage, affairs pipe It manages device and corresponding operation is executed according to the feedback result of all resource managers.Such as, if receiving the feedback of all resource managers It as a result is successfully, then all resource managers to be notified to submit in all branches with acting in agreement;If receiving all resource managements The feedback result of a resource manager in device is failure, then notifies the rollback in all branches of all resource managers.It can See, a stage and two-stage serially execute, and completion is just calculated in the execution of distributed transaction after only terminating there are two the stage.
Illustratively, as shown in Figure 1,1. the participant of self-explanatory characters' business initiates affairs;Task manager is coordinated in two stages Resource manager: 2. in a stage, task manager is sent to all resource managers prepares operation requests, all resource managements Device is according to preparation operation requests return response result;3. task manager is according to resource managements all in a stage in the two-stage The response results that device returns send to all resource managers and execute operation requests;4. all resource managers are according to the two-stage The execution operation requests that service managerZ-HU is sent execute corresponding operation.1.~4. execute and complete after, entire distribution thing Business, which just calculates to execute, to be terminated.Combined with Figure 1 and Figure 2, it is assumed that executing 1. time-consuming is a, executing 2. time-consuming is b+c, and executing 3. time-consuming is d, Executing 4. time-consuming is e+f, and affairs terminate time-consuming to be g, then it is 1.+2.+3.+time-consuming 4. that entire distributed transaction, which executes total time-consuming, The sum of, i.e. the summation of a+b+c+d+e+f+g.
In summary, existing distributing real time system needs are carried out a stage and second order to each resource manager Section, so that the execution link of distributing real time system is more, total time-consuming is longer.
Summary of the invention
This specification embodiment provides a kind of distributed transaction processing method, system, task manager and terminal device, with The execution link for solving distributing real time system in the prior art is more, the longer problem of total time-consuming.
This specification embodiment adopts the following technical solutions:
In a first aspect, providing a kind of distributed transaction processing method, comprising:
In response to the request operation of distributed transaction, the son of the distributed transaction is sent to multiple resource managers respectively The preparation operation requests of affairs, the implementing result for preparing operation requests and being used for the resource of the corresponding subtransaction of request confirmation;
Based on the multiple resource manager to the response knot of the preparation operation requests of the subtransaction of the distributed transaction Fruit executes the corresponding transaction operation of the response results to the distributed transaction by asynchronous system.
Second aspect provides a kind of task manager, comprising:
Sending module, for the request operation in response to distributed transaction, respectively to described in the transmission of multiple resource managers The preparation operation requests of the subtransaction of distributed transaction, the money for preparing operation requests and being used for the corresponding subtransaction of request confirmation The implementing result in source;
Execution module, for being operated based on the multiple resource manager to the preparation of the subtransaction of the distributed transaction The response results of request execute the corresponding transaction operation of the response results to the distributed transaction by asynchronous system.
The third aspect provides a kind of distributing real time system system, comprising:
Task manager is operated in response to the request of distributed transaction, sends the distribution to multiple resource managers respectively The preparation operation requests of the subtransaction of formula affairs, the preparation operation requests are used for the resource of the corresponding subtransaction of request confirmation Implementing result;
The corresponding subtransaction of multiple response results is distributed to line according to default allocation rule by task manager Multiple synchronizing threads in Cheng Chi are pre-configured with multiple synchronizing threads in the thread pool;
Multiple synchronizing threads in the thread pool execute the response to the distributed transaction by asynchronous system and tie The corresponding transaction operation of fruit.
Fourth aspect provides a kind of distributing real time system system, comprising:
Task manager is operated in response to the request of distributed transaction, sends the distribution to multiple resource managers respectively The preparation operation requests of the subtransaction of formula affairs, the preparation operation requests are used for the resource of the corresponding subtransaction of request confirmation Implementing result;
Pair that task manager requests transaction operation corresponding to the response results and response results and response results It should be related to and be stored in standby database;
Other equipment are based on the response results inquired in the standby database, response results pair described in asynchronous execution The transaction operation answered.
5th aspect, provides a kind of terminal device, comprising: memory, processor and be stored on the memory simultaneously The computer program that can be run on the processor realizes following step when the computer program is executed by the processor It is rapid:
In response to the request operation of distributed transaction, the son of the distributed transaction is sent to multiple resource managers respectively The preparation operation requests of affairs, the implementing result for preparing operation requests and being used for the resource of the corresponding subtransaction of request confirmation;
Based on the multiple resource manager to the response knot of the preparation operation requests of the subtransaction of the distributed transaction Fruit executes the corresponding transaction operation of the response results to the distributed transaction by asynchronous system.
6th aspect, provides a kind of computer readable storage medium, is stored on the computer readable storage medium Computer program, the computer program realize following steps when being executed by processor:
In response to the request operation of distributed transaction, the son of the distributed transaction is sent to multiple resource managers respectively The preparation operation requests of affairs, the implementing result for preparing operation requests and being used for the resource of the corresponding subtransaction of request confirmation;
Based on the multiple resource manager to the response knot of the preparation operation requests of the subtransaction of the distributed transaction Fruit executes the corresponding transaction operation of the response results to the distributed transaction by asynchronous system.
This specification embodiment use at least one above-mentioned technical solution can reach it is following the utility model has the advantages that
This specification embodiment is based on multiple resource managers to the preparation operation requests of the subtransaction of distributed transaction Response results execute the corresponding transaction operation of response results to distributed transaction by asynchronous system, so that response results are corresponding Transaction operation by asynchronous system execute, reduce the execution link of distributing real time system, shorten distributed transaction Execute loss.
Detailed description of the invention
Attached drawing described herein is used to provide to further understand this specification, forms part of this specification, The illustrative embodiments and their description of this specification do not constitute the improper restriction to this specification for explaining this specification. In the accompanying drawings:
Fig. 1 is one of distributed transaction processing method flow chart in the prior art;
Fig. 2 is the two of distributed transaction processing method flow chart in the prior art;
Fig. 3 is the flow chart for the distributed transaction processing method that one embodiment of this specification provides;
Fig. 4 is that the practical application scene for the distributed transaction processing method that one embodiment of this specification provides realizes stream Journey schematic diagram;
Fig. 5 is the structural block diagram for the distributing real time system device that one embodiment of this specification provides;
Fig. 6 is one of the structural block diagram for the distributing real time system system that one embodiment of this specification provides;
Fig. 7 is the two of the structural block diagram for the distributing real time system system that one embodiment of this specification provides;
Fig. 8 is the structural block diagram for the terminal device that one embodiment of this specification provides.
Specific embodiment
To keep the purposes, technical schemes and advantages of this specification clearer, it is embodied below in conjunction with this specification This specification technical solution is clearly and completely described in example and corresponding attached drawing.Obviously, described embodiment is only this Specification a part of the embodiment, instead of all the embodiments.The embodiment of base in this manual, ordinary skill people Member's every other embodiment obtained without making creative work, belongs to the range of this specification protection.
This specification embodiment provides a kind of distributed transaction processing method and terminal device, to solve to divide in the prior art The execution link of cloth issued transaction is more, the longer problem of total time-consuming.This specification embodiment provides a kind of distributed transaction Processing method, the executing subject of this method can be, but not limited to the task manager of distributed transaction or can be configured as holding The device or system of this method that row this specification embodiment provides.
For ease of description, hereafter executing subject in this way is to be able to carry out for the task manager of this method, it is right The embodiment of this method is introduced.It is appreciated that it is that one kind is exemplary that the executing subject of this method, which is task manager, Explanation, be not construed as the restriction to this method.
Fig. 3 is the flow chart for the distributed transaction processing method that this specification embodiment provides, and the method for Fig. 3 can be by thing Business manager executes, as shown in figure 3, this method may include:
Step 310, the request operation in response to distributed transaction, send the distribution to multiple resource managers respectively The preparation operation requests of the subtransaction of affairs.
Implementing result of the preparation operation requests for the resource of the corresponding subtransaction of request confirmation.
Step 320, based on the multiple resource manager to the preparation operation requests of the subtransaction of the distributed transaction Response results, the corresponding transaction operation of the response results is executed to the distributed transaction by asynchronous system.
The preparation operation of the subtransaction of distributed transaction is asked it will be appreciated that task manager obtains multiple resource managers After the response results asked, the corresponding transaction operation of response results is executed to distributed transaction by asynchronous system.
In other words, task manager obtains multiple resource managers and asks to the preparation operation of the subtransaction of distributed transaction After the response results asked, the processing of distributed transaction is completed in task manager.
The response results can be to prepare successfully or prepare failure;Alternatively, the response results can be to run succeeded or hold Row failure.
The corresponding transaction operation of the response results is executed to the distributed transaction by asynchronous system, specific implementation can With are as follows:
Task manager is by multiple resource managers to the response knot of the preparation operation requests of the subtransaction of distributed transaction Fruit is reported to other equipment, and e.g., server is grasped as a result, executing the corresponding affairs of the response results according to response by other equipment Make;Alternatively,
Task manager is by multiple resource managers to the response knot of the preparation operation requests of the subtransaction of distributed transaction Fruit distributes to multiple synchronizing threads in thread pool, is corresponded to according to response as a result, executing the response results by multiple synchronizing threads Transaction operation.
This specification embodiment is based on multiple resource managers to the preparation operation requests of the subtransaction of distributed transaction Response results execute the corresponding transaction operation of response results to distributed transaction by asynchronous system, so that response results are corresponding Transaction operation by asynchronous system execute, reduce the execution link of distributing real time system, shorten distributed transaction Execute loss.
Optionally, as one embodiment, the distributed transaction processing method that this specification embodiment provides can also be wrapped It includes:
It receives the affairs that client is sent and starts request, and request corresponding distributed transaction to divide affairs starting Multiple subtransactions, be assigned to the processing that the multiple resource manager is prepared operation.
For example, it is assumed that " account A transfers accounts to account B " is used as a distributed transaction, then need in three resource managements The enterprising row write operation (that is, the distributed transaction is segmented into three subtransactions) of device, is respectively as follows:
Operation 1 to account A deducts predetermined dollar value on resource manager 1;
Operation 2 gives account B to add the corresponding amount of money on resource manager 2;
Operation 3 transfer accounts on resource manager 3 summarizing.
Wherein, if it is all to prepare successfully that three resource managers, which are prepared the response results after operation processing, it is determined that Submission operation is carried out to the distributed transaction;If three resource managers are prepared in the response results after operation processing at least It is to prepare failure there are a response results, it is determined that rolling back action is carried out to the distributed transaction.
In practical applications, illustratively, the implementation procedure that the method for this specification is described in detail in above-mentioned example is continued to use:
User initiates the operation of " account A transfers accounts to account B " in client, and the operation carried out according to user is to transaction management Device registers distributed transaction;Task manager can distribute Transaction Identifier ID for the distributed transaction." account A transfers accounts to account B " It needs in the enterprising row write operation of three resource managers, that is to say, that the distributed transaction is segmented into three subtransactions:
Operation 1 to account A deducts predetermined dollar value on resource manager 1;
Operation 2 gives account B to add the corresponding amount of money on resource manager 2;
Operation 3 transfer accounts on resource manager 3 summarizing.
Wherein, if it is all to prepare successfully that three resource managers, which are prepared the response results after operation processing, it is determined that Submission operation is carried out to the distributed transaction;If three resource managers are prepared in the response results after operation processing at least It is to prepare failure there are a response results, it is determined that rolling back action is carried out to the distributed transaction.
After the completion of each subtransaction processing, response results of the task manager based on all subtransactions pass through asynchronous system The corresponding transaction operation of response results is executed to the distributed transaction.
Such as, after task manager reports the response results of all subtransactions to standby database, server end as coordinator, The response results for each subtransaction in database are inquired, and are determined according to the response results of each subtransaction inquired Initiate the submission or rollback of the distributed transaction;Alternatively,
The corresponding subtransaction of multiple response results is distributed to thread pool according to default allocation rule by task manager In multiple synchronizing threads, by multiple synchronizing threads based on response results determine initiate the distributed transaction submission or rollback.
Optionally, as one embodiment, step 120 specifically be can be achieved are as follows:
The corresponding subtransaction of multiple response results is distributed to according to default allocation rule more in thread pool A synchronizing thread is pre-configured with multiple synchronizing threads in the thread pool;
Multiple synchronizing threads in the thread pool are used to execute the sound to the distributed transaction by asynchronous system Answer the corresponding transaction operation of result.
In this application, it needs to pre-establish thread pool, the synchronizing thread in thread pool can be in the present embodiment are as follows: need The thread for calling run method to execute.
For example, being pre-configured with 10 synchronizing threads in thread pool, this 10 thread synchronizations are required using run method It executes, and this 10 synchronizing threads for using run method to execute can carry out in main thread when being executed, so that together The end time of step thread execution task can be perceived by main thread.
Wherein, thread pool can directly or indirectly extend from JDK (Java Development Kit, Java language it is soft Part development kit) provide ThreadPoolExecutor.Thread pool in the present embodiment (DoImmediatelyThreadPoolTaskExecutor) different from thread pool in the prior art, the line in the present embodiment The synchronizing thread of Cheng Chi is all that run method is called to execute, so that synchronizing thread can synchronize execution in the main thread of calling.
Wherein, the corresponding subtransaction of multiple response results is distributed in thread pool according to default allocation rule Multiple synchronizing threads, be pre-configured with multiple synchronizing threads in the thread pool, specific implementation may include:
Step A1: task queue is established for the thread pool.
Firstly, establishing a task queue for the thread pool created, which can deposit according to sequencing Put the distributing to the synchronizing thread in thread pool of the task.
Step A2: multiple subtransactions are added separately to described appoint according to each user for triggering the multiple subtransaction It is engaged in queue.
In the present embodiment, multiple subtransactions can be added separately to according to the difference of the user of triggering subtransaction In task queue.
For example, mending account business for the buffering in practical application, there are four users to trigger 7 tasks that buffering mends account.
It is specific as shown in table 1:
Table 1
User task id
A 1
A 2
A 3
B 4
B 5
C 6
D 7
Three subtransactions of user A can be first added so in task queue, then add two subtransactions of user B, then Successively add the task of user C and user D.
Step A3: the multiple synchronizing threads subtransaction in the task queue being respectively allocated in thread pool, wherein Each user corresponds to a synchronizing thread.
Then the subtransaction in task queue is respectively allocated to multiple synchronizing threads in thread pool again, for example, each The subtransaction correspondence of user distributes to a synchronizing thread.So, shown in reference table 1, three subtransactions of user A can be distributed To first synchronizing thread in thread pool, and two subtransactions of user B can distribute to second synchronization in thread pool Thread, and so on.
Certainly, in practical applications, it is not limited only to distribute thread for task by dimension of user, it can also be with sub- thing Business is dimension, for each subtransaction one synchronizing thread of corresponding distribution, can also use other methods of salary distribution certainly.
As shown in figure 4, this specification embodiment, returns resource managers all in a stage in two-stage task manager The corresponding subtransaction of multiple response results returned distributes to multiple synchronizing threads in thread pool according to default allocation rule, The corresponding affairs of the response results are executed to distributed transaction by asynchronous system by multiple synchronizing threads in thread pool to grasp Make, so that task manager becomes the summation of a+b+c+g to the reduction of entire distributed transaction execution link, total time-consuming, effectively contracts Short distributed transaction executes loss.
Optionally, as one embodiment, step 120 specifically be can be achieved are as follows:
The corresponding relationship of the request of transaction operation corresponding to the response results and response results and response results is stored In standby database, so that other equipment are based on the response results inquired in the standby database, asynchronous execution institute State the corresponding transaction operation of response results.
The standby database can be the database of other equipment, or relative to the independent data of other equipment Library, this specification embodiment are not specifically limited.
Illustratively, after task manager reports the response results of all subtransactions to standby database, server end conduct Coordinator inquires the response results for each subtransaction in database, and according to the response of each subtransaction inquired As a result the submission or rollback for determining the initiation distributed transaction, specifically, if all subtransactions of the distributed transaction Response results be all to prepare successfully, it is determined that the distributed transaction is submitted, if in all subtransactions at least It is the subtransaction for preparing failure there are a response results, it is determined that rollback is carried out to the distributed transaction.Specifically, clothes Business device determined to distributed transaction submit or rollback after, send submiting command or rollback order to each subtransaction, with Initiate the submission or rollback of global transaction.Therefore, the submission distributed transaction that can be sent according to the server received Order, execute the submission of the distributed transaction;Or the distribution thing according to the rollback that the server received is sent The order of business executes the rollback of the distributed transaction.In other words, if divided described in the submission that the server received is sent The order of cloth affairs then executes the submission of the distributed transaction;If divided described in the rollback that the server received is sent The order of cloth affairs then executes the rollback of the distributed transaction.
This specification embodiment, by asking response results and response results with transaction operation corresponding to response results The corresponding relationship asked is stored in standby database, by other equipment based on the response knot inquired in the standby database Fruit executes the corresponding transaction operation of response results, realizes the corresponding transaction operation of response results and executed by asynchronous system Purpose, reduce the execution link of distributing real time system, shorten distributed transaction executes loss.
More than, the distributed transaction processing method of this specification embodiment is described in detail in conjunction with Fig. 3 to Fig. 4, in the following, knot Fig. 5 is closed, the task manager of this specification embodiment is described in detail.
Fig. 5 shows the structural schematic diagram of the task manager of this specification embodiment offer, as shown in figure 5, the affairs Manager 500 may include:
Sending module 501 sends institute to multiple resource managers respectively for the request operation in response to distributed transaction The preparation operation requests of the subtransaction of distributed transaction are stated, the operation requests that prepare are for the corresponding subtransaction of request confirmation The implementing result of resource;
Execution module 503, for the preparation based on the multiple resource manager to the subtransaction of the distributed transaction The response results of operation requests execute the corresponding affairs of the response results to the distributed transaction by asynchronous system and grasp Make.
In one embodiment, the execution module 503 may include:
Allocation unit, for distributing to the corresponding subtransaction of multiple response results according to default allocation rule Multiple synchronizing threads in thread pool are pre-configured with multiple synchronizing threads in the thread pool;
Execution unit is used for through asynchronous system for multiple synchronizing threads in the thread pool to the distributed thing Business executes the corresponding transaction operation of the response results.
In one embodiment, the allocation unit may include:
Subelement is established, for establishing task queue for the thread pool;
Subelement is added, for adding multiple subtransactions respectively according to each user for triggering the multiple subtransaction To in the task queue;
Distribute subelement, multiple line synchros for being respectively allocated to the subtransaction in the task queue in thread pool Journey, wherein the corresponding synchronizing thread of each user.
In one embodiment, the execution module 503 may include:
Storage unit, for requesting transaction operation corresponding to the response results and response results and response results Corresponding relationship be stored in standby database, so that other equipment are based on the response knot inquired in the standby database Fruit, the corresponding transaction operation of response results described in asynchronous execution.
In one embodiment, the task manager can also include:
Distribution module 505 is received, for receiving the affairs starting request of client transmission, and the affairs is started and are requested Multiple subtransactions that corresponding distributed transaction divides, are assigned to the processing that the multiple resource manager is prepared operation.
This specification embodiment is based on multiple resource managers to the preparation operation requests of the subtransaction of distributed transaction Response results execute the corresponding transaction operation of response results to distributed transaction by asynchronous system, so that response results are corresponding Transaction operation by asynchronous system execute, reduce the execution link of distributing real time system, shorten distributed transaction Execute loss.
More than, the distributed transaction processing method of this specification embodiment is described in detail in conjunction with Fig. 3 to Fig. 4, in the following, knot Fig. 6 is closed, the distributing real time system system of this specification embodiment is described in detail.
Fig. 6 shows the structural schematic diagram of the distributing real time system system of this specification embodiment offer, such as Fig. 6 institute Show, which may include:
Task manager 601 is operated in response to the request of distributed transaction, respectively to described in the transmission of multiple resource managers The preparation operation requests of the subtransaction of distributed transaction, the money for preparing operation requests and being used for the corresponding subtransaction of request confirmation The implementing result in source;
Task manager 601 distributes to the corresponding subtransaction of multiple response results according to default allocation rule Multiple synchronizing threads 603 in thread pool are pre-configured with multiple synchronizing threads in the thread pool;
Multiple synchronizing threads 603 in the thread pool execute the response to the distributed transaction by asynchronous system As a result corresponding transaction operation.
This specification embodiment is based on multiple resource managers to the preparation operation requests of the subtransaction of distributed transaction Response results execute the corresponding transaction operation of response results to distributed transaction by asynchronous system, so that response results are corresponding Transaction operation by asynchronous system execute, reduce the execution link of distributing real time system, shorten distributed transaction Execute loss.
More than, the distributed transaction processing method of this specification embodiment is described in detail in conjunction with Fig. 3 and Fig. 4, in the following, knot Fig. 7 is closed, the distributing real time system system of this specification embodiment is described in detail.
Fig. 7 shows the structural schematic diagram of the distributing real time system system of this specification embodiment offer, such as Fig. 7 institute Show, which may include:
Task manager 701 is operated in response to the request of distributed transaction, respectively to described in the transmission of multiple resource managers The preparation operation requests of the subtransaction of distributed transaction, the money for preparing operation requests and being used for the corresponding subtransaction of request confirmation The implementing result in source;
Task manager 701 requests transaction operation corresponding to the response results and response results and response results Corresponding relationship be stored in standby database 703;
Other equipment 705 respond knot based on the response results inquired in the standby database described in asynchronous execution The corresponding transaction operation of fruit.
This specification embodiment is based on multiple resource managers to the preparation operation requests of the subtransaction of distributed transaction Response results execute the corresponding transaction operation of response results to distributed transaction by asynchronous system, so that response results are corresponding Transaction operation by asynchronous system execute, reduce the execution link of distributing real time system, shorten distributed transaction Execute loss.
Fig. 8 is the structural schematic diagram for the terminal device that one embodiment of this specification provides.Referring to FIG. 8, in hardware Level, the terminal device include processor, optionally further comprising internal bus, network interface, memory.Wherein, memory can It can include memory, such as high-speed random access memory (Random-AccessMemory, RAM), it is also possible to further include non-volatile Property memory (non-volatile memory), for example, at least 1 magnetic disk storage etc..Certainly, which is also possible to wrap Include hardware required for other business.
Processor, network interface and memory can be connected with each other by internal bus, which can be ISA (Industry Standard Architecture, industry standard architecture) bus, PCI (Peripheral Component Interconnect, Peripheral Component Interconnect standard) bus or EISA (Extended Industry Standard Architecture, expanding the industrial standard structure) bus etc..The bus can be divided into address bus, data/address bus, control always Line etc..Only to be indicated with a four-headed arrow in Fig. 8, it is not intended that an only bus or a type of convenient for indicating Bus.
Memory, for storing program.Specifically, program may include program code, and said program code includes calculating Machine operational order.Memory may include memory and nonvolatile memory, and provide instruction and data to processor.
Processor is from the then operation into memory of corresponding computer program is read in nonvolatile memory, in logical layer The associated apparatus of resource increment object and resource object is formed on face.Processor executes the program that memory is stored, and specific For performing the following operations:
In response to the request operation of distributed transaction, the son of the distributed transaction is sent to multiple resource managers respectively The preparation operation requests of affairs, the implementing result for preparing operation requests and being used for the resource of the corresponding subtransaction of request confirmation;
Based on the multiple resource manager to the response knot of the preparation operation requests of the subtransaction of the distributed transaction Fruit executes the corresponding transaction operation of the response results to the distributed transaction by asynchronous system.
This specification embodiment is based on multiple resource managers to the preparation operation requests of the subtransaction of distributed transaction Response results execute the corresponding transaction operation of response results to distributed transaction by asynchronous system, so that response results are corresponding Transaction operation by asynchronous system execute, reduce the execution link of distributing real time system, shorten distributed transaction Execute loss.
Distributed transaction processing method disclosed in the above-mentioned embodiment illustrated in fig. 3 such as this specification can be applied to processor In, or realized by processor.Processor may be a kind of IC chip, the processing capacity with signal.It was realizing Each step of Cheng Zhong, the above method can be complete by the integrated logic circuit of the hardware in processor or the instruction of software form At.Above-mentioned processor can be general processor, including central processing unit (Central Processing Unit, CPU), Network processing unit (Network Processor, NP) etc.;It can also be digital signal processor (Digital Signal Processor, DSP), it is specific integrated circuit (Application Specific Integrated Circuit, ASIC), existing Field programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic device are divided Vertical door or transistor logic, discrete hardware components.It may be implemented or execute this specification one or more embodiment In disclosed each method, step and logic diagram.General processor can be microprocessor or the processor is also possible to Any conventional processor etc..The step of method in conjunction with disclosed in this specification one or more embodiment, can directly embody Execute completion for hardware decoding processor, or in decoding processor hardware and software module combination execute completion.Software Module can be located at random access memory, flash memory, read-only memory, programmable read only memory or electrically erasable programmable storage In the storage medium of this fields such as device, register maturation.The storage medium is located at memory, and processor reads the letter in memory Breath, in conjunction with the step of its hardware completion above method.
The terminal device can also carry out the distributing real time system side of Fig. 1 performed by the distributing real time system device of Fig. 3 Method, details are not described herein for this specification.
Certainly, other than software realization mode, other implementations are not precluded in the terminal device of this specification, such as Logical device or the mode of software and hardware combining etc., that is to say, that the executing subject of following process flow is not limited to each Logic unit is also possible to hardware or logical device.
This specification embodiment also provides a kind of computer readable storage medium, is stored on computer readable storage medium Computer program, the computer program realize each process of above-mentioned each embodiment of the method when being executed by processor, and can reach To identical technical effect, to avoid repeating, which is not described herein again.Wherein, the computer readable storage medium, it is such as read-only Memory (Read-Only Memory, abbreviation ROM), random access memory (Random Access Memory, abbreviation RAM), magnetic or disk etc..
It should be understood by those skilled in the art that, the embodiment of this specification can provide as method, system or computer journey Sequence product.Therefore, in terms of this specification can be used complete hardware embodiment, complete software embodiment or combine software and hardware Embodiment form.Moreover, it wherein includes computer usable program code that this specification, which can be used in one or more, The computer implemented in computer-usable storage medium (including but not limited to magnetic disk storage, CD-ROM, optical memory etc.) The form of program product.
This specification is referring to the method, equipment (system) and computer program product according to this specification embodiment Flowchart and/or the block diagram describes.It should be understood that can be realized by computer program instructions every in flowchart and/or the block diagram The combination of process and/or box in one process and/or box and flowchart and/or the block diagram.It can provide these computers Processor of the program instruction to general purpose computer, special purpose computer, Embedded Processor or other programmable data processing devices To generate a machine, so that generating use by the instruction that computer or the processor of other programmable data processing devices execute It is in realize the function of specifying in one or more flows of the flowchart and/or one or more blocks of the block diagram System.
These computer program instructions, which may also be stored in, is able to guide computer or other programmable data processing devices with spy Determine in the computer-readable memory that mode works, so that it includes referring to that instruction stored in the computer readable memory, which generates, Enable the manufacture of system, the instruction system realize in one box of one or more flows of the flowchart and/or block diagram or The function of being specified in multiple boxes.
These computer program instructions also can be loaded onto a computer or other programmable data processing device, so that counting Series of operation steps are executed on calculation machine or other programmable devices to generate computer implemented processing, thus in computer or The instruction executed on other programmable devices is provided for realizing in one or more flows of the flowchart and/or block diagram one The step of function of being specified in a box or multiple boxes.
In a typical configuration, calculating equipment includes one or more processors (CPU), input/output interface, net Network interface and memory.
Memory may include the non-volatile memory in computer-readable medium, random access memory (RAM) and/or The forms such as Nonvolatile memory, such as read-only memory (ROM) or flash memory (flash RAM).Memory is computer-readable medium Example.
Computer-readable medium includes permanent and non-permanent, removable and non-removable media can be by any method Or technology come realize information store.Information can be computer readable instructions, data structure, the module of program or other data. The example of the storage medium of computer includes, but are not limited to phase change memory (PRAM), static random access memory (SRAM), moves State random access memory (DRAM), other kinds of random access memory (RAM), read-only memory (ROM), electric erasable Programmable read only memory (EEPROM), flash memory or other memory techniques, read-only disc read only memory (CD-ROM) (CD-ROM), Digital versatile disc (DVD) or other optical storage, magnetic cassettes, tape magnetic disk storage or other magnetic storage devices Or any other non-transmission medium, can be used for storage can be accessed by a computing device information.As defined in this article, it calculates Machine readable medium does not include temporary computer readable media (transitory media), such as the data-signal and carrier wave of modulation.
It is above-mentioned that specification specific embodiment is described.Other embodiments are within the scope of the appended claims. In some cases, the movement recorded in detail in the claims or step can be executed according to the sequence being different from embodiment And desired result still may be implemented.In addition, process depicted in the drawing not necessarily require the particular order shown or Person's consecutive order is just able to achieve desired result.In some embodiments, multitasking and parallel processing are also possible Or it may be advantageous.
It should also be noted that, the terms "include", "comprise" or its any other variant are intended to nonexcludability It include so that the process, method, commodity or the equipment that include a series of elements not only include those elements, but also to wrap Include other elements that are not explicitly listed, or further include for this process, method, commodity or equipment intrinsic want Element.In the absence of more restrictions, the element limited by sentence "including a ...", it is not excluded that including element There is also other identical elements in process, method, commodity or equipment.
The above is only the embodiments of this specification, are not limited to this specification.For those skilled in the art For, this specification can have various modifications and variations.All any modifications made within the spirit and principle of this specification, Equivalent replacement, improvement etc., should be included within the scope of the claims of this specification.

Claims (10)

1. a kind of distributed transaction processing method, the task manager applied to distributed transaction, comprising:
In response to the request operation of distributed transaction, the subtransaction of the distributed transaction is sent to multiple resource managers respectively Preparation operation requests, it is described prepare operation requests for the corresponding subtransaction of request confirmation resource implementing result;
Based on the multiple resource manager to the response results of the preparation operation requests of the subtransaction of the distributed transaction, lead to It crosses asynchronous system and the corresponding transaction operation of the response results is executed to the distributed transaction.
2. the method as described in claim 1, described to execute the response results to the distributed transaction by asynchronous system Corresponding transaction operation, comprising:
The corresponding subtransaction of multiple response results is distributed to according to default allocation rule multiple same in thread pool Thread is walked, is pre-configured with multiple synchronizing threads in the thread pool;
Multiple synchronizing threads in the thread pool are used to execute the response to the distributed transaction by asynchronous system and tie The corresponding transaction operation of fruit.
3. method according to claim 2, it is described by the corresponding subtransaction of multiple response results according to default point Multiple synchronizing threads in thread pool are distributed to rule, comprising:
Task queue is established for the thread pool;
Multiple subtransactions are added separately in the task queue according to each user for triggering the multiple subtransaction;
Multiple synchronizing threads subtransaction in the task queue being respectively allocated in thread pool, wherein each user A corresponding synchronizing thread.
4. the method as described in claim 1, described to execute the response results to the distributed transaction by asynchronous system Corresponding transaction operation, comprising:
The corresponding relationship that the response results and response results and transaction operation corresponding to response results are requested is stored in standby With in database, so that other equipment are based on the response results inquired in the standby database, rung described in asynchronous execution Answer the corresponding transaction operation of result.
5. the method as described in claim 1, in the subtransaction for sending the distributed transaction to multiple resource managers respectively Preparation operation requests before, further includes:
The affairs for receiving client transmission start request, and the more of corresponding distributed transaction division are requested in affairs starting A subtransaction is assigned to the processing that the multiple resource manager is prepared operation.
6. a kind of task manager, comprising:
Sending module sends the distribution to multiple resource managers respectively for the request operation in response to distributed transaction The preparation operation requests of the subtransaction of formula affairs, the preparation operation requests are used for the resource of the corresponding subtransaction of request confirmation Implementing result;
Execution module, for the preparation operation requests based on the multiple resource manager to the subtransaction of the distributed transaction Response results, the corresponding transaction operation of the response results is executed to the distributed transaction by asynchronous system.
7. a kind of distributing real time system system, comprising:
Task manager is operated in response to the request of distributed transaction, sends the distributed thing to multiple resource managers respectively The preparation operation requests of the subtransaction of business, the execution for preparing operation requests and being used for the resource of the corresponding subtransaction of request confirmation As a result;
The corresponding subtransaction of multiple response results is distributed to thread pool according to default allocation rule by task manager In multiple synchronizing threads, be pre-configured with multiple synchronizing threads in the thread pool;
Multiple synchronizing threads in the thread pool execute the response results pair to the distributed transaction by asynchronous system The transaction operation answered.
8. a kind of distributing real time system system, comprising:
Task manager is operated in response to the request of distributed transaction, sends the distributed thing to multiple resource managers respectively The preparation operation requests of the subtransaction of business, the execution for preparing operation requests and being used for the resource of the corresponding subtransaction of request confirmation As a result;
The corresponding pass that task manager requests the response results and response results with transaction operation corresponding to response results System is stored in standby database;
For other equipment based on the response results inquired in the standby database, response results described in asynchronous execution are corresponding Transaction operation.
9. a kind of terminal device, comprising: memory, processor and be stored on the memory and can transport on the processor Capable computer program, the computer program realize following steps when being executed by the processor:
In response to the request operation of distributed transaction, the subtransaction of the distributed transaction is sent to multiple resource managers respectively Preparation operation requests, it is described prepare operation requests for the corresponding subtransaction of request confirmation resource implementing result;
Based on the multiple resource manager to the response results of the preparation operation requests of the subtransaction of the distributed transaction, lead to It crosses asynchronous system and the corresponding transaction operation of the response results is executed to the distributed transaction.
10. a kind of computer readable storage medium, computer program, the meter are stored on the computer readable storage medium Calculation machine program realizes following steps when being executed by processor:
In response to the request operation of distributed transaction, the subtransaction of the distributed transaction is sent to multiple resource managers respectively Preparation operation requests, it is described prepare operation requests for the corresponding subtransaction of request confirmation resource implementing result;
Based on the multiple resource manager to the response results of the preparation operation requests of the subtransaction of the distributed transaction, lead to It crosses asynchronous system and the corresponding transaction operation of the response results is executed to the distributed transaction.
CN201810614040.3A 2018-06-14 2018-06-14 Distributed transaction processing method, system, transaction manager and terminal equipment Active CN108958894B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810614040.3A CN108958894B (en) 2018-06-14 2018-06-14 Distributed transaction processing method, system, transaction manager and terminal equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810614040.3A CN108958894B (en) 2018-06-14 2018-06-14 Distributed transaction processing method, system, transaction manager and terminal equipment

Publications (2)

Publication Number Publication Date
CN108958894A true CN108958894A (en) 2018-12-07
CN108958894B CN108958894B (en) 2022-05-10

Family

ID=64488825

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810614040.3A Active CN108958894B (en) 2018-06-14 2018-06-14 Distributed transaction processing method, system, transaction manager and terminal equipment

Country Status (1)

Country Link
CN (1) CN108958894B (en)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109819023A (en) * 2018-12-29 2019-05-28 杭州励飞软件技术有限公司 Distributed transaction processing method and Related product
CN110134735A (en) * 2019-04-10 2019-08-16 阿里巴巴集团控股有限公司 The storage method and device of distributed transaction log
CN110264346A (en) * 2019-05-06 2019-09-20 阿里巴巴集团控股有限公司 Processing method, device and the equipment of assets consumer requests
CN110288255A (en) * 2019-06-28 2019-09-27 深圳前海微众银行股份有限公司 A kind of logistics method and device of distributed transaction
CN111414266A (en) * 2020-03-23 2020-07-14 山东浪潮通软信息科技有限公司 Synchronous and asynchronous communication method and device for distributed transactions
CN112416535A (en) * 2020-11-24 2021-02-26 中国工商银行股份有限公司 Distributed transaction processing method and system
CN115185677A (en) * 2022-06-24 2022-10-14 湖南长银五八消费金融股份有限公司 Business data merging general ledger method, device, computer equipment and medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2010039167A1 (en) * 2008-10-02 2010-04-08 Mindspeed Technologies, Inc. Multi-core system with central transaction control
CN103678556A (en) * 2013-12-06 2014-03-26 华为技术有限公司 Method for processing column-oriented database and processing equipment
CN105988862A (en) * 2015-02-04 2016-10-05 阿里巴巴集团控股有限公司 Distributed transaction processing method and device
CN106201853A (en) * 2015-04-30 2016-12-07 阿里巴巴集团控股有限公司 Method of testing and device
CN106502769A (en) * 2016-09-30 2017-03-15 华为技术有限公司 Distributed transaction processing method, apparatus and system

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2010039167A1 (en) * 2008-10-02 2010-04-08 Mindspeed Technologies, Inc. Multi-core system with central transaction control
CN103678556A (en) * 2013-12-06 2014-03-26 华为技术有限公司 Method for processing column-oriented database and processing equipment
CN105988862A (en) * 2015-02-04 2016-10-05 阿里巴巴集团控股有限公司 Distributed transaction processing method and device
CN106201853A (en) * 2015-04-30 2016-12-07 阿里巴巴集团控股有限公司 Method of testing and device
CN106502769A (en) * 2016-09-30 2017-03-15 华为技术有限公司 Distributed transaction processing method, apparatus and system

Cited By (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109819023A (en) * 2018-12-29 2019-05-28 杭州励飞软件技术有限公司 Distributed transaction processing method and Related product
CN109819023B (en) * 2018-12-29 2021-09-14 杭州励飞软件技术有限公司 Distributed transaction processing method and related product
CN110134735A (en) * 2019-04-10 2019-08-16 阿里巴巴集团控股有限公司 The storage method and device of distributed transaction log
CN110264346A (en) * 2019-05-06 2019-09-20 阿里巴巴集团控股有限公司 Processing method, device and the equipment of assets consumer requests
CN110288255A (en) * 2019-06-28 2019-09-27 深圳前海微众银行股份有限公司 A kind of logistics method and device of distributed transaction
CN111414266A (en) * 2020-03-23 2020-07-14 山东浪潮通软信息科技有限公司 Synchronous and asynchronous communication method and device for distributed transactions
CN111414266B (en) * 2020-03-23 2024-04-05 浪潮通用软件有限公司 Synchronous and asynchronous communication method and device for distributed transaction
CN112416535A (en) * 2020-11-24 2021-02-26 中国工商银行股份有限公司 Distributed transaction processing method and system
CN112416535B (en) * 2020-11-24 2023-12-22 中国工商银行股份有限公司 Distributed transaction processing method and system
CN115185677A (en) * 2022-06-24 2022-10-14 湖南长银五八消费金融股份有限公司 Business data merging general ledger method, device, computer equipment and medium

Also Published As

Publication number Publication date
CN108958894B (en) 2022-05-10

Similar Documents

Publication Publication Date Title
CN108958894A (en) A kind of distributed transaction processing method, system, task manager and terminal device
CN108595157B (en) Block chain data processing method, device, equipment and storage medium
CN105988862B (en) Distributed transaction processing method and device
KR101959153B1 (en) System for efficient processing of transaction requests related to an account in a database
CN108845866B (en) Method and apparatus for processing distributed transactions
CN113067900B (en) Intelligent contract deployment method and device
CN106445933B (en) A kind of data processing method and system
CN112688799B (en) Redis cluster-based client number distribution method and distribution device
CN108415792A (en) Disaster tolerance system, method, apparatus and equipment
CN108733457A (en) The implementation method and device of distributed transaction
CN109725989A (en) A kind of method and device of task execution
CN108574645A (en) A kind of array dispatching method and device
CN115543615A (en) Resource allocation method and device, electronic equipment and storage medium
CN111402058B (en) Data processing method, device, equipment and medium
CN111932238B (en) Payment account recommendation method and device and electronic equipment
CN110659905A (en) Transaction verification method, device, terminal equipment and storage medium
CN110134503A (en) Timed task processing method, device and storage medium under a kind of cluster environment
CN107147610B (en) Resource processing method and device
CN113869902A (en) Block chain transaction execution method and device
CN109461072A (en) A kind of transaction execution method and device
US11120513B2 (en) Capital chain information traceability method, system, server and readable storage medium
CN109582439A (en) DCN dispositions method, device, equipment and computer readable storage medium
CN110381150B (en) Data processing method and device on block chain, electronic equipment and storage medium
Moses et al. The unified structure of consensus: a layered analysis approach
CN108984105B (en) Method and device for distributing replication tasks in network storage device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
TA01 Transfer of patent application right
TA01 Transfer of patent application right

Effective date of registration: 20200921

Address after: Cayman Enterprise Centre, 27 Hospital Road, George Town, Grand Cayman, British Islands

Applicant after: Innovative advanced technology Co.,Ltd.

Address before: Cayman Enterprise Centre, 27 Hospital Road, George Town, Grand Cayman, British Islands

Applicant before: Advanced innovation technology Co.,Ltd.

Effective date of registration: 20200921

Address after: Cayman Enterprise Centre, 27 Hospital Road, George Town, Grand Cayman, British Islands

Applicant after: Advanced innovation technology Co.,Ltd.

Address before: A four-storey 847 mailbox in Grand Cayman Capital Building, British Cayman Islands

Applicant before: Alibaba Group Holding Ltd.

GR01 Patent grant
GR01 Patent grant