Support » Fixing WordPress » Displaying wp-admin/update-core.php takes about 50 secs

  • I have tried to find what was taking so much time with the help this small php code:

    $time_start = time();

    $time_end = time();
    $execution_time = ($time_end – $time_start);
    echo ‘<p>execution time: ‘ . $execution_time . ‘ sec</p>’;

    I have found the culprit to be:
    $time_start = time();
    /** WordPress Administration Bootstrap */
    require_once( dirname( __FILE__ ) . ‘/admin.php’ );
    $time_end = time();

    at the very top of update-core.php. The output is:
    execution time: 46 sec

    Any idea and/or suggestion about why including admin.php could take as much time as that?

Viewing 4 replies - 1 through 4 (of 4 total)
  • I have narrowed down further the problem.

    in wp-admin/admin.php, the following alteration:

    /**
    * Fires before a particular screen is loaded.
    *
    * The load-* hook fires in a number of contexts. This hook is for core screens.
    *
    * The dynamic portion of the hook name, $pagenow, is a global variable
    * referring to the filename of the current page, such as ‘admin.php’,
    * ‘post-new.php’ etc. A complete hook for the latter would be
    * ‘load-post-new.php’.
    *
    * @since 2.1.0
    */
    $time_start = time();
    do_action( “load-{$pagenow}” );
    $time_end = time();
    $execution_time = ($time_end – $time_start);
    error_log( ‘execution time: ‘ . $execution_time . ‘ sec for ‘ . $pagenow );

    gives

    [23-Jan-2018 22:55:40 UTC] execution time: 43 sec for update-core.php

    Ok, I did push the investigation further but I think that I am going to stop here.

    I have narrow down the bottleneck to the function wp_update_plugins() in wp-includes/update.php.

    In it, the function set_site_transient() is called twice:

    [24-Jan-2018 04:12:15 UTC] execution time: 25 sec for set_site_transient() #1
    [24-Jan-2018 04:12:32 UTC] execution time: 16 sec for set_site_transient() #2

    My site has 42 plugins
    _site_transient_update_plugins option has an option_value length of 36022 bytes.

    I did dump the result of the POST request sent to http://api.wordpress.org/plugins/update-check/1.1/

    and 1 of the record is HUUUUUGGGEEE. This is probably this big fat ass record that is causing performance issue. Here is the dump, let me know what you think and I am also going to contact the plugin author to let him know about the problem…

    [addons-for-visual-composer-pro/livemesh-vc-addons.php] => stdClass Object
    (
    [new_version] => 1.8.1
    [stable_version] => 1.8.1
    [name] => Addons for Visual Composer Pro
    [slug] => livemesh-vc-addons
    [url] => https://www.livemeshthemes.com/products/visual-composer-addons/?changelog=1
    [last_updated] => 2018-01-09 12:40:20
    [homepage] => https://www.livemeshthemes.com/products/visual-composer-addons/
    [package] => ‘URL removed’
    [download_link] => ‘URL removed’
    [sections] => stdClass Object
    (
    [description] => <p>Essential bundle of premium quality page builder elements or addons for use in WPBakery Visual Composer available on CodeCanyon.</p>

    [changelog] => <p>1.8.1</p>

    • Added – Option to have all accordion panels expanded during initial page load.
    • Updated – Refactored the tab and accordion related JS functions.

    <p>1.8</p>

    • Upgrade – Simpler grid system based on NEAT 2.1 version
    • Updated – The CSS is now optimized for vendor prefixes with reduced properties and file size.
    • Added – Scroll to the top of the posts block to display new posts during paged navigation (when new posts are not visible).

    <p>1.7.5</p>

    • Added – Image size option for all major addons including grid, gallery and carousels.
    • Added – The lightbox now opens on clicking anywhere on the image if no destination URL is specified for gallery item
    • Added – The link target option for all major addons like grid, gallery and carousels
    • Fixed – The gallery image was not clickable to the link specified
    • Fixed – The gallery filters would not center when a heading was not specified.
    • Fixed – The gallery filters will not display multi-line on devices of lower resolutions like mobile devices.
    • Fixed – The gallery pagination and load more loading icon overlapping the pagination and load more buttons.

    <p>1.7</p>

    • Added – Moved the Livemesh Grid addon to new framework based on reusable blocks. Pls note that the class names have changed to keep it consistent with the new framework.
    • Added – 6 different styles for grid items plus 7 header styles too
    • Added – Next Prev pagination options for Livemesh Grid addon
    • Added – Ability to handle large number of grid pages by providing dotted navigation
    • Added – AJAX Category or taxonomy filtering for Grid addon. No more empty grid on category/taxonomy filtering
    • Added – Read More option for the grid items
    • Added – Open in new window option for links to posts in the grid
    • Added – Two more header styles to posts blocks
    • Fixed – The grid image was not clickable to the post
    • Fixed – The filters would not center when a heading was not specified.
    • Fixed – The grid filters will not display multi-line on devices of lower resolutions like mobile devices.

    <p>1.6</p>

    • Added – Brand new Post Blocks addon with more than a dozen styles and options to present your posts or custom post types
    • Added – AJAX Pagination, Next Prev and Load More options for Post Blocks addon
    • Added – AJAX Category or taxonomy filtering for Post Blocks addon

    <p>1.5.2</p>

    • Added – Advanced tab and accordion functions that help directly link to Tabs and Accordion panels from external pages. On page load, the corresponding tab/panel opens upon auto-scrolling to the tab or accordion panel.
    • Added – Smooth scroll to tabs and accordion panels from internal links within a page.
    • Added – Open Tab or accordion panels clicking the internal links within a page.
    • Added – Ability to specify new window for URL pointed to by image gallery items

    <p>1.5.1</p>

    • Added – Automatic plugin updates and license key activation
    • Fixed – In a few installations, the grid elements may not occupy full width between 769px to 800px device resolutions
    • Fixed – The instagram icon not showing up for team profiles widget
    • Fixed – The posts carousel dots navigation was not clickable
    • Fixed – The posts carousel would not expand beyond 960px in width

    <p>1.5</p>

    • Added – Detailed documentation for all addon elements
    • Added – New addons including Gallery, Gallery Carousel, Image Slider, Custom Content Slider, Countdown, Features and FAQ.
    • Added – AJAX based Pagination and Load More options to Grid and Gallery addons.
    • Added – New styles and ability to specify custom icon color and icon size for services extensions.
    • Added – Plugin options panel for enabling or disabling addons along with other options.
    • Added – Ability to enter Custom CSS in plugin options
    • Added – Default theme color option for addons
    • Added – Support for lightweight Portfolio Post Type plugin. Jetpack custom post types module no longer recommended.
    • Fixed – The grid heading was not being displayed
    • Some styling improvements and fixes

    <p>1.4</p>

    • Added – Left, right and center alignment option to the heading element
    • Added – Styling for services when font icons are chosen instead of image icons
    • Fixed – The testimonials slider content not aligned to the center
    • Fixed – The tab title width was fixed with no wrapping
    • Updated – The isotope and imagesloaded JS libraries.

    <p>1.3</p>

    • Fixed – Check for page id when displaying posts/pages in a grid to avoid infinite loop
    • Fixed – Tabs not processing shortcode content
    • Fixed – Accordion/Toggle element not processing shortcode content

    <p>1.2</p>

    • Fixed PHP warnings raised in certain themes that customize VC.
    • Performed compatibility checks with a number of premium themes; fixed any issues found.
    • Compatibility fixes along with some minor styling tweaks for tabs, accordion, carousel and portfolio/post grid elements.

    <p>1.1</p>

    • New elements – Responsive Tabs and Accordion of variety of styles
    • Fixed a bug that caused many elements to become uneditable in VC editor
    • New services element style
    • Ability to choose entry meta contents for carousel and grid
    • Ability to set a link to the clients website in clients element
    • Email icon restored for team profiles element
    • Fixed some bugs, incompatibilities and design improvements

    <p>1.0</p>

    • Initial release.

    )

    [banners] => stdClass Object
    (
    [high] =>
    [low] =>
    )

    [description] => Array
    (
    [0] => <p>Essential bundle of premium quality page builder elements or addons for use in WPBakery Visual Composer available on CodeCanyon.</p>

    )

    [changelog] => Array
    (
    [0] => <p>1.8.1</p>

    • Added – Option to have all accordion panels expanded during initial page load.
    • Updated – Refactored the tab and accordion related JS functions.

    <p>1.8</p>

    • Upgrade – Simpler grid system based on NEAT 2.1 version
    • Updated – The CSS is now optimized for vendor prefixes with reduced properties and file size.
    • Added – Scroll to the top of the posts block to display new posts during paged navigation (when new posts are not visible).

    <p>1.7.5</p>

    • Added – Image size option for all major addons including grid, gallery and carousels.
    • Added – The lightbox now opens on clicking anywhere on the image if no destination URL is specified for gallery item
    • Added – The link target option for all major addons like grid, gallery and carousels
    • Fixed – The gallery image was not clickable to the link specified
    • Fixed – The gallery filters would not center when a heading was not specified.
    • Fixed – The gallery filters will not display multi-line on devices of lower resolutions like mobile devices.
    • Fixed – The gallery pagination and load more loading icon overlapping the pagination and load more buttons.

    <p>1.7</p>

    • Added – Moved the Livemesh Grid addon to new framework based on reusable blocks. Pls note that the class names have changed to keep it consistent with the new framework.
    • Added – 6 different styles for grid items plus 7 header styles too
    • Added – Next Prev pagination options for Livemesh Grid addon
    • Added – Ability to handle large number of grid pages by providing dotted navigation
    • Added – AJAX Category or taxonomy filtering for Grid addon. No more empty grid on category/taxonomy filtering
    • Added – Read More option for the grid items
    • Added – Open in new window option for links to posts in the grid
    • Added – Two more header styles to posts blocks
    • Fixed – The grid image was not clickable to the post
    • Fixed – The filters would not center when a heading was not specified.
    • Fixed – The grid filters will not display multi-line on devices of lower resolutions like mobile devices.

    <p>1.6</p>

    • Added – Brand new Post Blocks addon with more than a dozen styles and options to present your posts or custom post types
    • Added – AJAX Pagination, Next Prev and Load More options for Post Blocks addon
    • Added – AJAX Category or taxonomy filtering for Post Blocks addon

    <p>1.5.2</p>

    • Added – Advanced tab and accordion functions that help directly link to Tabs and Accordion panels from external pages. On page load, the corresponding tab/panel opens upon auto-scrolling to the tab or accordion panel.
    • Added – Smooth scroll to tabs and accordion panels from internal links within a page.
    • Added – Open Tab or accordion panels clicking the internal links within a page.
    • Added – Ability to specify new window for URL pointed to by image gallery items

    <p>1.5.1</p>

    • Added – Automatic plugin updates and license key activation
    • Fixed – In a few installations, the grid elements may not occupy full width between 769px to 800px device resolutions
    • Fixed – The instagram icon not showing up for team profiles widget
    • Fixed – The posts carousel dots navigation was not clickable
    • Fixed – The posts carousel would not expand beyond 960px in width

    <p>1.5</p>

    • Added – Detailed documentation for all addon elements
    • Added – New addons including Gallery, Gallery Carousel, Image Slider, Custom Content Slider, Countdown, Features and FAQ.
    • Added – AJAX based Pagination and Load More options to Grid and Gallery addons.
    • Added – New styles and ability to specify custom icon color and icon size for services extensions.
    • Added – Plugin options panel for enabling or disabling addons along with other options.
    • Added – Ability to enter Custom CSS in plugin options
    • Added – Default theme color option for addons
    • Added – Support for lightweight Portfolio Post Type plugin. Jetpack custom post types module no longer recommended.
    • Fixed – The grid heading was not being displayed
    • Some styling improvements and fixes

    <p>1.4</p>

    • Added – Left, right and center alignment option to the heading element
    • Added – Styling for services when font icons are chosen instead of image icons
    • Fixed – The testimonials slider content not aligned to the center
    • Fixed – The tab title width was fixed with no wrapping
    • Updated – The isotope and imagesloaded JS libraries.

    <p>1.3</p>

    • Fixed – Check for page id when displaying posts/pages in a grid to avoid infinite loop
    • Fixed – Tabs not processing shortcode content
    • Fixed – Accordion/Toggle element not processing shortcode content

    <p>1.2</p>

    • Fixed PHP warnings raised in certain themes that customize VC.
    • Performed compatibility checks with a number of premium themes; fixed any issues found.
    • Compatibility fixes along with some minor styling tweaks for tabs, accordion, carousel and portfolio/post grid elements.

    <p>1.1</p>

    • New elements – Responsive Tabs and Accordion of variety of styles
    • Fixed a bug that caused many elements to become uneditable in VC editor
    • New services element style
    • Ability to choose entry meta contents for carousel and grid
    • Ability to set a link to the clients website in clients element
    • Email icon restored for team profiles element
    • Fixed some bugs, incompatibilities and design improvements

    <p>1.0</p>

    • Initial release.

    )

    • This reply was modified 2 years, 10 months ago by lano1106.

    I have found someone guilty (there appear to be more than one…). MonsterInsights plugin install 4 times the same pre_set_site_transient_update_plugins callback and takes 16 seconds everytime set_site_transient() is called from wp_update_plugins():

    [25-Jan-2018 20:34:38 UTC] execution time: 1 sec for revslider.set_update_transient()
    [25-Jan-2018 20:34:38 UTC] execution time: 0 sec for wordpress-seo-premium.set_updates_available_data()
    [25-Jan-2018 20:35:02 UTC] execution time: 4 sec for google-analytics-premium.update_plugins_filter()
    [25-Jan-2018 20:35:05 UTC] execution time: 3 sec for google-analytics-premium.update_plugins_filter()
    [25-Jan-2018 20:35:09 UTC] execution time: 4 sec for google-analytics-premium.update_plugins_filter()
    [25-Jan-2018 20:35:13 UTC] execution time: 4 sec for google-analytics-premium.update_plugins_filter()
    [25-Jan-2018 20:35:13 UTC] execution time: 36 sec for pre_set_site_transient_update_plugins
    [25-Jan-2018 20:35:13 UTC] execution time: 36 sec for set_site_transient() #1
    [25-Jan-2018 20:35:13 UTC] execution time: 0 sec for revslider.set_update_transient()
    [25-Jan-2018 20:35:13 UTC] execution time: 0 sec for wordpress-seo-premium.set_updates_available_data()
    [25-Jan-2018 20:35:28 UTC] execution time: 4 sec for google-analytics-premium.update_plugins_filter()
    [25-Jan-2018 20:35:32 UTC] execution time: 4 sec for google-analytics-premium.update_plugins_filter()
    [25-Jan-2018 20:35:36 UTC] execution time: 4 sec for google-analytics-premium.update_plugins_filter()
    [25-Jan-2018 20:35:39 UTC] execution time: 3 sec for google-analytics-premium.update_plugins_filter()
    [25-Jan-2018 20:35:39 UTC] execution time: 26 sec for pre_set_site_transient_update_plugins
    [25-Jan-2018 20:35:39 UTC] execution time: 26 sec for set_site_transient() #2

    BTW, having wp_update_plugins() call set_site_transient() twice feels like a hack. It is all good to update last_checked but is it necessary to call all the hooks twice??

    Hi, I have new info concerning my wp-admin/update-core.php slowness issue. It is caused by the plugin Ad Inserter Pro (author contacted) who does this:

    add_filter (‘http_headers_useragent’, ‘ai_http_headers_useragent’);

    function ai_http_headers_useragent ($useragent) {

    $useragent = get_bloginfo (‘url’);

    return $useragent;

    }

    This appears to disrupt all the other premium plugins when they contact their servers to check the license validity. One of the things that they do remotely is to authenticate the request by checking the user-agent header-field. By messing with it, it disrupts a LOT of stuff. and makes a lot of things VERY slow.

    http_headers_useragent filter hook appears to be VERY VERY risky hook…

    I have suggested an improvement concerning the problem here if you are interested in following it: https://core.trac.wordpress.org/ticket/43160

    • This reply was modified 2 years, 10 months ago by lano1106.
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Displaying wp-admin/update-core.php takes about 50 secs’ is closed to new replies.