Every week someone recommends self-hosting an open-source headless scraper to bring RAG ingestion costs down to $0. The library license really is free, so I spun up a clean Python 3.12 virtual environment and measured what Crawl4AI v0.9.6 actually consumes on disk, in live RAM, and against real-world JavaScript and WAF-protected pages.
Here are the exact numbers, the minimal script to reproduce them on your machine, and the three gotchas that will break a small Docker container on day one.
1. Disk footprint and cold-start surprises
Installing crawl4ai==0.9.6 in an empty .venv pulled 96 Python packages (playwright, patchright, scipy, numpy, lxml, nltk, unclecode-litellm, and others):
-
Install duration:
1m 34s -
.venvsize before downloading Chromium:633 MB -
First run failure: Calling
AsyncWebCrawler()immediately threw:BrowserType.launch: Executable doesn't exist at .../chrome-headless-shelluntil runningcrawl4ai-setup(or explicitly passingchannel="chrome"to use an existing browser binary).
If you build lean Alpine or 512 MB Fly.io / Railway / Render containers, the dependency tree alone changes your image size and deploy time before you fetch a single URL.
2. Reproducible memory & pruning benchmark (Python 3.12)
To capture real memory usage (not just the Python parent process), you have to sum RSS across the Python process plus all child Chromium renderer processes via psutil.
Also worth noting if you are copying 2025 tutorials: importing PruningContentFilter now raises a DeprecationWarning in v0.9.6. Switch to PruningContentFilterLXML:
import asyncio
import time
import psutil
from crawl4ai import AsyncWebCrawler, BrowserConfig, CrawlerRunConfig
from crawl4ai.content_filter_strategy import PruningContentFilterLXML
from crawl4ai.markdown_generation_strategy import DefaultMarkdownGenerator
def total_rss_mb() -> float:
proc = psutil.Process()
rss = proc.memory_info().rss
for child in proc.children(recursive=True):
try:
rss += child.memory_info().rss
except psutil.NoSuchProcess:
pass
return round(rss / (1024 * 1024), 1)
async def bench():
browser_cfg = BrowserConfig(headless=True)
md_gen = DefaultMarkdownGenerator(
content_filter=PruningContentFilterLXML(threshold=0.48, threshold_type="fixed")
)
run_cfg = CrawlerRunConfig(markdown_generator=md_gen)
urls = [
"https://quotes.toscrape.com/js/",
"https://stripe.com/pricing",
"https://www.g2.com/products/apify/reviews",
]
t0 = time.perf_counter()
async with AsyncWebCrawler(config=browser_cfg) as crawler:
print(f"Browser boot: {round((time.perf_counter() - t0) * 1000)} ms")
for url in urls:
start = time.perf_counter()
res = await crawler.arun(url=url, config=run_cfg)
ms = round((time.perf_counter() - start) * 1000)
raw_len = len(res.markdown.raw_markdown or "") if res.markdown else 0
fit_len = len(res.markdown.fit_markdown or "") if res.markdown else 0
print(
f"{url} | HTTP {res.status_code} | {ms} ms | "
f"RSS {total_rss_mb()} MB | raw={raw_len} fit={fit_len}"
)
asyncio.run(bench())
3. Real measured results across 3 live URLs
Running this against a JS SPA (quotes.toscrape.com/js/), a complex SaaS pricing DOM (stripe.com/pricing), and a DataDome-protected review page (g2.com/products/apify/reviews) with no custom proxies produced:
| Live URL | HTTP Status | Latency | Peak Total RSS | Raw Markdown | Pruned (fit_markdown) |
|---|---|---|---|---|---|
quotes.toscrape.com/js/ |
200 |
4,413 ms |
646.6 MB |
1,666 chars |
1,463 chars |
stripe.com/pricing |
200 |
4,263 ms |
659.5 MB |
74,631 chars |
33,571 chars (-55%) |
g2.com/products/apify/reviews |
403 |
2,900 ms |
582.0 MB |
1 char |
Blocked (DataDome) |
Three practical takeaways from the logs:
-
512 MB containers will OOM on page one: Browser boot took
1,126 ms, and a single active page hit659.5 MBcombined RSS. If you run Crawl4AI in production, budget at least 2 GB RAM for 1 to 2 concurrent workers (4 GB+ if you crawl concurrently). -
Never feed
raw_markdownstraight to an LLM: Onstripe.com/pricing, defaultraw_markdowndumped 74,631 characters of header menus and nav links. AddingPruningContentFilterLXMLcut token bloat by 55% down to33,571characters. -
Anti-bot walls are where "free" turns into proxy ops: On
g2.com, headless Chromium returnedHTTP 403(Blocked by anti-bot protection: DataDome captcha) and printed an upsell banner for paid Crawl4AI Cloud. Once your targets include Cloudflare or DataDome, residential proxy bandwidth plus maintenance quickly becomes the real bill.
4. Sizing your infrastructure vs. managed APIs
Self-hosting Crawl4AI is genuinely hard to beat when you already operate 2 GB+ Python servers and mostly crawl clean, unprotected documentation or blogs under Apache-2.0.
Once your workload mixes WAF-protected domains or unpredictable volume spikes, the break-even point shifts fast once you factor in VPS RAM tiers and residential proxy bandwidth. I plugged these exact memory measurements and current Dec 2026 managed API rate cards into a free interactive scraping cost calculator so you can adjust monthly page volume and anti-bot share for your own stack.
If you want to see the side-by-side latency numbers, Markdown cleanup captures, and DataDome comparison against a managed cloud API on the exact same three URLs, the full write-up is here: Firecrawl vs Crawl4AI (2026) live benchmark.
How are you handling Chromium memory limits in your own scraping containers (cgroups caps, browser pooling, or offloading hard domains to an API)? Curious what has held up best in production.

Top comments (0)