Giter Site home page Giter Site logo

ticketd's Introduction

Distributed durable unique 64bit ID server

What?

ticketd is a distributed durable unique 64bit ID server. The raft protocol is used for consistency.

It uses LMDB for storing data, H2O for HTTP, and raft for concensus.

ticketd is completely written in C.

How?

ticketed opens 2 ports as follows:

  1. HTTP client traffic
  2. Peer to peer traffic using a ticketd specific binary protocol

Usage

Examples below make use of the excellent httpie

Starting

Node A starts a new cluster:

ticketd start --id 1 --peer_port 9001 --http_port 8001

Node B joins the new cluster via A:

ticketd join 127.0.0.1:9001 --id 2 --peer_port 9002 --http_port 8002

Node C joins the new cluster via A:

ticketd join 127.0.0.1:9001 --id 3 --peer_port 9003 --http_port 8003

Obtain a unique identifier via HTTP POST

http --ignore-stdin POST 127.0.0.1:8001
HTTP/1.1 200 OK
Connection: keep-alive
Date: Sat, 08 Aug 2015 10:02:07 GMT
Server: h2o/1.3.1
transfer-encoding: chunked

823378840

Leader Redirection

If we try to obtain an identifier from a non-leader, then ticketd will respond with a 301 redirect reponse. The redirect shows the location of the current leader.

Forcing the client to redirect to the leader means that future requests will be faster (ie. no delays are caused by proxying the request).

curl --request POST -i -L 127.0.0.1:8003
HTTP/1.1 301 Moved Permanently
Date: Thu, 13 Aug 2015 16:03:02 GMT
Server: h2o/1.3.1
Connection: close
location: http://127.0.0.1:8001/

HTTP/1.1 200 OK
Date: Thu, 13 Aug 2015 16:03:02 GMT
Server: h2o/1.3.1
Connection: keep-alive
transfer-encoding: chunked

1272863780

Leader Unavailability

If the leader isn't available, then we respond with a 503.

curl --request POST -i -L 127.0.0.1:8003
HTTP/1.1 503 Leader unavailable
Date: Sat, 15 Aug 2015 05:54:38 GMT
Server: h2o/1.3.1
Connection: keep-alive
content-length: 0

Building

$ make libuv
$ make libh2o
$ make

ticketd's People

Contributors

willemt avatar

Watchers

Marcin Boćkowski avatar James Cloos 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.