Back to articles
Technology Insight

Scaling Automation Testing: Building a Headless Chrome Cluster with Selenoid on VPS

May 30, 2026

Introduction to Modern Test Automation Infrastructure

In the era of continuous integration and continuous deployment (CI/CD), test automation has transitioned from a luxury to an absolute necessity. As software applications grow in complexity, the volume of automated regression tests expands exponentially. Running hundreds of UI tests sequentially is no longer viable, as it creates severe bottlenecks in the deployment pipeline. To achieve rapid feedback loops, QA engineering teams must execute tests in parallel at scale.

However, scaling traditional Selenium Grid infrastructure presents significant operational challenges. Resource management, browser crashes, zombie processes, and configuration drift frequently disrupt testing environments. This is where Selenoid steps in. Selenoid is a powerful, lightweight Selenium hub implementation that launches browsers inside isolated Docker containers. By leveraging Selenoid to build a Headless Chrome Cluster on a Virtual Private Server (VPS), organizations can achieve a robust, isolated, and highly cost-effective automation ecosystem capable of handling large-scale test execution.

Why Choose Selenoid Over Traditional Selenium Grid?

Traditional Selenium Grid architectures often suffer from stability issues over prolonged execution periods. Node machines accumulate cache, experience memory leaks, and require manual intervention to clean up frozen browser processes. Selenoid revolutionizes this paradigm by utilizing a container-driven approach.

  • Total Isolation: Every single test session runs in a brand-new, pristine Docker container. This guarantees that cookies, local storage, and browser states do not leak between test cases.
  • Precise Resource Utilization: Headless Chrome containers consume minimal CPU and RAM compared to full GUI instances, maximizing the density of parallel execution on a single VPS.
  • Version Control Flexibility: Selenoid allows you to run multiple versions of Chrome simultaneously on the same infrastructure simply by pulling the respective Docker images.
  • Automatic Cleanup: The moment a test session terminates, Selenoid automatically destroys the container, ensuring zero zombie processes and optimal resource reclamation.

Architecting the VPS Environment for Large-Scale Testing

Before deploying Selenoid, properly sizing and provisioning your Virtual Private Server is critical to ensure stability under heavy parallel loads. As a rule of thumb, each headless Chrome instance typically requires approximately 0.5 to 1 vCPU and 1GB to 1.5GB of RAM depending on the complexity of the web application under test.

For a medium-to-large scale automation framework requiring 15 to 20 parallel execution threads, we recommend the following baseline hardware specifications:

  • CPU: 8 vCPUs (Optimized or Dedicated CPU instances are preferred over shared resources).
  • Memory: 16GB - 32GB RAM to absorb peak memory spikes during intensive DOM manipulations.
  • Storage: 50GB+ NVMe SSD (Fast I/O is crucial for quick container initialization and logging).
  • OS: Ubuntu 22.04 LTS or Ubuntu 24.04 LTS for maximum compatibility with modern Docker runtimes.

Step-by-Step Guide to Configuring the Headless Chrome Cluster

Step 1: System Preparation and Docker Installation

First, access your VPS via SSH and update the package index to ensure system security and stability. Then, install Docker and Docker Compose, which serve as the foundation for our containerized cluster.

sudo apt update && sudo apt upgrade -y
sudo apt install apt-transport-https ca-certificates curl software-properties-common -y
curl -fsSL [https://download.docker.com/linux/ubuntu/gpg](https://download.docker.com/linux/ubuntu/gpg) | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] [https://download.docker.com/linux/ubuntu](https://download.docker.com/linux/ubuntu) $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt update && sudo apt install docker-ce docker-ce-cli containerd.io -y

Step 2: Configuring Selenoid Browsers (browsers.json)

Selenoid relies on a central configuration file named browsers.json to map requested browser versions to specific Docker images. Create a configuration directory and define your headless Chrome targets:

sudo mkdir -p /etc/selenoid
sudo nano /etc/selenoid/browsers.json

Insert the following JSON configuration. Notice that we utilize official Aerokube images, which are highly optimized for automated testing:

{
  "chrome": {
    "default": "latest",
    "versions": {
      "latest": {
        "image": "selenoid/chrome:latest",
        "port": "4444",
        "path": "/"
      },
      "120.0": {
        "image": "selenoid/chrome:120.0",
        "port": "4444",
        "path": "/"
      }
    }
  }
}
Pro-Tip: Always pre-pull the required browser images manually using docker pull selenoid/chrome:latest before launching your cluster to eliminate latency spikes during the initial test execution run.

Step 3: Deploying Selenoid via Docker Compose

To orchestrate Selenoid and its companion visualization dashboard, create a docker-compose.yml file in your workspace directory. This file defines the core Selenoid service, exposes the required ports, and mounts the Docker socket so Selenoid can dynamically spin up browser containers dynamically.

version: '3.8'

services:
  selenoid:
    image: aerokube/selenoid:latest-release
    container_name: selenoid
    ports:
      - "4444:4444"
    volumes:
      - "/var/run/docker.sock:/var/run/docker.sock"
      - "/etc/selenoid:/etc/selenoid:ro"
      - "/opt/selenoid/video:/opt/selenoid/video"
      - "/opt/selenoid/logs:/opt/selenoid/logs"
    command: ["-conf", "/etc/selenoid/browsers.json", "-limit", "20", "-video-output-dir", "/opt/selenoid/video", "-log-output-dir", "/opt/selenoid/logs"]
    restart: always

  selenoid-ui:
    image: aerokube/selenoid-ui:latest-release
    container_name: selenoid-ui
    ports:
      - "8080:8080"
    command: ["--selenoid-uri", "http://selenoid:4444"]
    depends_on:
      - selenoid
    restart: always

Execute docker compose up -d to initialize the entire infrastructure. Selenoid will now listen for incoming Selenium webdriver sessions on port 4444, and the real-time Selenoid UI dashboard will be accessible via port 8080.

Optimizing Headless Chrome for Peak Enterprise Performance

Running Chrome inside containers requires careful optimization to prevent excessive resource utilization. When configuring your automation framework (such as Selenium WebDriver in Java, Python, or TypeScript), you must pass specific capabilities and arguments to the RemoteWebDriver setup to trigger optimized headless mode.

Ensure your driver initialization scripts incorporate the following critical switches:

  • --headless=new: Activates the modernized, highly efficient headless architecture native to recent Chrome versions.
  • --disable-gpu: Disables hardware acceleration, saving substantial CPU cycles on headless cloud environments.
  • --no-sandbox: Prevents container permission conflicts while maintaining isolated runtime execution.
  • --disable-dev-shm-usage: Forces Chrome to use system memory instead of /dev/shm, preventing unexpected page crashes due to shared memory constraints.

By enforcing these configurations within your test runner, you drastically reduce the memory footprint per session, allowing your VPS to sustain maximum parallel throughput under stress.

Conclusion and Best Practices for Continuous Operations

Setting up a Headless Chrome cluster with Selenoid transforms how development teams approach continuous quality assurance. By replacing erratic, stateful Selenium nodes with lightweight, ephemeral Docker containers, you gain a scalable and predictable testing environment. To ensure the long-term reliability of your cluster, always implement standard maintenance routines: schedule automated cron jobs to purge old recorded videos and log files, configure robust firewall rules to restrict access to ports 4444 and 8080, and regularly monitor system memory thresholds. With this powerful infrastructure in place, your automation framework is fully equipped to deliver rapid, reliable insights at an enterprise scale.

Scaling Automation Testing: Building a Headless Chrome Cluster with Selenoid on VPS | DPTCloud