11

我看到@parscale 推文:您对主页的多少个查询感到满意?你什么时候说这是优化的?

我看到反应 < 50 是好的,30 或更少是最好的,100+ 是危险区域。真的有合适的数字吗?如果说您的页面上确实有超过 50 个查询在运行,有什么方法可以降低它?

我通常有一些网站运行的查询不到 50 个,还有更多,虽然“更多”似乎并不太慢,但我总是有兴趣让它更快。如何?

4

6 回答 6

11

如何减少查询因站点、模板和模板而异,但有几篇关于 EE 优化和性能的文章:

http://expressionengine.com/wiki/Reduce_Queries/
http://expressionengine.com/blog/entry/troubleshooting_site_performance_issues/
http://www.netmagazine.com/tutorials/optimise-your-expressionengine-site
http://www .leezilla.net/post/12377053779/ab-seeing-your-sites-performance
http://eeinsider.com/articles/using-cache-wisely-with-expressionengine/

但是,如果您已经完成了所有这些并且仍然需要加快速度,那么下一步就是查看诸如CE Cache之类的附加组件。

于 2012-10-24T00:53:59.140 回答
7

Thing to remember is not all queries are created equal. You can have 1,000 queries that do very little in the way of impacting performance, or a single query that can slow everything way down.

In EE its actually better to look at the template debug output and identify key slow down spots in the template build then to always focus on just the query count.

As others have pointed out products like CE Cache, Solspace's Template Morsels, or even adding a varnish caching server in-front of an intensive EE web site can do wonders, though with the added work required to fully get a varnish setup in front of EE setup, I would currently stick to the other solutions/directions first.

于 2012-10-25T05:45:59.210 回答
6

没有一个神奇的查询号码。在我看来,您的服务器环境决定了可以支持的内容。你拥有的资源越多,你的代码就越复杂。

话虽如此,如果 EE 网站上确实出现问题,您可以使用很多选项。上面答案中的链接为您提供了一个可靠的列表,但这里有一些首先要检查的事情:

  1. 删除 search:field_name="" 参数
  2. 减少频道标签的使用,尽可能结合
  3. 将 disable="" 参数添加到频道选项卡以禁用您不需要的内容
  4. 减少嵌入的使用
  5. 关闭所有 EE 跟踪代码
  6. 如果您有频道标签,请停止使用高级条件
于 2012-10-24T02:06:01.213 回答
6

Following on from Nevin's point. I find that the JB Graphite is a huge help, it turns the debug output into a pretty graph, so you can easily spot bottleneck queries.

http://devot-ee.com/add-ons/jb-graphite

于 2012-10-25T10:37:14.963 回答
4

我将扩展 MediaGirl 的第 6 点——您通常可以通过使用 Croxton 的 Ifelse 和/或 Switchee 附加组件来大大简化条件句。绝对值得一看。

于 2012-10-24T13:29:32.777 回答
3

我在一个非常密集的构建中使用了 CE Cache,它将页面加载时间从 6 秒减少到 0.7 秒。很棒的插件,具有令人难以置信的文档和您可以在任何地方获得的最佳支持。

于 2012-10-24T12:25:53.513 回答