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
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
Comment #2
catchComment #5
smustgrave commentedFixed the small cspell issue but fix of changing to 3 from 2 seems straightforward enough.
Comment #6
smustgrave commentedI jumped the gun appears this is the test failing now?
Comment #7
catchOK 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.
Comment #8
smustgrave commentedAnd before my comment I reran twice and it failed both
Comment #9
catchPushed 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.
Comment #10
catchhttps://git.drupalcode.org/issue/drupal-3554646/-/jobs/7071428 looking better (although not finished yet).
Comment #11
catchWithout 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.
Comment #12
catchComment #13
catchFresh repeat test class job https://git.drupalcode.org/issue/drupal-3554646/-/jobs/7076879
Comment #14
mondrakeLooks good to me.
Comment #15
catchhttps://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.
Comment #16
alexpottCommitted and pushed 050d15b0c84 to 11.x and 291780218a5 to 11.3.x. Thanks!
Comment #20
catchThis failed again on an MR almost immediately after it was committed, so more to do here.
Comment #21
catchFigured 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.
Comment #22
catchhttps://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.
Comment #23
catchComment #24
catchComment #25
catchRebased.
Comment #26
catchComment #27
nicxvan commentedLogic 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.
Comment #28
berdir+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.
Comment #30
alexpottCommitted and pushed 3aa7b25f383 to 11.x and e4bc44f2ad1 to 11.3.x. Thanks!