Skip to content

Retry maintenance jobs with fewer resources when they run out of memory - #379

Open
bruno-espino wants to merge 1 commit into
mainfrom
bruno/maintenance-resource-ladder
Open

bruno-espino wants to merge 1 commit into
mainfrom
bruno/maintenance-resource-ladder

Conversation

@bruno-espino

Copy link
Copy Markdown
Member

Summary

Compaction and maintenance jobs that run out of memory now retry with fewer resources, instead of failing again and again on the same files.

  • The maintenance and compaction workers set FF_MAINTENANCE_RESOURCE_LADDER=true. When a job fails on the record-batch memory limit, the worker retries it in the same process with fewer parallel lanes and smaller batches. Jobs that fit run as before.
  • The workers and the maintenance scheduler set FF_MAINTENANCE_JOB_MAX_ATTEMPTS=5, so a job has room for the retries. The scheduler deletes a job at its maximum attempts, so all three services use the same value.
  • A merge of wide rows, such as large JSON or LLM payloads, can need more memory than the job size suggests. Before this change, such a job failed on every attempt, and compaction for that partition stopped.
  • A service's env still overrides both values. The chart leaves out a default when the service env sets the same name, so the pod spec has no duplicate entry.

In a test where a compaction worker failed the same merge 20 times without the ladder, the ladder retried the two failing jobs once each, and the partition compacted fully. The memory request did not change.

Upgrade notes

None. To keep the previous behavior, set FF_MAINTENANCE_RESOURCE_LADDER: "false" in the env of logfire-ff-maintenance-worker and logfire-ff-compaction-worker.

{{- $env := get (get .Values .serviceName | default dict) "env" | default list -}}
{{- $names := list -}}
{{- if kindIs "map" $env -}}
{{- $names = keys $env -}}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟠 High templates/_helpers-fusionfire.tpl:284

A map-form env entry set to null suppresses the chart default, but logfire.serviceEnv drops that entry, so the pod receives neither the override nor the default variable. Filter null-valued entries when collecting names so they do not count as overrides.

Suggested change
{{- $names = keys $env -}}
{{- range $name, $value := $env -}}
{{- if not (kindIs "invalid" $value) -}}
{{- $names = append $names $name -}}
{{- end -}}
{{- end -}}
🚀 Reply "fix it for me" or copy this AI Prompt for your agent:
In file @charts/logfire/templates/_helpers-fusionfire.tpl around line 284:

A map-form `env` entry set to `null` suppresses the chart default, but `logfire.serviceEnv` drops that entry, so the pod receives neither the override nor the default variable. Filter null-valued entries when collecting names so they do not count as overrides.

This branch has not been deployed

No deployments
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.

1 participant