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
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions plugin-server/src/config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ export function getDefaultConfig(): PluginsServerConfig {
OBJECT_STORAGE_SECRET_ACCESS_KEY: 'object_storage_root_password',
OBJECT_STORAGE_BUCKET: 'posthog',
PLUGIN_SERVER_MODE: null,
PLUGIN_LOAD_SEQUENTIALLY: false,
KAFKAJS_LOG_LEVEL: 'WARN',
HISTORICAL_EXPORTS_ENABLED: true,
HISTORICAL_EXPORTS_MAX_RETRY_COUNT: 15,
Expand Down
1 change: 1 addition & 0 deletions plugin-server/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ export interface PluginsServerConfig {
OBJECT_STORAGE_SECRET_ACCESS_KEY: string
OBJECT_STORAGE_BUCKET: string // the object storage bucket name
PLUGIN_SERVER_MODE: PluginServerMode | null
PLUGIN_LOAD_SEQUENTIALLY: boolean // could help with reducing memory usage spikes on startup
KAFKAJS_LOG_LEVEL: 'NOTHING' | 'DEBUG' | 'INFO' | 'WARN' | 'ERROR'
HISTORICAL_EXPORTS_ENABLED: boolean // enables historical exports for export apps
HISTORICAL_EXPORTS_MAX_RETRY_COUNT: number
Expand Down
7 changes: 5 additions & 2 deletions plugin-server/src/worker/plugins/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,11 @@ export async function setupPlugins(hub: Hub): Promise<void> {
pluginConfig.vm = statelessVms[plugin.id]
} else {
pluginConfig.vm = new LazyPluginVM(hub, pluginConfig)
pluginVMLoadPromises.push(loadPlugin(hub, pluginConfig))

if (hub.PLUGIN_LOAD_SEQUENTIALLY) {
await loadPlugin(hub, pluginConfig)
} else {
pluginVMLoadPromises.push(loadPlugin(hub, pluginConfig))
}
if (prevConfig) {
void teardownPlugins(hub, prevConfig)
}
Expand Down