GithubHelp home page GithubHelp logo

duraqueue's Introduction

https://travis-ci.org/willemt/duraqueue.png https://coveralls.io/repos/willemt/duraqueue/badge.png

Dead simple queue that allows zero copy semantics and is durable under failure.

How?

We read and write to the underlying binary file using mmap. We use a second mmap to create a mirror of the buffer so that the caller doesn't need to fool around with pointer arithmetic + buffer boundaries.

Durability

  1. dqueue_offer() returns only when the item has been msync()'d.
  2. Because we write a header and footer for each item, the non-existence of the footer indicates the item wasn't completely written to disk.
doc/durability.png

Why?

A frontend process provides durability with minimal latency, while a backend process does processing of the queue.

Example

void *qu = dqueuew_open("tmp.queue", 1 << 13);
dqueue_offer(qu, "abcd", 4);
dqueue_poll(qu);

Tradeoffs

  • Multiple writers/readers aren't possible. It isn't thread safe. You should just create multiple queues.

duraqueue's People

Contributors

willemt avatar

Stargazers

Cat avatar  avatar Rick Blundell avatar  avatar  avatar Jack Shao avatar Zhao Xiaohong avatar  avatar Scott Ivey avatar Jonathan McHugh avatar Ryder Rishel avatar Christofer Sjögren avatar  avatar TJ Atterberry avatar Ben Gura avatar Quinlan Pfiffer avatar David Leon Gil avatar Joseph Werle avatar

Watchers

James Cloos avatar  avatar  avatar  avatar

duraqueue's Issues

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.