E
E
EvgenyMorozov2018-04-29 14:40:56
WordPress
EvgenyMorozov, 2018-04-29 14:40:56

Big time between Core init and Main Loop. Where to dig?

Good afternoon, colleagues
I came across a profiler for WordPress LAPS . And he showed me a mysterious picture.
5ae5adfc15057421818288.png
This long white bar is the "delay" between Core Init and Main Loop. And so on every page of the site. The site has over 14,000 posts. Base on InnoDB, only 234MB.
Caching, of course, saves, but it's interesting to figure out: what is happening at this time?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Igor Vorotnev, 2018-05-01
@HeadOnFire

5ae8677286270930142007.jpeg
1. Update the plugin to the 2nd version, additional data will appear there.
2. Core init is a conditional event, essentially the sum of the main actions on the init hook.
3. Main Loop - this is the moment of execution of the main loop.
4. It is important to understand that between 2 and 3 there is still a lot of things going on, including queries to the database - posts, their metadata, taxonomy terms and their metadata, selection of menu items and their metadata, some options, as well as connecting templates and assembling subsequent output. This takes a certain amount of time, often significantly more than the initialization of the kernel. In your case, it costs a lot.
5. To see in more detail what is happening "under the hood", you need to do code profiling - look towards Xdebug and its profiler, towards XHProf/Tideways, Blackfire.io and so on.
Roughly speaking, there should be a "delay" between Core Init and Main Loop, but this is not a delay at all, a lot of things happen at this time. How big this delay is depends on your code, database, server settings, etc.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question