Slow admin/config page load

Created on 26 January 2023, over 2 years ago

Problem/Motivation

I've noticed that the admin/config page takes a lot of time to load on a large project with a lot of contributed modules enabled. The reason for this turned out to be the check for the status report errors that is done every time on page load in SystemController's overview() method. For me this status check doesn't make sense on this page, which is the front gate for all configuration pages and is supposed load fast (rendering only links). Moreover, there is a dedicated page for that check.

Proposed resolution

If there is no strong reason this check to be executed there on every page load, I would prefer to not have it at all there.

Some stats with and without this check:
Page load (with status check) - 11 sec
Page load (without status check) - 0.8 sec

πŸ› Bug report
Status

Active

Version

9.4

Component
SystemΒ  β†’

Last updated about 11 hours ago

No maintainer
Created by

πŸ‡§πŸ‡¬Bulgaria yivanov

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @yivanov
  • Status changed to Needs review over 2 years ago
  • πŸ‡¬πŸ‡§United Kingdom catch

    The idea of this is to alert system admins to problems when they might not be looking for them - however, agreed it's very expensive to do this every time you're browsing to this page. I also wonder if people actually follow the link vs. just doing what they're trying to do.

    Tagging for product manager and usability review, since removing the warning altogether seems like a decision for them.

    If we can't completely remove it, I wonder if we could put it behind flood control instead, so that it only runs every 24 hours or similar? That way if there's a persistent warning on the status report, you'll get alerted to it within a day, but you don't get the performance hit every time you visit the page.

    Another possibility might be to check this on cron once every 24 hours (again using flood control or a timestamp to avoid running it too often), set a value if it's OK, and then we could look for that and skip the check if so. If it's not OK, then run the check as we currently do (to avoid showing an error if things have been fixed in-between).

  • Status changed to Needs work about 2 years ago
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Think also a test case could benefit in showing the issue. Though not sure how to simulate a large site and if it's testing load time.

  • πŸ‡¨πŸ‡¦Canada ambient.impact Toronto

    If the status check is indeed the culprit, that would also explain why admin/reports/status also takes a good few seconds to load for me on sites that also have this slow loading issue on admin/config. I think a fast loading UI should be the priority on both routes, and have the status check done asynchronously with the results displayed from cache if possible. Doing the checks on cron can be part of the solution, but there will be places where getting that info updated (such as on admin/reports/status) on command will be necessary, so an ideal solution would be if it can be run as a batch operation or something similar that shows progress like checking for updates does.

    As for how to replicate this in a test, one way might be create a whole bunch of test modules that add additional \hook_requirements() implementations that do file system checks or other things that might introduce a bit of overhead. Short of just pulling in a bunch of existing contrib modules for the test, that's how I'd try to accomplish it. If that doesn't work, it might be good to take an inventory of the modules in use on sites that are experiencing this, and then figure out what checks they're doing that might be a performance issue, to replicate those in a test.

  • πŸ‡§πŸ‡ͺBelgium hoebekewim

    Confirming this patch has a huge improvement on complex websites when visiting the configurations screen. In my project it went from a 10 second pageload to a 1 second pageload. This is what Drupal should be capable of, running complex content management systems, which work fast in day to day content and configuration manipulations.
    I agree that this should not run on the configuration screen, but only on a dedicated page as the report status or by implementing a cronjob task as suggested inside this thread.

  • πŸ‡¬πŸ‡§United Kingdom catch

    Another option on top of #5 would be to put this in a lazy builder, then at least with bigpipe it won't block the page from loading.

  • πŸ‡¨πŸ‡·Costa Rica yuvania

    I've tested the provided patch and observed a significant improvement in the load times for the admin/config page. This change greatly enhances the usability of the configuration page in larger projects.

    I agree with the suggestion to run these checks less frequently, such as through a cron job or lazy loading, to ensure we still catch potential issues without affecting performance. Implementing this would provide a balanced approach to maintain site health without compromising speed.

  • πŸ‡ΊπŸ‡ΈUnited States hablat

    This issue is exacerbated by https://www.drupal.org/project/drupal/issues/312395 πŸ“Œ Queries on search admin and node indexing are slow for many-node sites Needs work for sites with many node content. As the call for
    $this->systemManager->checkRequirements()
    Eventually leads to calling the following hook on the search module file
    search_requirements($phase) on search.install
    Which then subsequently calls the method
    indexStatus() on core/modules/node/src/Plugin/Search/NodeSearch
    That runs the long sql query that causes noted on issue #312395 πŸ“Œ Queries on search admin and node indexing are slow for many-node sites Needs work .

    For us this is site breaking because the sql query hangs/takes too long which eventually leads to timeout and us being unable to access the /admin/config page. This usually triggers after a cache clear.

    The patch here helps us get around this issue. But I think maybe better to fix the performance issue caused by #312395 πŸ“Œ Queries on search admin and node indexing are slow for many-node sites Needs work if we want to keep the check.

Production build 0.71.5 2024