Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Sidekiq / Sidekiq Pro to project #1

Open
wants to merge 18 commits into
base: master
Choose a base branch
from
Open

Add Sidekiq / Sidekiq Pro to project #1

wants to merge 18 commits into from

Conversation

afinetooth
Copy link
Owner

@afinetooth afinetooth commented Feb 27, 2018

Nick,

This is a tiny work sample in PR format to simulate working together.

I asked about one of your next backlog stories and you mentioned adding Sidekiq / Sidekiq Pro to your project. It's a good story for this because it doesn't require knowledge of your existing app. On the other hand it might not be ideal because it's not a discrete feature with acceptance criteria I could demonstrate meeting with tests.

Speaking of tests, I had hoped to include some, but honestly, I wasted time with a complicated background job I made up based on assumptions about your domain, and then realized I didn't have time to proceed. So, I decided to just focus on the core of the story and re-cast it as something more completable--a spike:


Story
Add Sidekiq to improve background job performance

Description
Spike adding Sidekiq to the project and examine changes required to integrate a concurrent job runner.

Concerns / Criteria

  • We can use Sidekiq with ActiveJob. Should we? Why/why not? How/how not?
  • Show how to deploy to production (to Heroku).
  • Create some runnable example jobs in production.
  • Cover the key configuration settings and best practices.
  • Do we need Sidekiq Pro? Why/Why not?

Complexity
1 point (or ~0.5-1 days)


The main work here was getting Rails + Sidekiq running on Heroku in order to create some runnable examples in production. A lot of the rest was writing the instructions to deploy to production in the README.

The code itself is minimal but gives the picture of how to wire up Sidekiq for both development and production environments.

I suspect you know a lot about Sidekiq, but if not then I hope the rest of the README is useful. I imagined how I'd create such as PR for the purpose of a code review by a lead engineer or a full team where this might be the team's first exposure.

Totally could have added some tests here for two very basic classes, HardJob and HardWorker, but I did run out of time so I decided I'll pull up some old code showing how we tested some of our old background workers in mc supply.

Thanks,
James

…y of configuring Sidekiq for both development and production environments. Sidekiq will always try to connect to redis at localhost:6379, which is the default configuration for a local install. However, on Heroku, Sidekiq will connect to whatever redis instance is stored in the env variable REDIS_PROVIDER. Eliminating config/initializers/sidekiq.rb lets Sidekiq do its thing on Heroku with the least amount of extra work.
…eues: critical, default and low. Gave critical queue a weight of 2, which means it will be checked twice as often as the other queues. The ordering of queues specifies the order in which the queues will be processed.
…o be run with: foreman start -f Procfile.dev.
…il.logger due to context and removing “Rails” makes logging look more parallel between Jobs and Workers and helps in explaining logging differences between them. (See README.)
@afinetooth afinetooth changed the title Spike adding Sidekiq / Sidekiq Pro to project Add Sidekiq / Sidekiq Pro to project Feb 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant