Giter VIP home page Giter VIP logo

faktory_worker_ruby's Introduction

faktory_worker_ruby

travis

Faktory_worker_ruby is the official Ruby client and worker process for the Faktory background job server. It is similar to Sidekiq.

                       +--------------------+
                       |                    |
                       |     Faktory        |
                       |     Server         |
        +---------->>>>|                    +>>>>--------+
        |              |                    |            |
        |              |                    |            |
        |              +--------------------+            |
+-----------------+                            +-------------------+
|                 |                            |                   |
|    Client       |                            |     Worker        |
|    pushes       |                            |     fetches       |
|     jobs        |                            |      jobs         |
|                 |                            |                   |
|                 |                            |                   |
+-----------------+                            +-------------------+
  • Client - an API any process can use to push jobs to the Faktory server.
  • Worker - a process that pulls jobs from Faktory and executes them.
  • Server - the Faktory daemon which stores background jobs in queues to be processed by Workers.

This gem contains only the client and worker parts. The server part is here

Requirements

Installation

gem install faktory_worker_ruby

Documentation

See the wiki for more details.

Your First Job

Your Jobs should include the Faktory::Job module and have a perform method.

class SomeJob
  include Faktory::Job

  def perform(...)
  end
end

then just call SomeJob.perform_async(...) to create a job.

Arguments to the perform method must be simple types supported by JSON, exactly like Sidekiq.

Start the worker

Once you've created a job, you need to start a Worker process to execute those jobs.

bundle exec faktory-worker

Why not Sidekiq?

Sidekiq is awesome; it's stable and useful. It suffers from two design limitations:

  1. Sidekiq uses Redis and Redis is dumb datastore, all Sidekiq features are implemented in Ruby and have to travel over the network to access data.
  2. Because of (1), Sidekiq is limited to Ruby. You can't execute jobs with, e.g., Python and get the same Sidekiq features.

Instead Faktory is a "smart" server that implements all major features within the server itself; the worker process can be dumb and rely on the server for job retries, reservation, Web UI, etc. This also means we can create workers in any programming language.

If your organization is 100% Ruby, Sidekiq will serve you well. If your organization is polyglot, Faktory will be a better fit.

faktory_worker_ruby tries to be Sidekiq API compatible where possible (and PRs to improve this are very welcome).

Author

Mike Perham, @mperham, mike @ contribsys.com

faktory_worker_ruby's People

Contributors

bryanrite avatar jagthedrummer avatar jpwinans avatar jweslley avatar mperham avatar nathanpalmer avatar neilturner77 avatar razenpok avatar thebadmonkeydev avatar ttasanen avatar ttilberg avatar y-yagi avatar

Watchers

 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.