cdpfleet Docs Sign up free

Examples & benchmarks / #92 · 2026-11-27 · Example · Easy · for web scraping

When the fleet is full: 503 capacity_full and Retry-After, vs your own 429 thread cap

Three plans launch while the shared fleet is full. A shared plan gets `503 shared_capacity_full` with `Retry-After: 5` and waits as told; a Community launch is refused the same way; a dedicated plan keeps launching until its own 10 threads are used, and only then gets `429 threads_exceeded` with `Retry-After: 1`. Two different limits, two different fixes, in five languages.

Chromium

Run on production on 2026-11-27: ✓ Node.js ✓ Python ✓ Java ✓ C# ✓ Go

The problem

A launch can be refused for two different reasons, and they need different handling. Your plan has a thread cap: hit it and the answer is 429 threads_exceeded, which only clears when one of your own sessions ends. Shared and Community plans also run on a shared fleet: when it is full the answer is 503 with shared_capacity_full or community_capacity_full, which clears on its own as capacity frees up. To show the 503 for real, the shared fleet's capacity was set to 3 threads for about 5 minutes on 2026-11-27 and filled, and these programs ran inside that window.

What we used, and why

WhatWhy
POST https://starter.cdpfleet.com/chromium/sessionThe launch request. The programs only read the answer (status, error, the Retry-After header and in_use); nobody connects, so each launched session is ended at once.
Three accountsA shared plan (with your own proxy), the free Community plan (on the Community proxy) and a dedicated plan with 10 threads.
A retry that follows Retry-AfterOn a 503 …_capacity_full wait the number of seconds in Retry-After, then try again; give up after 4 tries.
DELETE /v1/me/threads/:idEnds a launched session and frees its thread; each program checks that nothing is left running.

How it works

  1. Shared plan: launch; on 503 wait Retry-After seconds and launch again, at most 4 tries; record each answer and when it came.
  2. Community plan: launch once on the Community proxy and record the answer.
  3. Dedicated plan: launch until all 10 of its threads are in use, then launch one more and record the answer.
  4. End every session and count the threads left running on each account.

The code

The same program in five languages (also on GitHub, with the raw output). Set these environment variables first:

// Node 20+ (fetch), no packages needed.
// env: CDPFLEET_API_KEY (a shared plan), COMMUNITY_API_KEY (the free Community plan),
//      CDPFLEET_DEDICATED_API_KEY (a dedicated plan), PROXY_URL
const STARTER = 'https://starter.cdpfleet.com';
const API = 'https://cdpfleet.com';
const PROXY = process.env.PROXY_URL;
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
const t0 = Date.now();
const at = () => Math.round((Date.now() - t0) / 100) / 10;

// One launch request; the answer is all we look at (nobody connects, so the session is ended right after).
async function launch(key, body) {
  const res = await fetch(`${STARTER}/chromium/session`, {
    method: 'POST',
    headers: { 'x-api-key': key, 'content-type': 'application/json' },
    body: JSON.stringify({ headless: true, record: false, ...body }),
  });
  const j = await res.json().catch(() => ({}));
  return { status: res.status, error: j.error ?? null, retry_after: res.headers.get('retry-after'), in_use: j.in_use ?? null, session_id: j.sessionId ?? null };
}
const end = (key, id) => fetch(`${API}/v1/me/threads/${id}`, { method: 'DELETE', headers: { 'x-api-key': key } });
const threadsLeft = async (key) => (await (await fetch(`${API}/v1/me/threads`, { headers: { 'x-api-key': key } })).json()).threads.length;

// What a client should do with each answer.
function meaning(r) {
  if (r.status === 200) return 'launched';
  if (r.status === 503 && /capacity_full$/.test(r.error)) return 'the fleet is full: wait Retry-After and try again';
  if (r.status === 429 && r.error === 'threads_exceeded') return 'your own plan is at its thread cap: end a session or wait for one';
  if (r.status === 429 && r.error === 'rate_limited') return 'too many launches a second: slow down';
  return 'other';
}

// 1. A shared plan: launch, and on a full fleet wait as Retry-After says, at most 4 tries.
async function sharedPlan() {
  const key = process.env.CDPFLEET_API_KEY;
  const attempts = [];
  for (let i = 0; i < 4; i++) {
    const r = await launch(key, { proxy: PROXY });
    attempts.push({ at_s: at(), status: r.status, error: r.error, retry_after: r.retry_after, meaning: meaning(r) });
    if (r.status === 200) { await end(key, r.session_id); break; }
    if (!(r.status === 503 && r.retry_after)) break;
    if (i < 3) await sleep(Number(r.retry_after) * 1000);
  }
  return { attempts, got_session: attempts.at(-1).status === 200, threads_left: await threadsLeft(key) };
}

// 2. The free Community plan, on the Community proxy (no proxy given): one launch.
async function communityPlan() {
  const key = process.env.COMMUNITY_API_KEY;
  const r = await launch(key, {});
  if (r.status === 200) await end(key, r.session_id);
  return { status: r.status, error: r.error, retry_after: r.retry_after, meaning: meaning(r), threads_left: await threadsLeft(key) };
}

// 3. A dedicated plan: fill its own threads, then ask for one more.
async function dedicatedPlan() {
  const key = process.env.CDPFLEET_DEDICATED_API_KEY;
  const threads = (await (await fetch(`${API}/v1/me`, { headers: { 'x-api-key': key } })).json()).subscription.threads;
  const held = [];
  try {
    while (held.length < threads) {
      const r = await launch(key, { proxy: PROXY });
      if (r.status === 200) held.push(r.session_id);
      else if (r.status === 429 && r.error === 'rate_limited') await sleep(Number(r.retry_after || 1) * 1000);
      else throw new Error(`hold ${r.status} ${r.error}`);
      await sleep(300);
    }
    const over = await launch(key, { proxy: PROXY });
    if (over.status === 200) held.push(over.session_id);
    return { threads, held: Math.min(held.length, threads), over_cap: { status: over.status, error: over.error, retry_after: over.retry_after, in_use: over.in_use, meaning: meaning(over) } };
  } finally {
    for (const id of held) await end(key, id);
  }
}

const out = { language: 'node' };
out.shared = await sharedPlan();
out.community = await communityPlan();
out.dedicated = await dedicatedPlan();
await sleep(3000);
out.dedicated.threads_left = await threadsLeft(process.env.CDPFLEET_DEDICATED_API_KEY);
out.measured_at = new Date().toISOString().slice(0, 10);
console.log(JSON.stringify(out, null, 2));

What we got

LanguageShared plan (4 tries, waiting Retry-After)Community planDedicated plan, 11th launchMeasured
node0.1 s: 503 shared_capacity_full, Retry-After 5 s · 5.2 s: 503 shared_capacity_full, Retry-After 5 s · 10.3 s: 503 shared_capacity_full, Retry-After 5 s · 15.4 s: 503 shared_capacity_full, Retry-After 5 s503 shared_capacity_full, Retry-After 5 s10/10 launched, then 429 threads_exceeded, Retry-After 1 s, in_use 102026-11-27

From the Node.js run on 2026-11-27. IP addresses are replaced with placeholders (203.0.113.x); equal addresses stay equal. The other languages produced the same findings.

Raw output (Node.js)
{
  "language": "node",
  "shared": {
    "attempts": [
      {
        "at_s": 0.1,
        "status": 503,
        "error": "shared_capacity_full",
        "retry_after": "5",
        "meaning": "the fleet is full: wait Retry-After and try again"
      },
      {
        "at_s": 5.2,
        "status": 503,
        "error": "shared_capacity_full",
        "retry_after": "5",
        "meaning": "the fleet is full: wait Retry-After and try again"
      },
      {
        "at_s": 10.3,
        "status": 503,
        "error": "shared_capacity_full",
        "retry_after": "5",
        "meaning": "the fleet is full: wait Retry-After and try again"
      },
      {
        "at_s": 15.4,
        "status": 503,
        "error": "shared_capacity_full",
        "retry_after": "5",
        "meaning": "the fleet is full: wait Retry-After and try again"
      }
    ],
    "got_session": false,
    "threads_left": 0
  },
  "community": {
    "status": 503,
    "error": "shared_capacity_full",
    "retry_after": "5",
    "meaning": "the fleet is full: wait Retry-After and try again",
    "threads_left": 0
  },
  "dedicated": {
    "threads": 10,
    "held": 10,
    "over_cap": {
      "status": 429,
      "error": "threads_exceeded",
      "retry_after": "1",
      "in_use": 10,
      "meaning": "your own plan is at its thread cap: end a session or wait for one"
    },
    "threads_left": 0
  },
  "measured_at": "2026-11-27"
}

Takeaways