Setting up Sidekiq with Redis for background job processing

Before starting with setup process lets first briefly go through what Sidekiq is? and how it works? Sidekiq provides very handy and efficient way to perform most of our work asynchronously in a job. Provided Redis cache connection to it, it serializes all job parameters in Redis and deserializes it while picking it up for execution based on priority of job as it uses queue data structure to store each job in particular queue specified in job and each queue has its priority defined as high, medium, low etc. To setup Sidekiq with Redis in your application you can follow

Issues with Sidetiq recurrence - tends to eat up 100% CPU for quite a while

If you are using Sidetiq to set recurrence to schedule background jobs, then you may want to be aware of this known and reported issue with recurrence. BTW, recurrence schedule is done using ice_cube gem This is likely an issue in Ruby 1.9.3 but I have posted comments on this article here along with git issue to clarify if its an issue with Ruby 2.0 and above. References at the bottom of this email. Issues: We generally set recurrence daily or hourly in our app/workers/job_name.rb like this recurrence do daily end recurrence

Recurring Sidekiq jobs

In most of our apps, we probably need to execute few background tasks more often, like every 10 minutes, once a week, etc. For scheduling these jobs, we need a scheduler that can re-run these tasks on specified intervals. There are few schedulers like whenever, resque-scheduler, rufus-scheduler, etc that can do the job. However, these gems are not compatible Sidekiq and with apps deployed on Heroku. There are 2 ways to make it work on Heroku. 1/ Using Heroku Scheduler addon. Steps: i) Create sidekiq job. ii) Create a rake task that will triggers that worker. iii) In Heroku Scheduler