-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Security Solution] Deduplicate requests to ML #153244
Conversation
Pinging @elastic/security-detections-response (Team:Detections and Resp) |
Pinging @elastic/security-solution (Team: SecuritySolution) |
a2b63d9
to
b610099
Compare
b610099
to
a033d3d
Compare
💚 Build Succeeded
Metrics [docs]Module Count
Async chunks
Unknown metric groupsESLint disabled line counts
Total ESLint disabled count
History
To update your PR or re-run it, just comment with: cc @xcrzx |
@machadoum @e40pud FYI guys, please take a look if you're interested |
@banderror Yes, that was the last one. We can close the ticket after merging this PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Tanks for fixing this.
Great changes! Thanks for this. LGTM 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks great! 🎉
I left a tiny comment about a hook that returns a new array on every render. It would be nice to cache it to avoid unnecessary HTTP requests on the entity analytics page.
addError(error, { title: i18n.SIEM_JOB_FETCH_FAILURE }); | ||
} | ||
}, [addError, error]); | ||
const securityJobs = jobs.filter(isSecurityJob); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you move job filter logic to inside useMemo
and prevent unnecessary renders?
Resolves: #134826
Summary
We've recently had a couple of SDHs related to the slow performance of Security Solution. The performance issues were related to slow responses from ML API. In this PR, I rewrite data-fetching hooks to React Query to leverage request deduplication and caching. That significantly reduces the number of outgoing HTTP requests to ML routes on page load.
Before
9 HTTP requests to ML endpoints on initial page load, 5 of which are duplicates.
After
4 HTTP requests to ML endpoints on initial page load, no duplicates.