Why is remote Playwright so slow? | 52Pi Store's Forum

Why is remote Playwright so slow?


  • I've been working on a price monitoring script that collects product information from several online stores using Playwright. It runs reasonably fast when Chromium is on the same machine, but I recently tried connecting to a remote browser and noticed a huge difference in execution time. The pages themselves load without much trouble, yet extracting prices, product names and availability from a long list of items takes much longer than it does locally. I'm using separate locators to read each field, and I'm starting to wonder whether all those individual operations are slowing things down over the network. I'd prefer to keep the browser running remotely, since that would make it easier to run the script from different machines. Has anyone dealt with this kind of slowdown? Is there a better way to structure Playwright scripts when the browser isn't running locally?



  • A few extra milliseconds don't look like much until the script repeats the same trip to the browser hundreds of times. With a remote Chromium instance, every separate request has network delay attached to it, so reading the name, price and stock one field at a time can add up fast. I'd collect all the product details together and send them back in one go instead of asking the browser for each value separately. That should cut down the number of back-and-forth requests and make the whole run noticeably faster.


  • Read about using a Playwright automation tool in the cloud here: https://gologin.com/blog/playwright-automation-tool-in-the-cloud/ . Since you want to launch the same job from different machines, think about how the remote sessions themselves are organised. Separate sessions for each run will save you from one machine interfering with another, while a persistent setup can be useful when the script needs to keep cookies or logged-in states between runs. That part is worth deciding before you move more of the monitoring work away from the local machine.


Please login to reply to this topic!