zuiwanting / easycar

A simple distributed transaction framework implemented by go

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

easycar

简体中文

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.

Architecture

easycar

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.

Client-side load balancing

Support

  • IPHash
  • ConsistentHash
  • P2C
  • Random
  • R2
  • LeastLoad
  • Bounded

Examples of success

success

Examples of failed

success

State

global state global

Run

cp conf.example.yml conf.ymal

Modify configuration

## 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:8085

db: #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: 20

registry: 
  etcd:
    user: ""
    pass: ""
    hosts:
      - 127.0.0.1:2379
  #add more

tracing:
  jaegerUrl: http://localhost:14268/api/traces

run

go run cmd/main.go 

client

If you use Golang, the client-go is here client.

examples

more examples to:examples

todo list

  • Saga
  • TCC
  • XA
  • client
    • client-go
    • client-rust
    • client-php
    • client-python
    • client-java
  • retry
  • registry and discovery
    • etcd
    • consul
    • zookeeper
  • balancer
  • test
  • notify
  • tracing
  • tool
  • more store
  • ......

About

A simple distributed transaction framework implemented by go

License:MIT License


Languages

Language:Go 98.3%Language:Dockerfile 1.0%Language:Makefile 0.7%