Performance, on-demand plugin loading

At the risk of showing my ignorance at the way elgg works.

I read somewhere here that one reason elgg may be slow is the processing of too many plugins. That got me thinking.  Why are all plugins loaded all the time.  A typical user may use 5 or 6 plugins a lot and others very seldomly. This would suggest a scheme where plugins are loaded on demand.  Is my thinking about this totally bogus?

  • I also want to know something about this subject. My site is to slow (http://CredoConect.com) i want to understand if it so slow becouse of many plugins... What should i do to increase the speed? Can it be a server issue?

  • Usually poorly written plugins slow down the site much more than the ones with good code. You shouldn't experience trouble with multiple well written plugins, I know websites with 50 and more plugins which run well.

    I'm affraid it's hard to use lazy loading of plugins (only when they're required). What I think could be done in the core is to allow to load pagesetup handler with context parameter. It would allow to process submenu links of only those plugins which are defined in given context.

     

    The best steps to improve performance of the site in a short term is to optimize memcache and mysql and make sure Elgg isn't in debug mode. You can also try turning off Elgg logs in database and launch garbagecollector.

     

    In case your website contains multiple search queries, this is a separate problem. It can be overcome although it requires more complex solution. In Elgg search queries can choke on search by 4 metadata, after optimization you can search by as many metadata as you wish.

  • Mike, in short, we can't load just a few plugins for a given user. We can however slightly improve the way submenus in plugins are loaded which can give slight improvement of performance (probably less than 1% on well written site though).

  • Another good idea would be to not to register actions unless we're in a script launched with action handler. We don't use actions registered by plugins in views in any way.

  • Hey, Mike,

    There is a bit more lazy loading in Elgg 1.8.  Not the plugin itself, but some of the code can be loaded only when needed if the plugin is coded correctly. For example, plugins can declare libraries that are only loaded when you explicitly call them, so the library is registered, but the code is not parsed until the library is explicitly loaded.  Also, classes are autoloaded if you format your plugin correctly, so that code is not parsed until needed either.

    Vazco's recommendations for plugin authors are good too -- skipping registration functions when they don't apply.  I actually just submitted a ticket to core for this the other day: http://trac.elgg.org/ticket/3003.

Performance and Scalability

Performance and Scalability

If you've got a need for speed, this group is for you.