Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
The following services are initialized on every HTML request, but rarely needed:
- 'config.manager'
- 'config.typed'
Proposed resolution
TODO
Remaining tasks
User interface changes
API changes
Comment | File | Size | Author |
---|---|---|---|
#22 | patch-warm.png | 22.07 KB | claudiu.cristea |
#22 | patch-cold.png | 22.74 KB | claudiu.cristea |
#22 | HEAD-warm.png | 21.21 KB | claudiu.cristea |
#22 | HEAD-cold.png | 24.17 KB | claudiu.cristea |
#3 | 2384015-3.patch | 14.5 KB | claudiu.cristea |
Comments
Comment #1
tim.plunkettIs this doable in 8.0.x or should it be bumped?
Comment #2
dawehnerIMHO if everything works, this could be done in 8.0.x
Adapted the issue summary because config.installer is already lazy
One important thing to keep in mind is that changes like that DON'T require a container rebuild, as a non lazy variant works the same.
Comment #3
claudiu.cristeaNot sure :)
Comment #4
Wim LeersDo we need profiling or not?
Comment #5
claudiu.cristea@Wim Leers, I guess we lazy load for performance reasons. I would say Yes, but maybe @dawehner knows better.
Comment #6
dawehnerIMHO it is always nice to know what is going on, instead of just, guessing. IMHO even if it doesn't matter much, its still from a general understanding of our project, nice to see what those kind of changes help us.
Comment #7
Wim LeersComment #8
claudiu.cristea@Wim Leers, can you provide some benchmarks?
Comment #9
dawehnerEveryone should be able to do profiling, IMHO. Relying on specific persons to do that, is a sign of a unhealthy community
Comment #10
claudiu.cristea@dawehner I have no problem to do that. I just don't know what scenario to test. It's not clear for me what page should be tested, I guess a page where the 2 services are not needed but how I determine that? Is there an inspector module that shows us what services are used on a specific page?
Comment #11
dawehnerWell, as the issue summary says, this happened on every HTML request.
Comment #12
claudiu.cristeaHow I ran the benchmark:
So HEAD has 1880.71 (±2.6) vs. #3 that is 1921.43 (±2.3). Even if looks like a relevant delta, I'm not so sure that the difference is so big. But, anyway, at least we know that #3 is not a performance regression.
I'm passing this to @dawehner for review.
Comment #13
dawehnerWell, its at least 2%. There are worse things to do.
Comment #14
claudiu.cristea@dawehner, does this issue need anything else?
Comment #15
dawehnerIMHO no
Comment #16
claudiu.cristeaOK.
Comment #17
Wim LeersYay!
Comment #18
alexpottI'm not sure I believe the benchmarks in #12. If we have 0.5ms response then Drupal 8 has got significantly faster.
Comment #19
alexpottGiven the results below I'm not sure that there is much of a boost here... comparing first runs shows a boost but the second run without the patch is as fast as with the patch.
Without patch
On second run...
With patch
On second run
Comment #20
Wim LeersWell spotted, Alex. 0.5 ms is even faster than page cache. I was gonna say "concurrency higher than 1", but that's also not the case. Not sure what #12 tested then, but it's definitely not Drupal.
This should get actual profiling, using XHProf. The numbers in #19 may be skewed also, because DB I/O has a higher variance that can easily obscure this.
Comment #21
claudiu.cristea@Wim Leers. The explanation has been provided by @Berdir on IRC:
It seems that there was an error (500 or something else) while ran the benchmark. I didn't pay attention to that line.
Yes, wee need to profile and see function calls, etc.
Comment #22
claudiu.cristeaHere's the profiling.
HEAD cold
HEAD warm
Patch cold
Patch warm
Looks like a small regression.
EDIT: I repeated several times the whole scenario but the deltas were more or less the same.
Comment #23
Wim LeersWhat profiling tool is this? It's definitely not XHProf's default UI.
Comment #24
claudiu.cristea@Wim Leers, I installed xhprof on my Mac
$ brew install homebrew/php/php55-xhprof
. Then I enabled the https://www.drupal.org/project/xhprof module.Comment #25
alexpottHmmm using a module to generate XHProf data is not really the best way. Here's a warm cache compared with and without the patch where the Xhprof code is added by Apache. The test was the frontpage standard with no content and the anonymous user. I repeat the runs with and without the patch until the number of functions calls remains the same.
Diff%
Diff
(microsec)
Diff%
Diff
(microsec)
Diff%
MemUse
Diff
(bytes)
Diff%
MemUse
Diff
(bytes)
Diff%
PeakMemUse
Diff
(bytes)
Diff%
PeakMemUse
Diff
(bytes)
Diff%
Comment #26
claudiu.cristeaWell, #25, shows some progress in terms of response time even function calls and memory are increasing. But the time is what concerns us, right?
Now what?
Comment #37
BerdirStumbled over this. Did some checks with blackfire, config managed does not show up, with enabled or disabled page cache.
I suspect that was related to config entities and setting their values, we've removed the runtime dependency on typed config/config schema for that a long time ago.
I do see some possibly micro-optimizations, like putting the default timezone into the container similar to how we handle the default language, but that's not related to this.