简体   繁体   English

对于在drupal中每个请求调用的许多查询

[英]To many queries called per request in drupal

I've built an website using drupal and deployed it. 我已经使用drupal构建了一个网站并进行了部署。 But it very very slow. 但是它非常非常慢。 I installed the Devel module and see 120 queries per request. 我安装了Devel模块,每个请求看到120个查询。 And the total execution time is 3000ms. 总执行时间为3000ms。 Is this normal? 这正常吗?

I just install some module such as: taxonomy menu, simple ads, classified ads, rule, locale. 我只安装了一些模块,例如:分类菜单,简单广告,分类广告,规则,语言环境。 Can anyone suggest how to reduce this? 谁能建议如何减少这种情况?

First try to debug the website as an anonymous user or any logged in user other than the admin to get more accurate stats. 首先尝试以匿名用户或除管理员以外的任何登录用户的身份调试网站,以获取更准确的统计信息。

Then you can consider caching the output to reduce the number of database queries. 然后,您可以考虑缓存输出以减少数据库查询的数量。 (faster approaches: cache some blocks in your page using views caching or block cache module ). (更快的方法:使用视图缓存或块缓存模块在页面中缓存一些块)。

Hope this helps. 希望这可以帮助。

Make sure you have enabled caching option available in 'admin/config/development/performance' page, aggregating css and javascript could help a lot. 确保已启用“管理/配置/开发/性能”页面中可用的缓存选项,聚合CSS和JavaScript可能会有所帮助。

You can also enable views caching in those block in which you think data is not going to change frequently. 您还可以在认为数据不会频繁更改的块中启用视图缓存。

For images you can use image cache to reduce size of image from their original size, it could reduce you page size. 对于图像,您可以使用图像缓存将图像的大小从其原始大小减小,从而可以减小页面大小。

For more info you can visit " Drupal caching, speed and performance " page on drupal.org. 有关更多信息,您可以访问drupal.org上的“ Drupal缓存,速度和性能 ”页面。

here the link of html output of my modules and my home page , which include devel information. 这是我的模块主页的html输出的链接,其中包括开发信息。 Can you see some thing make my site slow.Maybe I left some module which need to be uninstalled. 您能看到一些使我的网站运行缓慢的东西吗?也许我留下了一些需要卸载的模块。 I see more than 300 query, and I don't think a website with 300 queries per request is normal. 我看到300多个查询,而且我认为每个请求包含300个查询的网站是正常的。 Thanks! 谢谢!

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

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