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

Queries page takes a long time to load with a few hundred queries #21855

Open
Zaulao opened this issue Sep 5, 2024 · 12 comments
Open

Queries page takes a long time to load with a few hundred queries #21855

Zaulao opened this issue Sep 5, 2024 · 12 comments
Labels
~backend Backend-related issue. bug Something isn't working as documented ~frontend Frontend-related issue. #g-endpoint-ops Endpoint ops product group :incoming New issue in triage process. :release Ready to write code. Scheduled in a release. See "Making changes" in handbook. :reproduce Involves documenting reproduction steps in the issue

Comments

@Zaulao
Copy link

Zaulao commented Sep 5, 2024

Fleet version: Fleet 4.55.1 • Go go1.22.4

Web browser and operating system: Chrome 128.0.6613.119 and Firefox 130.0 running on Ubuntu Linux


💥  Actual behavior

A deployment (in Kubernetes) with just over 400 queries causes the query page to take more than 20 seconds to load, remaining frozen with very high CPU usage during that time.

(In the video linked below, the loading animation freezes, but this is a problem with the recording. In fact, the animation continues to rotate until the tab is changed)
https://github.com/user-attachments/assets/daf92bf1-936c-458c-88da-9ad31fb84d7e

Screenshot of computer resource consumption statistics during page loading. Page load started at this network spike and lasted until CPU stats normalized:
system-monitor-data

Screenshot of the performance profile generated by Google Chrome during page loading:
image

Screenshot of the performance profile generated by Mozilla Firefox during page loading:
image

🧑‍💻  Steps to reproduce

  1. Load a large number of different queries into Fleet, easily through community-distributed packs such as osquery's native ones, osquery-attck and osquery-defense-kit;
  2. Load or refresh /queries/manage page.

To fix:

Paginate queries on front and backend

@Zaulao Zaulao added :incoming New issue in triage process. :reproduce Involves documenting reproduction steps in the issue bug Something isn't working as documented labels Sep 5, 2024
@getvictor getvictor added #g-endpoint-ops Endpoint ops product group :release Ready to write code. Scheduled in a release. See "Making changes" in handbook. labels Sep 6, 2024
@xpkoala
Copy link
Contributor

xpkoala commented Sep 10, 2024

@Zaulao thank you for submitting this issue, we are currently working on reproducing it.

Just so we have a better understanding of your environment, could you let us know if your server configuration is inline with our recommendations and also let us know the number of enrolled hosts.

@Zaulao
Copy link
Author

Zaulao commented Sep 10, 2024

Hello @xpkoala! Yes, currently I'm using a kubernetes deployment with the appropriate resource providing. We have around 160 enrolled hosts, so the server's resource consumption is quite light.

@xpkoala
Copy link
Contributor

xpkoala commented Sep 11, 2024

Thank you @Zaulao I've got a test instance running on my local machine with 438 queries and ~105 hosts. I'm seeing a load time of ~5 seconds across safari, chrome, and firefox.

Are the queries present large (in terms of character count - like in the thousands of characters)?

I'll continue experimenting with this and see if I can get the longer lag time to generate.

image

@Zaulao
Copy link
Author

Zaulao commented Sep 11, 2024

Thanks for the testing @xpkoala. Yes, there are a few pretty long queries, specially the ones generated by the osquery-defense-kit (using the make detect build option)

@RachelElysia
Copy link
Member

This is one of the few pages that don't have serverside pagination.

Suggestion is we switch this page to serverside pagination, IIRC we would need to build the API to allow pagination and switch the FE code from client side to server side.

@rachaelshaw thoughts on this solution?

@rachaelshaw
Copy link
Member

@RachelElysia that makes total sense to me— for some reason I thought we had added pagination when we added query reports; I definitely agree we should have it!

@RachelElysia
Copy link
Member

Ok sweet, I think that should be the solution and test it!

@jacobshandling
Copy link
Contributor

I'd estimate FE 5 here

@jacobshandling jacobshandling added ~frontend Frontend-related issue. ~backend Backend-related issue. labels Oct 2, 2024
@RachelElysia
Copy link
Member

@jacobshandling
Copy link
Contributor

Consensus on FE 5

@sharon-fdm sharon-fdm added the Epic DO NOT USE. Auto-created by ZenHub, cannot be disabled. label Oct 2, 2024
@sharon-fdm
Copy link
Collaborator

Estimation for paginating as a solution:

@sharon-fdm sharon-fdm removed the Epic DO NOT USE. Auto-created by ZenHub, cannot be disabled. label Oct 2, 2024
@rachaelshaw
Copy link
Member

API doc changes: #22590

rachaelshaw added a commit that referenced this issue Oct 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
~backend Backend-related issue. bug Something isn't working as documented ~frontend Frontend-related issue. #g-endpoint-ops Endpoint ops product group :incoming New issue in triage process. :release Ready to write code. Scheduled in a release. See "Making changes" in handbook. :reproduce Involves documenting reproduction steps in the issue
Development

No branches or pull requests

7 participants