Skip to content

perf(runtime): reuse invocation Container client - #327

Merged
stephenlclarke merged 4 commits into
mainfrom
perf/invocation-container-client-reuse
Aug 26, 2026
Merged

stephenlclarke merged 4 commits into
mainfrom
perf/invocation-container-client-reuse

Conversation

@stephenlclarke

Copy link
Copy Markdown
Owner

Summary

  • lazily reuse one control-plane ContainerClient across a Compose invocation
  • keep attach and exec sessions on dedicated clients because disconnect owns their XPC connection
  • preserve the public dependency-construction API and parser/help laziness
  • add concurrency, isolation, and laziness coverage for the client pool

Evidence

  • focused runtime proof: 19 tests in 4 suites passed
  • 100 concurrent control requests construct exactly one client
  • session clients remain distinct; dependency construction creates no XPC client
  • strict SwiftLint, SwiftFormat, and git diff --check: passed
  • exact matched-stack release benchmark: 84/84 operations passed; functional parity PASS; 10x guard PASS
  • median startup changes versus retained evidence: 1 service -5.3%, 10 services +10.0%, 50 services +13.2%
  • median teardown changes: 1 service +5.2%, 10 services -1.5%, 50 services -1.9%

The timing result is mixed, so this PR claims reduced XPC connection construction/churn and resource ownership—not a latency improvement. Raw evidence was produced with identical Container 731f195c and Containerization 97049499 sources, release configuration, images, Docker reference, host, fixtures, and counterbalanced seven-run schedule.

Compatibility

  • public ComposeContainerRuntime.dependencies call shapes are preserved
  • help/parser-only paths remain lazy and do not activate Container XPC
  • attach and exec cancellation/disconnect semantics retain connection isolation

Related work

@stephenlclarke

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Nice work!

Reviewed commit: 4ae1f92210

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@stephenlclarke

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 👍

Reviewed commit: 10a35f7e15

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@stephenlclarke
stephenlclarke merged commit b10cf37 into main Aug 26, 2026
11 of 16 checks passed
@stephenlclarke
stephenlclarke deleted the perf/invocation-container-client-reuse branch August 26, 2026 23:42
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