Rails 3 的优化工具正在开发中?
我正在开发一个部署在 Heroku 上的 Rails 3 应用程序,希望对其进行优化。我探索了不同的解决方案,例如 query_reviewer 或 New Relic。
我无法使 query_reviewer 与 Rails 3.0.1 一起工作(我还必须切换到 MySql,因为不支持 PostgreSQL)。
关于 New Relic,它看起来是一个很棒的免费工具,但仅适用于生产环境。我首先需要在开发过程中改进许多数据库查询,然后再在生产中调整应用程序。
所以这些工具都不符合我的需求。
有什么建议吗?也许我应该只依赖日志跟踪并减少 SQL 查询的数量?
I'm developing a Rails 3 app deployed on Heroku which would like to optimize. I've explored different solutions such as query_reviewer or New Relic.
I couldn't make query_reviewer work with Rails 3.0.1 (also I had to switch to MySql, because PostgreSQL is not supported).
Regarding New Relic, it looks like a great free tool, but works only in production. I first need to improve many DB queries at development before getting to tune the app in production.
So none of this tools fit my needs.
Any advice? Maybe I should just rely on log traces and reduce the number of SQL queries?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您想找出哪些活动不是绝对必要的,并且如果您可以“修剪”它们,可以节省大量时间?
请原谅我是一个单一的回答者,但有一种简单的方法可以做到这一点,而且很容易演示。
当代码运行缓慢并让您等待时,请使用 Ctrl-C 或其他方式手动中断它,并检查堆栈跟踪。这样做几次。
您看到它在多个堆栈跟踪上执行的任何操作都会占用相当大一部分时间,而且具体多少并不重要。如果你可以修剪它,那么它要做的工作就会少得多。
如果这种方法的功效因为技术含量低而令人怀疑,这是可以理解的,但事实上它可以快速找到任何分析器可以发现的任何问题。
You want to find out which activities aren't absolutely necessary and would save a good amount of time if you could "prune" them?
Forgive me for being a one-track answerer, but there's an easy way to do that, and it's easy to demonstrate.
While the code is running slowly and making you wait, manually interrupt it with Ctrl-C or whatever, and examine the stack trace. Do this a few times.
Anything you see it doing on more than one stack trace is responsible for a substantial percent of time, and it doesn't really matter exactly how much. If it's something you could prune, it will have that much less work to do.
If the efficacy of this method seems doubtful because it's low-tech, that's understandable, but in fact it can quickly find any problem any profiler can find.
我发现 New Relic 有一个开发模式,它看起来像是在开发阶段优化应用程序的理想设置: http://support.newrelic.com/kb/docs/developer-mode
I found that New Relic has a Development mode, which looks like an ideal setup for optimizing an application in development phase: http://support.newrelic.com/kb/docs/developer-mode