Tabs being throttled in parallel - how to give them all equal share of resources?
See original GitHub issueHello, there doesn’t seem to be a way to disable resource load scheduling in Puppeteer, or we’re doing it wrong. For our purposes, which entail a lot of pages being open in parallel, with no particular priority, we want to allocate an equal amount of resources to each page. We found that there should be a flag called
--enable-resource-load-scheduler=false
that would disable the throttling features of Chromium that were introduced recently. It doesn’t seem to have an effect, unfortunately.
Steps to reproduce
Tell us about your environment:
- Puppeteer version: 1.13
- Platform / OS version: Mac OS 10.14.3 / various Linuxes in Docker
- Node.js version: 10 LTS
What steps will reproduce the problem?
const puppeteer = require('puppeteer');
(async function main() {
const browser = await puppeteer.launch({
args:['--enable-resource-load-scheduler=false'],
headless: true,
});
const start = Date.now();
const promises = Array(10).fill(null).map(async () => {
const page = await browser.newPage();
await page.goto('https://www.booking.com');
console.log(`Page took ${Date.now() - start}ms to load.`);
});
await Promise.all(promises);
console.log(`Opening of 10 pages took ${Date.now() - start}ms.`);
await browser.close();
})();
What is the expected result? With the code above, I expect the 10 pages to load in very similar times (using booking.com because it’s quite a complex website that requires CPU power).
What happens instead? Pages load one after the other, the last one taking almost twice as much time as first one.
Page took 4520ms to load.
Page took 5151ms to load.
Page took 5346ms to load.
Page took 6411ms to load.
Page took 6733ms to load.
Page took 7451ms to load.
Page took 7498ms to load.
Page took 7570ms to load.
Page took 8187ms to load.
Page took 8755ms to load.
Opening of 10 pages took 8755ms.
The enable-resource-load-scheduler=false
might not even be the way to go, but do you have any tips on how to achieve equal power to all tabs?
Thanks.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:8 (5 by maintainers)
Top GitHub Comments
@mnmkng I didn’t know about resource load scheduler before. Why do you think it’s the culprit?
FWIW, creating pages in separate browser contexts seems to be working fine:
What about the RAM and CPU performance when there are several context / windows created? Won’t it suffer enough for example with 10 windows opened?
Would we have a similar performance having:
1 window with 10 tabs vs 10 windows with 1 tab each one?