Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Sidekiq como alternativa para background jobs

Sidekiq como alternativa para background jobs

Renan Gurgel

February 24, 2017
Tweet

More Decks by Renan Gurgel

Other Decks in Technology

Transcript

  1. class HandoutsController < ApplicationController def create @handout = Handout.create(handout_params) #

    this may take a while Notification.notify_parents(@handout) head :ok end end
  2. Os argumentos do job vão ser serializados - JSON #

    Bad HandoutWorker.perform_async(@handout) # Good HandoutWorker.perform_async(@handout.id)
  3. Delayed Job Delayed Job uses your SQL database for storage

    and processes jobs in a single-threaded process. It's simple to set up but the performance and scalability aren't great. I would not use delayed_job for systems processing 100,000s of jobs/day.
  4. Sidekiq uses redis for storage and processes jobs in a

    multi- threaded process. It's just as easy to set up as resque but more efficient in terms of raw processing speed. Your worker code does need to be thread-safe.
  5. Sidekiq uses redis for storage and processes jobs in a

    multi- threaded process. It's just as easy to set up as resque but more efficient in terms of raw processing speed. Your worker code does need to be thread-safe.