puppeteer-cluster icon indicating copy to clipboard operation
puppeteer-cluster copied to clipboard

Limit number of tasks per browser instance

Open fomojola opened this issue 6 years ago • 6 comments

Is there any way to limit the number of tasks used per browser instance? I'm thinking of something along the lines (perhaps) of tasksPerInstance: 1000, and then the cluster will track the number of tasks that have been used in a specific browser instance and then whenever that limit is reached will kill that browser instance and launch another, as a (potential) shield against browser memory growth. Its a technique I've seen used in other process pooling models (I think some of the Apache web server modules let you specify a maximum number of requests a worker process will serve before it is terminated and replaced with a fresh process).

fomojola avatar Jan 25 '19 18:01 fomojola

Yes, seems like a good idea to build into the library.

thomasdondorf avatar Feb 16 '19 12:02 thomasdondorf

Is this issue being developed right now ? If not, I can pick it up.

phoenix1796 avatar Apr 23 '19 05:04 phoenix1796

@phoenix1796 Feel free to open a pull request 👍

thomasdondorf avatar Apr 28 '19 17:04 thomasdondorf

This really would be helpful in managing the memory pile up...

hatemalimam avatar Jan 07 '20 18:01 hatemalimam

is there any conclustion on the memory piles up?... we are using puppeteer-cluster and its seems pretty obvious that the memory grows as times goes by, and when looking on the memory utilization it doesnt seems like anything is actually holding this memory. my only assumption is that chrome has some cache which keeps growing. we've tried to restart the puppeteer cluster after X requests but seems like it didnt helped to the mem to get down. any insight?

lechen26 avatar Jan 21 '20 06:01 lechen26

Was this ever handled? Is there a work around that will cause the memory to go down?

tomerb15 avatar Nov 19 '20 14:11 tomerb15