-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Fleet] Delete installed package assets in chunks to avoid high memor…
…y consumption (#188248) **Resolves: #188208 ## Summary This PR limits the number of assets that can be deleted in one request. Before, the bulk delete method was called with all package assets: ```ts await savedObjectsClient.bulkDelete(assetsToDelete, { namespace }); ``` This led to significant request and response objects being created and stored in memory at the same time before being garbage collected. We don't want those objects to grow with package size indefinitely, so splitting that work into smaller chunks to reduce memory pressure. This slows the installation of larger packages but ensures we do not reach OOM errors. For packages with ~5000 saved objects, the installation time was ~50% slower but with memory consumption not exceeding 800-850Mb during the package removing phase vs. ~1Gb without the optimization. **Before** ``` Summary: Total: 190.7639 secs Slowest: 10.1355 secs Fastest: 9.0772 secs Average: 9.5382 secs Requests/sec: 0.1048 ``` ![Screenshot 2024-07-12 at 12 40 54](https://github.com/user-attachments/assets/a10aaaa9-ac3d-4a5a-b624-8b4a36400a6a) **After** ``` Summary: Total: 303.8411 secs Slowest: 19.1417 secs Fastest: 13.0912 secs Average: 15.1921 secs Requests/sec: 0.0658 ``` ![Screenshot 2024-07-12 at 12 44 58](https://github.com/user-attachments/assets/2c7bb609-f107-46bd-bd98-43a0c58107e8)
- Loading branch information
Showing
1 changed file
with
85 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters