Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/wuqinqiang/easycar
A simple distributed transaction framework implemented by go
https://github.com/wuqinqiang/easycar
distributed-transaction easycar golang grpc saga tcc
Last synced: 13 days ago
JSON representation
A simple distributed transaction framework implemented by go
- Host: GitHub
- URL: https://github.com/wuqinqiang/easycar
- Owner: wuqinqiang
- License: mit
- Created: 2021-10-31T08:58:57.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2023-05-03T04:44:52.000Z (over 1 year ago)
- Last Synced: 2024-08-02T20:44:57.653Z (4 months ago)
- Topics: distributed-transaction, easycar, golang, grpc, saga, tcc
- Language: Go
- Homepage:
- Size: 413 KB
- Stars: 69
- Watchers: 3
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- my-awesome - wuqinqiang/easycar - transaction,easycar,golang,grpc,saga,tcc pushed_at:2023-05 star:0.1k fork:0.0k A simple distributed transaction framework implemented by go (Go)
README
# easycar
[简体中文](https://github.com/wuqinqiang/easycar/blob/main/README_CN.md)
## What is easycar?
easycar is a distributed transaction framework implemented in go that supports a two-phase commit protocol. Its full
name is (easy commit and rollback).For more information about easycar see this post [easycar](https://www.syst.top/posts/go/easycar/).
Architecture
![easycar](https://cdn.syst.top/easycar2.jpg)
## Features
**Supports both protocol and transaction mode mixing**
In a set of distributed transactions, each RM can use a different transport protocol (HTTP/gRPC) and transaction mode (
TCC/Sage...), so it allows a mix of RM protocols and transaction modes.**Support for concurrent execution of transactions**
Supports concurrent execution in layers. The participating RMs are layered by the set weights, and RMs in the same layer
can be invoked concurrently, and the next layer is processed after one layer is finished.**Service Registration and Discovery**
Currently supports etcd and consul.
**Client-side load balancing**
**Support**:
- IPHash
- ConsistentHash
- P2C
- Random
- R2
- LeastLoad
- Bounded## Examples of success
![success](https://cdn.syst.top/success2.png)
## Examples of failed
![success](https://cdn.syst.top/failed2.png)
## State
**global state**
![global](https://cdn.syst.top/state3.png)## Run
```shell
cp conf.example.yml conf.ymal
```**Modify configuration**
```ymal
## conf
automaticExecution2: true #when the first stage of execution ends, it will commit automatically or rollback if it is true
timeout: 7 #unit of second
server:
grpc:
listenOn: 127.0.0.1:8088
keyFile: #server key
certFile: #server cert
gateway:
isOpen: true
certFile: #client cert
serverName:
http:
listenOn: 127.0.0.1:8085db: #easycar server db
driver: mongodb
mysql:
dbURL: easycar:easycar@tcp(127.0.0.1:3306)/easycar?charset=utf8&parseTime=True&loc=Local
maxLifetime: 7200
maxIdleConns: 10
maxOpenConns: 20
mongodb:
url: mongodb://127.0.0.1:27017/easycar
minPool: 10
maxPool: 20registry:
etcd:
user: ""
pass: ""
hosts:
- 127.0.0.1:2379
#add moretracing:
jaegerUrl: http://localhost:14268/api/tracescron:
maxTimes: 2 #max retry times when rm is not available
timeInterval: 1 #unit is minute. it means that the next retry is 1m later, not in strict mode
```**run**
```shell
go run cmd/main.go
```**docker-compose**
```shell
docker-compose up -d easycar
```## examples
more examples to:[examples](https://github.com/easycar/examples)
## todo list
- [x] Saga
- [x] TCC
- [ ] XA
- [ ] client
- [x] client-go
- [ ] client-rust
- [ ] client-php
- [ ] client-python
- [ ] client-java
- [x] retry
- [x] registry and discovery
- [x] etcd
- [x] consul
- [x] balancer
- [x] notify
- [x] tracing
- [ ] tool
- more store