Skip to content

Add bounded capture concurrency #10

Description

@pudo

Pravda must limit concurrent browser captures so incoming traffic cannot exhaust browser, memory, or CPU capacity.

Add per-instance admission control around snapshot creation.

Behavior

  • Configure a maximum number of concurrent captures.
  • Queue excess requests up to a bounded limit.
  • Reject requests when the queue is full.
  • Apply a maximum queue wait time.
  • Release capacity when a capture succeeds, fails, times out, or is cancelled.
  • Expose active captures and queue depth through structured logs and metrics.

Questions

  • Should queued requests remain open or receive 429 immediately?
  • Should concurrency be limited per Pravda instance, browser process, or both?
  • How many concurrent contexts can one playwright run-server process support reliably?
  • Should limits be fixed configuration or derived from browser-worker capacity?
  • Does the deployment topology selected in Define the Pravda Kubernetes deployment model #7 require different admission behavior?

Acceptance criteria

  • Concurrent captures never exceed the configured limit.
  • Queue depth and wait time are bounded.
  • Saturation produces a documented HTTP response.
  • Failed and cancelled captures release capacity.
  • Tests cover execution limits, queue saturation, timeout, and cancellation.
  • A small load test establishes an initial concurrency setting for the deployment model.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions