Skip to main content
Version: v2

Slow Response Times

This document explains how to troubleshoot and resolve slow response times when using Browserless BaaS (Browser as a Service). The most effective solution is choosing the regional endpoint closest to your location.

Primary Solution: Use the Closest Regional Endpoint

The most common cause of slow response times is using a regional endpoint that's geographically distant from your servers or users. Browserless operates multiple regional endpoints to minimize latency:

  • Americas: production-sfo.browserless.io (San Francisco, USA)
  • Europe: production-lon.browserless.io (London, UK) or production-ams.browserless.io (Amsterdam, Netherlands)

Geographic Recommendations

Your LocationRecommended EndpointExample WebSocket URL
North America, South Americaproduction-sfo.browserless.iowss://production-sfo.browserless.io/chromium/playwright?token=YOUR_TOKEN
Europe, Africa, Middle Eastproduction-lon.browserless.iowss://production-lon.browserless.io/chromium/playwright?token=YOUR_TOKEN
Europe (alternative)production-ams.browserless.iowss://production-ams.browserless.io/chromium/playwright?token=YOUR_TOKEN

Performance Impact

Choosing the correct regional endpoint can significantly reduce latency:

  • Cross-continental requests: 150-300ms additional latency
  • Regional requests: 10-50ms typical latency
  • Performance improvement: 3-10x faster response times

When to Contact Support

Contact Browserless support if you experience slow response times after:

  1. ✅ Switching to the closest regional endpoint
  2. ✅ Optimizing timeout settings
  3. ✅ Implementing connection reuse
  4. ✅ Testing from multiple locations

Provide the following information when contacting support:

  • Your geographic location
  • Regional endpoint being used
  • Typical response times observed
  • Sample code demonstrating the issue

Code Examples

If you're in Europe connecting to production-sfo (US West), change to production-lon for better performance. This is the most common case - European users accidentally using US endpoints.

Puppeteer Connection Optimization

const puppeteer = require('puppeteer-core');

const browser = await puppeteer.connect({
// browserWSEndpoint: 'wss://production-sfo.browserless.io/chromium/puppeteer?token=YOUR_TOKEN' // HIGH LATENCY from Europe
browserWSEndpoint: 'wss://production-lon.browserless.io/chromium/puppeteer?token=YOUR_TOKEN' // LOW LATENCY from Europe
});

Playwright Connection Optimization

const { chromium } = require('playwright-core');

const browser = await chromium.connect({
// wsEndpoint: 'wss://production-sfo.browserless.io/chromium/playwright?token=YOUR_TOKEN' // HIGH LATENCY from Europe
wsEndpoint: 'wss://production-lon.browserless.io/chromium/playwright?token=YOUR_TOKEN' // LOW LATENCY from Europe
});

Additional Performance Optimizations

1. Set Appropriate Timeouts

Configure reasonable timeout values to prevent unnecessary waiting. This timeout flag is a catch-all solution since it'll kill the browser even if something's running, which is a good step to avoid the browsers hanging and leaving zombie processes if an unhandled exception occurs:

const browser = await puppeteer.connect({
browserWSEndpoint: 'wss://production-sfo.browserless.io/?token=YOUR_TOKEN&timeout=60000'
});

2. Optimize Navigation Settings

Use appropriate wait conditions to avoid unnecessary delays. You can read our waitUntil blog post to decide which option is better for your use case:

const page = await browser.newPage();

// Only wait for DOM content, not all resources
await page.goto('https://example.com', {
waitUntil: 'domcontentloaded'
});