Problem/Motivation

Part of our performance issues in Drupal 8 are the sheer number of classes that need to be loaded.

I profiled an internal page cache hit, and saw some interfaces which couldn't possibly be needed being loaded. Turns out this is due to #1973618: DIC: Lazy instantiation of service dependencies (ProxyManager for "proxy services").

In the compiled container, we generate a proxy class that implements the interface for the real service.

On page cache hits, this means something like 10-15 interfaces being loaded. This is out of 73 total.

See attached file. For example ConfigInstallerInterface

Proposed resolution

  • Dump the lazy services into their own files
  • Register a PSR-4 namespaces for that dumped lazy files
  • Measure whether its worth to do it

Remaining tasks

User interface changes

API changes

CommentFileSizeAuthor
file.txt169.46 KBcatch
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

catch’s picture

Issue summary: View changes
catch’s picture

dawehner’s picture

Issue summary: View changes

Updated the IS based upon our IRC discussion

catch’s picture

Changing the parent issue. While this is the case on every request, the overhead is most noticeable on internal page cache hits.

Fabianx’s picture

Agree with proposed resolution, lets also not do that at run-time (proxy services are entirely optional optimization), but at commit and compile time.

dawehner’s picture

catch’s picture

Status: Active » Postponed

Yep. Marking this postponed on that, then we can close as duplicate.

catch’s picture

Status: Postponed » Closed (won't fix)
catch’s picture

Status: Closed (won't fix) » Closed (duplicate)