Giter Site home page Giter Site logo

bobbrez / sidekiq-dynamic-throttle Goto Github PK

View Code? Open in Web Editor NEW

This project forked from enova/sidekiq-rate-limiter

1.0 0.0 0.0 125 KB

Redis-backed, per-worker rate limits for job processing.

Home Page: http://rubygems.org/gems/sidekiq-rate-limiter

License: MIT License

Ruby 100.00%

sidekiq-dynamic-throttle's Introduction

Sidekiq Dynamic Throttle

Throttle fetching from queues dynamically.

Compatibility

sidekiq-rate-limiter works by using a custom fetch class, the class responsible for pulling work from the queue stored in redis. Consequently you'll want to be careful about using other gems that use a same strategy, sidekiq-priority being one example.

Installation

Add this line to your application's Gemfile:

gem 'sidekiq-dynamic-throttle'

And then execute:

$ bundle

Or install it yourself as:

$ gem install sidekiq-dynamic-throttle

Configuration

See server.rb for an example of how to configure sidekiq-rate-limiter. Alternatively you can add the following to your initializer or what-have-you:

require 'sidekiq-dynamic-throttle/server'

Or, if you prefer, amend your Gemfile like so:

gem 'sidekiq-dynamic-throttle', :require => 'sidekiq-dynamic-throttle/server'

Motivation

Sidekiq::Throttler is great for smaller quantities of jobs, but falls down a bit for larger queues (see issue #8). In addition, jobs that are limited multiple times are counted as 'processed' each time, so the stats balloon quickly.

Sidekiq::RateLimiter works well when you've got consistent job processing limits, but can be a bit restrictive when throttling needs to be based on something that is more dynamic (i.e. API limits).

Contributing

  1. Fork
  2. Commit
  3. Pull Request

License

MIT. See LICENSE for details.

Credits

This was originally forked from sidekiq-rate-limiter.

sidekiq-dynamic-throttle's People

Contributors

sentience avatar bwthomas avatar bobbrez avatar

Stargazers

 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.