Troubleshooting slow-loading Module admin page

Events happening in the community are now at Drupal community events on www.drupal.org.
OldAccount's picture

Any time I load or save any changes to the Module Admin page (http://localhost/drupal/admin/build/modules) it takes forever to load. I'm new to Drupal so I don't know where to begin troubleshooting this. I've found various solutions online (here's one), but they assume different issues and I don't want to mess anything up on the slight chance it happens to be the same problem, I'd like to be able to narrow down the problem first. Not to mention the solutions can be incredibly complex and daunting to a new user. Any suggestions on where to start?

I have the Devel module installed and it says it took 26961ms to load the page just now, vs. 1090ms to load the Home page.

Here's some info on my setup if that helps:
* Apache 2.2
* php 5
* mySQL 5.1
* phpMyAdmin 3.1.3

Comments

try disabling a few modules

Brian294's picture

I've noticed the same behavior when I have a lot of heavy weight modules activated. Try disabling the devel module and see what happens. You might even look into disabling each non-core module (one at a time) to see if any of them are misbehaving.

You might see improvement by increasing the amount of memory in apache my modifying the .htaccess or php.ini file. Try adding the following to .htaccess in your drupal installation directory.

php_value memory_limit 128M

This is assuming your apache memory limit is currently set to a low value like 32M.

Where exactly would this go

OldAccount's picture

Where exactly would this go in my .htaccess file?

I have this already in php.ini:
memory_limit = 128M ; Maximum amount of memory a script may consume (128MB)

pretty much anywhere

Brian294's picture

You can put it just about anywhere, just don't put it in a conditional statement (such as IfModule). I have mine after these lines:

# Don't show directory listings for URLs which map to a directory.
Options -Indexes

# Follow symbolic links in this directory.
Options +FollowSymLinks

# Make Drupal handle any 404 errors.
ErrorDocument 404 /index.php

php_value memory_limit 48M

Thanks for the help on this,

OldAccount's picture

Thanks for the help on this, I made this change as well, just to be safe.

if you're wondering your current memory limit

Brian294's picture

Visit the status page to find your limits:
http://localhost/admin/reports/status

Is this on a windows, apple

timnorman's picture

Is this on a windows, apple or linux machine running the apache/php/mysql setup you listed or are you running it on a server?

I find that my windows machine with WAMP installed takes forever to do Drupal admin stuff but could handle building home page without too much of a problem. I've been meaning to setup an old computer as a linux server to see if it ran any better on that.

You guessed it -- WAMP.

OldAccount's picture

You guessed it -- WAMP.

Perennial Favorite

smokris's picture

This issue is a perennial favorite over on the drupal.org forums. Seems to have been introduced in 6.0 via http://drupal.org/node/193366 , and there's not really a good solution yet, but there's been some recent discussion on that thread, about fixing it in a future 6.x release.

See also http://drupal.org/node/311626#comment-1066316 for an idea that might mitigate the issue until then.

Thanks, I remember reading this post actually

OldAccount's picture

...but there were so many things to try, I wasn't sure where to start.

The comment you linked to said "I fixed this issue by using cacherouter and using file based caching". I can get Cacherouter installed, but I don't understand the file-based caching thing.

Also, I don't understand how caching can be an issue for me already, I barely have any content on my site yet, and I'm the only user..? Like I said, I'm really new to Drupal, so I'm probably lacking understanding of some fundamentals here.

Some more info:

OldAccount's picture

More Devel stats from loading the Module Admin page:

Executed 4964 queries in 62830.76 milliseconds. Queries taking longer than 5 ms and queries executed more than once, are highlighted. Page execution time was 72048.55 ms.

I won't copy/paste the whole log here because it takes an hour to scroll through. Most of the entries have something to do with the menu (_menu_router_build and menu_link_save), some being executed over 120 times. The second most frequently occuring entries have something to do with cache (module_rebuild_cache). FYI, I installed the Cache Router module as suggested in one of the comments, but I'm not noticing any difference.

Troubleshooting slow-loading Module admin page

bigjim's picture

Yea

It's a known issue with the modules page, one that has no fix as of now. Loading that page runs an extensive set of maintenance procedures including clearing catches including menu (hence why you see all those menu queries), theme, etc... Except hacking Drupal core you cannot get it to speed up at this point, unless you try tweaking MYSQL/ Apache settings. It's a total pain in the butt, but there isn't much you can do unless you want to hack core every time you update Drupal, besides it does not affect the rest of the site only the person loading that page. The theory, one I'm not sure I buy into, is that you don't need to visit that page to often once you have settled on the modules you need so it shouldn't kill you :)

If you are curious about a hack....

Brian294's picture

See if this works for you:
http://drupal.org/node/342020

I believe it's the system.admin.inc file.

Find:
drupal_rebuild_theme_registry();
node_types_rebuild();
menu_rebuild();
cache_clear_all('schema', 'cache');

Replace with:
if ($form_state['post']) {
drupal_rebuild_theme_registry();
node_types_rebuild();
menu_rebuild();
cache_clear_all('schema', 'cache');
}

Wow, thanks!

OldAccount's picture

I tried the first solution and the Module List page went from 4964 queries in 62831 milliseconds to 288 queries in 6566 milliseconds. I think that's about a 90% decrease. Thank you!

I don't like hacks either, but this slow-down was really adding up because I'm new to all this so I'm still testing modules and stuff.

Another thing to try:

Brian294's picture

See:
http://drupal.org/node/403744

"Try editing your php.ini and make realpath_cache_size=2M and uncomment skip innob in your my.cnf mysql file, restart apache and mysql"

I made both changes, but now

OldAccount's picture

I made both changes, but now I can't get mysql to restart... doh!

undo my.cnf

Brian294's picture

you may want to undo the change you made to my.cnf.

Yep, that's what it was.

OldAccount's picture

Yep, that's what it was. After 3 hrs. of searching for answers, I decided to undo it and see if that worked. Duh! :-)

Thanks for your help!

mysql on windows

vwX's picture

I would leave in the skip-innodb unless you are using that feature in mysql. Saves a lot of memory.

I had to leave it out

OldAccount's picture

I had to leave it out because mysql wouldn't restart otherwise. I'm very happy with the improvement after following the suggestion here though: http://drupal.org/node/342020

voting on fixes

bigjim's picture

Wouldn't it be great is d.o had the ability to say you like a post, eg digg, facebooks's like function, etc...

total noob question but...

huijing's picture

On the module list page count of SQL queries more than 1000.

In sources I find this:

drupal_rebuild_theme_registry();
node_types_rebuild();
menu_rebuild();
cache_clear_all('schema', 'cache');
.....

my question is...where is sources? or which file do i edit?

fixed in 6.14

bigjim's picture

I thought this was fixed in 6.14

Same problem here, thanks for

sinasalek's picture

Same problem here, thanks for the tips guys. i'm going to try some of them

The problem is fixed

andrew answer's picture

My Drupal admin UI performance radically down after Ubercart installing. I check my installation (6.20) with "devel" module and surprised what only small set of queries is eating almost all time (bottleneck identified!). With modules page, this is UPDATE query in module_rebuild_cache function on show modules list (simply on showing page!). This is what I get: Executed 251 queries in 18419.37 milliseconds.
I fix it with additional line in includes/module.inc::module_rebuild_cache() : immediately before db_query("UPDATE {system} SET put if($file->old_filename!=$file->filename) So you filter update query to run only when file info changed. Now I get: Executed 87 queries in 1179.66 milliseconds. what is radically (18 times!) better.

But, this fix only for show modules page, not for update. When I update modules list (simply check Aggregator module on and off) I see slow INSERT query in _menu_router_build function. What I get: Executed 1347 queries in 65291.81 milliseconds. when I put Aggregator module OFF and Executed 1414 queries in 71114.93 milliseconds. when I put Aggregator module ON.

This is well-known problem described here http://drupal.org/node/512962, and many patches provided.

It's possible for the

hefox's picture

It's possible for the information about a module to change, not just the location of the module, so that if statements looks a tad dangerous.

Central Ohio

Group categories

Topics

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: