返回资讯中心
外部精选
软件工程
#开发者实时流

Drums 发布共享运行时守护进程 drumsd,139 毫秒内可 fork Linux 桌面

来源标题:Show HN: Fork Linux desktops in 139ms for computer-use agent training

Drums 公布其共享运行时的宿主守护进程 drumsd,可在单台服务器上运行数百个隔离的 Linux 桌面,并从 CRIU 检查点恢复而非重新启动。每个环境拥有独立的 overlay root 和命名空间,fork 或重置桌面仅需 139 毫秒,多个环境共享同一镜像的物理页。该守护进程负责创建、重置、保存、fork、隔离和销毁环境。

Hacker News 最新sahiljagtapyc2026/11/25 · 今天30 分钟阅读

以下正文同步自 Hacker News 最新,版权归原站所有,已转换为易读排版。

The host daemon of the Drums shared runtime: hundreds of isolated Linux desktops on one server, restored from CRIU checkpoints, forked and reset without a reboot, with a gate report and a reward audit on every episode.

Training a computer-use agent needs thousands of isolated desktops, and the usual answer is one virtual machine per desktop, each booting its own kernel, operating system and applications. Drums takes a different route: one Linux host runs one booted desktop image, and every environment is a private copy-on-write state on top of it (its own overlay root, its own pid, mount, network, ipc, uts and user namespaces, its own cgroup). An environment is not booted; it is restored from a CRIU checkpoint of a running desktop, so a reset or a fork brings up Chrome, LibreOffice or GIMP where they were, in seconds, and many environments share the image's pages.

drumsd is the daemon that owns those environments on a host. It creates, resets, saves (captures), forks (branches), quarantines and destroys them; drives the Drums fork of CRIU (drums-criu, one template server per checkpoint); runs every episode behind a set of gates (restore fidelity, isolation, cgroup limits, OOM kills, application crashes) so a trainer never sees a reward from a broken desktop; and audits each reward (a second checker run, a redundant checker, a file-scope scan). It serves an HTTP API on the host that the Python SDK (drums-sdk), the Drums gateway and the MCP server talk to.

One host serves one tenant. Environments on a host are separated from each other by namespaces, cgroups and per-env uid ranges; customers are separated from each other by virtual machines. See Security.

  1. A host

A fresh Ubuntu 24.04 x86_64 machine with cgroup v2 (the default), 16 vCPU, 32 GiB of RAM and a 150 GiB disk, with outbound HTTPS during the install. Every release is tested on an AWS c8i.4xlarge. Details, the list of hosts the installer downloads from, and how many environments fit: docs/host-requirements.md.

A release is one self-contained tarball, drums-release-<commit>.tar.gz, from the releases page. Every input it needs (apt snapshot, the OSWorld image, the drums-criu and SDK commits, the Rust toolchain, a hashed Python lock) is pinned in install/lock.json and verified; the first mismatch stops the install.

tar xzf drums-release-.tar.gz cd drums-release-/ sudo ./install.sh

It takes 7 to 15 minutes on a 16-vCPU host and prints a progress line every 30 s. At the end it prints the API URL (http://127.0.0.1:7070) and where the token is: /etc/drums/token (root only, mode 0600; it is never printed). Running install.sh again is safe. Log: /var/log/drums-install.log.

From your laptop, tunnel the API (ssh -L 7070:127.0.0.1:7070 to the host), then install the SDK and point it at the daemon. The SDK is standard-library Python, 3.9 or later; the release also ships the same wheel under /opt/drums/sdk/ for hosts without PyPI access.

python3 -m venv ~/drums-venv ~/drums-venv/bin/pip install drums-sdk

export DRUMS_URL=http://127.0.0.1:7070 export DRUMS_TOKEN=$(ssh YOUR_HOST sudo cat /etc/drums/token)

(On the host itself: export DRUMS_TOKEN=$(sudo cat /etc/drums/token).)

Create an environment on an OSWorld task, act, fork the reached state into four copies, score each copy, save a state.

import drums

with drums.connect() as client: # DRUMS_URL, DRUMS_TOKEN; closes this client's envs at the end client.reset_metrics() # the cost window starts now with client.create(task="e0df059f") as env: # an OSWorld task id, a JSON path, or a dict env.wait_valid() # every gate of this episode passed (5 s after ready) obs = env.observe() # obs.png: 1920x1080 PNG; obs.meta: instruction and more env.step("pyautogui.hotkey('ctrl', 'alt', 't')") # pyautogui code, or an action dict with env.fork(4, keep_state=False) as kids: # 4 independent copies of the reached state for k in kids: k.step({"type": "execute", "command": ["ls", "Desktop"]}) r = k.verify(strict=False) # the task's checker, with the episode's validity print(k.id, r.score, r.valid, r.invalid_reasons) state = env.save() # later: client.create(from_state=state) client.delete_state(state) # or let its lease delete it (30 min unused) print(client.metrics()["cost"]) # USD per valid episode and per verified reward

Train only on rewards whose valid is True: with the default strict=True, verify() raises InvalidEpisode instead of returning a reward from an invalid episode. A longer loop that cannot leak environments is examples/rl_loop.py; the SDK itself is documented at docs.drums.run.

flowchart LR subgraph clients["Trainer, agent or gateway"] SDK["drums-sdk · gateway · MCP server"] end SDK -- "HTTP + bearer token<br/>127.0.0.1:7070" --> API["drumsd API (axum)"] subgraph host["One Linux host = one tenant (VM boundary between tenants)"] API --> MGR["Manager<br/>slots · episodes · gates · leases · journal"] MGR --> TS["drums-criu template server<br/>one per checkpoint, pages shared"] MGR --> OSW["OSWorld helper<br/>task setup and checker, unprivileged uid"] TS -. "criu restore" .-> S1["slot 101<br/>overlay root · namespaces · cgroup"] TS -. "criu restore" .-> S2["slot 102"] TS -. "criu restore" .-> SN["slot N"] MGR -- "cgroup.kill · overlay swap · forwarders" --> S1 end

Loading

Checkpoints and template servers. The installer boots the OSWorld desktop once and checkpoints it with drums-criu as the image checkpoint (osworld-ubuntu). Each checkpoint gets a long-lived template server that holds its pages; every environment made from it is a criu restore against that server, so restored desktops share memory and a restore is a page map, not a boot.

Slots. An environment is a slot: a numbered directory with its own overlay upper layer, a leaf cgroup (CPU and memory limits, OOM accounting), listeners for its guest ports, and, in the hardened profile, its own user namespace and host uid range. A reset kills the old tree with cgroup.kill, swaps in a spare upper layer prepared in the background and restores into the other leaf of the slot.

Fork, save, reset. capture dumps a running environment into a new checkpoint (incremental on top of its last base; only after the process tree has been quiescent for a window, and the dump is checked against the tree). branch restores N children from it. Everything a trainer forgets is reaped by leases.

Gates and validity. Every create, reset and fork child starts an episode with a gate report (lock_applied, cgroup, init_identity, mount_table, netns, guest_ready, state_hash, isolation, alive_after_resume, no_oom_kill, no_app_crash, not_quarantined). A failed gate quarantines the slot; an episode is valid only when every gate passed. docs/validity.md.

Reward audit. Every verify reply carries an audit block: checker timing and error class, a second checker run, an optional redundant checker, and a file-scope scan against the task's manifest. docs/reward-audit.md.

Crash safety. Slot and checkpoint records are journaled (write, fsync, rename) before work starts; on start drumsd reconciles what it finds, adopts running environments and template servers, and marks the rest down. docs/architecture.md has the full picture.

Configuration

drumsd reads one JSON file (/etc/drums/drumsd.json, written by the installer; drumsd serve --config PATH). The fields, from crates/drumsd/src/config.rs. "Required" fields have no default.

lease (a request's idle_timeout_s / ttl_s override these; null or 0 turns a limit off):

quiesce (before every capture the tree must be quiescent, and the dump must match it):

admission (a refusal is HTTP 429, code overloaded; nothing is started):

verifiers (uploaded lab verifiers and the sandbox they run in; docs/design/verifier-sandbox.md), every field optional:

Every route except GET /healthz needs Authorization: Bearer <token>. The full schema is api/openapi.json, also served at GET /openapi.json. The SDK's env, saved state, fork and save are this API's slot, checkpoint, branch and capture.

Step-argument limit. One limit for an action (POST /v1/slots/{id}/step) and for a task's setup and postconfig steps (config, evaluator.postconfig): a command string (a command given as a string, or one element of a command list) is at most 8,192 characters, a command list at most 256 elements, and pyautogui code at most 16,384 characters. These are the Drums gateway's numbers (Drums Cloud refuses an action over them today). Write a larger file in chunks (the task factory writes 8,000 base64 characters per step). With enforce_step_arg_limit, drumsd refuses an over-limit action or task with 400 and a body that names it: {"error": "action.command.5 is 60000 characters; the step-argument limit is 8192 characters ...", "code": "step_arg_too_long", "field": "action.command.5", "limit": 8192, "length": 60000, "unit": "characters"}. Without it (the default, today's behaviour) the request goes ahead and the event log records step_arg_over_limit.

Rust 1.96 (install/lock.json, rust_toolchain) and Linux. macOS builds and tests drumsd-core, drumsd-os and drums-pool only; drumsd-linux and drumsd need Linux (aya, namespaces, cgroups). CI runs exactly these on ubuntu-latest:

cargo fmt --all -- --check

cargo clippy --workspace --all-targets -- -D warnings

cargo test --workspace

The forget tests call tar --zstd, so install zstd. Four tests skip themselves when not root (they print skipped: needs root): the uid-range shift and the sealed saved state in idrange, the nested pid namespace in procfs, the netns forwarder in proxy. To run them too:

sudo -E cargo test --workspace

The Python and shell pieces have their own tests, and CI runs shellcheck over install/*.sh:

python3 -m unittest install/tests/test_build_wheel.py

python3 -m unittest discover -s osw/tests

for t in install/tests/test_*.sh; do bash "$t"; done

shellcheck -S warning install/*.sh

Changes to restore, gates, lifecycle or the installer are gated by the host tests, run as root on an installed host against the real daemon (tests/host/integration_host.py, tests/host/recovery_host.py and friends). Which tests gate which change, the fork gate, the CRIU pin bump procedure and how a release is cut: CONTRIBUTING.md.

Workspace: crates/drumsd-core (records, gates, journal, leases, admission), crates/drumsd-linux (cgroups, namespaces, mounts, uid ranges, crash watch, procview), crates/drumsd (the daemon: API, manager, config), crates/drums-pool (many hosts behind one API) and crates/drumsd-os (Android and Windows pools, drumsd serve-os). osw/ is the OSWorld bridge, install/ the installer and release builder, tests/host/ the host tests, examples/ the SDK examples. pool/, osvm/ and tenantvm/ hold the tooling behind the published measurements.

bench.drums.run is the public record: every number there names its hardware, workload, method and sample size, and failed and planned runs stay on the record. Numbers measured on the release host type (c8i.4xlarge, 16 vCPU, 32 GiB, scripted actions, one host, not a comparison) are in docs/host-requirements.md: 40 idle environments at once, all valid; 60 of 60 episodes valid over 20 environments running Chrome and LibreOffice tasks. 128 and 256 environments per host were run on an r8i.16xlarge (496 GiB). Incumbent comparisons on the site are labelled paired or unpaired and replicated or not; read the label before the number.

The security model is docs/security.md; how to report a vulnerability, which versions get fixes and the known limits are in SECURITY.md. In short: environments run in the hardened profile by default (own user namespace with an unprivileged host uid range, no_new_privs, a capability bounding set, seccomp, a metadata firewall, no network); the agent never gets root, and task setup steps that need it run as drumsd's trusted provisioning; the API binds to loopback and always needs a token. Isolation between environments is namespaces and cgroups inside one trusted customer's boundary. It is

正文由 探How 从来源站点 RSS 同步,内容未经改写;遇到排版缺失或需要图片、视频时请以原文为准。

打开原文
去社区讨论 →