I have a scraping algorithm in nodejs with puppeteer which scrapes 5 pages concurrently and when it finishes with one page it pulls the next url from a queue and open it in the same page. The CPU is always at 100%. How to make puppeteer use less cpu?
This process is running on a digitaloceans droplet with 4gb of RAM and 2 vCPUs.
I've launched the puppeteer instance with some args to try to make it lighter but nothing happened
puppeteer.launch({
args: ['--no-sandbox', "--disable-accelerated-2d-canvas","--disable-gpu"],
headless: true,
});
Are there any other args I can give to make it less CPU hungry?
I've also blocked images loading
await page.setRequestInterception(true);
page.on('request', request => {
if (request.resourceType().toUpperCase() === 'IMAGE')
request.abort();
else
request.continue();
});