On Monday 05 January 2009 5:53:27 am Matej Svetlik wrote:
hello, We have drupal page with 50+ modules. With every new module added, drupal is getting slower and slower (with load times near 2 seconds).
After installation of APC load times dropped drastically but are still slow.
Are there any common ways to handle installations with lots of modules (and even more include files)?
pages depend on 2 external systems, but loading data form them takes only 0.3 second.
PS: I tough about "hacking" core to load only modules that are really needed for the page that is loading (modules doesn't depend on each other). I'm just curious if it's possible?
thanks
Don't bother using D7. There aren't 50 modules that even work with D7 at this point. :-) D7 is still a long way off from production use, but it's true that we're putting a lot of effort into trying to make D7 more load-friendly.
The main problem is that Drupal 5 and earlier by design loaded ALL code on every page load. In Drupal 6 we introduced split include files for page callbacks, so most of those "foo.admin.inc" and "foo.pages.inc" files are not, in fact, loaded on every page request but only when needed. There are similar techniques that individual modules can implement if necessary for their own code, and some of the larger ones like Views and CCK do, but there's no central mechanism for it.
Hooks aren't the issue per se, although it is true that there's a cost to checking 50 modules for a hook.
Both of those are seeing major improvements in D7, but they're not anywhere near production ready yet.
An opcode cache will help immensely for the first problem, as that's the main thing it solves. Proper tuning of the cache (you can set it to not even stat the disk) will help, too.
Beyond that, depends on your modules. You may find some you do not, in fact, need. Others you could look into improving by implementing some sort of lazy- loading mechanism like Views does. (I believe Views' mechanism is being split off to the ctools module, now in alpha.) You'd have to work with the maintainers for those. Some modules wouldn't really support it, sadly.
For external systems, definitely look into proper caching, even if you think it's fast. You can also look into tuning the block cache, or using memcache instead of the default db caching, perhaps, but that's probably overkill if you are just running an intranet server.
Anyway, that's just general purpose advise. And, um, no, don't hack core. Really. You will regret it. Maybe not today, maybe not tomorrow, but soon, and for the rest of your life.