Koko supports multi-session browser execution — multiple isolated browser instances that can run concurrently without sharing process state.
Process model
Each koko serve instance is an independent browser process with its own memory, targets, and CDP endpoint. This differs from Chromium's multi-tab single-process model where tabs share a browser process tree.
Crawl worker pattern
# Worker 1
zig-out/bin/koko serve --port 9222 --browser-profile chrome-macos-catalina
# Worker 2
zig-out/bin/koko serve --port 9223 --browser-profile chrome-macos-catalina
# Worker N...
SDK crawl helper:
import { createCrawlWorker } from "koko-sdk";
const worker = await createCrawlWorker("http://127.0.0.1:9222");
const result = await worker.crawl({ url: "https://en.wikipedia.org/wiki/Earth" });
// result.ttfexMs, result.extractMs, result.title, ...
Benchmark architecture
The Wikipedia crawl benchmark compares:
| Koko | Chromium | |
|---|---|---|
| Parallelism unit | 8 isolated koko serve processes | 8 tabs in 1 browser |
| Peak processes (8 workers) | 8 | ~15 (browser + renderers + utilities) |
| RSS / page | ~8.5 MiB | ~29.9 MiB |
| Sessions / GB | ~9 | ~2 |
When to use multi-session
- High-concurrency crawling with isolation
- Agent pools where one bad page must not crash others
- Memory-bounded density testing
- Per-tenant or per-profile session separation
Session persistence
import { captureSessionState, restoreSessionState } from "koko-sdk";
const state = await captureSessionState(page, "https://example.com");
await restoreSessionState(page, state);