Mike K.
Mike K.

Reputation: 606

Using puppeteer cluster with multiple tabs per chrome?

My website with 100s of users needs the ability to launch headless puppeteer instances, load data into it, and take a screenshot. This works fine with one chrome at a time, but if I need to scale this process, I was looking to use puppeteer cluster so dozens of people could use this at the same time

But how can I specify the max amount of tabs (pages) that a browser can use?

const cluster = await Cluster.launch({
  concurrency: Cluster.CONCURRENCY_CONTEXT, // Using BROWSER concurrency
  maxConcurrency: 10,
  puppeteer,
  puppeteerOptions: {
    headless: true,
    args: [
      '--no-sandbox',
      '--disable-setuid-sandbox',
      '--disable-dev-shm-usage',
      // ... other args
    ],
  },
  timeout: 30000,
  retryLimit: 1,
  retryDelay: 1000,
  monitor: process.env.NODE_ENV !== 'production',
})

Upvotes: 0

Views: 18

Answers (0)

Related Questions