Search code examples
ruby-on-rails-4redissidekiq

How can I place Sidekiq alongside redis on a different server than the app server?


In order to have a loosely coupled architecture, can I have a server that has Redis and Sidekiq, and another separate worker server which I can create multiple instances of?

What I have now is:

  1. Server A:

    • Redis
    • Sidekiq
    • Rails to convert images
  2. Server B:

    • Rails calls Server A's Sidekiq's perform_async(image) through the controller

What I want to do is:

  1. Server A:
    • Redis
    • Sidekiq
  2. Server B(scalable):
    • Rails to convert images -Sidekiq Workers-
  3. Server C:
    • Rails that calls Server A to push jobs to the queue so that Server B can convert them by pulling from Server A's queues.

Solution

  • Yes, you'll make things more scalable, although things will be slightly slower this way since you'll increase network IO when communicating between server A and server B (where in the first case they were on the same server). You'll also need to pay for and manage that extra box. If you're close to the point where you can't get enough throughput in scenario A, switching makes sense. If you're not, this seems like premature optimization.