Skip to content

perf: prefetch running containers, spawn_blocking for I/O, stage cleanup#95

Open
Jaro-c wants to merge 1 commit into
developfrom
perf/reliability
Open

perf: prefetch running containers, spawn_blocking for I/O, stage cleanup#95
Jaro-c wants to merge 1 commit into
developfrom
perf/reliability

Conversation

@Jaro-c

@Jaro-c Jaro-c commented Jun 10, 2026

Copy link
Copy Markdown
Member

Summary

  • PERF-003: up_with_options called is_container_running per container replica — each was a separate list_containers round-trip. Replaced with a single prefetch of all running project containers into a HashSet; in-loop checks become O(1) hash lookups. Removes the now-dead is_container_running helper.
  • PERF-004: build_context_tar* functions ran walkdir + file reads on the tokio executor thread. Wrapped all three variants (build_context_tar, build_context_tar_with_inline, build_context_tar_with_target) in tokio::task::spawn_blocking.
  • PERF-005: pack_path (tar creation) and tar::Archive::unpack (tar extraction) ran blocking I/O on the tokio thread. Wrapped both in spawn_blocking.
  • STAGE-001: up_with_options never called cleanup_temp_dir on failure, leaving inline secret/config staging files behind. Wrapped the up body in an async block and call cleanup_temp_dir before propagating any error.

Test plan

  • cargo check — clean, no warnings
  • cargo test — all tests pass

Closes #84

PERF-003: up_with_options called is_container_running per container —
each was a list_containers round-trip. Prefetch all running project
containers once before the loop; check names against a HashSet.
Removes the now-dead is_container_running helper from Engine.

PERF-004: build_context_tar* functions run walkdir + file reads on the
tokio thread. Wrap all three variants in spawn_blocking.

PERF-005: pack_path and tar unpack in cp run blocking I/O on the tokio
thread. Wrap both in spawn_blocking.

STAGE-001: up_with_options did not call cleanup_temp_dir on failure.
Wrap the up body in an async block, check result, and call
cleanup_temp_dir before propagating any error.

Closes #84

Signed-off-by: Jaro-c <75870284+Jaro-c@users.noreply.github.com>
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