```yaml
product: AlterLab
title: "Selenium & Playwright Resource Usage per Session | AlterLab"
comparison_context: "AlterLab is an alternative to Firecrawl, ScrapingBee, and Bright Data."
source_url: https://alterlab.io/answers/headless-browser-resource-usage-multiple-sessions
```

# Headless Browser Resource Usage Across Many Sessions

## Short answer

### How much do Selenium and Playwright sessions cost in resources, and how do you run many?

Each full browser instance typically needs 150-500 MB of RAM, plus CPU spikes during rendering. Playwright browser contexts share one browser process, so many isolated sessions cost far less than many browsers. Block images, fonts and media, cap concurrency to available memory and recycle browsers periodically. AlterLab runs this browser fleet for you.

## Step by step

1. 1
   ### Prefer contexts over browsers
   Open one browser per worker and a new context per session. Contexts isolate cookies and storage at a fraction of the memory cost.
2. 2
   ### Block heavy resources
   Abort requests for images, media and fonts you do not need. This cuts both memory and bandwidth.
3. 3
   ### Cap concurrency by memory
   Set the number of parallel sessions from measured memory per session, not CPU count, and leave headroom.
4. 4
   ### Recycle regularly
   Restart each browser after a few hundred pages to release leaked memory.

## Example

Python

```
from playwright.async_api import async_playwright

async def run(urls: list[str]) -> None:
    async with async_playwright() as p:
        browser = await p.chromium.launch()
        for url in urls:
            context = await browser.new_context()  # cheap, isolated session
            page = await context.new_page()
            await page.route("**/*.{png,jpg,jpeg,gif,woff,woff2,mp4}",
                             lambda route: route.abort())
            await page.goto(url)
            print(await page.title())
            await context.close()
        await browser.close()
```

## Frequently Asked Questions

### Is Selenium heavier than Playwright?

Per browser they are similar, since both drive the same engines. Playwright's lightweight contexts make many parallel sessions cheaper than one Selenium driver per session.

### When should I stop managing browsers myself?

When fleet size, crashes and memory tuning take more time than your extraction logic. A rendering API removes the fleet entirely and bills per page.

## Read the full guide

[How to handle JavaScript-rendered pages](https://alterlab.io/how-to/handle-javascript-rendered-pages)

## Related answers

[Keeping Canvas and WebGL Output Consistent in Headless Browsers](https://alterlab.io/answers/canvas-webgl-fingerprint-consistency-headless-browsers)[Checking Proxy Tunnel Health Before Sending Browser Commands](https://alterlab.io/answers/proxy-tunnel-health-checks-before-browser-commands)

## Try it with AlterLab

Send a URL, get the page back as HTML, markdown or JSON. Rendering, proxy rotation and retries are handled for you.

[View API docs](https://alterlab.io/docs/api/rest)

## Your first scrape. Sixty seconds.

Up to 5,000 free requests — about 5,000 direct fetch, 500 managed sessions or 250 full browser rendering requests. No credit card. 
Just a POST request.

terminal

curl -X POST https://api.alterlab.io/v1/scrape \

-H "X-API-Key: YOUR_KEY" \

-H "Content-Type: application/json" \

-d '{"url": "https://example.com", "formats": ["markdown"]}'

[Start building free](https://alterlab.io/signin)

No credit card required · Up to 5,000 free requests (about 5,000 direct fetch, 500 managed sessions or 250 full browser rendering requests) · Balance never expires