All Projects → klaxit → Sidekiq Worker Killer

klaxit / Sidekiq Worker Killer

Licence: mit
🔪Sidekiq Worker Killer

Programming Languages

ruby
36898 projects - #4 most used programming language

Labels

Projects that are alternatives of or similar to Sidekiq Worker Killer

datadog-sidekiq
A Rust app to track Sidekiq enqueued & processed jobs in Datadog
Stars: ✭ 14 (-81.58%)
Mutual labels:  sidekiq
Verk
A job processing system that just verks! 🧛‍
Stars: ✭ 666 (+776.32%)
Mutual labels:  sidekiq
Sidekiq Job Php
Push and schedule jobs to Sidekiq from PHP
Stars: ✭ 34 (-55.26%)
Mutual labels:  sidekiq
Rocketjob
Ruby's missing background and batch processing system
Stars: ✭ 258 (+239.47%)
Mutual labels:  sidekiq
Sidekiq Throttled
Concurrency and threshold throttling for Sidekiq.
Stars: ✭ 359 (+372.37%)
Mutual labels:  sidekiq
Gush
Fast and distributed workflow runner using ActiveJob and Redis
Stars: ✭ 894 (+1076.32%)
Mutual labels:  sidekiq
limestone-accounts
Boilerplate Rails 5.2 multitenant SaaS application with webpack and Docker integration. Billing is scoped to accounts.
Stars: ✭ 97 (+27.63%)
Mutual labels:  sidekiq
Sidekiq Lock
Simple redis-based lock mechanism for your sidekiq workers
Stars: ✭ 60 (-21.05%)
Mutual labels:  sidekiq
Sidekiq Superworker
Directed acyclic graphs of Sidekiq jobs
Stars: ✭ 419 (+451.32%)
Mutual labels:  sidekiq
Docker Rails
Dockerize Rails 6 with ActionCable, Webpacker, Stimulus, Elasticsearch, Sidekiq
Stars: ✭ 856 (+1026.32%)
Mutual labels:  sidekiq
Api.rss
RSS as RESTful. This service allows you to transform RSS feed into an awesome API.
Stars: ✭ 340 (+347.37%)
Mutual labels:  sidekiq
Active Job Style Guide
This Background Jobs style guide is a list of best practices working with Ruby background jobs.
Stars: ✭ 355 (+367.11%)
Mutual labels:  sidekiq
Activejob Scheduler
A background job scheduler for any queue backend
Stars: ✭ 24 (-68.42%)
Mutual labels:  sidekiq
nokul
The Nokul Project
Stars: ✭ 47 (-38.16%)
Mutual labels:  sidekiq
Sidekiq Unique Jobs
Ensure uniqueness of your Sidekiq jobs
Stars: ✭ 984 (+1194.74%)
Mutual labels:  sidekiq
rust-sidekiq
Rust Sidekiq Client
Stars: ✭ 24 (-68.42%)
Mutual labels:  sidekiq
Sidekiq Statistic
See statistic about your workers
Stars: ✭ 709 (+832.89%)
Mutual labels:  sidekiq
Sidekiq Scheduler
Lightweight job scheduler extension for Sidekiq
Stars: ✭ 1,198 (+1476.32%)
Mutual labels:  sidekiq
Sidekiq Priority
Prioritize Sidekiq jobs within queues
Stars: ✭ 47 (-38.16%)
Mutual labels:  sidekiq
La gear
What do you get when you glue sneakers and sidekiq together? la_gear! Pump it up!
Stars: ✭ 8 (-89.47%)
Mutual labels:  sidekiq

sidekiq-worker-killer

Gem Version CircleCI

Sidekiq is probably the best background processing framework today. At the same time, memory leaks are very hard to tackle in Ruby and we often find ourselves with growing memory consumption. Instead of spending herculean effort fixing leaks, why not kill your processes when they got to be too large?

Highly inspired by Gitlab Sidekiq MemoryKiller and Noxa Sidekiq killer.

quick-refs: install | usage | available options | development

Install

Use Bundler

gem "sidekiq-worker-killer"

Usage

Add this to your Sidekiq configuration.

require 'sidekiq/worker_killer'

Sidekiq.configure_server do |config|
  config.server_middleware do |chain|
    chain.add Sidekiq::WorkerKiller, max_rss: 480
  end
end

Available options

The following options can be overridden.

Option Defaults Description
max_rss 0 MB (disabled) Max RSS in megabytes. Above this, shutdown will be triggered.
grace_time 900 seconds When shutdown is triggered, the Sidekiq process will not accept new job and wait at most 15 minutes for running jobs to finish. If Float::INFINITY specified, will wait forever.
shutdown_wait 30 seconds When the grace time expires, still running jobs get 30 seconds to stop. After that, kill signal is triggered.
kill_signal SIGKILL Signal to use to kill Sidekiq process if it doesn't stop.
gc true Try to run garbage collection before Sidekiq process stops in case of exceeded max_rss.
skip_shutdown_if proc {false} Executes a block of code after max_rss exceeds but before requesting shutdown.

skip_shutdown_if is expected to return anything other than false or nil to skip shutdown.

require 'sidekiq/worker_killer'

Sidekiq.configure_server do |config|
  config.server_middleware do |chain|
    chain.add Sidekiq::WorkerKiller, max_rss: 480, skip_shutdown_if: ->(worker, job, queue) do
      worker.to_s == 'LongWorker'
    end
  end
end

Development

Pull Requests are very welcome!

There are tasks that may help you along the way in a makefile:

make console # Loads the whole stack in an IRB session.
make test # Run tests.
make lint # Run rubocop linter.

Please make sure that you have tested your code carefully before opening a PR, and make sure as well that you have no style issues.

Authors

See the list of contributors who participated in this project.

License

Please see LICENSE

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].