GithubHelp home page GithubHelp logo

universal-it-systems / p5-queue-q Goto Github PK

View Code? Open in Web Editor NEW

This project forked from atomicstack/p5-queue-q

0.0 3.0 1.0 288 KB

Mix-and-match Queue types and backends for Perl5

Perl 93.95% Lua 6.05%

p5-queue-q's Introduction

NAME
    Queue::Q - Mix-and-match Queue Implementations and Backends

SYNOPSIS
      # Pick you queue type and a back-end:
  
      # Very primitive FIFO queue (abstract interface)
      use Queue::Q::NaiveFIFO;
      # ... and its pure-Perl, in-memory implementation
      use Queue::Q::NaiveFIFO::Perl;
      # ... its Redis-based implementation
      use Queue::Q::NaiveFIFO::Redis;
  
      # "Reliable" enqueue, claim, mark-as-done FIFO queue:
      use Queue::Q::ClaimFIFO; # abstract interface
      # ... and again, its pure-Perl, in-memory implementation
      use Queue::Q::ClaimFIFO::Perl;
      # ... and its Redis-based implementation
      use Queue::Q::ClaimFIFO::Redis;
  
      # A composite, distributed queue, built from shards of
      # the above types with weak global and strict local
      # ordering, scaling beyond single nodes.
      use Queue::Q::DistFIFO; 
  
      # Usage is somewhat similar for most queue types:
      my $queue = Queue::Q::ClaimFIFO::Redis->new(
          server      => 'redis-01',
          port        => '6379',
          queue_name  => "image_queue"
      );
  
      $q->enqueue_item( $img_url );
  
      # In another process on another machine:
      while (defined( my $item = $q->claim_item )) {
          # Do some work!
          $q->mark_item_as_done($item);
      }

      # n-ary versions exist, too:
      $q->enqueue_items( @img_urls );
      my @items = $q->claim_items(10); # 10 at a time, padded with undef
      $q->mark_items_as_done(@items);

DESCRIPTION
    This is an experimental module. The interface may change without notice.
    Before using it in production, please get in touch with the authors!

    "Queue::Q" is a collection of queue implementations each with multiple
    backends. Right now, it comes with three basic queues:

    Queue::Q::NaiveFIFO
      A naive FIFO queue "NaiveFIFO". Supports enqueuing data and later
      claiming it in the order it was enqueued. Strict ordering,
      low-latency, high-throughput, no resilience against crashing workers.

    Queue::Q::ClaimFIFO
      A claim/mark-as-done FIFO queue "ClaimFIFO". Supports enqueuing data
      (as Queue::Q::ClaimFIFO::Item objects), claiming items, and keeping
      track of items-being-worked-on until they are reported as done. Strict
      ordering, slightly higher latency and lower throughput than the naive
      FIFO queue. Resilience against crashing workers when combined with a
      clean-up script that checks for old, claimed items.

    Queue::Q::ReliableFIFO
      Similar interface to the "ClaimFIFO" queue type, but only comes with a
      Redis-backed implementation now. Much faster for the basic operations
      then "ClaimFIFO" since it doesn't always have to execute Lua scripts.
      See Queue::Q::ReliableFIFO for details.

    The first two basic queues come with two back-end implementations each
    right now: One is a very simple, in-memory, single-process
    implementation Queue::Q::NaiveFIFO::Perl and Queue::Q::ClaimFIFO::Perl
    respectively. The other is an implementation based on Redis:
    Queue::Q::NaiveFIFO::Redis and Queue::Q::ClaimFIFO::Redis.

    As noted above, the "ReliableFIFO" queue has a Redis-based backend only
    for now.

    In addition to the basic queue types, the distribution contains
    Queue::Q::DistFIFO, an implementation of a distributed queue that can
    use the basic queues as shards (but only one type of shard per
    distributed queue). It supports all operations of the basic queues, but
    does not enforce strict global ordering, but weak global and strict
    local ordering. In an early test, two mid-range servers running multiple
    instances of Redis each sustained 800k-1M transactions per second with a
    naive-type distributed queue. "DistFIFO" has not been tested with the
    "ReliableFIFO" implementation as building blocks yet!

ACKNOWLEDGMENT
    This module was originally developed for Booking.com. With approval from
    Booking.com, this module was generalized and put on CPAN, for which the
    authors would like to express their gratitude.

AUTHOR
    Herald van der Breggen, <[email protected]>

    Steffen Mueller, <[email protected]>

COPYRIGHT AND LICENSE
    Copyright (C) 2012, 2013, 2014 by Steffen Mueller

    This library is free software; you can redistribute it and/or modify it
    under the same terms as Perl itself, either Perl version 5.8.1 or, at
    your option, any later version of Perl 5 you may have available.

p5-queue-q's People

Contributors

heraldb avatar tsee avatar rgs avatar atomicstack avatar ksurent avatar iftekhar25 avatar pjsg avatar xant avatar ericherman avatar komarov avatar samitbadle avatar bkgood avatar

Watchers

James Cloos avatar Antony Ingram avatar  avatar

Forkers

vrosnet

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.