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

Background jobs at scale

Background jobs at scale

Talk at RubyUnconfEU

Kerstin Puschke

May 05, 2018
Tweet

More Decks by Kerstin Puschke

Other Decks in Programming

Transcript

  1. • 202 Accepted • Location: temporary resource • 303 See

    other Don’t lie about resource creation
  2. • 202 Accepted • Location: temporary resource • 303 See

    other • Location: does not represent target resource Don’t lie about resource creation
  3. • Overhead of relational database • Workers monitored from outside

    • Frequently needs workers to restart DelayedJob has downsides at scale
  4. • Overhead of relational database • Workers monitored from outside

    • Frequently needs workers to restart • Hard to keep track DelayedJob has downsides at scale
  5. • Redis • Parent-child forking for workers • Rarely needs

    workers to restart • Easy to keep track, since workers manage their own state Resque scales
  6. • Redis • Parent-child forking for workers • Rarely needs

    workers to restart • Easy to keep track, since workers manage their own state • Memory hungry Resque scales
  7. • Resque compatible • Worker uses threads instead of child

    processes • Fast • Less memory hungry Sidekiq scales
  8. • Resque compatible • Worker uses threads instead of child

    processes • Fast • Less memory hungry • Requires thread safe code Sidekiq scales
  9. • Split job into • Collection • Task to be

    done • Checkpoint after iteration & requeue Large collections
  10. • Allows for frequent deployments • Disaster prevention • Data

    integrity Interruptible job with automatic resuming
  11. • Benefit apps of all sizes • Require trade-offs •

    Keep code simple at scale Background jobs