Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

docs(embed): publish reproducible Linux fleet and cgroup measurements

Steven Enamakele6b56b3d422d
diff --git a/crates/openhuman-embed/examples/linux_fleet_cgroup.py b/crates/openhuman-embed/examples/linux_fleet_cgroup.py
new file mode 100644
index 0000000000..8e86022e16
--- /dev/null
+++ b/crates/openhuman-embed/examples/linux_fleet_cgroup.py
@@ -0,0 +1,18 @@
+"""Record the release example and its enclosing Linux cgroup's limits/peak.
+
+Run through systemd-run --user --scope; build the Rust example first.
+The cgroup contains the example's HTTP mock and this small Python monitor.
+"""
+
+import json, pathlib, subprocess, sys
+count=sys.argv[1]
+binary = pathlib.Path(__file__).resolve().parents[3] / 'target/release/examples/linux_fleet'
+r=subprocess.run([str(binary), count],capture_output=True,text=True)
+if r.returncode:
+ print(r.stderr, file=sys.stderr);sys.exit(r.returncode)
+record=json.loads(r.stdout)
+path=next(line.split('::',1)[1] for line in pathlib.Path('/proc/self/cgroup').read_text().splitlines() if line.startswith('0::'))
+cg=pathlib.Path('/sys/fs/cgroup')/path.lstrip('/')
+for name in ['memory.peak','memory.max','cpu.max','memory.events']:
+ record['cgroup_'+name.replace('.','_')]=(cg/name).read_text().strip()
+print(json.dumps(record))
diff --git a/docs/benchmarks/medulla-embed-linux.json b/docs/benchmarks/medulla-embed-linux.json
new file mode 100644
index 0000000000..7358a1bc1d
--- /dev/null
+++ b/docs/benchmarks/medulla-embed-linux.json
@@ -0,0 +1,237 @@
+{
+ "source_commit": "e2224a22a3171d20fb1f0e936d5fdc3b30961961",
+ "date": "2026-10-10",
+ "host": "Intel Core i7-14700F; x86_64 Ubuntu Linux 7.0.0-31-generic",
+ "runs": [
+ {
+ "after_turns_rss_kib": 222956,
+ "agents": 50,
+ "before_boot_rss_kib": 13544,
+ "boot_ms": 302.35022,
+ "cold_turn_ms": 74.338948,
+ "fleet_elapsed_ms": 599.894233,
+ "inference": "loopback-http-mock",
+ "marginal_after_turns_mib": 3.76015625,
+ "registered_rss_kib": 32504,
+ "runtime_rss_kib": 30436,
+ "tool_scope": [
+ "shell"
+ ],
+ "turn_p50_ms": 442.656279,
+ "turn_p95_ms": 558.987831,
+ "turn_p99_ms": 577.114408,
+ "worker_threads": 2,
+ "cgroup_memory_peak": "256131072",
+ "cgroup_memory_max": "2147483648",
+ "cgroup_cpu_max": "200000 100000",
+ "cgroup_memory_events": "low 0\nhigh 0\nmax 0\noom 0\noom_kill 0\noom_group_kill 0\nsock_throttled 0"
+ },
+ {
+ "after_turns_rss_kib": 230456,
+ "agents": 50,
+ "before_boot_rss_kib": 14684,
+ "boot_ms": 259.898322,
+ "cold_turn_ms": 17.341459999999998,
+ "fleet_elapsed_ms": 535.350733,
+ "inference": "loopback-http-mock",
+ "marginal_after_turns_mib": 3.83796875,
+ "registered_rss_kib": 36184,
+ "runtime_rss_kib": 33952,
+ "tool_scope": [
+ "shell"
+ ],
+ "turn_p50_ms": 415.089916,
+ "turn_p95_ms": 477.391643,
+ "turn_p99_ms": 494.830836,
+ "worker_threads": 2,
+ "cgroup_memory_peak": "209993728",
+ "cgroup_memory_max": "2147483648",
+ "cgroup_cpu_max": "200000 100000",
+ "cgroup_memory_events": "low 0\nhigh 0\nmax 0\noom 0\noom_kill 0\noom_group_kill 0\nsock_throttled 0"
+ },
+ {
+ "after_turns_rss_kib": 221192,
+ "agents": 50,
+ "before_boot_rss_kib": 14756,
+ "boot_ms": 256.45689,
+ "cold_turn_ms": 16.850222000000002,
+ "fleet_elapsed_ms": 497.84299300000004,
+ "inference": "loopback-http-mock",
+ "marginal_after_turns_mib": 3.659140625,
+ "registered_rss_kib": 35980,
+ "runtime_rss_kib": 33844,
+ "tool_scope": [
+ "shell"
+ ],
+ "turn_p50_ms": 359.819163,
+ "turn_p95_ms": 473.740273,
+ "turn_p99_ms": 480.653368,
+ "worker_threads": 2,
+ "cgroup_memory_peak": "198828032",
+ "cgroup_memory_max": "2147483648",
+ "cgroup_cpu_max": "200000 100000",
+ "cgroup_memory_events": "low 0\nhigh 0\nmax 0\noom 0\noom_kill 0\noom_group_kill 0\nsock_throttled 0"
+ },
+ {
+ "after_turns_rss_kib": 380208,
+ "agents": 100,
+ "before_boot_rss_kib": 14784,
+ "boot_ms": 258.699509,
+ "cold_turn_ms": 18.28909,
+ "fleet_elapsed_ms": 959.732258,
+ "inference": "loopback-http-mock",
+ "marginal_after_turns_mib": 3.384140625,
+ "registered_rss_kib": 37764,
+ "runtime_rss_kib": 33672,
+ "tool_scope": [
+ "shell"
+ ],
+ "turn_p50_ms": 753.579677,
+ "turn_p95_ms": 834.150036,
+ "turn_p99_ms": 864.9725179999999,
+ "worker_threads": 2,
+ "cgroup_memory_peak": "371425280",
+ "cgroup_memory_max": "2147483648",
+ "cgroup_cpu_max": "200000 100000",
+ "cgroup_memory_events": "low 0\nhigh 0\nmax 0\noom 0\noom_kill 0\noom_group_kill 0\nsock_throttled 0"
+ },
+ {
+ "after_turns_rss_kib": 384124,
+ "agents": 100,
+ "before_boot_rss_kib": 14736,
+ "boot_ms": 259.450986,
+ "cold_turn_ms": 22.879907000000003,
+ "fleet_elapsed_ms": 876.001291,
+ "inference": "loopback-http-mock",
+ "marginal_after_turns_mib": 3.419296875,
+ "registered_rss_kib": 38144,
+ "runtime_rss_kib": 33988,
+ "tool_scope": [
+ "shell"
+ ],
+ "turn_p50_ms": 637.160772,
+ "turn_p95_ms": 748.4570659999999,
+ "turn_p99_ms": 771.86696,
+ "worker_threads": 2,
+ "cgroup_memory_peak": "375803904",
+ "cgroup_memory_max": "2147483648",
+ "cgroup_cpu_max": "200000 100000",
+ "cgroup_memory_events": "low 0\nhigh 0\nmax 0\noom 0\noom_kill 0\noom_group_kill 0\nsock_throttled 0"
+ },
+ {
+ "after_turns_rss_kib": 380588,
+ "agents": 100,
+ "before_boot_rss_kib": 14668,
+ "boot_ms": 256.08613,
+ "cold_turn_ms": 17.111337000000002,
+ "fleet_elapsed_ms": 974.2819109999999,
+ "inference": "loopback-http-mock",
+ "marginal_after_turns_mib": 3.3854296875,
+ "registered_rss_kib": 38164,
+ "runtime_rss_kib": 33920,
+ "tool_scope": [
+ "shell"
+ ],
+ "turn_p50_ms": 733.667637,
+ "turn_p95_ms": 878.9274019999999,
+ "turn_p99_ms": 905.8316749999999,
+ "worker_threads": 2,
+ "cgroup_memory_peak": "370524160",
+ "cgroup_memory_max": "2147483648",
+ "cgroup_cpu_max": "200000 100000",
+ "cgroup_memory_events": "low 0\nhigh 0\nmax 0\noom 0\noom_kill 0\noom_group_kill 0\nsock_throttled 0"
+ },
+ {
+ "after_turns_rss_kib": 1521308,
+ "agents": 500,
+ "before_boot_rss_kib": 14596,
+ "boot_ms": 259.61459199999996,
+ "cold_turn_ms": 17.803175,
+ "fleet_elapsed_ms": 5067.754381000001,
+ "inference": "loopback-http-mock",
+ "marginal_after_turns_mib": 2.906046875,
+ "registered_rss_kib": 53776,
+ "runtime_rss_kib": 33412,
+ "tool_scope": [
+ "shell"
+ ],
+ "turn_p50_ms": 4318.977334,
+ "turn_p95_ms": 4925.888849999999,
+ "turn_p99_ms": 5006.735527,
+ "worker_threads": 2,
+ "cgroup_memory_peak": "1627930624",
+ "cgroup_memory_max": "2147483648",
+ "cgroup_cpu_max": "200000 100000",
+ "cgroup_memory_events": "low 0\nhigh 0\nmax 0\noom 0\noom_kill 0\noom_group_kill 0\nsock_throttled 0"
+ },
+ {
+ "after_turns_rss_kib": 1496992,
+ "agents": 500,
+ "before_boot_rss_kib": 14716,
+ "boot_ms": 257.994615,
+ "cold_turn_ms": 28.108373999999998,
+ "fleet_elapsed_ms": 5018.514113,
+ "inference": "loopback-http-mock",
+ "marginal_after_turns_mib": 2.8576796875,
+ "registered_rss_kib": 54372,
+ "runtime_rss_kib": 33860,
+ "tool_scope": [
+ "shell"
+ ],
+ "turn_p50_ms": 4253.114938000001,
+ "turn_p95_ms": 4757.166389,
+ "turn_p99_ms": 4834.214146,
+ "worker_threads": 2,
+ "cgroup_memory_peak": "1598652416",
+ "cgroup_memory_max": "2147483648",
+ "cgroup_cpu_max": "200000 100000",
+ "cgroup_memory_events": "low 0\nhigh 0\nmax 0\noom 0\noom_kill 0\noom_group_kill 0\nsock_throttled 0"
+ },
+ {
+ "after_turns_rss_kib": 1517088,
+ "agents": 500,
+ "before_boot_rss_kib": 14532,
+ "boot_ms": 257.593554,
+ "cold_turn_ms": 41.288444,
+ "fleet_elapsed_ms": 4804.511533999999,
+ "inference": "loopback-http-mock",
+ "marginal_after_turns_mib": 2.8974609375,
+ "registered_rss_kib": 54176,
+ "runtime_rss_kib": 33588,
+ "tool_scope": [
+ "shell"
+ ],
+ "turn_p50_ms": 4032.232026,
+ "turn_p95_ms": 4566.384357000001,
+ "turn_p99_ms": 4703.506536,
+ "worker_threads": 2,
+ "cgroup_memory_peak": "1626206208",
+ "cgroup_memory_max": "2147483648",
+ "cgroup_cpu_max": "200000 100000",
+ "cgroup_memory_events": "low 0\nhigh 0\nmax 0\noom 0\noom_kill 0\noom_group_kill 0\nsock_throttled 0"
+ }
+ ],
+ "no_swap_500_agents": {
+ "after_turns_rss_kib": 1503036,
+ "agents": 500,
+ "before_boot_rss_kib": 13544,
+ "boot_ms": 291.090911,
+ "cold_turn_ms": 64.148624,
+ "fleet_elapsed_ms": 5087.109549,
+ "inference": "loopback-http-mock",
+ "marginal_after_turns_mib": 2.875234375,
+ "registered_rss_kib": 51472,
+ "runtime_rss_kib": 30916,
+ "tool_scope": [
+ "shell"
+ ],
+ "turn_p50_ms": 4365.676439,
+ "turn_p95_ms": 4865.638112,
+ "turn_p99_ms": 4952.234937,
+ "worker_threads": 2,
+ "cgroup_memory_peak": "1663881216",
+ "cgroup_memory_max": "2147483648",
+ "cgroup_cpu_max": "200000 100000",
+ "cgroup_memory_events": "low 0\nhigh 0\nmax 0\noom 0\noom_kill 0\noom_group_kill 0\nsock_throttled 0"
+ }
+}
diff --git a/gitbooks/developing/performance.md b/gitbooks/developing/performance.md
index 37f5a3d825..99abd762e6 100644
--- a/gitbooks/developing/performance.md
+++ b/gitbooks/developing/performance.md
@@ -100,3 +100,61 @@ scripts/kernel-floor.sh flows
These numbers were gathered on macOS. It has no local cgroup memory limit and no `/proc/<pid>/smaps_rollup`, so there is no true PSS (proportional shared memory) reading. RSS overcounts shared pages, and the error grows with agent count. The fleet and instances numbers project from measured marginal cost. They are not a live test of surviving an OOM kill at N agents on a 2 GB / 2 vCPU Linux box. Every scenario also replaces network inference with a mock provider at fixed latency, so turn timings measure orchestration overhead, not real model latency. Validation under Linux cgroups has not been done yet.
For token cost instead of process footprint, see [Smart token compression](../features/token-compression.md). It is the other half of "cheap": it controls how much of what the harness assembles reaches the model.
+
+## Linux runtime-owned agents (Medulla integration)
+
+Measured on 2026-10-10 at OpenHuman commit `e2224a22a3`, using the release
+`openhuman-embed` example `linux_fleet` with default features disabled. This
+exercises one `Runtime` and N `AgentSpec`s, with two Tokio workers, ephemeral
+session storage, and a loopback HTTP chat-completions mock. Each agent
+advertises the builtin `shell` tool; the mock returns text without executing it.
+Conversation memory, local model runtimes, and session dual writes are off.
+The host is x86_64 Ubuntu, Linux 7.0.0-31-generic, on an Intel Core i7-14700F.
+Other builds were running on the host, so these are shared-host measurements.
+
+Each run starts in a fresh cgroup with `memory.max = 2147483648` and
+`cpu.max = 200000 100000` (2 GiB and a two-CPU quota). Three fresh processes
+were measured at each size; the table gives medians. RSS is sampled after every
+agent completes one concurrent turn, with all agent handles retained. Marginal
+RSS is `(RSS after turns - RSS after Runtime::build) / N`, without allocator
+trimming. The cgroup peak includes the HTTP mock and the Python measurement
+wrapper. RSS and cgroup accounting differ because shared file pages may be
+charged outside the new cgroup.
+
+| Concurrent agents | Process RSS after turns | Marginal RSS/agent | Cgroup peak | Fleet wall time | Turn p95 |
+| --- | --- | --- | --- | --- | --- |
+| 50 | 217.73 MiB | 3.760 MiB | 200.27 MiB | 535 ms | 477 ms |
+| 100 | 371.67 MiB | 3.385 MiB | 354.22 MiB | 960 ms | 834 ms |
+| 500 | 1,481.53 MiB | 2.897 MiB | 1,550.87 MiB | 5,019 ms | 4,757 ms |
+
+The 100- and 500-agent results are within twice the earlier macOS/mock
+1.77 MiB figure (3.54 MiB). The 50-agent result misses that target slightly:
+its three runs used 3.659–3.838 MiB per agent. These are different hosts and
+harness entry points, so the table is a capacity measurement rather than a
+controlled comparison of the platforms.
+
+Runtime boot took 256–302 ms. The first turn in each fresh process took
+16.9–74.3 ms, before launching the concurrent fleet. Both are within twice the
+earlier 476 ms bootstrap and 102 ms first-turn figures. “First turn” includes
+session/model/tool initialization, but excludes compiling and loading the
+executable; the OS page cache was warm.
+
+A separate 500-agent run with **swap disabled** (`MemorySwapMax=0`) completed
+in 5,087 ms, with 2.875 MiB marginal RSS per agent and a 1,586.80 MiB cgroup
+peak. Every run recorded zero `max`, `oom`, and `oom_kill` memory events.
+This does not establish capacity for real providers, tool subprocesses, MCP
+servers, or 1,000 simultaneously active turns. Measure those workloads before
+sizing a production fleet.
+
+To reproduce from the OpenHuman repository root:
+
+```sh
+cargo build -p openhuman-embed --locked --release --no-default-features --example linux_fleet
+systemd-run --user --scope -p MemoryMax=2G -p MemorySwapMax=0 -p CPUQuota=200% --quiet \
+ python3 crates/openhuman-embed/examples/linux_fleet_cgroup.py 500
+```
+
+Use `50` or `100` for the other sizes and repeat each command in a fresh scope.
+The JSON output records process RSS, bootstrap/turn timings, cgroup limits,
+peak memory, and OOM counters. The raw runs are checked in as
+[`docs/benchmarks/medulla-embed-linux.json`](https://github.com/tinyhumansai/openhuman/blob/main/docs/benchmarks/medulla-embed-linux.json).