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

chore(ingestion): optionally serialize the calls to loadPlugin to limit memory usage #17391

Merged
merged 4 commits into from
Sep 12, 2023

Conversation

xvello
Copy link
Contributor

@xvello xvello commented Sep 12, 2023

Problem

We can observe prod-us plugin-ingestion memory usage spiking up to 12GiB at startup, and sometimes OOMIng. This does not happen on EU nor other roles of plugin-server. overflow spikes lower, but still around 5GiB, even when there's no significant traffic to the overflow topic.

We currently have 31k active pluginconfig entries on US, and we can observe that this creates a significant amount of heap allocations on startup:

image

#16329 tried to delay the call to loadPlugin until an event comes in, but that behaviour would break scheduler, and the PR has failing tests due to side-effects. The current PR is a way to reduce the impact, instead of completely negating it, by hopefully reducing the GC pressure.

Changes

  • Add a PLUGIN_LOAD_SEQUENTIALLY boolean option to call loadPlugin sequentially instead of in parallel for all pluginconfigs
  • While loadPlugin is async, its only awaits are frontend app transpilation (only executed on scheduler pods) and processError when the plugin is invalid. I think this should not increase startup times significantly, but I'm keeping it disabled by default for now.

How did you test this code?

@xvello xvello requested a review from a team September 12, 2023 11:45
Copy link
Contributor

@tiina303 tiina303 left a comment

Choose a reason for hiding this comment

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

not fully sure on the pnpm changes, but 👍

@xvello xvello changed the title perf(ingestion): limit concurrency when setting-up plugins chore(ingestion): optionnaly serialize the calls to loadPlugin to limit memory usage Sep 12, 2023
@xvello xvello changed the title chore(ingestion): optionnaly serialize the calls to loadPlugin to limit memory usage chore(ingestion): optionally serialize the calls to loadPlugin to limit memory usage Sep 12, 2023
@xvello xvello merged commit b2035c6 into master Sep 12, 2023
@xvello xvello deleted the xvello/setup-concurrency branch September 12, 2023 13:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants