Skip to content

feat(docreader): limit concurrent parses by container memory capacity - #6166

Open
BrucePayton wants to merge 1 commit into
Tencent:mainfrom
BrucePayton:contribute/docreader-admission
Open

BrucePayton wants to merge 1 commit into
Tencent:mainfrom
BrucePayton:contribute/docreader-admission

Conversation

@BrucePayton

Copy link
Copy Markdown
Contributor

Description

Concurrent PDF or spreadsheet parses can exhaust container memory even when every input fits the existing per-file size limit. This change lets operators set a shared memory budget for unary and streaming parses. It reads the Linux cgroup working set, estimates expanded XLSX size from ZIP metadata, and releases reservations on completion or cancellation.

Set DOCREADER_MEMORY_PAUSE_MIB to enable the gate. The default is zero. Capacity pressure returns a distinct gRPC reason that the ingestion queue can retry. Operators receive an actionable error if retries run out.

Type of Change

  • ✨ New feature
  • 🔧 Configuration

Testing

  • 35 Python tests passed across admission, configuration, gRPC envelopes, streaming and web parsing. They exercise concurrent reservations, high-compression XLSX inputs, recovery below the resume watermark, and permanent size errors.
  • go test ./internal/application/service -run 'DocReader|ConvertFailureSpan' passed.
  • Diff-scoped Go lint passed for the changed Go packages.

Checklist

  • Diff checked against upstream main
  • Targeted tests and formatting checked
  • Example configuration and localized errors updated

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