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
Issue fork experience_builder-3471070
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
wim leersHuh — 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.
Comment #3
lauriiiI tested this again with xdebug and loading the endpoint takes >23s. 😅
Comment #4
wim leersYep, 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 😊)
Comment #5
traviscarden commented@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.
Comment #6
wim leersWill remember that, thanks @traviscarden!
Comment #7
bnjmnmI 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-componentsnow 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.
Comment #8
wim leers#7++ :)
Comment #9
wim leersTed will take this on — he noticed in his review of #3469856: The component preview should have a background: include theme's global asset libraries for component preview that this is a blocker to that.
See https://git.drupalcode.org/project/experience_builder/-/merge_requests/2....
Comment #10
tedbowFrom the summary:
I am not see this performance at all in 0.x
xb/node/1xb/node/1I then get ~300 msxb/node/1I will even sometimes get as low as ~270msHas 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
Comment #11
tedbowOk 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
Comment #12
wim leersUpdated issue summary per how I always interpreted @bnjmnm ran into this issue — I indeed also cannot reproduce it with "only" XB.
Comment #14
tedbowComment #15
tedbowComment #16
tedbowI 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.
Comment #17
tedbowAssigning to @wim leers but @bnjmnm or others could review it otherwise
Comment #18
kristen polOMG! I tested and it's so much faster 😍 Thanks! 👏
Comment #19
longwaveThis looks great to me, the cache tag is correct as per ConfigEntityType so the cache will be invalidated if any of the
componentconfig entities are updated:Comment #20
tedbow@kristen pol thanks for testing!
@longwave thanks for reviewing!
Comment #21
wim leersComment #22
wim leersThere's 2 failures in the E2E tests:
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.xcommit: https://git.drupalcode.org/project/experience_builder/-/commit/e6af2f761...So going ahead and merging.
Comment #24
wim leersComment #25
wim leersAfter merging, CI is green: https://git.drupalcode.org/project/experience_builder/-/commit/94014b2ff... 👍
That confirms the problem was d.o's GitLab CI runner.