Coder Social home page Coder Social logo

xid's Introduction

xid

Docker Cloud Build Status Docker Pulls

分布式 ID 生成工具

依赖

  • redis

运行 web 服务

单节点

docker run -p8080:8080 threewq/xid

获取 id:

  • 方式 1:GET http://127.0.0.1:8080
  • 方式 2:GET http://127.0.0.1:8080?gen=type1
  • 方式 2:GET http://127.0.0.1:8080/gen/type2

查看所有支持参数

Usage of ./bin/xid_mac:
  -epoch int
        开始时间(秒)
  -mode string
        id 生成模式【snake / id14】 (default "snake")
  -model string
        运行模式:single 单机 id 生成;redis 使用redis 分布式 id生成 (default "single")
  -node-bits uint
        机器长度 (default 5)
  -path string
        访问路径 (default "/")
  -redis-addr string
        redis 地址和端口 (default "localhost:6379")
  -redis-pwd string
        redis 密码
  -step-bits uint
         (default 6)
  -time-unit string
        时间单位: s,ms,10ms,100ms (default "ms")
  -web-addr string
        web 监听地址和端口 (default ":8080")

查看所有运行参数

docker run --rm threewq/xid -h

性能测试

服务器配置:4C8G Linux

启动参数

bin/xid_linux -node-bits=4 -step-bits=7

压测配置

./wrk/wrk -t32 -c300 --latency http://10.105.55.218:8080

结果

Running 10s test @ http://10.105.55.218:8080
  32 threads and 300 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency     2.76ms    2.07ms  34.96ms   70.47%
    Req/Sec     3.50k   243.75     7.20k    78.05%
  Latency Distribution
     50%    2.52ms
     75%    3.91ms
     90%    5.26ms
     99%    9.22ms
  1123959 requests in 10.10s, 142.56MB read
Requests/sec: 111284.29
Transfer/sec:     14.12MB

xid's People

Contributors

threeq avatar nalutor 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.