Memory heap : best use of page "newPage" and urls "goto"
See original GitHub issueTell us about your environment:
- Puppeteer version: puppeteer@1.11.0
- Platform / OS version: Centos 7
- URLs (if applicable): 500000 urls crawled one by one
- Node.js version: v10.14.2
I’m using puppeteer to crawl web pages. Should I create only one page to go to all urls (url by url)? or should I create a new page for each url and close it once the page is loaded (always url by url, one after the other).
The problem with the first solution (creating only one page) is the high memory use.
The memory used by the page is constantly increasing. This error is :
FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
This occurs when 1.5 GB of memory is reached.
The problem with the second solution (creation one page for each url) could be the creation/closing of 500000 pages (one page per url). Is it optimized,? Is it the the best practice?
Thanks
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (3 by maintainers)
Top Results From Across the Web
Memory heap : best use of page "newPage" and urls "goto"
The problem with the first solution (creating only one page) is the high memory use. The memory used by the page is constantly...
Read more >node.js - Managing puppeteer for memory and performance
The library puppteer-cluster (disclaimer: I'm the author) creates a pool of browsers or pages for you. It takes care of the creation, error ......
Read more >How does the paging concept work with heap and stack ...
When a process allocates memory, the corresponding page-table entries are allocated, and initialised to point to the zero page (except on ...
Read more >Puppeteer documentation - DevDocs
Puppeteer 7.1.0 API documentation with instant search, offline support, keyboard shortcuts, mobile version, and more.
Read more >Web Performance Recipes With Puppeteer - Addy Osmani
This guide has recipes for automating Web Performance measurement with Puppeteer.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It’s been over two years, but I’ve run into a similar (same?) issue and found a workaround that isn’t too tough to implement. The leak seems to happen in the
Browser
object or something related, so disconnecting and reconnecting it worked pretty well in my case. After reconnecting, you will need to reassign yourPage
references.With this, I could reload the url using the same page indefinitely, whereas before it would run out of memory in about 2 days.
https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev/qwirZaQ27E4