Overview

It seems that #3455975: HTTP API: update /xb-component/{component_id} to list possible prop sources for current entity context introduced a singificant increase to the /xb-components load time. Previously, this API endpoint responded within ~200ms. Now with the changes it takes >5s to get a response.

Note: that is with https://www.drupal.org/project/demo_design_system installed.

Proposed resolution

User interface changes

Remains tasks

After the initial fix we could look at also caching /xb-component/{component_id} on just 1 component. But since this is critical we should fix /xb-components and then make things better

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

lauriii created an issue. See original summary.

wim leers’s picture

Huh — odd that neither @tedbow nor @bnjmnm pointed that out 😅

I do know that now we're computing + preloading a lot of information on that endpoint. Will investigate and propose a way forward.

lauriii’s picture

I tested this again with xdebug and loading the endpoint takes >23s. 😅

wim leers’s picture

Yep, not surprised. See #2.

(This is intentional: we ideally preload all relevant info, so that the XB UI remains snappy while in use. Only now are we loading (almost) all the things. So only now do we run into this problem. We may need to move some info to other routes, some info may not be necessary, we probably recompute the same things multiple times, etc. I'm confident there'll be tons of low-hanging fruit 😊)

traviscarden’s picture

@Wim Leers, if you're ever interested in automated performance testing, I have experience using PHPBench on Composer Stager. It's extremely nice. I use it to compare the performance of different design decisions, and I run it on CI to detect regressions. I can show it to you sometime, if it interests you. Here's an example report: https://github.com/php-tuf/composer-stager/pull/230.

wim leers’s picture

Will remember that, thanks @traviscarden!

bnjmnm’s picture

I certainly ran into hints of this in #3455975: HTTP API: update /xb-component/{component_id} to list possible prop sources for current entity context as I had to fix test failures related to /xb-components now completing after the layout preview.

The difference wasn't noticeable enough on my machine to have me concerned, but I suspected this endpoint would eventually get bogged down. Fortunately, AFAIK, this is very cacheable - the response content only changes if an XB-SDC is added/removed/edited, and if the cache is repopulated when SDCs change then there wouldn't even be slowness on the initial request.

wim leers’s picture

#7++ :)

tedbow’s picture

From the summary:

Now with the changes it takes >5s to get a response.

I am not see this performance at all in 0.x

  1. on a fresh install of Drupal I am consistently seeing ~350 ms for /xb-components in Chrome inspector when I first load xb/node/1
  2. When I reload xb/node/1 I then get ~300 ms
  3. If I log another user into the site using an anonymous browser session I then see ~300 ms
  4. If reload xb/node/1 I will even sometimes get as low as ~270ms

Has maybe something changed in 0.x that has made this faster since #3455975: HTTP API: update /xb-component/{component_id} to list possible prop sources for current entity context?

What exactly is the UI lag effect I should be looking to improve? That's why I added Needs issue summary update presumably that should be the most important thing, correct?

could it be because I am using 10.3.x and others are using 11.x? Will try that next

tedbow’s picture

Ok talked to @wim leers and apparently I need to use the theme in https://www.drupal.org/project/demo_design_system to have enough components to see the performance issues. working on that now

wim leers’s picture

Issue summary: View changes
Issue tags: -Needs issue summary update

Updated issue summary per how I always interpreted @bnjmnm ran into this issue — I indeed also cannot reproduce it with "only" XB.

tedbow’s picture

Assigned: tedbow » Unassigned
Status: Active » Needs review
tedbow’s picture

Issue summary: View changes
tedbow’s picture

I did install the Demo Design System.

The first request is about ~4 secs about the ones after that even for another user are around <90ms!

I think this is good enough to get in and then we can look at ways to make sure the cache is warm.

tedbow’s picture

Assigned: Unassigned » wim leers

Assigning to @wim leers but @bnjmnm or others could review it otherwise

kristen pol’s picture

OMG! I tested and it's so much faster 😍 Thanks! 👏

longwave’s picture

Status: Needs review » Reviewed & tested by the community

This looks great to me, the cache tag is correct as per ConfigEntityType so the cache will be invalidated if any of the component config entities are updated:

core/lib/Drupal/Core/Config/Entity/ConfigEntityType.php
66:      $this->list_cache_tags = ['config:' . $definition['id'] . '_list'];
tedbow’s picture

Assigned: wim leers » Unassigned

@kristen pol thanks for testing!

@longwave thanks for reviewing!

wim leers’s picture

Title: [Performance regression] Loading the components takes >5s » `/xb-components` takes multiple seconds when *many* SDCs are present
Issue tags: +D8 cacheability
wim leers’s picture

There's 2 failures in the E2E tests:

  1. one is known: #3472579: `components-slots.cy.js ` is sometimes failing
  2. The other (xb-general.cy.js) is not a known failure, but I can get it to pass reliably locally.

There appear to be significant GitLab CI Runner issues on d.o today, because there's lots of nonsensical failures across the board for today's only 0.x commit: https://git.drupalcode.org/project/experience_builder/-/commit/e6af2f761...

So going ahead and merging.

  • wim leers committed 94014b2f on 0.x authored by tedbow
    Issue #3471070 by tedbow, wim leers, lauriii, bnjmnm, kristen pol,...
wim leers’s picture

Status: Reviewed & tested by the community » Fixed
wim leers’s picture

After merging, CI is green: https://git.drupalcode.org/project/experience_builder/-/commit/94014b2ff... 👍

That confirms the problem was d.o's GitLab CI runner.

Status: Fixed » Closed (fixed)

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