简体   繁体   English

如何在Heroku Cedar堆栈上优化Rails应用程序?

[英]How to optimize a Rails application on the Heroku Cedar stack?

Which gem do you install or which configuration do you change to optimize your Ruby on Rails applications on the Cedar stack of Heroku? 在Heroku的Cedar堆栈上,您安装了哪种gem或更改了哪种配置以优化Ruby on Rails应用程序?

Like adding Rack::Deflater ... 就像添加Rack::Deflater ...

There is no specific optimization applied for Cedar stack currently, but there are many way you can optimize your Rails app, including: 目前,尚无针对Cedar堆栈的特定优化应用,但是有多种方法可以优化Rails应用,包括:

  • Optimizing the client's side of your app, eg: techniques like CSS sprite, reduce number of files loading, compress your html code etc. You can benchmark use tool like Page Speed 优化应用程序的客户端,例如:CSS Sprite之类的技术,减少文件加载数量,压缩html代码等。您可以对诸如Page Speed的使用工具进行基准测试

  • Optimizing your app using caching: there are many database queries that you will need to cache to make it most efficient and fastest. 使用缓存优化您的应用程序:您需要缓存许多数据库查询以使其最有效和最快。 You can cache Views and different other things also, you can find more on Rails Caching 您还可以缓存Views和其他不同的东西,可以在Rails Caching上找到更多信息。

  • Optimizing database: there will be table that you have not add correct indexing etc... so be sure that the query is optimized (especially those join queries), and there is suitable indexing 优化数据库:将存在您未添加正确索引的表等信息,因此请确保查询已优化(尤其是那些联接查询),并且有合适的索引

To be honest, there's nothing specific to optimising Rails for Heroku that isn't part of regular optimising for Rails on it's own. 老实说,针对Heroku优化Rails并没有专门针对常规Rails进行优化的部分。

A fair amount of general best practise can be found here: http://railslab.newrelic.com/ 可以在此处找到大量的通用最佳实践: http : //railslab.newrelic.com/

The only thing worth mentioning specifically for Heroku is regarding dyno blocking uploads. 特别值得一提的是Heroku唯一关于dyno阻止上传的内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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