Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(scaffolder): use virtualization with MultiEntityPicker #25315

Merged

Conversation

kmikko
Copy link
Contributor

@kmikko kmikko commented Jun 19, 2024

Hey, I just made a Pull Request!

Use virtualization with MultiEntityPicker. This fixes performance issues with large data sets. Fixes #25243.

Testing

Not sure how you would test this with testing-library as the issue manifests itself only in real browser environment. However have tested this locally by comparing behaviour between master branch and this as follows:

  • Generate catalog-info.yaml containing a large number (~5k will do it) of entities using a script like so:
#!/bin/bash

# Check if exactly one argument is passed
if [ "$#" -ne 1 ]; then
  echo "Usage: $0 <number_of_entries>"
  exit 1
fi

# Check if the argument is a positive integer
if ! [[ "$1" =~ ^[0-9]+$ ]]; then
  echo "Error: Argument must be a positive integer."
  exit 1
fi

# Number of entries to generate
NUM_ENTRIES=$1

# Output file
OUTPUT_FILE="generated-$NUM_ENTRIES.yaml"

# Create or clear the output file
>"$OUTPUT_FILE"

# Generate YAML entries
for ((i = 1; i <= NUM_ENTRIES; i++)); do
  cat <<EOL >>"$OUTPUT_FILE"
apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
  name: example-app-$i
  title: example-app-$i
spec:
  lifecycle: experimental
  type: backstage-frontend
  owner: maintainers
---
EOL
done

echo "Generated $NUM_ENTRIES entries in $OUTPUT_FILE"
  • Include entities in app config
# app-config.yaml
...
catalog:
    ...
    - type: file
      target: ../../generated-10000.yaml
      rules:
        - allow: [Component]
  • Start the app with yarn dev and wait until all entities have been ingested
  • Open Custom Field Explorer from http://localhost:3000/create/edit and select MultiEntityPicker
  • Open dropdown menu. Scrolling, searching and selecting items should work as expected without lag. Whereas compared to master branch browser (tested with latest Chrome) quickly becomes unresponsive and finally hangs:

Screenshot 2024-06-19 at 9 16 51

I have tested this with 5k, 10k and 100k entities and in all cases the input remains responsive. Here's demo with 100k entities

Screen.Recording.2024-06-19.at.12.57.22.mov

✔️ Checklist

  • A changeset describing the change and affected packages. (more info)
  • Added or updated documentation
  • Tests for new functionality and regression tests for bug fixes
  • Screenshots attached (for UI changes)
  • All your commits have a Signed-off-by line in the message. (more info)

Signed-off-by: Mikko Korhonen <mikko.korhonen@op.fi>
@kmikko kmikko requested review from a team and backstage-service as code owners June 19, 2024 10:11
@github-actions github-actions bot added the area:scaffolder Everything and all things related to the scaffolder project area label Jun 19, 2024
@backstage-goalie
Copy link
Contributor

Changed Packages

Package Name Package Path Changeset Bump Current Version
@backstage/plugin-scaffolder plugins/scaffolder minor v1.21.0

Signed-off-by: blam <ben@blam.sh>
@benjdlambert benjdlambert force-pushed the kmikko/virtualize-multi-entity-picker branch from 9f81749 to 030f4b1 Compare June 24, 2024 11:41
Copy link
Member

@benjdlambert benjdlambert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Let's go with this! 🎉

@benjdlambert benjdlambert merged commit d2f1f68 into backstage:master Jun 24, 2024
34 checks passed
Copy link
Contributor

Thank you for contributing to Backstage! The changes in this pull request will be part of the 1.29.0 release, scheduled for Tue, 16 Jul 2024.

@kmikko kmikko deleted the kmikko/virtualize-multi-entity-picker branch June 24, 2024 13:41
benjdlambert added a commit that referenced this pull request Jun 25, 2024
Signed-off-by: blam <ben@blam.sh>
benjdlambert added a commit that referenced this pull request Jun 26, 2024
@Rugvip Rugvip mentioned this pull request Jul 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:scaffolder Everything and all things related to the scaffolder project area
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🐛 Bug Report: MultiEntityPicker causes browser to stop responding with bigger amount of entitites
2 participants