Panelizer implements hook_admin_paths(), which is run everywhere and all the time, and hook_default_page_manager_handlers(), which is run for page manager controlled pages, and delegates this to all plugins. This will fetch all available plugins by using ctools_plugin_load_includes(), and that function only caches when you request a particular file.

This results in some disk IO and unnecessary cache writes, which is not very good for performance.

I don't know a good solution for this, but here are some ideas:

A) Change ctools_plugin_load_includes in CTools so that it caches even if you don't specify a file that should be loaded. This will impact various administration UI:s, since that would require a cache purge before any change is picked up. We could potentially add a parameter to the function, $bypass_cache or similar, if we want to bypass the cache for admin tasks, but this would still be a fair amount of re factoring to get that in everywhere it's used. If we want to go this route we should obviously move this to CTools.

B) Put a cache layer inside of panelizer. This will fix the problems, but it will also result in duplicate cache entries for the same thing, and CTools is meant to handle this thing already, but it will solve the immediate problem.

CommentFileSizeAuthor
#2 panelizer-n1719090-2.patch418 bytesdamienmckenna

Comments

merlinofchaos’s picture

Category: bug » task

A) isn't going to happen; that system is designed that way to ensure that we don't have dirty caches.

B) can potentially be alleviated just by turning on caching for panelizer entity plugins. Maybe you can give that a try? It's a simple flag in hook_ctools_plugin_type I think.

This isn't really a bug.

damienmckenna’s picture

Version: 7.x-2.x-dev » 7.x-3.x-dev
Issue summary: View changes
Status: Active » Needs review
StatusFileSize
new418 bytes

@merlinofchaos: Did you mean that panelizer_ctools_plugin_type() should be changed so that 'cache' is set to TRUE?

mglaman’s picture

Context does this.

function context_ctools_plugin_type() {
  return array(
    'plugins' => array(
      'cache' => TRUE, 
      'use hooks' => TRUE, 
      'classes' => array('handler'),
    ),
  );
}

However git blame doesn't lead to a useful commit as to why/ticket :/. However, given what Context is used for I imagine this might be a useful patch. I'll try to keep testing and do some benchmarking.

damienmckenna’s picture

Status: Needs review » Fixed

Committed.

  • DamienMcKenna committed 1ebc111 on 7.x-3.x
    Issue #1719090 by DamienMcKenna: Cache entity plugins to reduce file...
damienmckenna’s picture

Status: Fixed » Needs work

Had to roll this back, it was causing problems.

  • DamienMcKenna committed ce5ff4a on 7.x-3.x
    Revert "Issue #1719090 by DamienMcKenna: Cache entity plugins to reduce...
joelpittet’s picture

What kind of problems?

damienmckenna’s picture

@joelpittet: Various menu lists were not reloaded after actions were performed; it probably just needs some drupal_static_reset() calls placed in appropriate locations, but it was too unstable as-is.

joelpittet’s picture

Ah, that is always overlooked (it seems and by me)

damienmckenna’s picture

Issue tags: +Performance

  • DamienMcKenna committed 1ebc111 on 8.x-3.x
    Issue #1719090 by DamienMcKenna: Cache entity plugins to reduce file...
  • DamienMcKenna committed ce5ff4a on 8.x-3.x
    Revert "Issue #1719090 by DamienMcKenna: Cache entity plugins to reduce...

  • DamienMcKenna committed 1ebc111 on 8.x-4.x
    Issue #1719090 by DamienMcKenna: Cache entity plugins to reduce file...
  • DamienMcKenna committed ce5ff4a on 8.x-4.x
    Revert "Issue #1719090 by DamienMcKenna: Cache entity plugins to reduce...