Introduction
This guide explains how to architect production-scale browser automation systems using Kernel, how to handle high-concurrency workloads, and best practices for building resilient systems. After understanding the basics of our browsers, you should understand how to create and connect to individual browsers on-demand. This guide builds on that foundation to help you design systems using browser pools that can handle hundreds or thousands of concurrent browser tasks reliably.Understanding your requirements
Before selecting an architecture, assess your workload’s characteristics: Concurrency: How many browsers need to run simultaneously?- Low (1-50): On-demand browser creation is sufficient
- Medium (50-100): Pre-configuring browser pools provides significant benefits
- High (100+): Use multiple pools with queuing
- Steady state: Size your pool to match average load
- Bursty traffic: Size for burst capacity or implement queuing
- Scheduled batches: Pre-configure pools to match batch processing size
- Flexible (a few per hour or day): On-demand creation may suffice
- Moderate (a few per minute): Pools provide noticeable improvement
- High (many per second): Browser pools are essential
Architecture patterns
Direct browser creation (POC)
For proof-of-concept work and early production systems with modest concurrency needs, creating browsers on-demand is the simplest approach. When to use:- Processing fewer than 50 concurrent tasks
- Infrequent, unpredictable workloads
- Early development and testing
Example
Example
Single browser pool (scaling)
For production systems with consistent, high-frequency workloads, a browser pool allows you to access higher concurrency plus predictable performance. When to use:- 50-100+ concurrent tasks with consistent configuration
- Steady request patterns
Example
Example
- Pool size should match your typical concurrency
- Always release browsers in a
finallyblock to prevent pool exhaustion - Set
acquire_timeout_secondsbased on your SLA requirements
Queue-based processing (high scale)
For systems exceeding pool capacity or with unpredictable bursts, implement a task queue to manage workloads gracefully. When to use:- Request volume exceeds maximum pool capacity (100+ concurrent)
- Highly variable traffic patterns
- Need to prioritize certain tasks
- Want to decouple request ingestion from processing
Example
Example
- Set worker concurrency to match or slightly exceed pool size
- Implement proper retry logic for transient failures
- Monitor queue depth to scale pools dynamically
- Use priority queues for different SLAs

