Search code examples
multithreadingherokuconcurrencysidekiq

Sidekiq running multiple jobs in a single heroku dyno?


I have noticed that on some of my sidekiq workers, they appear to be running multiple processes (Working multiple jobs concurrently) in a single dyno (The logs would suggest this).

How many processes could be/are running separate jobs within a single dyno concurrently without using swarming (The enterprise feature)?

I have everything set up to defaults without using swarms, so each sidekiq worker is using 25 threads. What exactly all these threads are used for, however, I have no idea. Can anyone help me understand how this translates into concurrent workers working jobs inside a single Heroku dyno?


Solution

  • You are seeing a single Sidekiq process with 25 threads running jobs concurrently. Each thread will execute a job so you can have up to 25 jobs running at once.

    Without swarm, you can only run one process per dyno.

    You can run multiple processes in a dyno using swarm but how many depends on the memory requirements of your app and how many cores in the dyno.

    This will get you 100 worker threads: 4*25.

    SIDEKIQ_COUNT=4 bundle exec sidekiqswarm -e production -c 25