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

[Security Solution] Event Renderer Virtualization #193316

Merged

Conversation

logeekal
Copy link
Contributor

@logeekal logeekal commented Sep 18, 2024

Summary

This PR implements virtualization when Event Renderers are enabled. Ideally from UX pespective nothing should change but from performance perspective, the event renderers should be scalable.

Testing checklist

  1. UX is working same as before when Event Renderers are enabled.
  2. Operations such as increasing page size from 10 to 100 are not taking as much time as before. Below operations can be used to test.
    a. Closing / Opening Timeline
    b. Changes Rows per page
    c. Changes tabs from query to any other and back.

Before

In below video, you will notice how long it took to change pageSize to 100 and all 100 rows are rendered at once.

event_renderers_without_virtualization.mp4

After

event_renderers_with_virtualization.mp4

Note

  1. Also test in small screen. The table should be scrollable but nothing out of ordinary.
  2. Additionally, try to load data which has network_flow process so as to create bigger and varied Event Renderers.

@janmonschke
Copy link
Contributor

Screen.Recording.2024-09-23.at.13.57.43.mov

Overall this seems to be working :)

I noticed two small issues:

  1. The vertical scrollbar for the event rendered items is hidden. I've tested this with multiple screen widths and it's always outside of the container. (see attached video)
  2. Closing a timeline with 500+ items takes a loooooong time. This might not be an issue with this PR but with timeline in general 🤷

@logeekal
Copy link
Contributor Author

logeekal commented Sep 24, 2024

I noticed two small issues:

The vertical scrollbar for the event rendered items is hidden. I've tested this with multiple screen widths and it's always outside of the container. (see attached video)
Closing a timeline with 500+ items takes a loooooong time. This might not be an issue with this PR but with timeline in general 🤷

Hey @janmonschke

Thanks for the feedback.

  1. First is a bug in EUI for which i have raised a bug here : DataGrid width is more than a container with customBodyRender eui#8038
  2. I am checking if closing timeline performance is related to this PR.

Avoid height calculation for row renderer, leads to great performance.
This was done by passing `auto` height.
@logeekal
Copy link
Contributor Author

logeekal commented Sep 27, 2024

@janmonschke ,

The vertical scrollbar for the event rendered items is hidden. I've tested this with multiple screen widths and it's always outside of the container. (see attached video)

Closing a timeline with 500+ items takes a loooooong time. This might not be an issue with this PR but with timeline in general 🤷

Both of these things are fixed and table should feel much faster than before. Could you please take another look?

Note

you will need to download a new attached version of EUI tarball

@janmonschke
Copy link
Contributor

@logeekal Just tested it and both issues are gone, wohooo 🎉

I noticed another thing where the table stays blank for quite a while when scrolling. This feels like it comes from the virtualization and I wonder if it performs better when React is not running in dev mode. Do you see the same?

Screen.Recording.2024-09-30.at.09.56.14.mov

@logeekal
Copy link
Contributor Author

logeekal commented Sep 30, 2024

I noticed another thing where the table stays blank for quite a while when scrolling. This feels like it comes from the virtualization and I wonder if it performs better when React is not running in dev mode. Do you see the same?

Great. Thanks Jan for giving it a shot. To answer your question, if the delay in rows appearing is production grade or not, it is difficult to answer in absolute terms. Could you compare below 3 scenarios and see if the delay is still too much?

  1. Timeline Without Event Renderers
  2. Timeline With Event Renderers
  3. Discover

When comparing we can actually measure where these new virtualization changes actually stand.

@janmonschke
Copy link
Contributor

Thanks @logeekal. I tested it again and this time around it was much faster. Not sure what was happening on my machine earlier. The simple rows render much faster than the event renderers but both feel fast enough.

}, []);

const innerRowContainer = useMemo(() => {
const InnerComp = React.forwardRef<HTMLDivElement, PropsWithChildren<{}>>(
Copy link
Contributor

Choose a reason for hiding this comment

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

can probably pull this definition to the top level of this file, and that way this is never recreated.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes.. I was just waiting for the EUI teams opinion and then i will refactor code to be put in production. Currently, this is just working code.

I wanted to get everyone opinions mainly on performance. But what you say makes sense.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@kqualters-elastic , I just checked, it has depenendencies headerRow and footerRow and hence it cannot be pulled out.

@logeekal logeekal added the release_note:skip Skip the PR/issue when compiling release notes label Oct 11, 2024
@logeekal
Copy link
Contributor Author

Gotcha, so this issue of the alert table not expanding to full height is also not part of this PR then?

No. The alert table height was intentionally made limited to enable virtualization because otherwise performance was pretty bad. This was done in PR : #192827

@logeekal
Copy link
Contributor Author

/ci

@logeekal logeekal requested a review from a team as a code owner October 16, 2024 08:38
@logeekal logeekal requested a review from nkhristinin October 16, 2024 08:38
indicatorRuleMatchingDoc.atomic
}${accessibilityText}threat.enrichments.matched.typeindicator_match_rule${accessibilityText}provided` +
Copy link
Contributor

Choose a reason for hiding this comment

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

Hey, why we remove this accessibilityText?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The accessibility text was related to draggables in Event Renderers and they are no longer draggables. I have created a follow-up issue to add a new text for all Event Renderers and not just this : #196505

@nkhristinin nkhristinin self-requested a review October 16, 2024 11:10
@logeekal logeekal enabled auto-merge (squash) October 16, 2024 11:11
@elasticmachine
Copy link
Contributor

elasticmachine commented Oct 16, 2024

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] FTR Configs #60 / Spaces app (with solution view) space solution tour solution tour does not show the solution tour after deleting spaces and leave only the default

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
securitySolution 6036 6038 +2

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
securitySolution 20.7MB 20.7MB +26.4KB

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
securitySolution 87.4KB 87.5KB +65.0B

History

@logeekal logeekal merged commit fa92a8e into elastic:main Oct 16, 2024
45 checks passed
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 8.x

https://github.com/elastic/kibana/actions/runs/11371137966

kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Oct 16, 2024
## Summary

This PR implements virtualization when Event Renderers are enabled.
Ideally from UX pespective nothing should change but from performance
perspective, the event renderers should be scalable.

### Testing checklist

1. UX is working same as before when Event Renderers are enabled.
2. Operations such as increasing page size from `10` to `100` are not
taking as much time as before. Below operations can be used to test.
   a. Closing / Opening Timeline
   b. Changes `Rows per page`
   c. Changes tabs from query to any other and back.

### Before
In below video, you will notice how long it took to change `pageSize` to
100 and all 100 rows are rendered at once.

https://github.com/user-attachments/assets/106669c9-bda8-4b7d-af3f-b64824bde397

### After

https://github.com/user-attachments/assets/356d9e1f-caf1-4f88-9223-0e563939bf6b

> [!Note]
> 1. Also test in small screen. The table should be scrollable but
nothing out of ordinary.
> 2. Additionally, try to load data which has `network_flow` process so
as to create bigger and varied Event Renderers.

---------

Co-authored-by: Cee Chen <[email protected]>
(cherry picked from commit fa92a8e)
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.x

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request Oct 16, 2024
…96587)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[Security Solution] Event Renderer Virtualization
(#193316)](#193316)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Jatin
Kathuria","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-10-16T17:53:49Z","message":"[Security
Solution] Event Renderer Virtualization (#193316)\n\n##
Summary\r\n\r\nThis PR implements virtualization when Event Renderers
are enabled.\r\nIdeally from UX pespective nothing should change but
from performance\r\nperspective, the event renderers should be
scalable.\r\n\r\n### Testing checklist\r\n\r\n1. UX is working same as
before when Event Renderers are enabled.\r\n2. Operations such as
increasing page size from `10` to `100` are not\r\ntaking as much time
as before. Below operations can be used to test.\r\n a. Closing /
Opening Timeline\r\n b. Changes `Rows per page`\r\n c. Changes tabs from
query to any other and back.\r\n\r\n### Before\r\nIn below video, you
will notice how long it took to change `pageSize` to\r\n100 and all 100
rows are rendered at
once.\r\n\r\n\r\nhttps://github.com/user-attachments/assets/106669c9-bda8-4b7d-af3f-b64824bde397\r\n\r\n\r\n###
After\r\n\r\n\r\nhttps://github.com/user-attachments/assets/356d9e1f-caf1-4f88-9223-0e563939bf6b\r\n\r\n\r\n\r\n>
[!Note]\r\n> 1. Also test in small screen. The table should be
scrollable but\r\nnothing out of ordinary.\r\n> 2. Additionally, try to
load data which has `network_flow` process so\r\nas to create bigger and
varied Event Renderers.\r\n\r\n---------\r\n\r\nCo-authored-by: Cee Chen
<[email protected]>","sha":"fa92a8ede7bce32456e3d6a6307761b4209248f9","branchLabelMapping":{"^v9.0.0$":"main","^v8.16.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["backport","release_note:skip","v9.0.0","Team:Threat
Hunting:Investigations","ci:project-deploy-security","v8.16.0"],"title":"[Security
Solution] Event Renderer
Virtualization","number":193316,"url":"https://github.com/elastic/kibana/pull/193316","mergeCommit":{"message":"[Security
Solution] Event Renderer Virtualization (#193316)\n\n##
Summary\r\n\r\nThis PR implements virtualization when Event Renderers
are enabled.\r\nIdeally from UX pespective nothing should change but
from performance\r\nperspective, the event renderers should be
scalable.\r\n\r\n### Testing checklist\r\n\r\n1. UX is working same as
before when Event Renderers are enabled.\r\n2. Operations such as
increasing page size from `10` to `100` are not\r\ntaking as much time
as before. Below operations can be used to test.\r\n a. Closing /
Opening Timeline\r\n b. Changes `Rows per page`\r\n c. Changes tabs from
query to any other and back.\r\n\r\n### Before\r\nIn below video, you
will notice how long it took to change `pageSize` to\r\n100 and all 100
rows are rendered at
once.\r\n\r\n\r\nhttps://github.com/user-attachments/assets/106669c9-bda8-4b7d-af3f-b64824bde397\r\n\r\n\r\n###
After\r\n\r\n\r\nhttps://github.com/user-attachments/assets/356d9e1f-caf1-4f88-9223-0e563939bf6b\r\n\r\n\r\n\r\n>
[!Note]\r\n> 1. Also test in small screen. The table should be
scrollable but\r\nnothing out of ordinary.\r\n> 2. Additionally, try to
load data which has `network_flow` process so\r\nas to create bigger and
varied Event Renderers.\r\n\r\n---------\r\n\r\nCo-authored-by: Cee Chen
<[email protected]>","sha":"fa92a8ede7bce32456e3d6a6307761b4209248f9"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/193316","number":193316,"mergeCommit":{"message":"[Security
Solution] Event Renderer Virtualization (#193316)\n\n##
Summary\r\n\r\nThis PR implements virtualization when Event Renderers
are enabled.\r\nIdeally from UX pespective nothing should change but
from performance\r\nperspective, the event renderers should be
scalable.\r\n\r\n### Testing checklist\r\n\r\n1. UX is working same as
before when Event Renderers are enabled.\r\n2. Operations such as
increasing page size from `10` to `100` are not\r\ntaking as much time
as before. Below operations can be used to test.\r\n a. Closing /
Opening Timeline\r\n b. Changes `Rows per page`\r\n c. Changes tabs from
query to any other and back.\r\n\r\n### Before\r\nIn below video, you
will notice how long it took to change `pageSize` to\r\n100 and all 100
rows are rendered at
once.\r\n\r\n\r\nhttps://github.com/user-attachments/assets/106669c9-bda8-4b7d-af3f-b64824bde397\r\n\r\n\r\n###
After\r\n\r\n\r\nhttps://github.com/user-attachments/assets/356d9e1f-caf1-4f88-9223-0e563939bf6b\r\n\r\n\r\n\r\n>
[!Note]\r\n> 1. Also test in small screen. The table should be
scrollable but\r\nnothing out of ordinary.\r\n> 2. Additionally, try to
load data which has `network_flow` process so\r\nas to create bigger and
varied Event Renderers.\r\n\r\n---------\r\n\r\nCo-authored-by: Cee Chen
<[email protected]>","sha":"fa92a8ede7bce32456e3d6a6307761b4209248f9"}},{"branch":"8.x","label":"v8.16.0","branchLabelMappingKey":"^v8.16.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Jatin Kathuria <[email protected]>
hop-dev pushed a commit to hop-dev/kibana that referenced this pull request Oct 17, 2024
## Summary

This PR implements virtualization when Event Renderers are enabled.
Ideally from UX pespective nothing should change but from performance
perspective, the event renderers should be scalable.

### Testing checklist

1. UX is working same as before when Event Renderers are enabled.
2. Operations such as increasing page size from `10` to `100` are not
taking as much time as before. Below operations can be used to test.
   a. Closing / Opening Timeline
   b. Changes `Rows per page`
   c. Changes tabs from query to any other and back.

### Before
In below video, you will notice how long it took to change `pageSize` to
100 and all 100 rows are rendered at once.


https://github.com/user-attachments/assets/106669c9-bda8-4b7d-af3f-b64824bde397


### After


https://github.com/user-attachments/assets/356d9e1f-caf1-4f88-9223-0e563939bf6b



> [!Note]
> 1. Also test in small screen. The table should be scrollable but
nothing out of ordinary.
> 2. Additionally, try to load data which has `network_flow` process so
as to create bigger and varied Event Renderers.

---------

Co-authored-by: Cee Chen <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport ci:project-deploy-security Create a Security Serverless Project release_note:skip Skip the PR/issue when compiling release notes Team:Threat Hunting:Investigations Security Solution Investigations Team v8.16.0 v9.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants