All Projects → hwholiday → gid

hwholiday / gid

Licence: Apache-2.0 license
Golang 分布式ID生成系统,高性能、高可用、易扩展的id生成服务

Programming Languages

go
31211 projects - #10 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to gid

leafserver
🍃A high performance distributed unique ID generation system
Stars: ✭ 31 (-43.64%)
Mutual labels:  id, distributed
goimpulse
高可用,高性能的分布式发号服务
Stars: ✭ 17 (-69.09%)
Mutual labels:  id, distributed
GraviT
GraviT is a distributed ray tracing framework that enables applications to leverage hardware-optimized ray tracers within a single environment across many nodes for large-scale rendering tasks.
Stars: ✭ 18 (-67.27%)
Mutual labels:  distributed
hazelcast-csharp-client
Hazelcast .NET Client
Stars: ✭ 98 (+78.18%)
Mutual labels:  distributed
rig
RIG - A Randomised ID Card Generator
Stars: ✭ 20 (-63.64%)
Mutual labels:  id
FastNN
FastNN provides distributed training examples that use EPL.
Stars: ✭ 79 (+43.64%)
Mutual labels:  distributed
toy-rpc
Java基于Netty,Protostuff和Zookeeper实现分布式RPC框架
Stars: ✭ 55 (+0%)
Mutual labels:  distributed
xmutca-rpc
Xmutca-rpc是一个基于netty开发的分布式服务框架,提供稳定高性能的RPC远程服务调用功能,支持注册中心,服务治理,负载均衡等特性,开箱即用。
Stars: ✭ 18 (-67.27%)
Mutual labels:  distributed
Galaxy
Galaxy is an asynchronous parallel visualization ray tracer for performant rendering in distributed computing environments. Galaxy builds upon Intel OSPRay and Intel Embree, including ray queueing and sending logic inspired by TACC GraviT.
Stars: ✭ 18 (-67.27%)
Mutual labels:  distributed
rockgo
A developing game server framework,based on Entity Component System(ECS).
Stars: ✭ 617 (+1021.82%)
Mutual labels:  distributed
heat
Distributed tensors and Machine Learning framework with GPU and MPI acceleration in Python
Stars: ✭ 127 (+130.91%)
Mutual labels:  distributed
sandid
Every grain of sand on Earth has its own ID.
Stars: ✭ 39 (-29.09%)
Mutual labels:  id
tips
TiKV based Pub/Sub server
Stars: ✭ 31 (-43.64%)
Mutual labels:  distributed
meesee
Task queue, Long lived workers for work based parallelization, with processes and Redis as back-end. For distributed computing.
Stars: ✭ 14 (-74.55%)
Mutual labels:  distributed
FedScale
FedScale is a scalable and extensible open-source federated learning (FL) platform.
Stars: ✭ 274 (+398.18%)
Mutual labels:  distributed
dask-sql
Distributed SQL Engine in Python using Dask
Stars: ✭ 271 (+392.73%)
Mutual labels:  distributed
go-cita
A Go implementation of CITA. https://docs.nervos.org/cita
Stars: ✭ 25 (-54.55%)
Mutual labels:  distributed
DemonHunter
Distributed Honeypot
Stars: ✭ 54 (-1.82%)
Mutual labels:  distributed
blockchain-hackathon
An electronic health record (EHR) system built on Hyperledger Composer blockchain
Stars: ✭ 67 (+21.82%)
Mutual labels:  distributed
erl dist
Rust Implementation of Erlang Distribution Protocol
Stars: ✭ 110 (+100%)
Mutual labels:  distributed

简介

推荐使用V2版本

gid 是使用golang开发的生成分布式Id系统,基于数据库号段算法实现

HTTP,GRPC 对外服务

性能

  • id 从内存生成,如果(step)步长设置的足够大,qps可达到千万+

可用性

  • id 分配依赖mysql ,当mysql不可用的,如果内存上还有的可以继续分配

特性

  1. 全局唯一的int64型id
  2. 分配ID只访问内存
  3. 可无限横向扩展
  4. 依赖mysql恢复服务迅速
    ......

安装

  • 初始化 mysql
create database gid;
use gid;
create table segments
(
    biz_tag     varchar(128) not null,
    max_id      bigint       null,
    step        int          null,
    remark      varchar(200) null,
    create_time bigint       null,
    update_time bigint       null,
    constraint segments_pk
        primary key (biz_tag)
) ENGINE = InnoDB
  DEFAULT CHARSET = utf8mb4
  COLLATE = utf8mb4_bin;

INSERT INTO segments(`biz_tag`, `max_id`, `step`, `remark`, `create_time`, `update_time`)
VALUES ('test', 0, 100000, 'test', 1591706686, 1591706686);
  • 编译运行项目
    git clone https://github.com/hwholiday/gid.git
    cd gid/cmd
    go build -o gidsrv
   ./gidsrv -conf ./gid.toml

压测

BenchmarkService_GetId-4         2046296               583 ns/op 

健康检查

获取ID

获取雪花算法生成的ID

创建 tag

  • biz_tag tag 名称
  • max_id 从这里开始派发ID
  • step 步长
  • remark 备注
  • {"biz_tag":"test6","max_id":0,"step":10,"remark":"test6 tag"}
  • curl -H "Content-Type:application/json" -X POST --data '{"biz_tag":"test6","max_id":0,"step":10,"remark":"test6 tag"}' http://127.0.0.1:8080/tag

重点SQL

Begin
UPDATE table SET max_id=max_id+step WHERE biz_tag=xxx
SELECT tag, max_id, step FROM table WHERE biz_tag=xxx
Commit

文献

美团点评分布式ID生成系统

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].