DUMBUSER
DUMBUSER

Reputation: 531

how to open multiple puppeteer instances without effecting it's speed

so what happening to me is when i open 1 puppeteer instance it would go fast a but the more i open the more time it need to load the URL + fill information is that a normal thing ?

const puppeteer = require('puppeteer');

(async () => {
  const browser = await puppeteer.launch();
  const page = await browser.newPage();
  await page.goto('https://example.com');
  await page.screenshot({ path: 'example.png' });

  await browser.close();
})();

Upvotes: 4

Views: 2102

Answers (1)

Matyas
Matyas

Reputation: 13702

Answer

Performance of

  1. multiple pupeteer instances and
  2. running on the same machine and
  3. testing a single application

is highly dependent on the performance of your machine (4 cored , 8 threads , corei7 7700hq)

On my local setup I could not run more than 10 parallel instances and the performance drop was noticeable the more instances I've launched.

My Story

I have faced similar challenge, when I was trying to simulate multiple users using the same application in parallel.

I know: pupeteer (and/or) similar ui-test-automation tools are not good tools for stresstesting your application; or that: there are better tools for that.

Nevertheless, my case was:

  1. Run "user-like" behavior
  2. From the other end of the world
  3. Collect HAR files - that represent network timings of the browser interacting with 10-20 different systems
  4. Analyze the behavior

My approach was - maybe this helps you:

  1. Create a puppeteer test
  2. Enable headless running
  3. Make it triggerable via curl
  4. Dockerize it
  5. Run the docker image on 10 different machines (5-10 dockerized pupeteer tests/machine)
  6. Trigger them all at once via curl

plantuml pupeteer usage scenario

Upvotes: 4

Related Questions