Application 2024-09-21

Code Reading of Sidekiq

Understand Sidekiq architecture for Redis-based asynchronous job queuing, job enqueuing, and execution flow in Ruby applications.

Read in: ja
Code Reading of Sidekiq

Overview

A quick read through the Sidekiq code.

Preparation

  1. Clone sidekiq
  2. Start redis
    • docker run --name redis-server -p 6379:6379 -d redis
  3. Insert binding.pry where you want to debug
  4. Start sidekiq
    • bundle exec sidekiq -r ./examples/blog.rb
  5. Enqueue a job
    • bundle exec irb -r ./examples/por.rb

Code Reading

Enqueuing Jobs

  1. Call asynchronous processing starting from perform_async
  2. Enqueue the job

Executing Jobs

  1. Start sidekiq
  2. Fetch jobs
  3. Execute the job
Tags: Ruby Sidekiq
Share: 𝕏 Post Facebook Hatena
✏️ View source / Discuss on GitHub
☕ Support

If you enjoy this blog, consider supporting it. Every bit helps keep it running!


Related Articles