which browser is the best to crawl
# apify-platform
w
As title said I’m using chromium currently but it is cpu heavy in usage Killing browser do not kill the process and because of that it’s easy to get 100% cpu usage pretty quickly (I’m crawling thousands of websites where on each I’m looking for different data) I already try to load pure html without css, images and other assets, that helped a lot but issue is still there
h
message has been deleted
c
Hi @Wojciech I recommend also blocking unnecessary network requests. with the [blockRequests](https://crawlee.dev/api/playwright-crawler/interface/PlaywrightCrawlingContext#blockRequests) Make sure that are running it in headless mode. Also you could try using cheerio if the use-case allows it. Regarding your question about the browser: [Firefox](https://crawlee.dev/docs/examples/playwright-crawler-firefox) tends to be lighter on CPU usage.
w
yes I already do that
Copy code
typescript
   const launchContext: PlaywrightLaunchContext = {
      launcher: firefox,
      launchOptions: {
        headless: false,
        args: [
          '--no-sandbox',
          '--disable-setuid-sandbox',
          '--disable-dev-shm-usage',
        ],
      },
      useChrome: false, // Use Chromium instead of Chrome for better performance
      userAgent: userAgents[Math.floor(Math.random() * userAgents.length)],
    }
...
     launchContext,
      preNavigationHooks: [
        async ({ page }) => {
          await playwrightUtils.blockRequests(page, {
            urlPatterns: [
              '.png',
              '.jpg',
              '.jpeg',
              '.gif',
              '.svg',
              '.ico',
              '.woff',
              '.woff2',
              'adsbygoogle.js',
            ],
            extraUrlPatterns: ['adsbygoogle.js'],
          })

          await playwrightUtils.closeCookieModals(page)
        },
      ],
unfortunetly I recive:
WARN  Playwright Utils: blockRequests() helper is incompatible with non-Chromium browsers.
I didn't know that 😄
o
you can block requests manually (I mean not using util func) Example:
Copy code
const BLOCKED = ['image', 'stylesheet', 'media', 'font','other'];

Then within your preNavigationHooks of your crawler, add this function:
async ({ page }) => {
    await page.route('**/*', (route) => {
        if (BLOCKED.includes(route.request().resourceType())) return route.abort();
        return route.continue()
    });
};