[drupal-devel] [feature] Speed up Drupal and improve scalability: On demand module loading

eldarin drupal-devel at drupal.org
Mon Aug 1 00:10:32 UTC 2005

Issue status update for 
Post a follow up: 

 Project:      Drupal
 Version:      cvs
 Component:    module system
 Category:     feature requests
 Priority:     normal
 Assigned to:  Anonymous
 Reported by:  Jose A Reyero
 Updated by:   eldarin
 Status:       patch (code needs review)

Interesting issue and approach; I'm also looking into reducing
processing load and speeding things up.
I have completed a first test version of a template system where I can
keep the generated content - without the theme template "XHTML
framework". I am now looking into how to cache partially parsed pages -
with parts like e.g user specific information being always getting

It's kind of complicated when to dirty cached contents - perhaps some
simple rules could do - but I've yet to discover which.

In my opinion the biggest gain can be found by reducing whatever
processing needed to deliver XHTML to users - but not all is serving up
the pages - a lot is also logging, AAA etc.

I think a combination of successful caching and reducing module loading
can be the best overall solution.

For security I also like to try and differentiate db users - don't like
the idea of a central "db-root" being used for all accessing. An
encrypted password like /etc/passwd with perhaps client-side browser
encryption generation could serve - a IDEA, 3DES or Rijndael. That
would effectively get rid of most of the hacking/defacing of web-sites
- i.e keep the db intact from hackers.


Previous comments:

Sun, 31 Jul 2005 15:43:13 +0000 : Jose A Reyero

Attachment: http://drupal.org/files/issues/on_demand_module_loading.patch (7.8 KB)

As Drupal grows bigger, there is too much code not really needed parsed
for each request.

Also, installing more and more modules presents serious scalability
issues, as all the enabled modules are included always for each non
cached page.

This is a first attempt to keep track of *all* module hooks, and only
load modules when they're really needed. I guess it may need some
polishing but the idea is simple enough. 

Currently, as the hook_menu is implemented by most of the modules, and
it is called most of the times, the potential performance improvement
introduced by this mechanism may be small. 

But the thing is, once he have some system for on demand module
loading, hooks can be reworked in the future, to have some real
performance boost. I.e. hook_menu could be easily split in two
'hook_menu' and 'hook_menu_dynamic', thus really reducing acually
loaded modules.

As I said, this is a first step. If there's some interest in this kind
of features, I have some other things in the works aimed at performance
and scalability, like:

- (Simple) Rework of menu system to take real advantage of on demand
module loading
- Expand menu items to be able to include some file where the callback
is in
- Extend module loading for 'loading on path', and maybe 'loading split
- Some API loader, kind of api_invoke....


Sun, 31 Jul 2005 21:00:41 +0000 : chx

This will be never be really efficient. If you have a block from
aggregator, then aggregator needs to be loaded and parsed and store
despite most of the functionality is never used. Quite a lot of modules
play a small part in most pages.

Alas, my split mode development is halted a bit, but I'll revive. My
problem is that drupal_eval needs on the fly tokenizing and wrapping...

More information about the drupal-devel mailing list