Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

144
Views
Speeding up Puppeteer Operations

I am currently trying to speed up my server, which uses puppeteer to scrape information whenever it receives requests from a chrome extension I am building. However, it is still quite slow despite me trying to run it concurrently. Is there a way to keep my puppeteer browser open once my server starts, so I can shave off the time it takes to open the browser each time a request is sent?

const withBrowser = async (fn) => {
    const browser = await puppeteer.launch({args: ['--no-sandbox']});
    try {
        return await fn(browser); }
    finally {
        await browser.close();
    }
}

const withPage = (browser) => async (fn) => {
    const page = await browser.newPage();
    // await page.setDefaultNavigationTimeout(0);
    // await page.setCacheEnabled(false);
    try {
        return await fn(page);
    } finally {
        await page.close();
    }
}

async function processing(urls){ 

    return await withBrowser(async (browser) => {
    return bluebird.map(urls, async (url) => {
        return withPage(browser)(async (page) => {
            await page.goto(url);
            let texts = await page.evaluate(() => {
                let data = [];
                // do work
            }
            return ["0000"];
        }
        );
    }, {concurrency: 4});
});
}
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!