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

Browsing features too slow when there are lots of features #3301

Closed
1 of 4 tasks
Dogacel opened this issue Jan 16, 2024 · 5 comments · Fixed by #4188
Closed
1 of 4 tasks

Browsing features too slow when there are lots of features #3301

Dogacel opened this issue Jan 16, 2024 · 5 comments · Fixed by #4188
Assignees
Labels
bug Something isn't working

Comments

@Dogacel
Copy link
Contributor

Dogacel commented Jan 16, 2024

How are you running Flagsmith

  • Self Hosted with Docker
  • Self Hosted with Kubernetes
  • Self Hosted at flagsmith.com
  • Some other way (add details in description below)

Describe the bug

When there is a project with many feature flags (700+ in this case), the page for browsing flags becomes very slow and unresponsive. Searching a flag takes over 20 seconds.

I suspect most calls to /api/v1/environments/<env-id>/featurestates/ are unnecessary.

Steps To Reproduce

  1. Create lots of feature flags
  2. Try to search for a feature flag

Expected behavior

Page should be responsive.

Screenshots

Screen.Recording.2024-01-16.at.14.04.49.mov
@Dogacel Dogacel added the bug Something isn't working label Jan 16, 2024
@dabeeeenster dabeeeenster added this to the Front End ToDo milestone Jan 17, 2024
@kyle-ssg
Copy link
Member

kyle-ssg commented Jan 19, 2024

Unfortunately, at the moment those calls are necessary. Features are paged but the feature states (i.e. the enabled states/remote config for the environment) are accessed separately, so the frontend currently needs all feature states to be accessible in order to match them up.

To get to 76 pages of 200 is a very extreme case but this probably needs to be sorted.

I think the only way to solve this is to start returning the feature state in the /features call, we pass the environment as a get param to this endpoint, so I think it's possible @matthewelwell ? The only alternative is to do a get per result which seems excessive.

@matthewelwell
Copy link
Contributor

@kyle-ssg , I think we can add this to the payload in the case that the environment query parameter is provided.

@kyle-ssg
Copy link
Member

@matthewelwell Great, could this get added / assigned to me when ready?

@kyle-ssg kyle-ssg removed their assignment Jan 24, 2024
@Dogacel
Copy link
Contributor Author

Dogacel commented Feb 13, 2024

I must say urgency of this task is not too high because there I wasn't able to reproduce this. I believe my local setup had a bug and imported the same flag many times. Certainly 76 * 200 = 15,000 feature flags is a lot to handle but must say not impossible 🙂

@matthewelwell
Copy link
Contributor

@kyle-ssg the response to the /projects/:id/features/ endpoint now returns an attribute of environment_feature_state which includes the default environment feature state when the environment query parameter is provided.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants