简体   繁体   中英

Drupal high number of queries

I have Drupal site and it is very slow. It's on localhost and it takes 4-5 sec to load one page. I enabled general_log in mysql and i saw that for just one page drupal executes more than 2000 queries...

Is there way to speed up this ?

Drupal can be a beast if not optimized for production: General guideline:

  • Disabled devel module
  • Disabled Views UI
  • Enabled any Views caching (views content cache)
  • Enable Page caching
  • Enable Block caching
  • Disable database logging (use syslog instead)
  • Disable the statistics module

Note: If your site makes use of authenticated traffic (logged in users to Drupal), this is a completely different paradigm in which most of the caching efforts above are ignored for logged in users.

One way to improve that is to turn on all the different forms of caching. You may not see much of a difference when you are logged in, but guests can often see a substantial speedup. Also consolidating JS and CSS files helps a lot.

If you use the devel module, you can see all the queries and the time they take. It's very convenient.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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