Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

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
Closed

Asset pipeline and production resource-intensive compiling #1956

josepjaume opened this issue Jul 4, 2011 · 3 comments

Comments

@josepjaume
Copy link
Contributor

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!

@pixeltrix
Copy link
Contributor

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.

@josepjaume
Copy link
Contributor Author

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 :)

@hone
Copy link
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 as completed Jul 22, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants