Why is drupal slow?
Asked Answered
R

5

8

I have made site on drupal

My site has 7500 users and approx (20 to 50 without logged in)(2 to 10 logged in) users are online (and this is not heavy traffic I think)

The site is on dedicated server. I have enabled setting in performance from drupal admin and also installed memcache and eaccelerator

I looked in query logs from using devel module. it is firing total 600 to 900 queries on each page

When I have installed patch of path.inc to reduce the queries of drupal_look_path(). It has reduced queries to around 400

I have also made some positive changes in mysql (my.cnf) file, but still there are many same queries run form user_load() function again and again

I have 60 to 70 modules enabled and all are use full. I can't remove the modules

Still the site is running slow it is taking approx 10 to 15 sec

Now I don't know why the site is running so slow

  • Is it because the drupal has the large php code ?
  • Is it because it is firing so many queries on each page?
  • Does the InnoDB engine improve the performance?

Please, any kind of suggestions are welcome

Rosalvarosalyn answered 18/5, 2011 at 14:31 Comment(3)
There is an extension for firefox called yslow. Maybe you can use that to see why your site is running slow.Ironsmith
This question would get much better answers on drupal.stackexchange.com.Aretha
Is this a D6 or D7 site? You have both tags on the question.Tadpole
C
9

400 queries for each requests is a sucidie (but even 50+).

You should implement some html cacher. My website generally doens't even make the db connection. It just fires the html cached in a file.

Callup answered 18/5, 2011 at 14:34 Comment(10)
400 queries sounds mad, I can't think of a single reason why any website should make 400 queries. +1 from me, this is a great advice.Milwaukee
400 queries? Suicide, more like dropping an atom-bomb on yourself.Doorjamb
Well, we ar talking about drupal here, possibly with a large number of contributed modules. And one of the downsides of using a large CMS with many modules is that various parts of the code base might not work nicely together and re-load the same information multiple times. Also, static html caching doesn't work for authenticated users, but surely is a way to boost performance for anon users.Pow
@berdir: that's not quitly true. Recently I am using always the cached html even for registred user. Then with ajax I inject the user-related html into the pageCallup
@yes123: with Drupal? :) Sure, that works, but it would be news to me if Drupal could do that (do it fast, I mean, so that it would actually help).Pow
no not with drupal (i was reffering to my own framework ). but i guess it will take not taht long to be available with drupal tooCallup
It's not a trivial problem to solve in Drupal. Because ajax requests wouldn't help, they are probably slow too (they do a normal page bootstrap in Drupal, so many of these queries might be executed too).Pow
don't know much about drupal but I tinnk somewhere you can request a page without bootstrapping everythingCallup
@yes123: Not really, right now. That is one of the design goals for Drupal 8 (Cleaning up the bootstrap, proper context systems to load only what's necessary ...), we'll see what Larry Garfield and his initative will come up with :)Pow
The Devel module can display a summary of the DB queries used when generating a single page. It can be useful to troubleshoot what is causing 400+ queries. per page. drupal.org/project/develMarston
P
6

Some additional things to look into:

  • Install a tool like Yslow/PageSpeed to see how much of those 10-15s are client and server time.

  • Instal XhProf (on a development site, not live) together with Devel to see which are the functions that use the most time. Look into these first. Edit, now with link: http://groups.drupal.org/node/82889

  • Using pressflow might help a bit, but since you are alrady using the path.inc patch, probably not so much.

  • You mentioned that you installed memcache. Did you also install the memcache module and configure the cache plugin to use memcache?

  • EDIT: Yes, switching to InnoDB can help. One of the main performance advantages of InnoDB is row-level locking (as opposed to table-level locking of MyISAM), which means that multiple INSERT/UPDATE queries against the same table won't block each other unless really necessary. However, InnoDB does not perform well at all out of the box, you really need to fine-tune your mysql configuration for your specific site. So this is a step that you should only take carefully and after testing and optimizing on a development site. There are various questions already on this site and elsewhere about InnoDB tuning...

Anything else than that is then site specific and depends on the modules you are using. But especially things like complex node_access setups and multiple languages (i18n!) tend to either cause slow queries and/or a lot of them.

Pow answered 18/5, 2011 at 15:12 Comment(1)
+1 for xhprof, I was going to suggest that karan could post the graph back here. Probably a very way for us to diagnose what is going on.Severini
D
1

Not all modules make use of the caching mechanisms you can switch on in the performance settings area. It would be worth trying to identify which ones are doing the most/slowest queries and attempting to get the developer(s) to improve them.

Alternatively, examine whether you could achieve things with fewer modules. Some modules do overlap somewhat in functionality, so you may be able to reorganise the way the site functions a bit.

Additionally, you need to look at whether your settings MySQL are allowing enough memory for these queries to be carried out. Most MySQL distributions come with different versions of my.ini labelled 'small', 'medium', 'huge' etc. Copy the 'huge' one to my.ini (back up the old one first) and restart the DB to see if maxing out all the cache sizes makes a difference. You may well have a bottle neck there, but it can be hard to work out what setting is causing it.

Same goes for PHP. Set memory_limit in php.ini to 500MB or something and see if it helps. Of course, you may not be able to do this, depending on your hosting arrangements, but it will eliminate one possible cause (or not) if you can.

Dictate answered 4/8, 2011 at 16:29 Comment(0)
K
0

Performance of your Drupal website also depends on how well your hosting platform is tuned for Drupal. Drupal requires special optimization of LAMP stack components. You can try Drupal-specific hosting companies http://www.drupalspecific.com to make your website run faster.

Karlin answered 14/10, 2013 at 21:5 Comment(0)
A
0

facing the drupal slowness issue myself. But have a very different issue than the others mentioned.

I disabled all the content also the drupal header for a drupal page of a specific content type.

Still the time taken by this page to load is above 20 secs!

I took help of YSlow and NET firebug panels.

Upon looking at them, noticed:

JS and CSS files inclusion individually takes 3 to 2 secs, and there are fair bit of inclusions happening, as a result it takes like 20 secs.

But i am not able to figure out, why the js and css inclusions are taking so much time. (this includes normal drupal core js and css files as well)

Acetylide answered 3/12, 2014 at 13:36 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.