[PR #49] [CLOSED] feat(ublk): add weight-based I/O scheduler for fair sandbox bandwidth sharing #140

Closed
opened 2026-10-29 14:20:07 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/kvcache-ai/AgentENV/pull/49
Author: @rogeroger-yu
Created: 7/28/2026
Status: ❌ Closed

Base: main ← Head: feat/disk-io-weight-scheduler


📝 Commits (2)

  • a39275d feat(sandbox): add Firecracker disk I/O rate limiting (bandwidth + IOPS)
  • f955e7b feat(ublk): add weight-based I/O scheduler for fair sandbox bandwidth sharing

📊 Changes

10 files changed (+493 additions, -1 deletions)

View changed files

📝 config/default.toml (+15 -0)
📝 src/cfg.rs (+42 -0)
📝 src/sandbox/firecracker/config.rs (+3 -0)
📝 src/sandbox/firecracker/instance.rs (+20 -1)
📝 src/sandbox/firecracker/sandbox.rs (+46 -0)
📝 storage/ublk-daemon/src/main.rs (+37 -0)
📝 storage/ublk-daemon/src/server.rs (+22 -0)
📝 storage/ublk/src/impls/overlaybd_target.rs (+14 -0)
➕ storage/ublk/src/io_weight_scheduler.rs (+293 -0)
📝 storage/ublk/src/lib.rs (+1 -0)

📄 Description

Summary

  • Implement node-wide weighted fair I/O scheduler at the ublk layer
  • Each sandbox's block device gets proportional share of total bandwidth budget
  • Work-conserving: idle devices' bandwidth redistributed to active ones
  • Supports runtime weight updates for dynamic priority adjustment

Closes #47

Changes

  • storage/ublk/src/io_weight_scheduler.rs: Core scheduler (global singleton, token bucket, async acquire)
  • storage/ublk/src/lib.rs: Export new module
  • storage/ublk/src/impls/overlaybd_target.rs: Integrate IoWeightHandle into I/O path via ArcSwap
  • storage/ublk-daemon/src/server.rs: Register devices on pool acquire/create
  • storage/ublk-daemon/src/main.rs: Initialize global scheduler from config
  • config/default.toml: Add [machine.disk_weight_scheduler] section
  • src/cfg.rs: Add DiskWeightSchedulerConfig struct

Test plan

  • Build passes (cargo build --release)
  • Single sandbox: throttled to ~111 MB/s (from 1.8 GB/s baseline)
  • Two concurrent sandboxes: fair 50/50 split (~76 MB/s each, fairness=1.00)
  • Total throughput stays within budget (152 MB/s < 200 MB/s)
  • Unit tests pass (cargo test -p uvm-ublk)
  • Integration test with full sandbox lifecycle

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/kvcache-ai/AgentENV/pull/49 **Author:** [@rogeroger-yu](https://github.com/rogeroger-yu) **Created:** 7/28/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `feat/disk-io-weight-scheduler` --- ### 📝 Commits (2) - [`a39275d`](https://github.com/kvcache-ai/AgentENV/commit/a39275db8554b9f37411642f5026d78b9f8a7268) feat(sandbox): add Firecracker disk I/O rate limiting (bandwidth + IOPS) - [`f955e7b`](https://github.com/kvcache-ai/AgentENV/commit/f955e7b954d51069479460974065ad0ab30b4a44) feat(ublk): add weight-based I/O scheduler for fair sandbox bandwidth sharing ### 📊 Changes **10 files changed** (+493 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `config/default.toml` (+15 -0) 📝 `src/cfg.rs` (+42 -0) 📝 `src/sandbox/firecracker/config.rs` (+3 -0) 📝 `src/sandbox/firecracker/instance.rs` (+20 -1) 📝 `src/sandbox/firecracker/sandbox.rs` (+46 -0) 📝 `storage/ublk-daemon/src/main.rs` (+37 -0) 📝 `storage/ublk-daemon/src/server.rs` (+22 -0) 📝 `storage/ublk/src/impls/overlaybd_target.rs` (+14 -0) ➕ `storage/ublk/src/io_weight_scheduler.rs` (+293 -0) 📝 `storage/ublk/src/lib.rs` (+1 -0) </details> ### 📄 Description ## Summary - Implement node-wide weighted fair I/O scheduler at the ublk layer - Each sandbox's block device gets proportional share of total bandwidth budget - Work-conserving: idle devices' bandwidth redistributed to active ones - Supports runtime weight updates for dynamic priority adjustment Closes #47 ## Changes - `storage/ublk/src/io_weight_scheduler.rs`: Core scheduler (global singleton, token bucket, async acquire) - `storage/ublk/src/lib.rs`: Export new module - `storage/ublk/src/impls/overlaybd_target.rs`: Integrate `IoWeightHandle` into I/O path via `ArcSwap` - `storage/ublk-daemon/src/server.rs`: Register devices on pool acquire/create - `storage/ublk-daemon/src/main.rs`: Initialize global scheduler from config - `config/default.toml`: Add `[machine.disk_weight_scheduler]` section - `src/cfg.rs`: Add `DiskWeightSchedulerConfig` struct ## Test plan - [x] Build passes (`cargo build --release`) - [x] Single sandbox: throttled to ~111 MB/s (from 1.8 GB/s baseline) - [x] Two concurrent sandboxes: fair 50/50 split (~76 MB/s each, fairness=1.00) - [x] Total throughput stays within budget (152 MB/s < 200 MB/s) - [x] Unit tests pass (`cargo test -p uvm-ublk`) - [ ] Integration test with full sandbox lifecycle --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-29 14:20:07 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
kvcache-ai/AgentENV#140
No description provided.