Skip to content

Conversation

@sjmiller609
Copy link
Collaborator

@sjmiller609 sjmiller609 commented Dec 26, 2025

Note

Adds resource accounting and enforcement across CPU, memory, disk, and network.

  • New lib/resources with discovery, oversubscription, per-instance allocations, and default limit calculators; integrated via wire and ApiService
  • New GET /resources endpoint (OpenAPI + server) returning Resources with ResourceStatus, DiskBreakdown, and per-instance allocations
  • Instance API/domain: support network.bandwidth_download/bandwidth_upload and disk_io_bps; defaults auto-calculated from CPU share; values echoed in Instance
  • Network: bidirectional rate limiting
    • Download: TBF on TAP egress per-VM
    • Upload: HTB classes on bridge with fq_codel; setup at startup and cleanup of orphaned classes; burst multipliers configurable
  • Disk I/O: per-VM throttling wired into Cloud Hypervisor and QEMU configs; burst = 4× sustained
  • Images/Volumes: expose total sizes for disk accounting; instances report overlays/volume overlays for accounting
  • Config: add oversub ratios, net burst multipliers, and capacity limits (disk, net, disk I/O) with validation
  • Wiring/boot: initialize ResourceManager; set up bridge HTB; pass limits into network allocation and VM disks
  • Misc: OpenAPI regenerated; tests updated; make test VERBOSE=1 flag

Written by Cursor Bugbot for commit c1641a5. This will update automatically on new commits. Configure here.

@github-actions
Copy link

github-actions bot commented Dec 26, 2025

✱ Stainless preview builds

This PR will update the hypeman SDKs with the following commit message.

feat: Resource accounting

Edit this comment to update it. It will appear in the SDK's changelogs.

⚠️ hypeman-typescript studio · code · diff

There was a regression in your SDK.
generate ⚠️ (prev: generate ✅) → build ✅lint ✅test ✅

npm install https://pkg.stainless.com/s/hypeman-typescript/8260c24d6cae153725e9e9b4052c10de22a4d97a/dist.tar.gz
New diagnostics (1 warning)
⚠️ Endpoint/NotConfigured: `get /resources` exists in the OpenAPI spec, but isn't specified in the Stainless config, so code will not be generated for it.
⚠️ hypeman-go studio · code · diff

There was a regression in your SDK.
generate ⚠️ (prev: generate ✅) → lint ✅test ✅

go get github.com/stainless-sdks/hypeman-go@4b445ea68c73debc7c08db3f1f8eed88c94f405a
New diagnostics (1 warning)
⚠️ Endpoint/NotConfigured: `get /resources` exists in the OpenAPI spec, but isn't specified in the Stainless config, so code will not be generated for it.
⚠️ hypeman-cli studio · conflict

There was a regression in your SDK.

New diagnostics (1 warning)
⚠️ Endpoint/NotConfigured: `get /resources` exists in the OpenAPI spec, but isn't specified in the Stainless config, so code will not be generated for it.

This comment is auto-generated by GitHub Actions and is automatically kept up to date as you push.
Last updated: 2025-12-26 04:51:11 UTC

default:
return fmt.Sprintf("%dbit", bitsPerSec)
}
}
Copy link

Choose a reason for hiding this comment

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

Network rate formatting truncates bandwidth values significantly

The formatTcRate function uses integer division to convert bandwidth to tc rate strings, which silently truncates non-round values. For example, when the proportional bandwidth calculation yields 2.5 Gbps (312,500,000 bytes/sec), the function converts to 2,500,000,000 bits/sec, then divides by 1,000,000,000 resulting in "2gbit" instead of "2500mbit". This is a 20% reduction in actual bandwidth applied. Since DefaultNetworkBandwidth commonly produces non-round gigabit values (e.g., (vcpus * effectiveNet) / cpuCapacity), VMs will often receive significantly less bandwidth than calculated. The fix is to use the smaller unit (mbit) when the value isn't evenly divisible by the larger unit.

Fix in Cursor Fix in Web

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