All Projects → soveran → Ost

soveran / Ost

Licence: mit
Redis based queues and workers.

Programming Languages

ruby
36898 projects - #4 most used programming language

Labels

Projects that are alternatives of or similar to Ost

Qutee
PHP Background Jobs (Tasks) Manager
Stars: ✭ 63 (-61.35%)
Mutual labels:  workers
Dtcqueuebundle
Symfony2/3/4/5 Queue Bundle (for background jobs) supporting Mongo (Doctrine ODM), Mysql (and any Doctrine ORM), RabbitMQ, Beanstalkd, Redis, and ... {write your own}
Stars: ✭ 115 (-29.45%)
Mutual labels:  workers
Gores
👷 Redis-backed library for creating background jobs in Go. Placing jobs in multiple queues, and process them later asynchronously.
Stars: ✭ 137 (-15.95%)
Mutual labels:  workers
Ngx Papaparse
Papa Parse wrapper for Angular
Stars: ✭ 83 (-49.08%)
Mutual labels:  workers
Serverless Cloudflare Workers
Serverless provider plugin for Cloudflare Workers
Stars: ✭ 114 (-30.06%)
Mutual labels:  workers
Workq
Job server in Go
Stars: ✭ 1,546 (+848.47%)
Mutual labels:  workers
Muster
A universal data layer for components and services
Stars: ✭ 59 (-63.8%)
Mutual labels:  workers
Php Resque
An implementation of Resque in PHP.
Stars: ✭ 157 (-3.68%)
Mutual labels:  workers
React Native Workers
Do heavy data process outside of your UI JS thread.
Stars: ✭ 114 (-30.06%)
Mutual labels:  workers
Meteor Service Worker
An universal service worker for meteor apps
Stars: ✭ 132 (-19.02%)
Mutual labels:  workers
Create Google Shared Drive
Cloudflare Redesigned Script for creating a Shared/Team Drive
Stars: ✭ 93 (-42.94%)
Mutual labels:  workers
Workers
Cloudflare Workers
Stars: ✭ 111 (-31.9%)
Mutual labels:  workers
Simpleue
PHP queue worker and consumer - Ready for AWS SQS, Redis, Beanstalkd and others.
Stars: ✭ 124 (-23.93%)
Mutual labels:  workers
Rqueue
Rqueue aka Redis Queue [Task Queue, Message Broker] for Spring framework
Stars: ✭ 76 (-53.37%)
Mutual labels:  workers
Worker Plugin
👩‍🏭 Adds native Web Worker bundling support to Webpack.
Stars: ✭ 1,840 (+1028.83%)
Mutual labels:  workers
Node Cluster Email
📨 send email if node cluster throw exception
Stars: ✭ 60 (-63.19%)
Mutual labels:  workers
Kafka Flow
KafkaFlow is a .NET framework to consume and produce Kafka messages with multi-threading support. It's very simple to use and very extendable. You just need to install, configure, start/stop the bus with your app and create a middleware/handler to process the messages.
Stars: ✭ 118 (-27.61%)
Mutual labels:  workers
Tunny
A goroutine pool for Go
Stars: ✭ 2,755 (+1590.18%)
Mutual labels:  workers
Cfworker
A collection of packages optimized for Cloudflare Workers and service workers.
Stars: ✭ 152 (-6.75%)
Mutual labels:  workers
Worker Typescript Template
ʕ •́؈•̀) TypeScript template for Cloudflare Workers
Stars: ✭ 129 (-20.86%)
Mutual labels:  workers

Ost

Redis based queues and workers.

Ost Cafe, by Arancia Project

Description

Ost makes it easy to enqueue object ids and process them with workers.

Say you want to process video uploads. In your application you will have something like this:

Ost[:videos_to_process].push(@video.id)

Then, you will have a worker that will look like this:

require "ost"

Ost[:videos_to_process].each do |id|
  # Do something with it!
end

Usage

Ost uses a lightweight Redis client called Redic. To connect to a Redis database, you will need to set an instance of Redic, with a URL of the form redis://:<passwd>@<host>:<port>/<db>.

You can customize the connection by calling Ost.redis=:

require "ost"

Ost.redis = Redic.new("redis://127.0.0.1:6379")

Then you only need to refer to a queue for it to pop into existence:

require "ost"

Ost.redis = Redic.new("redis://127.0.0.1:6379")

Ost[:rss_feeds] << @feed.id

Ost defaults to a Redic connection to redis://127.0.0.1:6379. The example above could be rewritten as:

require "ost"

Ost[:rss_feeds] << @feed.id

A worker is a Ruby file with this basic code:

require "ost"

Ost[:rss_feeds].each do |id|
  # ...
end

It will pop items from the queue as soon as they become available. It uses BRPOPLPUSH with a timeout that can be specified with the OST_TIMEOUT environment variable.

Note that in these examples we are pushing numbers to the queue. As we have unlimited queues, each queue should be specialized and the workers must be smart enough to know what to do with the numbers they pop.

Available methods

Ost[:example].push item, Ost[:some_queue] << item: add item to the :example queue.

Ost[:example].pop { |item| ... }, Ost[:example].each { |item| ... }: consume item from the :example queue. If the block doesn't complete successfully, the item will be left at a backup queue.

Ost.stop: halt processing for all queues.

Ost[:example].stop: halt processing for the example queue.

Failures

Ost stores in-process items in backup queues. That allows the developer to deal with exceptions in a way that results adequate for his application.

There is one backup queue for each worker, with the following convention for naming the key in Redis: given a worker using the :events queue, running in the hostname domU-12-31-39-04-49-C7 with the process id 28431, the key for the backup queue will be ost:events:domU-12-31-39-04-49-C7:28431.

Here's the explanation for each part:

  • ost: namespace for all Ost related keys.
  • events: name of the queue.
  • domU-12-31-39-04-49-C7: hostname of the worker.
  • 28431: process id of the worker.

Priorities

There's no concept of priorities, as each queue is specialized and you can create as many as you want. For example, nothing prevents the creation of the :example_high_priority or the :example_low_priority queues.

Differences with Delayed::Job and Resque

Both Delayed::Job and Resque provide queues and workers (the latter using Redis). They provide dumb workers that process jobs, which are specialized for each task. The specialization takes place in the application side, and the job is serialized and pushed into a queue.

Ost, by contrast, just pushes numbers into specialized queues, and uses workers that are subscribed to specific queues and know what to do with the items they get. The total sum of logic is about the same, but there's less communication and less data transfer with Ost.

Installation

$ gem install ost
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].