BF BotFoundry
BotFoundry / 8 Bot Blueprints / selenium-grid-crawler
BOTFOUNDRY SELENIUM RUNBOOK • 1.5GB/SLOT & AUTO-DRAIN=50

BotFoundry Selenium Grid 4 Parallel Session, /dev/shm & Auto-Drain Runbook

Hosted browser-grid SaaS platforms bill $150–$600/mo per parallel WebDriver slot. Using BotFoundry’s strict 1 dedicated thread + 1.5 GB RAM per active session rule with shm_size: 2gb and automatic 50-session container draining, teams run 10 to 40+ parallel Chrome/Firefox sessions on flat-rate KVM or Ryzen hardware.

Inspect InterServer Specs for SELENIUM-GRID via BotFoundry → Compare UltaHost Tiers via BotFoundry → Load Preset in BotFoundry RAM Sizer →

BotFoundry Deterministic vCPU, RAM & Guard Matrix (BP-08 // SELENIUM-GRID)

Public rates retrieved 2026-11-12 from official vendor pricing pages cited below; promotional & renewal prices may change — always verify exact specs, term length, and renewal rates on the vendor’s official checkout page.

Concurrency Scale vCPU DDR5 RAM OS / Runtime /dev/shm & Watchdog Guard Public Tier Match (2026-11-12)
4 Parallel WebDriver Slots 4 vCPU KVM 8 GB DDR5 Ubuntu 24.04 Docker Grid shm_size: 2gb + Timeout 180s Hostinger KVM 2 ($5.99/mo)
10 Parallel WebDriver Slots 8 vCPU KVM 16–32 GB DDR5 Ubuntu 24.04 Docker Grid Drain=50 + Localhost 4444 Hostinger KVM 8 ($19.99/mo)
20 Parallel Slots + Video Sidecar 8–12 Dedicated VDS 32 GB ECC Ubuntu 24.04 Dedicated Dedicated Threads + NVMe UltaHost VDS 32GB / InterServer 32GB
40+ Multi-Browser Crawler Fleet 12–16 Core Ryzen 64–128 GB DDR5 Bare-Metal Ubuntu 24.04 Bare-Metal IPC + Price-Lock InterServer Ryzen 64GB ($89/mo)

BotFoundry Unattended Supervisor Snippet (BP-08 // SELENIUM-GRID)

BotFoundry Selenium Grid 4 Chrome node shm_size 2gb and SE_DRAIN_AFTER_SESSION_COUNT container recycling
BotFoundry Selenium Grid 4 Chrome node shm_size 2gb and SE_DRAIN_AFTER_SESSION_COUNT container recycling
docker-compose.yml — BotFoundry Selenium Grid 4 Hub (Localhost 4444) + Auto-Draining Nodes
services:
  selenium-hub:
    image: selenium/hub:4.26.0
    restart: unless-stopped
    ports:
      - "127.0.0.1:4444:4444"
    environment:
      SE_SESSION_REQUEST_TIMEOUT: 120
      SE_NODE_SESSION_TIMEOUT: 180

  chrome-node:
    image: selenium/node-chrome:4.26.0
    restart: always
    init: true
    shm_size: 2gb
    depends_on: [selenium-hub]
    deploy:
      replicas: 4
      resources:
        limits:
          memory: 3500M
    environment:
      SE_EVENT_BUS_HOST: selenium-hub
      SE_EVENT_BUS_PUBLISH_PORT: 4442
      SE_EVENT_BUS_SUBSCRIBE_PORT: 4443
      SE_NODE_MAX_SESSIONS: 2
      SE_DRAIN_AFTER_SESSION_COUNT: 50
  1. 1. Recycling Leaked Xvfb & WebDriver Descriptors via SE_DRAIN_AFTER_SESSION_COUNT on BotFoundry

    Long-lived ChromeDriver and Xvfb virtual framebuffer processes leak file descriptors across hundreds of E2E runs. Setting SE_DRAIN_AFTER_SESSION_COUNT=50 alongside restart: always gracefully drains each node after 50 sessions and boots a clean container.

  2. 2. Why BotFoundry Caps SE_NODE_MAX_SESSIONS Strictly at 1 Session per vCPU Thread

    Stuffing 8 Chrome sessions onto a 2-vCPU VM starves DOM layout threads and triggers flaky TimeoutException failures on element waits. Budget 1 vCPU thread and 1.5 GB RAM per concurrent browser session (plus +0.35 vCPU if FFmpeg video recording sidecars are enabled).

  3. 3. Locking Port 4444 to 127.0.0.1 or WireGuard in Every BotFoundry Selenium Deployment

    An unauthenticated Selenium Grid Hub port 4444 exposed on a public IP is routinely compromised within minutes by automated scanners launching arbitrary Chrome processes — always bind 127.0.0.1:4444:4444 or guard via private VPN.

BotFoundry Troubleshooting & Sizing FAQ (BP-08 // SELENIUM-GRID)

How much extra CPU does BotFoundry add when Selenium Grid 4 records MP4 session videos?

Enabling selenium/video FFmpeg sidecars adds ~0.35 vCPU and continuous sequential NVMe writes per active browser — step up to Dedicated VDS or InterServer Ryzen hardware when recording all runs.

How does BotFoundry stop hung target websites from deadlocking all Selenium Grid slots?

Enforce SE_NODE_SESSION_TIMEOUT=180 (3-minute idle session reaper), SE_SESSION_REQUEST_TIMEOUT=120, and pageLoadStrategy: "eager" inside your WebDriver client options.

When does BotFoundry recommend InterServer 64 GB Ryzen ($89/mo) over KVM slices for Grid 4?

Once concurrency crosses 20–25 heavy Chrome/Firefox sessions running 24/7, a bare-metal 12–16 core Ryzen node with 64 GB DDR5 and flat port quota outperforms stacked virtual machines on price and IPC.

Related BotFoundry Unattended Sizing Blueprints

InterServer (BP-08 BotFoundry) From $6.00/mo
Inspect Specs on BotFoundry →