3

I am at design phase for a load test setup using headless chrome controlled by Puppeteer. Whats the best approach to follow? I have thought of below two approaches.

Say I need to simulate 1000 users login.

  1. Using await puppeteer.launch() api, create 1000 headless chrome instances. And then access the login page, type user / password, hit the log in button. This looks strait forward, but it may take lot of system resources and simulation of 1000 user logins may not be possible (will it be?)

  2. Launch only one chrome instance. Create 1000 CDP sessions. However I am not sure if this approach will work, because of same cache (userDataDir) path. Is it possible to set different cache for each CDP session.

Or is there any better approach for load testing using Puppeteer?

Austin
  • 1,709
  • 20
  • 40

1 Answers1

3

Try to use puppeteer-loadtest. Another project puppeteer-cluster manage instances and optimize performance, see related post

storenth
  • 967
  • 11
  • 18
  • In puppeteer-loadtest and puppeteer-cluster, number of chrome instances will be limited. How the cache part is handled? Say I have logged-in a user with user1/password1, when I go to next user(s), it may result as logged-in user. Any idea / thought in this regard? – Austin Aug 23 '19 at 02:59
  • Please read the spec for loadtest and clusters, what about login you solution is the user rotation. You need to test those solutions related to your specific application and if you will have any issues file they to appropriate desk. CDP session can help with some kind of load as a stream of bytes to the server manually too hard to reproduce and don't forget about JS runtime vs webApi context because of eventLoop. So looks like we talk about a new product for performance testing) – storenth Aug 23 '19 at 05:09
  • 2
    @Austin Author of puppeteer-cluster here. The number of Chrome instances is not limited and you can spawn individual browsers to separate the sessions. – Thomas Dondorf Aug 23 '19 at 06:30
  • Thanks Thomas. Basic problem I am facing, if I run 40 headless instances, my laptop comes to standstill mode. I was thinking of design - Say I have one headless browser instance, and create more pages. Per page can I login for different user? Like page1, I log in for user1, pag2 I log in for user2 so on .. , will cache be a problem here or log in will be successful. – Austin Aug 23 '19 at 06:39