Skip to content

Commit

Permalink
Merge branch 'no-pool-fork-concurr'
Browse files Browse the repository at this point in the history
  • Loading branch information
ryandotsmith committed Sep 5, 2013
2 parents ab0785d + f314b7e commit a01b0a9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion queue_classic.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Gem::Specification.new do |s|
s.name = "queue_classic"
s.email = "[email protected]"
s.version = "2.2.1"
s.version = "2.3.0beta"
s.date = "2013-01-02"
s.description = "queue_classic is a queueing library for Ruby apps. (Rails, Sinatra, Etc...) queue_classic features asynchronous job polling, database maintained locks and no ridiculous dependencies. As a matter of fact, queue_classic only requires pg."
s.summary = "postgres backed queue"
Expand Down
15 changes: 10 additions & 5 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ Features:
* Leverage of PostgreSQL's listen/notify & row locking.
* Support for multiple queues with heterogeneous workers.
* JSON data format.
* Forking workers.
* [Fuzzy-FIFO support](http://www.cs.tau.ac.il/~shanir/nir-pubs-web/Papers/Lock_Free.pdf).
* Concurrent job processing using forking workers.
* [Reduced contention FIFO design](http://www.cs.tau.ac.il/~shanir/nir-pubs-web/Papers/Lock_Free.pdf).

Contents:

Expand Down Expand Up @@ -56,7 +56,12 @@ p_queue.enqueue("Kernel.puts", ["hello", "world"])

### Working Jobs

There are two ways to work jobs. The first approach is to use the Rake task. The second approach is to use a custom executable.
There are two ways to work jobs. The first approach is to use the Rake task. The second approach is to use a custom executable. Each approach provides a set of configuration options accessable through the processes' environment:

* `$CONCURRENCY=1` - The number of child processes to run concurrently.
* `$FORK_WORKER=false` - Fork on each job execution. Enabled if `$CONCURRENCY` > 1
* `$QUEUE=default` - The name of the queue to process.
* `$TOP_BOUND=9` - The section of the queue that is elgible for dequeue operations. Setting this value to 1 will ensure a strict FIFO ordering.

#### Rake Task

Expand All @@ -74,10 +79,10 @@ Start the worker via the Rakefile.
$ bundle exec rake qc:work
```

Setup a worker to work a non-default queue.
Setup a worker to work a non-default queue while processing 4 jobs at a time.

```bash
$ QUEUE="priority_queue" bundle exec rake qc:work
$ CONCURRENCY=4 QUEUE="priority_queue" bundle exec rake qc:work
```

#### Custom Worker
Expand Down

0 comments on commit a01b0a9

Please sign in to comment.