What Isoloop gives you, and what it costs
Features, by group
Containment
Each isolate runs on an event loop in a worker: its own, or one it shares in a pool. When a loop blocks, the kernel stops it and starts it again. When an isolate reports an error, only that isolate restarts, even in a pool. The main thread and the other loops don’t wait for either.
A live recording of four isolates
- A bar is work running on that thread; time moves to the left.
- Hatched: the thread is stuck, so nothing else on it can run.
- A line across a track: that isolate was stopped and started again.
- A hollow tick is a reaction to a record; the line points to who sent it.
- The demo’s own measurement records aren’t drawn.
Starting basic…
An isolate that crashes more than 3 times within a minute is marked failed, and the kernel stops restarting it.
Restart and catch-up
The kernel expects a heartbeat from every loop. By default, after 400 ms without one, an isolate is marked blocked. After killAfterMs (10 s by default; basic uses 2 s) its worker is stopped and started again. With the defaults, a fourth crash marks it failed unless it ran for a minute or more before one of them, and it stays down: that’s the crash-loop guard, so an isolate that keeps crashing stops costing restarts. kernel.restart(id) brings it back.
Restarted, each subscription starts where its from says, except in a consumer group that has committed, which resumes after its commit.
latest, the default, starts with new records.earliestreads everything the topic still retains.committedreads on after its last commit; commits go out every 100 ms, so the few records it had read but not committed come again: at least once, none lost.
committed: it had read to 4139 and committed 4137 when it got stuck.The message bus
The bus runs in a worker of its own. Each isolate talks to it over its own channel, so records never pass through the main thread. Every topic has a schema, written with any Standard Schema library (Zod, Valibot, ArkType), and the bus checks each record before it’s appended. One that fails is rejected with invalid and no reader ever sees it.
Records arrive on three topics. C reads count.v1; D reads all three.
// contracts.ts: the bus worker, the host and the isolates all use this one module
export const note = topic('note.v1', {
schema: z.string().trim().min(1).max(200),
retention: { kind: 'last-n', n: 50 },
});Retention and replay
A topic keeps its records under a retention policy: the last n, a time window, or the latest record per key. Where a restarted reader starts is its own choice: earliest reads every retained record again, committed reads on after its last commit, latest takes only new records. A consumer group, whose members share a topic’s records between them (experimental in 0.1), is the exception: once it has committed, it resumes after its commit whatever from says. D subscribes from earliest, which is how it rebuilds its list of notes.
D reads each note as it arrives.
Durable history
Mark a topic persistent and the bus keeps it in the origin private file system (OPFS). It survives a page reload, a closed tab and a crash of the bus worker. A publish is acknowledged once its batch is on disk; batches are written every 5 ms. The plant dashboard keeps its alarms and events this way.
| Topic | Before the reload | After the reload |
|---|---|---|
count.v1memory | 4131413241334134 | empty |
alarms.v1persistent | 212213214215 | 212213214215 |
bus:durability_degraded.export const alarms = topic('alarms.v1', {
schema: Alarm,
retention: { kind: 'last-n', n: 10_000 },
durability: 'persistent',
});Placement
Each isolate gets a worker of its own by default. Give several the same pool name and they share one: less memory and a faster start, but one event loop, so they stall and restart together. A pool is a unit of failure, so group what can fail together.
Own workers 4 loops
As in basic 3 loops
One pool 1 loop
kernel.spawn({ id: 'c', src: primesUrl, surface, pool: 'shared' });
kernel.spawn({ id: 'd', src: messagesUrl, surface, pool: 'shared' });Automatic placement Experimental
@isoloop/balancer is experimental and opt-in. Spawn through it instead of naming a pool, and it puts each isolate in a pool where its measured load fits, within a cap on workers. The kernel never moves anything on its own, and the balancer moves only the isolates spawned through it.
It reads every isolate’s heartbeat: its worker’s lag and the isolate’s own busy time. For work the runtime can’t attribute, such as code that resumes after await, the app can report its own busy time and how much work is queued. An isolate that blocks twice within a minute, or crashes, waits in a quarantine pool until it has been quiet; the fourth time, it’s kept apart for good. An isolate the kernel has given up on is left alone until the app restarts it.
A move is a restart: the isolate stops, starts again in its new pool and catches up from the bus, and a visual one is blank until it redraws. The balancer groups by load, not by what belongs together, so place by hand what must fail together or stay apart.
| When | What the balancer does |
|---|---|
| An isolate blocks its pool for over 100 ms twice within 60 s, or crashes | Moves it to the quarantine pool until it has been quiet for 30 s, a window that doubles with each repeat offence, up to 2 minutes. One that has used its 3 moves stays until the oldest is 5 minutes old |
| A pool lags over 50 ms for 3 s, or its members use 80 % of a core or more | Moves the heaviest member to a pool with room, or to a new one within the cap |
| A pool is killed for blocking and no heartbeat names the culprit | Moves half its members to quarantine; whichever half blocks again holds the culprit |
| The backlog the app reports for an isolate grows over two 10 s windows in a row | Gives the isolate a pool of its own if the cap allows, else a less loaded pool. A second quarantine pool folds into the first to free a worker for it |
| Every isolate in a pool stays steady for 60 s | Moves them one at a time into another pool that stays under 40 % with all of them, freeing a worker |
| The kernel gives up on an isolate | Marks it failed and leaves it alone until the app restarts it |
const balancer = createBalancer(kernel, { maxWorkers: 4 });
balancer.spawn({ id: 'task-1', src: taskUrl }); // no `pool`: the balancer picks one
balancer.spawn({ id: 'chart-1', src: chartUrl, surface: chartEl });
balancer.on('move', (e) => console.log(`${e.id}: ${e.from} → ${e.to} (${e.reason})`));Tools for agents Experimental
A requestable topic, one with a reply, can carry a tool description, and the kernel’s agents.expose lists which of them agents may call. Each becomes a tool whose input and output JSON Schemas come from the topic’s own schemas. The isolate that answers it replies as it does to any request, whichever agent asked.
In development, npx isoloop mcp serves the tools to a coding agent over MCP, with tools of its own for reading the page: its isolates, topics, records and events. The page pairs only with the CLI’s token and from an allowed origin. Tools that change something, and the CLI’s restart, kill, block, publish and request, are listed only with --allow-write. @isoloop/vite fails a production build that still contains the dev MCP.
In the browser, @isoloop/webmcp registers the same tools with WebMCP, a Community Group draft. Chromium 158 and Firefox 159 both keep it behind a flag, and it’s tested under Playwright only. Firefox’s agent sees only the read-only hint, and can’t cancel a call.
The hints, read-only, consequential and untrusted content, describe a tool; they don’t stop a call, so asking the user first is the agent’s job, or the page’s. Delivery is at least once, so a tool that changes something has to recognise a request it has already handled.
What one call costs the page, measured on the plant dashboard with 0.1.0-next.5, one call in flight and a handler that does nothing, on the bench machine (4 cores fixed at 2.0 GHz): a round trip took 0.15 ms on average on an idle page and 0.24 ms at 5 kHz in Chromium 158, and 0.60 ms and 1.48 ms in Firefox 159. Each call took 0.035 ms of the main thread idle and 0.059 ms at 5 kHz, measured in Chromium only. The transport’s hop, the agent’s own time and the tool’s work come on top.
A tool’s topic keeps only what its retention says, and the calls waiting on it are records there: a burst of 1,000 calls at once on a topic that keeps 100 records gets 100 answers, and the other 900, removed by retention before any isolate got them, fail at once with dropped. Give a tool’s topic the retention its largest burst needs.
// contracts.ts: a requestable topic (it has a `reply`) that agents may call
export const quote = topic('markets.quote.v1', {
schema: z.object({ symbol: z.string() }),
reply: z.object({ vwap: z.number().nullable(), volume: z.number() }),
retention: { kind: 'last-n', n: 100 },
tool: {
description: 'The latest VWAP and volume for one symbol.',
readOnly: true,
},
});
// main.ts: the kernel lists which topics agents may call
const kernel = createKernel({
contracts: { url: contractsUrl, list: contracts(quote) },
workers,
agents: { expose: ['markets.quote.v1'] },
});
connectWebMCP(kernel); // a browser agent, where the browser has WebMCP
// in development, `npx isoloop mcp` serves the same tools to a coding agentDevtools Experimental
connectDevtools(kernel) from @isoloop/devtools puts a button in a corner of the page, ringed by twelve arcs that show the kernel’s health, each arc a stretch of isolates coloured by their worst state. healthStatus picks the ring, a variant that also fills the logo, or a plain white ring.
A click or Alt+Shift+D opens a panel with four tabs:
- Isolates: each one’s state, lag, busy time, crash restarts, pool and memory, with Restart, Kill and Block on each row, and the pools on a tab of their own.
- Bus: each topic’s rate, head offset and retained count, each subscription’s lag and credit, and rejected publishes.
- Events: the kernel’s own history, isolates changing state, crashing or failing and the bus restarting, up to 6,000 events for this page session and for each of the last three sessions before it, so a crash that ended in a reload can be read back.
- Messages: live records, at most 50 a second, with a count of what that cap left out; a row opens into its value and its record.
The panel is a visual isolate in its own worker, never pooled, so a crash or hang in it doesn’t reach the page, and the supervisor restarts it like any other. It lists itself, marked devtools. It reads the kernel’s inspection feed, kernel.inspect(), through the inspect grant on a port of its own, so it keeps working while the bus restarts, and its traffic stays out of the bus figures it shows. The dev MCP reads the same feed for a coding agent.
Memory per isolate is measured only in Chromium on a cross-origin isolated page, while a reader listens, so a figure can be many seconds old. Nothing gates the controls in production, and killing a pool member stops its whole worker. With nothing reading it, the feed costs a buffer of the last 200 events, about 18 KB on the plant dashboard; what an open feed costs is on the plant example’s measurements.
// main.ts: the panel is an isolate of its own, opened with its button or Alt+Shift+D
if (new URLSearchParams(location.search).get('devtools') === '1') {
const { connectDevtools } = await import('@isoloop/devtools');
connectDevtools(kernel, { position: 'bottom-right' });
}Your framework
Write an isolate with React (18 or 19), Preact (10 or 11) or plain DOM. Each isolate picks its own, and one page can mix them. An isolate renders into a DOM subset inside its worker; the host applies the changes to the page once a frame.
React
import { defineIsolate, usePublish, useTopic } from '@isoloop/react';
import { count } from './topics';
function Counter() {
const n = useTopic(count, { from: 'earliest' }) ?? 0;
const publish = usePublish(count);
return <button onClick={() => void publish(n + 1)}>Count: {n}</button>;
}
export default defineIsolate(Counter);Preact
import { defineIsolate, usePublish, useTopic } from '@isoloop/preact';
import { count } from './topics';
function Counter() {
const n = useTopic(count, { from: 'earliest' }) ?? 0;
const publish = usePublish(count);
return <button onClick={() => void publish(n + 1)}>Count: {n}</button>;
}
export default defineIsolate(Counter);Plain DOM
import { defineIsolate } from '@isoloop/runtime';
import { count } from './topics';
export default defineIsolate<HTMLElement>({
start(ctx) {
let n = 0;
const button = document.createElement('button');
const show = () => {
button.textContent = `Count: ${n}`;
};
button.addEventListener('click', () => void ctx.bus.publish(count, { value: n + 1 }));
ctx.bus.subscribe(
count,
(r) => {
n = r.value;
show();
},
{ from: 'earliest' },
);
show();
ctx.root?.append(button);
},
});Safety
Isolates run on your origin, so they share its cookies and storage. Isoloop contains unreliable code (a widget that hangs, throws or leaks), not hostile code: for code you don’t trust at all, use a cross-origin iframe.
- Grants
- Each isolate lists the topics it may publish and subscribe to. Anything else is rejected with
forbidden. Isolates in one pool share a worker and can reach each other’s ports, so treat a pool as holding all its members’ grants. - A sanitised DOM
- Every tag and attribute an isolate renders passes the host’s registry first. Unknown tags become
div, script-capable tags andon*attributes are never created, and URLs are limited to http(s), mailto and relative ones. - No inline scripts
- The workers are same-origin module files, so a page can run Isoloop under
script-src 'self'. The host writes thestylean isolate renders through the element’sstyleobject, which CSP doesn’t govern, so a page that shows a surface needs onlystyle-src 'self'too. The hosting guide has the full policy.
kernel.spawn({
id: 'd',
src: messagesUrl,
surface,
grants: { publish: ['note.v1'], subscribe: ['count.v1', 'note.v1', 'primes.v1'] },
});What it costs
Isoloop adds workers, a bus and a kernel. That takes CPU, memory and start-up time on every device. It improved responsiveness on some of the devices measured, and not on others.
Desktop
The plant dashboard on the desktop machine (4 cores fixed at 2.0 GHz), Chromium at 5 kHz, 5 interleaved rounds, measured on plant-bench (plant at plant-v0.4.2 on @isoloop/*@0.1.0), November 2026. Each native build is measured against the Isoloop placement shaped like it.
Findings
- Isoloop moves the widgets off the main thread: it's 22–24% busy against 78–80% on the native builds. Typing answers 32 ms sooner in
one; inmatchedthe rounds disagree, 18 ms sooner at the median. - In the default placement,
matched, against native + workers: after a 3 s block, the page is back to normal 0.25 s sooner. - It costs CPU, memory and start-up: +15 to +19 points of CPU across threads, +39 to +46 MB after GC, and first data 0.21–0.28 s later.
| Native against Isoloop one (one pool) | Native + workers against Isoloop matched (the default) | |||||
|---|---|---|---|---|---|---|
| Native | Isoloop one | Δ | Native + workers | Isoloop matched | Δ | |
| Responsiveness | ||||||
| Main thread busy | 80% | 22% | −58 pts better | 78% | 24% | −54 pts better |
| Typing, median | 65 ms | 38 ms | −32 ms better | 58 ms | 41 ms | −18 ms no change |
| Faults and start-up | ||||||
| Back to normal after the block | 3.2 s | 3.4 s | +0.25 s worse | 3.2 s | 2.9 s | −0.25 s better |
| All 72 widgets with data | 1.2 s | 2.4 s | +1.2 s worse | 2.3 s | 1.5 s | −0.8 s no change |
| First data | 0.22 s | 0.50 s | +0.28 s worse | 0.37 s | 0.56 s | +0.21 s worse |
| Cost | ||||||
| CPU, all threads | 91% | 106% | +15 pts worse | 97% | 112% | +19 pts worse |
| Memory after GC, at 16 s | 168 MB | 207 MB | +39 MB worse | 227 MB | 272 MB | +46 MB worse |
| Workers | 0 | 1 + bus | 9 | 10 + bus | ||
The plant dashboard on the desktop machine (4 cores fixed at 2.0 GHz), Chromium at 5 kHz, 5 interleaved rounds, measured on plant-bench (plant at plant-v0.4.2 on @isoloop/*@0.1.0), November 2026. Each native build is measured against the Isoloop placement shaped like it.
| Native | Isoloop one | Δ | |
|---|---|---|---|
| Responsiveness | |||
| Main thread busy | 80% | 22% | −58 pts better |
| Typing, median | 65 ms | 38 ms | −32 ms better |
| Faults and start-up | |||
| Back to normal after the block | 3.2 s | 3.4 s | +0.25 s worse |
| All 72 widgets with data | 1.2 s | 2.4 s | +1.2 s worse |
| First data | 0.22 s | 0.50 s | +0.28 s worse |
| Cost | |||
| CPU, all threads | 91% | 106% | +15 pts worse |
| Memory after GC, at 16 s | 168 MB | 207 MB | +39 MB worse |
| Workers | 0 | 1 + bus | |
| Native + workers | Isoloop matched | Δ | |
|---|---|---|---|
| Responsiveness | |||
| Main thread busy | 78% | 24% | −54 pts better |
| Typing, median | 58 ms | 41 ms | −18 ms no change |
| Faults and start-up | |||
| Back to normal after the block | 3.2 s | 2.9 s | −0.25 s better |
| All 72 widgets with data | 2.3 s | 1.5 s | −0.8 s no change |
| First data | 0.37 s | 0.56 s | +0.21 s worse |
| Cost | |||
| CPU, all threads | 97% | 112% | +19 pts worse |
| Memory after GC, at 16 s | 227 MB | 272 MB | +46 MB worse |
| Workers | 9 | 10 + bus | |
- Δ is the median of the gaps measured in each round, so it can differ from the difference of the two medians.
- The native builds keep their data in a small store written for this app, with no message bus. They don't contain a blocked widget, restart a crashed one, replay data to it, check grants or schemas, or keep acknowledged history. The extra CPU and memory pay for those features.
Isoloop and the alternatives
Six other ways to move work off the main thread or contain it, next to Isoloop. Each mark comes from that project’s own docs, linked under its name with the date they were checked.
There are no benchmarks here: these tools do different jobs, so the table compares what each one does.
| Tool | UI in a worker | Supervision and restart | A durable bus with replay | A security boundary | Browser support | The main cost |
|---|---|---|---|---|---|---|
| IsoloopDocs, checked | YesEach isolate renders in a worker, and the page applies its DOM changes. Layout reads and focus are asynchronous. | YesHeartbeats, restarts with backoff, a fallback after repeated crashes, and catch-up from the bus. | YesTopics with retention, replay and consumer groups, and an optional copy on disk. | NoIt contains crashes and hangs from code you trust. Isolates run on the page's origin, so hostile code belongs in a cross-origin iframe. | Chrome 108, Firefox 114 and Safari 16.4 or later. | More CPU across threads, more memory and a slower start than native code with workers. The main thread still applies every DOM change. |
| Remote DOMDocs, checked | YesRenders from a hidden iframe or, with its DOM polyfill, from a worker. The host page mirrors the elements. | NoIts docs describe no restart for a remote side that crashes or hangs. | NoIt sends DOM changes from the remote side to the host. There's no log to replay. | PartialThe boundary is the sandbox you run the remote side in. The host can limit which elements it creates. | Not stated. The remote side needs custom elements and MutationObserver, or the DOM polyfill in a worker. | You build the host, the sandbox and the channel between them, and decide which elements the remote side may render. |
| PartytownDocs, checked | PartialRuns third-party scripts in a worker against a proxied DOM. Its docs say scripts that build UI aren't a good fit. | NoIts docs describe no restart for a script that crashes or hangs. | NoScripts reach the page through a proxy. There's no log to replay. | PartialYou can allow or deny each script access to main-thread APIs, cookies and storage. | Every browser. Without service workers or Atomics, scripts run on the main thread as before. | Each DOM call from the worker is a blocking round trip, throttled on purpose, and preventDefault() has no effect. It needs a service worker, or extra response headers for Atomics. |
| worker-domDocs, checked | YesA DOM in a worker, which sends its changes to the main thread. | NoIts docs describe no restart for a worker that crashes or hangs. | NoIt sends DOM changes to the main thread. There's no log to replay. | PartialIts AMP build adds hooks for safety features such as HTML sanitization. | The latest two versions of the major browsers, on desktop and mobile. | Its docs call it an in-progress DOM: querySelector works in part, and APIs such as History aren't there yet. |
| Comlink + workersDocs, checked | NoWorkers have no DOM. Comlink turns calls to a worker into promises. | NoErrors are thrown again on the calling side. Nothing restarts a worker. | NoRemote calls over postMessage. There's no log to replay. | NoIt adds no boundary of its own. | Chrome 56, Firefox 52 and Safari 10.1 or later. | Every call is asynchronous, and you split the app between the page and its workers yourself. |
| Cross-origin iframesDocs, checked | NoA frame is a separate document, not a worker. | NoNothing restarts a frame that crashes or hangs. | NoThe page and its frames talk through postMessage. There's no log to replay. | YesThe same-origin policy keeps the frame out of the page's DOM, cookies and storage, and sandbox restricts it further. | Every browser. | Each frame is a complete document with its own memory and compute, and it shares nothing with the page but messages. |
scheduler.yield()Docs, checked | NoWork stays on the main thread, which it hands back between pieces. | NoA browser API for scheduling, with nothing to restart. | NoIt schedules work and carries no messages. | NoEverything runs in the page. | Chrome and Edge 129 and Firefox 142 or later. Not in Safari. | You split each long task by hand, and the main thread still runs all of it. |
Where an alternative is the better choice
- Remote DOM: Rendering untrusted extension UI from a set of elements the host defines, with the remote code in a sandboxed iframe.
- Partytown: Moving third-party scripts such as tag managers and analytics off the main thread without changing them.
- worker-dom: AMP pages, where it runs
amp-script. - Comlink + workers: Moving computation, not UI, off the main thread with a 1.1 kB library.
- Cross-origin iframes: Code you don't trust at all: the browser keeps another origin out of the page.
scheduler.yield(): Long tasks that must stay on the main thread and can be split, without workers or a new architecture.
