简体   繁体   中英

How can I troubleshoot extremely slow rake assets:precompile on heroku?

rake assets:precompile is fast (<10 seconds) both locally and when I run it on heroku:

heroku run time rake assets:precompile --trace (clean first)

During deploy to heroku it takes around 10 minutes.

How do I figure out what the problem is here and fix it?

For reference I have tried all these:

We are on Rails 3.2.13, Ruby 2.0.0p353

You should try storing your assets in memcached/redis database so you only need to compile the ones that have changed in each release you deploy:

Setup a redis/memcached database w/ Heroku ( http://addons.heroku.com/ ) or use the one you already have

Configure an Asset cache store (via config/environments/production.rb ):

config.assets.cache_store = [ :redis_store,  {
  url: ENV['REDIS_URL'] || 'redis://127.0.0.1/0',
  namespace: 'assets'
}]

We have been able to get our asset precompilations times down < 30sec using this method from several minutes.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM