Processing Jobs Faster Without Incurring Higher Dyno Fees
The cost remains stable during job processing because dyno charges on Heroku are prorated to the second. Consider a scenario where you have 60 jobs queued, with each job taking one minute to complete. Using a single worker dyno, this amounts to approximately one hour of background processing time.
Here are the details for this example:
- Heroku dyno cost: $0.035 per hour
- Time to process one job: 1 minute
With one worker dyno:
- Total processing time for 60 jobs: 1 hour
- Cost: $0.035 (since the processing time is 1 hour)
With ten worker dynos:
- Total processing time for 60 jobs: 6 minutes
- Effective cost: Approximately $0.035 (since each dyno operates for only 6 minutes, but when combined, they still amount to the equivalent of 1 hour's worth of dyno time, prorated)
This example shows that by increasing the worker count tenfold, we've greatly accelerated processing speed without impacting our Heroku costs, achieved by shutting down dynos when they are not in use.