CN108038141A - Ensure the method for data consistency under micro services framework HTTP interactive modes - Google Patents

Ensure the method for data consistency under micro services framework HTTP interactive modes Download PDF

Info

Publication number
CN108038141A
CN108038141A CN201711201403.2A CN201711201403A CN108038141A CN 108038141 A CN108038141 A CN 108038141A CN 201711201403 A CN201711201403 A CN 201711201403A CN 108038141 A CN108038141 A CN 108038141A
Authority
CN
China
Prior art keywords
business
business service
service
call
micro services
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.)
Withdrawn
Application number
CN201711201403.2A
Other languages
Chinese (zh)
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.)
G Cloud Technology Co Ltd
Original Assignee
G Cloud Technology Co 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 G Cloud Technology Co Ltd filed Critical G Cloud Technology Co Ltd
Priority to CN201711201403.2A priority Critical patent/CN108038141A/en
Publication of CN108038141A publication Critical patent/CN108038141A/en
Withdrawn legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • G06F16/2365Ensuring data consistency and integrity

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The present invention relates to micro services development technique field, a kind of method for particularly relating to ensure under micro services framework HTTP interactive modes data consistency.All pre-operations from business service are called in present invention main business service first respectively, are then recorded in active manager all from business service;If it is all from business service pre-operation success or some from business service pre-operation fail, then continue affairs, otherwise perform affairs stop perform;If all from business service all pre-operation successes, teamworker calls all confirmation operations from business service, if it is confirmed that operation failure, then all confirmation operations of rollback, and perform and operated from the cancellation of service business.Finally if part fails from business service pre-operation, then call all cancellations from business service to operate, untill cancelling successfully.The present invention solves the problems, such as traditional two-phase commitment protocol poor-performing, is not suitable for micro services framework;Three in business service simple semantic operations can be achieved and be called.

Description

Ensure the method for data consistency under micro services framework HTTP interactive modes
Technical field
The present invention relates to micro services development technique field, particularly relates to ensure under a kind of micro services framework HTTP interactive modes The method of data consistency.
Background technology
With the popularization of micro services framework, more and more enterprises are put down using micro services framework to build the business of oneself Platform.While micro services framework brings many benefits for business development, such as single responsibility, stand-alone development are disposed, function is multiple With with System Fault Tolerance etc.;Also some problems are brought, such as exploitation threshold is higher, O&M is more complicated, and the dependence between module is closed It is more complicated, so as to cause data consistency to be difficult to ensure that.At present generally using two-phase commitment protocol under micro services framework Mode ensures the strong consistency of data, and two-phase commitment protocol is a distributed transaction model, this model mainly uses two Stage is submitted to ensure the integrality of distributed transaction.Inside this model, there are three roles:
1、AP:Application, application program, operation layer.
2、RM:Resource Manager, explorer, relevant database or the component for supporting XA interfaces.
3、TM:Transaction Manager, task manager, is responsible for the submission and rollback of each RM.
Two sections of committing protocols are divided into two stages:
1st, TM notifies each RM of all participation affairs, and prepare message is sent to each RM.It is laggard that RM receives message After entering the preparation stage, otherwise directly return failure, or creates and performs local matter, handwritten copy transaction journal (redo with Undo daily records), but do not submit;
2nd, TM, which receives the failed message of RM preparation stages or obtains RM, returns to message time-out, then sends rollback directly to RM (rollback) message, otherwise sends and submits (commit) message.RM performs submission or rollback according to the instruction of TM, has performed The lock used into rear all transaction process of release.
The above method realizes the strong consistency of data, but there are following drawback:
1st, TM is by carrying out data interaction between XA interfaces and each RM, since the 1st stage, the data involved by business It is just locked, and lock across whole and submit flow.High concurrent and be related to business module it is more in the case of to database Performance have a great influence;
2nd, micro services framework is this for XA agreements using the communication between http protocol progress component, HTTP mostly Semantic complex protocol comparison is difficult to realize, and therefore, the above method does not apply to substantially in micro services development field.
Therefore, it is necessary to design a kind of high performance guarantee data consistency suitable for micro services framework HTTP interactive modes Method.
The content of the invention
Present invention solves the technical problem that it is to propose to ensure that data are consistent under a kind of micro services framework HTTP interactive modes The method of property.
The present invention solve above-mentioned technical problem technical solution be:
The method comprises the following steps:
Step 1:All pre-operations from business service of main business service call;
Step 2:Recorded in active manager all from business service;
Step 3:If it is all from business service pre-operation success or some from business service pre-operation fail, then hold Row step 4, otherwise performs affairs and stops performing;
Step 4:If all call all confirmations from business service from business service all pre-operation successes, teamworker Operation, if it is confirmed that operation failure, then all confirmation operations of rollback, and perform and operated from the cancellation of service business;
Step 5:If part fails from business service pre-operation, then call all cancellations from business service to grasp Make, if cancelling operation failure, then cancel operation, Zhi Daoqu in the mechanism that automation is locally provided from business service to perform Untill disappearing successfully;The program that locally executed from business service to retry automatically, which performs, cancels operation, such as timed task etc..
The main business service refers to the initiator of whole business activity, including pays the payment system under scene;
The operation side that whole business activity is referred to from business service;From business service must realize pre-operation, really Recognize and cancel three interfaces, for main business service call.
The active manager management controls whole business activity, including record safeguards the transaction status of global transaction and every A subtransaction state from business service, and all confirmation operations are confirmed when business activity is submitted, cancel in business activity When call it is all cancel operation.
The pre-operation is an attempt to execution business, specifically includes and completes all service observations and reserved necessary business money Source;
Confirmation is to confirm execution business, is the real place for performing business operation, and the stage of recognition does not do any service observation, The service resources only reserved using the pre-operation stage;
The service resources that cancellation is the business that cancels, in particular to the release pre-operation stage is reserved.
The method of the present invention can produce following beneficial effect:
1st, long-time lock database is not required in method of the invention, or even is all not required database service online at any time, Therefore with the advantage in performance.
2nd, the operational semantics of Interface Semantic and HTTP interactive modes that method of the invention defines is closer to, therefore, than It is well suited to use in micro services field.
Brief description of the drawings
The present invention is further described below in conjunction with the accompanying drawings:
Fig. 1 is the flow chart of the present invention;
Fig. 2 is the sequence chart of the one of which implementation of the present invention.
Embodiment
As shown in Figure 1, basic step of the invention is as follows:
Step 1:All pre-operations from business service of main business service call;
Step 2:Recorded in active manager all from business service;
Step 3:If it is all from business service pre-operation success or some from business service pre-operation fail, then hold Row step 4, otherwise performs affairs and stops performing;
Step 4:If all call all confirmations from business service from business service all pre-operation successes, teamworker Operation, if it is confirmed that operation failure, then all confirmation operations of rollback, and perform and operated from the cancellation of service business;
Step 5:If part fails from business service pre-operation, then call all cancellations from business service to grasp Make, if cancelling operation failure, then cancel operation, Zhi Daoqu in the mechanism that automation is locally provided from business service to perform Untill disappearing successfully;The program that locally executed from business service to retry automatically, which performs, cancels operation, such as timed task etc..
Below by taking the process flow of HTTP as an example, the processing procedure of one of which implementation is told about.As shown in Fig. 2, point Pre-operation is not represented respectively, confirm and take realizing three kinds of interfaces try, confirm, cancel from business 1 and from business 2 Disappear.Specific process flow is as follows:
1. main business service call is operated from the try of business service, and when obtaining confirm/cancel interfaces and time-out Between.
If 2. from business all try successes, main business service execution local service, and by the confirm/cancel of acquisition Interface is sent to active manager, and active manager can sequentially call the confirm interfaces from business 1 and from business 2 and record Solicited status, if asking successfully, to notify main business service commitment local matter.If the failure of confirm parts, activity Manager can be called sequentially from business 1 and from the cancel interfaces of business 2 to cancel the operation of try.
3. if from the part or all of try failures of business, the direct rollback of main business simultaneously terminates, and try successfully obtains employment Business service then handles the data in try completions but time-out by timed task, these data are done rollback processing ensures master Business service is consistent with the data from business service.

Claims (5)

1. ensure the method for data consistency under a kind of micro services framework HTTP interactive modes, it is characterised in that the method Comprise the following steps:
Step 1:All pre-operations from business service of main business service call;
Step 2:Recorded in active manager all from business service;
Step 3:If it is all from business service pre-operation success or some from business service pre-operation fail, then perform step Rapid 4, otherwise perform affairs and stop performing;
Step 4:If all call all confirmations from business service to grasp from business service all pre-operation successes, teamworker Make, if it is confirmed that operation failure, then all confirmation operations of rollback, and perform and operated from the cancellation of service business;
Step 5:If part fails from business service pre-operation, then call all cancellations from business service to operate, such as Fruit cancel operation failure, then from business service locally provide automation mechanism come perform cancel operation, until cancel into Untill work(;The program that locally executed from business service to retry automatically, which performs, cancels operation.
2. according to the method described in claim 1, it is characterized in that,
The main business service refers to the initiator of whole business activity, including pays the payment system under scene;
Described is the operation side of whole business activity from business service;Pre-operation, confirmation and cancellation must be realized from business service Three interfaces, for main business service call.
3. according to the method described in claim 1, it is characterized in that, the active manager management controls whole business activity, The transaction status of global transaction is safeguarded including record and each from the subtransaction state of business service, and when business activity is submitted Confirm all confirmation operations, call all cancel to operate when business activity is cancelled.
4. according to the method described in claim 2, it is characterized in that, the active manager management controls whole business activity, The transaction status of global transaction is safeguarded including record and each from the subtransaction state of business service, and when business activity is submitted Confirm all confirmation operations, call all cancel to operate when business activity is cancelled.
5. method according to any one of claims 1 to 4, it is characterised in that
The pre-operation is an attempt to execution business, specifically includes and completes all service observations and reserved necessary service resources;
Confirmation is to confirm execution business, is the real place for performing business operation, and the stage of recognition does not do any service observation, only makes The service resources reserved with the pre-operation stage;
The service resources that cancellation is the business that cancels, in particular to the release pre-operation stage is reserved.
CN201711201403.2A 2017-11-27 2017-11-27 Ensure the method for data consistency under micro services framework HTTP interactive modes Withdrawn CN108038141A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201711201403.2A CN108038141A (en) 2017-11-27 2017-11-27 Ensure the method for data consistency under micro services framework HTTP interactive modes

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201711201403.2A CN108038141A (en) 2017-11-27 2017-11-27 Ensure the method for data consistency under micro services framework HTTP interactive modes

Publications (1)

Publication Number Publication Date
CN108038141A true CN108038141A (en) 2018-05-15

Family

ID=62094053

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201711201403.2A Withdrawn CN108038141A (en) 2017-11-27 2017-11-27 Ensure the method for data consistency under micro services framework HTTP interactive modes

Country Status (1)

Country Link
CN (1) CN108038141A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109495452A (en) * 2018-10-24 2019-03-19 苏宁易购集团股份有限公司 Response timeout processing method, server and client end response timeout treatment system
CN109978540A (en) * 2019-03-07 2019-07-05 银清科技(北京)有限公司 A kind of distribution bookkeeping methods, equipment and system
WO2019232962A1 (en) * 2018-06-06 2019-12-12 平安科技(深圳)有限公司 Data processing method, system, computer device and storage medium
CN112417042A (en) * 2020-11-19 2021-02-26 中国建设银行股份有限公司 Method and device for processing service request

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120011100A1 (en) * 2010-07-06 2012-01-12 Fujitsu Limited Snapshot acquisition processing technique
CN106168915A (en) * 2016-04-25 2016-11-30 云南电网有限责任公司昆明供电局 Distributed system architecture data process consistency ensuring method
CN106502769A (en) * 2016-09-30 2017-03-15 华为技术有限公司 Distributed transaction processing method, apparatus and system
CN106503132A (en) * 2016-10-19 2017-03-15 广州快塑电子商务有限公司 A kind of distributed transaction management method and system
CN106649845A (en) * 2016-12-30 2017-05-10 上海富聪金融信息服务有限公司 Transaction information service platform and information processing method thereof
CN106775959A (en) * 2016-12-06 2017-05-31 上海亿账通互联网科技有限公司 Distributed transaction processing method and system
CN106777026A (en) * 2016-12-08 2017-05-31 用友网络科技股份有限公司 Support method, the apparatus and system of micro services framework affairs final consistency

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120011100A1 (en) * 2010-07-06 2012-01-12 Fujitsu Limited Snapshot acquisition processing technique
CN106168915A (en) * 2016-04-25 2016-11-30 云南电网有限责任公司昆明供电局 Distributed system architecture data process consistency ensuring method
CN106502769A (en) * 2016-09-30 2017-03-15 华为技术有限公司 Distributed transaction processing method, apparatus and system
CN106503132A (en) * 2016-10-19 2017-03-15 广州快塑电子商务有限公司 A kind of distributed transaction management method and system
CN106775959A (en) * 2016-12-06 2017-05-31 上海亿账通互联网科技有限公司 Distributed transaction processing method and system
CN106777026A (en) * 2016-12-08 2017-05-31 用友网络科技股份有限公司 Support method, the apparatus and system of micro services framework affairs final consistency
CN106649845A (en) * 2016-12-30 2017-05-10 上海富聪金融信息服务有限公司 Transaction information service platform and information processing method thereof

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
GUY PARDON 等: "Atomic distributed transactions: a RESTful design", 《WWW'14 COMPANION: PROCEEDINGS OF THE 23RD INTERNATIONAL CONFERENCE ON WORLD WIDE WEB》 *
中国支付清算协会: "《支付大讲堂—中国支付清算协会培训课程精选系列》", 31 December 2015, 中国金融出版社 *

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2019232962A1 (en) * 2018-06-06 2019-12-12 平安科技(深圳)有限公司 Data processing method, system, computer device and storage medium
CN109495452A (en) * 2018-10-24 2019-03-19 苏宁易购集团股份有限公司 Response timeout processing method, server and client end response timeout treatment system
CN109495452B (en) * 2018-10-24 2020-08-11 苏宁易购集团股份有限公司 Response timeout processing method, server and client response timeout processing system
CN109978540A (en) * 2019-03-07 2019-07-05 银清科技(北京)有限公司 A kind of distribution bookkeeping methods, equipment and system
CN109978540B (en) * 2019-03-07 2021-02-23 银清科技有限公司 Distributed accounting method, device and system
CN112417042A (en) * 2020-11-19 2021-02-26 中国建设银行股份有限公司 Method and device for processing service request

Similar Documents

Publication Publication Date Title
CN108038141A (en) Ensure the method for data consistency under micro services framework HTTP interactive modes
CN103647834B (en) System and method used for processing multi-phase distributed task scheduling
Butler et al. A trace semantics for long-running transactions
US6138143A (en) Method and apparatus for asynchronous transaction processing
US9286583B2 (en) Integrating mind mapping technology with case modeling
DE69719269T2 (en) Ensuring indivisibility for a collection of transactional work steps in a workflow management system
US8656342B2 (en) Composing integrated systems using GUI-based applications and web services
EP1693765B1 (en) A data processing system and method
US7971183B2 (en) Tool for converting legacy applications to web services
CN103902560A (en) Distributed transaction processing method and system
US20040268187A1 (en) Undo infrastructure
CN110502319B (en) Distributed transaction processing method and device, electronic equipment and storage medium
CN104216912A (en) Method and device for achieving non-intrusive service form workflow
Dalal et al. Empirical study of root cause analysis of software failure
CN108197176A (en) Core bank data processing method and its system based on distributed type assemblies framework
CN102317913B (en) A kind of transaction recovery method and transaction recovery device
US7971184B2 (en) GUI-based application to web services conversion system
CN114925084B (en) Distributed transaction processing method, system, equipment and readable storage medium
CN106874130A (en) The processing method of distributed transaction in a kind of micro services framework
CN109002462A (en) A kind of method and system for realizing distributed things
CN108292207A (en) Method and apparatus for declaratively choreography
Gan et al. Runtime monitoring of web service conversations
CN110532069A (en) A kind of distributed transaction submission method and device
CN108205440A (en) A kind of task flow framework implementation method for supporting rollback
CN113297329A (en) Transaction processing method, device, equipment, storage medium and program product

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
WW01 Invention patent application withdrawn after publication
WW01 Invention patent application withdrawn after publication

Application publication date: 20180515