Anuja Sharma
Anuja Sharma

Reputation: 15

Difference between job and worker in rails

In an interview I was asked this and I was unable to describe this. Could anyone help me with this.

  1. I have tried to found out answers from stack overflow but did not get a complete explanation.

Upvotes: -2

Views: 93

Answers (1)

Schwern
Schwern

Reputation: 165396

It isn't a fair question.

While @dbugger is correct that, generally, a "worker" processes a "job", Rails doesn't use the term "worker" in relation to "jobs".

Where Rails does use the term "worker" they're referring to processes in a pool like the ActionCable worker pool or Puma web server processes.

Resque does use worker/job, but that's not Rails.

Sidekiq did, but not anymore because, as they put it....

The term "worker" is too generic and overly confusing, used in several different contexts meaning different things. Many people call a Sidekiq process a "worker". Some people call the thread that executes jobs a "worker". This change brings Sidekiq closer to ActiveJob where your job classes extend ApplicationJob.

Upvotes: 2

Related Questions