Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Asset pipeline and production resource-intensive compiling #1956

Closed
josepjaume opened this Issue Jul 4, 2011 · 3 comments

Comments

Projects
None yet
4 participants
Contributor

josepjaume commented Jul 4, 2011

Hi,

I've been with this problem for a few weeks and I'm not sure how to sort it out.

I've got a Rails 3.1.0.rc4 application in Heroku running and I'm (trying) to serve my assets with S3.

The thing is: The way things are now, I can't disable the asset compilation in production. I understand that in order to calculate the MD5 of the assets (and so call the proper asset in my S3 bucket) they must be compiled when starting the environment, but:

  • If I understand well, the assets are compiled when called from the view helper (sylesheet_link_tag or javascript_include_tag). That creates an unnecessary delay to the user that (in my case) frequently leads to a timeout (due to the 30s per request limit in Heroku).
  • There is no way to disable the MD5 calculation so I can freely reference application.css and therefore not having to compile it in production every time.

This problem is particularly painful when compiling javascript since I need a javascript runtime in production (therubyracer).

As far as I know, there are only two solutions to the problem:

  • Calculating the MD5 of the source files (scss, js) rather than the compiled ones. The compiled files are changed when the source files are, so that would be sufficient.
  • Add a configuration option to disable the MD5 calculation somewhat.

Is there anyone with the same problem? Any thoughts?

Thanks!

Owner

pixeltrix commented Jul 4, 2011

I believe the intention with running Rails 3.1 on Heroku is to run rake assets:precompile as part of the slug compilation, however I'm not sure how that affects assets stored on S3. I know that Terence Lee (@hone) at Heroku is working on Rails 3.1 compatibility - perhaps he can help.

Contributor

josepjaume commented Jul 4, 2011

The thing is that I don't think that would solve the problem. Assets are still needed to be compiled in memory so the helper can deduct wich MD5 to use. And will be needed when another process spawns, with it's subsequent extra memory and CPU consumption.

Am I wrong? Didn't I understand how the asset pipeline works?

I will try to discuss it with @hone though, thanks :)

Contributor

hone commented Jul 5, 2011

If the assets are precompiled, is this still an issue for you? Someone from rails can correct me here, but the md5 calculations should be fast if the file exists.

@josh josh closed this Jul 22, 2011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment