Problem/Motivation

This has apparently random failures as in https://git.drupalcode.org/issue/drupal-3518662/-/jobs/7054606

Steps to reproduce

Proposed resolution

Instead of a full admin user, create a user with lots of admin permissions, but not access to contextual links, because contextual links make an AJAX request.

Swap navigation for toolbar since that also makes an AJAX request, and one that is dependent on local storage.

Uninstall history module - another AJAX request.

Ensure exactly the same combination of libraries that will eventually be on the page to be tested is requested in the cache warming step to avoid any stray asset aggregates being created.

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Issue fork drupal-3554646

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

catch created an issue. See original summary.

catch’s picture

Status: Active » Needs review

smustgrave made their first commit to this issue’s fork.

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

Fixed the small cspell issue but fix of changing to 3 from 2 seems straightforward enough.

smustgrave’s picture

Status: Reviewed & tested by the community » Needs work

I jumped the gun appears this is the test failing now?

       ├ Failed asserting that two arrays are identical.
       ┊ ---·Expected
       ┊ +++·Actual
       ┊ @@ @@
       ┊  Array &0 [
       ┊ -····'QueryCount'·=>·525,
       ┊ -····'CacheGetCount'·=>·550,
       ┊ +····'QueryCount'·=>·527,
       ┊ +····'CacheGetCount'·=>·548,
       ┊      'CacheGetCountByBin' => Array &1 [
       ┊          'config' => 201,
       ┊ -········'bootstrap'·=>·28,
       ┊ -········'discovery'·=>·112,
       ┊ +········'bootstrap'·=>·27,
       ┊ +········'discovery'·=>·111,
       ┊          'data' => 72,
       ┊ +········'entity'·=>·23,
       ┊          'dynamic_page_cache' => 2,
       ┊          'default' => 45,
       ┊ -········'entity'·=>·23,
       ┊          'render' => 39,
       ┊          'menu' => 28,
       ┊      ],
catch’s picture

OK that either means there's still random failures or it means it was 'randomly passing' before.

I think this is the only performance test in core that covers contextual links, which are rendered via a custom AJAX request, which will be even more delayed than asset/image requests - so it could be that.

smustgrave’s picture

And before my comment I reran twice and it failed both

catch’s picture

Pushed a commit that tries to disable local storage during performance tests - this should mean we don't get a situation where one test run happens to have something in local storage and another doesn't. I am not entirely sure if the syntax is correct but it passes locally and also passed a couple of test runs.

Kicked off a repeat test run here: https://git.drupalcode.org/issue/drupal-3554646/-/jobs/7067105 - and that didn't work, or at least not enough. However it's interesting that all the failing tests took more than 200s to run and everything 200s or less passed, so at least there's a pattern.

Tried uninstalling contextual module in the test, but we can't do that because layout builder depends on it. It would be possible to remove that dependency in performance_test module in a hook_system_info_alter() maybe, but would be more realistic to manually add a load of permissions to a user instead of using the admin role, and just don't give that user access to contextual links - although no guarantee that's 100% the problem but it feels like it's worth trying to rule out.

catch’s picture

Status: Needs work » Needs review

https://git.drupalcode.org/issue/drupal-3554646/-/jobs/7071428 looking better (although not finished yet).

catch’s picture

Without the longer sleep after user login, a handful of tests would run for about double time and fail with slightly different numbers. Compensated for that with shorter sleeps for the actual page cache warming which appears to still work fine. Going to kick off another repeat class test job just for luck, but this seems to be it.

Would be nicer if we didn't have to have the sleeps here and could instead assert that every http request issued from the browser gets a response, but even that wouldn't help with post response tasks. Essentially several of the optimisations in core to improve response times, parallelise work etc. make it harder to write accurate performance tests, but of all the performance problems we have, a few sleep() in a few tests is not the biggest.

catch’s picture

Issue summary: View changes
catch’s picture

mondrake’s picture

Status: Needs review » Reviewed & tested by the community

Looks good to me.

catch’s picture

https://git.drupalcode.org/issue/drupal-3554646/-/jobs/7076879 has some more failures, but one of the tests took more than 10 minutes to complete, so I'm wondering if that's partly an artifact of the repeat tests class job itself - e.g. normal functional test runs don't try to install Umami 100 times simultaneously. So it would be good to try this and we can open another issue if we see any more random failures.

alexpott’s picture

Version: 11.x-dev » 11.3.x-dev
Status: Reviewed & tested by the community » Fixed

Committed and pushed 050d15b0c84 to 11.x and 291780218a5 to 11.3.x. Thanks!

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

  • alexpott committed 29178021 on 11.3.x
    Issue #3554646 by catch, smustgrave: Stabilize...

  • alexpott committed 050d15b0 on 11.x
    Issue #3554646 by catch, smustgrave: Stabilize...
catch’s picture

Status: Fixed » Active

This failed again on an MR almost immediately after it was committed, so more to do here.

catch’s picture

Status: Active » Needs review

Figured it out.

The cache warming requests for asset aggregates/image derivatives on the node page weren't exactly the same as the one we're recording cold cache backend performance for - because the test logs in a user first and that warms some different caches and assets prior to warming the node page. So there was at least one aggregate that was unique to the performance recording request, which causes an extra Drupal request and bootstrap etc.

The solution is to visit node/1 with an empty cache after logging in, then the same asset libraries are requested and the aggregates created.

catch’s picture

https://git.drupalcode.org/issue/drupal-3554646/-/jobs/7142642 is 100 green runs of this test.

https://git.drupalcode.org/issue/drupal-3554646/-/jobs/7143359 is a second run I'm hoping will be green. edit: all green.

Answered the review comments on the MR.

catch’s picture

Issue summary: View changes
catch’s picture

Issue summary: View changes
catch’s picture

Priority: Normal » Critical
Issue tags: +Random test failure

Rebased.

catch’s picture

Version: 11.3.x-dev » 11.x-dev
nicxvan’s picture

Status: Needs review » Reviewed & tested by the community

Logic looks right to me, reran the random failures.

It's unfortunate that these numbers are not true savings since it's a bunch, but more of a new and more stable baseline.

berdir’s picture

+1 to RTBC.

On the cache operations, I was just confused by because the total didn't seem to add up, but I think I got confused, maybe I mixed up query count and cache get operations or maybe I compared the get per bin and the total of cache set operations.

  • alexpott committed e4bc44f2 on 11.3.x
    Issue #3554646 by catch, smustgrave, alexpott, berdir: Stabilize...
alexpott’s picture

Version: 11.x-dev » 11.3.x-dev
Status: Reviewed & tested by the community » Fixed

Committed and pushed 3aa7b25f383 to 11.x and e4bc44f2ad1 to 11.3.x. Thanks!

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

  • alexpott committed 3aa7b25f on 11.x
    Issue #3554646 by catch, smustgrave, alexpott, berdir: Stabilize...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.