Search code examples
ruby-on-railsrubysidekiq

Sidekiq how can two projects share one sidekiq pid?


I'm reading the sidekiq basics and I'm having some conceptual problems understanding how sidekiq works in a production setting.

Say I have two independent ruby applications, one rails, one sinatra. How could I share a single sidekiq process between the two applications? Is this possible?

The basics state this: "The Sidekiq client runs in your web application process (typically a Rails unicorn or passenger process) and allows you to push jobs into the background for processing" Does this imply that this use case is not possible?

Does each ruby application require a user to run: bundle exec sidekiq -C sidekiq.yml

https://github.com/mperham/sidekiq/wiki/The-Basics


Solution

  • I don't think you can share the same Sidekiq server process. In fact, the process will load your application environment in order to get access to the models and libraries and it won't be possible to share the process with two Rails applications, for instance.

    However, you can configure both instances to share the same database if you want.

    The client process runs inside a web application request, thus for sure you cannot share it.