Giter Site home page Giter Site logo

kaanid / dtm Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dtm-labs/dtm

0.0 0.0 0.0 1.65 MB

A distributed transaction solution that supports saga, tcc, xa, 2-phase message strategies, supports multiple languages.

Home Page: http://d.dtm.pub

License: BSD 3-Clause "New" or "Revised" License

Go 96.98% Shell 2.07% Makefile 0.29% JavaScript 0.10% Smarty 0.55%

dtm's Introduction

license Build Status codecov Go Report Card Go Reference Mentioned in Awesome Go

English | 简体中文

Distributed Transactions Manager

What is DTM

DTM is a distributed transaction solution which provides cross-service eventually data consistency. It provides saga, tcc, xa, 2-phase message strategies for a variety of application scenarios. It also supports multiple languages and multiple store engine to form up a transaction as following:

function-picture

Who's using DTM (partial)

Tencent

Ivydad

Eglass

Features

  • Extremely easy to adapt

    • Support HTTP and gRPC, provide easy-to-use programming interfaces, lower substantially the barrier of getting started with distributed transactions. Newcomers can adapt quickly.
  • Easy to use

    • Relieving developers from worrying about suspension, null compensation, idempotent transaction, and other tricky problems, the framework layer handles them all.
  • Language-agnostic

    • Suit for companies with multiple-language stacks. Easy to write bindings for Go, Python, PHP, Node.js, Ruby, and other languages.
  • Easy to deploy, easy to extend

    • DTM depends only on MySQL, easy to deploy, cluster, and scale horizontally.
  • Support for multiple distributed transaction protocol

    • TCC, SAGA, XA, Transactional messages.

DTM vs. others

There is no mature open-source distributed transaction framework for non-Java languages. Mature open-source distributed transaction frameworks for Java language include Ali's Seata, Huawei's ServiceComb-Pack, Jingdong's shardingsphere, himly, tcc-transaction, ByteTCC, and so on, of which Seata is most widely used.

The following is a comparison of the main features of dtm and Seata.

Features DTM Seata Remarks
Supported languages Golang, Python, PHP, and others Java dtm allows easy access from a new language
Exception handling Sub-transaction barrier manual dtm solves idempotent transaction, hanging, null compensation
TCC
XA
AT suggest XA AT is similar to XA with better performance but with dirty rollback
SAGA support concurrency complicated state-machine mode dtm's state-machine mode is being planned
Transactional Messaging dtm provides Transactional Messaging similar to RocketMQ
Multiple DBs in a service
Communication protocols HTTP, gRPC Dubbo, no HTTP
Star count github stars github stars dtm 0.1 is released from 20210604 and under fast development

From the features' comparison above, if your language stack includes languages other than Java, then dtm is the one for you. If your language stack is Java, you can also choose to access dtm and use sub-transaction barrier technology to simplify your business development.

Quick start

run dtm

git clone https://github.com/dtm-labs/dtm && cd dtm
go run main.go

Start the example

git clone https://github.com/dtm-labs/dtmcli-go-sample && cd dtmcli-go-sample
go run main.go

Code

Use

  // business micro-service address
  const qsBusi = "http://localhost:8081/api/busi_saga"
  // The address where DtmServer serves DTM, which is a url
  DtmServer := "http://localhost:36789/api/dtmsvr"
  req := &gin.H{"amount": 30} // micro-service payload
	// DtmServer is the address of DTM micro-service
	saga := dtmcli.NewSaga(DtmServer, dtmcli.MustGenGid(DtmServer)).
		// add a TransOut subtraction,forward operation with url: qsBusi+"/TransOut", reverse compensation operation with url: qsBusi+"/TransOutCom"
		Add(qsBusi+"/TransOut", qsBusi+"/TransOutCom", req).
		// add a TransIn subtraction, forward operation with url: qsBusi+"/TransIn", reverse compensation operation with url: qsBusi+"/TransInCom"
		Add(qsBusi+"/TransIn", qsBusi+"/TransInCom", req)
	// submit the created saga transaction,dtm ensures all subtractions either complete or get revoked
	err := saga.Submit()

Complete example

Refer to dtm-examples.

Slack

You can join the DTM slack channel here.

Wechat

Add wechat friend with id yedf2008, or scan the OR code. Fill in dtm as verification.

yedf2008

Give a star! ⭐

If you think this project is good, or helpful to you, please give a star!

Who is using

Tencent Ivydad Eglass Jiou GoldenData

dtm's People

Contributors

ansionfor avatar authurguo avatar dependabot[bot] avatar fsdfsffdsf avatar geffzhang avatar hitzhangjie avatar huanghao9015 avatar jiahuizz avatar jinwuu avatar julian-chu avatar jxlwqq avatar kevwan avatar li-xiao-shuang avatar lsytj0413 avatar neptuneg avatar parkma99 avatar songliwei2014 avatar tinattwang avatar wei98k avatar wondar-chan avatar wuqinqiang avatar wz14 avatar xyctruth avatar ychensha avatar yedf2 avatar zxmfke avatar zxxshaycormac avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.