Session pools: skip the cold start
Keep browsers running ahead of demand and claim one in milliseconds. Why pool size is a total, and why a pool never falls back or changes shape.
Last updated:
Browsers that are already running
Launching a browser container takes seconds; claiming one from a pool takes almost none. A pool holds browsers that are already up, configured and waiting, so a session created with a poolId starts on a machine that exists rather than one being built.
Two properties keep pools honest. First, size is a total — warm browsers plus browsers currently claimed by sessions — so a pool of ten with ten sessions open has nothing warm left by definition, not by accident. Second, a pooled session never falls back to a cold start: if the pool is empty, the request is refused. Anything else would turn the pool into a hint, and a hint is not a capacity plan.
The same firmness applies to shape. The browsers were launched with their locale and viewport fixed; a session asking the pool for a different shape is refused rather than quietly served the wrong browser.
Create a pool and read its counters
Requires: api-key paid-plan
BASE="https://browserberg.com"
AUTH="Authorization: Bearer $BROWSERBERG_API_KEY"
JSON="Content-Type: application/json"
# Size is a TOTAL: warm browsers plus browsers already claimed by sessions.
POOL=$(curl -s -X POST "$BASE/v1/pools" -H "$AUTH" -H "$JSON" \
-d '{ "name": "Docs walkthrough", "size": 1, "shape": { "locale": "de-DE" } }')
PID=$(echo "$POOL" | python3 -c 'import json,sys; print(json.load(sys.stdin)["pool"]["id"])')
curl -s "$BASE/v1/pools/$PID" -H "$AUTH" \
| python3 -c 'import json,sys; p = json.load(sys.stdin)["pool"]; print(json.dumps({
"name": p["name"], "size": p["size"], "warm": p["warm"], "inUse": p["inUse"]}, indent=2))'
curl -s -X DELETE "$BASE/v1/pools/$PID" -H "$AUTH" > /dev/null
{
"name": "Docs walkthrough",
"size": 1,
"warm": 0,
"inUse": 0
}
Note · Reserved browsers are a paid entitlement
Reserved pool browsers are part of the paid plans — the free plan has 0 — and they are billed as a holding: reserved capacity costs while it is reserved, whether or not sessions claim it.