Skip to content

⚡ Bolt: Optimize dashboard handler to offload blocking I/O#219

Draft
EffortlessSteven wants to merge 2 commits intomainfrom
bolt/optimize-dashboard-io-7632869524254979254
Draft

⚡ Bolt: Optimize dashboard handler to offload blocking I/O#219
EffortlessSteven wants to merge 2 commits intomainfrom
bolt/optimize-dashboard-io-7632869524254979254

Conversation

@EffortlessSteven
Copy link
Member

  • 💡 What: Refactored dashboard handler in crates/http-platform/src/ui.rs to use tokio::task::spawn_blocking.
  • 🎯 Why: The handler was performing synchronous file I/O and spec parsing directly in the async handler, which blocks the executor thread and degrades performance under load.
  • 📊 Impact: Prevents the main thread from blocking. In the reproduction test with 50 concurrent requests and large specs, the latency overhead dropped from ~660ms to ~260ms (close to the baseline 200ms timer).
  • 🔬 Measurement: Verified with crates/app-http/tests/ui_blocking_reproduction.rs, which asserts that a concurrent timer is not starved by the handler workload.

PR created automatically by Jules for task 7632869524254979254 started by @EffortlessSteven

- Refactored `dashboard` handler in `crates/http-platform/src/ui.rs` to use `tokio::task::spawn_blocking`.
- Added `tokio` to `crates/http-platform/Cargo.toml` dependencies.
- Updated `crates/app-http/tests/ui_blocking_reproduction.rs` to correctly reproduce the issue and verify the fix.
Copilot AI review requested due to automatic review settings February 26, 2026 02:15
@google-labs-jules
Copy link

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@gemini-code-assist
Copy link

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@coderabbitai
Copy link

coderabbitai bot commented Feb 26, 2026

Warning

Rate limit exceeded

@EffortlessSteven has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 5 minutes and 22 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 90fd4d1 and 864e11e.

📒 Files selected for processing (3)
  • crates/app-http/tests/ui_blocking_reproduction.rs
  • crates/http-platform/Cargo.toml
  • crates/http-platform/src/ui.rs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch bolt/optimize-dashboard-io-7632869524254979254

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR optimizes the dashboard handler in crates/http-platform/src/ui.rs by offloading blocking file I/O and YAML parsing operations to tokio::task::spawn_blocking, preventing the Tokio executor thread from being starved under concurrent load. The optimization is verified with a reproduction test that demonstrates the performance improvement from ~660ms to ~260ms latency under load (50 concurrent requests).

Changes:

  • Wrapped all blocking I/O operations (spec loading, file reads, YAML parsing) in the dashboard handler within tokio::task::spawn_blocking
  • Moved tokio from dev-dependencies to dependencies in http-platform's Cargo.toml to support runtime usage
  • Enhanced the blocking reproduction test with larger workload (500 stories) and more concurrent requests (50) to better validate the optimization

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
crates/http-platform/src/ui.rs Refactored dashboard handler to use spawn_blocking for all blocking I/O operations (load_all_specs, load_tasks, load_service_metadata, file reads)
crates/http-platform/Cargo.toml Moved tokio dependency from dev-dependencies to dependencies to support spawn_blocking usage in production code
crates/app-http/tests/ui_blocking_reproduction.rs Enhanced test with larger spec file (500 stories), more concurrent requests (50), and improved test setup to better validate the non-blocking behavior

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

- Ran `cargo fmt` to fix formatting issues in `crates/app-http/tests/ui_blocking_reproduction.rs` and `crates/http-platform/src/ui.rs`.
- This resolves the CI failure in `rust-lints`.
@github-actions
Copy link

Test Results

283 tests   245 ✅  10m 52s ⏱️
 25 suites   38 💤
  1 files      0 ❌

Results for commit 864e11e.

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.

2 participants