Reputation: 1716
I have a rake task that takes about 90 seconds locally. It loops through objects and creates a large PG insert SQL, then executes it at the end.
On Heroku heroku run rake my_task
it takes about 1.5 hrs (same data as local). I've been researching Heroku and "One-Off Dynos" but I can't find much info on why it would take so long, other than the fact that my app is on the Heroku free plan with only one web dyno and 0 workers.
Its not the insert that takes long, it's the loop beforehand (loop does not have DB calls).
DB is PG Hobby-Basic. Rails 4.2 Ruby 1.9.3p374
Upvotes: 0
Views: 321
Reputation: 24290
If you're using a standard-1X dyno or bigger for your web process, you can run one-off tasks on faster dynos, as sorting ~100k objects in Ruby on a free/hobby dyno is likely to stretch it.
This article covers the basics - https://devcenter.heroku.com/articles/one-off-dynos#one-off-dyno-type for setting the dyno size for a one-off dyno.
Upvotes: 2