examples icon indicating copy to clipboard operation
examples copied to clipboard

add example for pooling browsers

Open rahulkumar66 opened this issue 6 years ago • 10 comments

this is an example for pooling browsers resulting in faster load times of pages since we not don't have to open new browser for each request . This results in improve load times especially in case of SPAs since cached resources can be reused.

rahulkumar66 avatar Aug 20 '18 12:08 rahulkumar66

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

:memo: Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here (e.g. I signed it!) and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

googlebot avatar Aug 20 '18 12:08 googlebot

CLAs look good, thanks!

googlebot avatar Aug 20 '18 12:08 googlebot

I signed it.

rahulkumar66 avatar Aug 20 '18 12:08 rahulkumar66

This fixes #14

rahulkumar66 avatar Aug 22 '18 05:08 rahulkumar66

Is it possible to add a few more examples to the demo that helps show why a pool is necessary in some cases. Otherwise it's easy just to use the same browser instance to open 2 tabs for the URLs you're using.

ebidel avatar Aug 23 '18 14:08 ebidel

The reason we are parallelizing work through browsers and not pages is because one page crash might bring down the whole browser and also each page isn't guaranteed to be totally clean (cookies and storage might bleed-through as seen here).

rahulkumar66 avatar Aug 24 '18 05:08 rahulkumar66

But that is unlikely :) The other one is a big in chrome that hopefully gets fixed soon.

I'd prefer to encourage folks to use separate browser instances only when it makes sense. It comes with much more overhead than launching a single instance. Having a demo that shows when/why you'd need to go with many instances would be more helpful IMO.

On Thu, Aug 23, 2018, 10:40 PM Rahul Kumar [email protected] wrote:

The reason we are parallelizing work through browsers and not pages is because one page crash might bring down the whole browser and also each page isn't guaranteed to be totally clean (cookies and storage might bleed-through as seen here https://bugs.chromium.org/p/chromium/issues/detail?id=754576).

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/GoogleChromeLabs/puppeteer-examples/pull/14#issuecomment-415656846, or mute the thread https://github.com/notifications/unsubscribe-auth/AAOigNgNRi0CBOgBxvKXxhW1e54Lpzaoks5uT5HQgaJpZM4WD4pV .

ebidel avatar Aug 24 '18 13:08 ebidel

i have used single browser in production and it was not stable over long periods of time maybe because i was using --single process flag. Even browserless.io recommends running multiple browsers opposed to running multiple pages

rahulkumar66 avatar Aug 27 '18 09:08 rahulkumar66

I'm not arguing the benefits for certain use cases. I'm saying we should have a demo that shows a case where you would want to do pooling.

On Mon, Aug 27, 2018, 2:36 AM Rahul Kumar [email protected] wrote:

i have used single browser in production and it was not stable over long periods of time maybe because i was using --single process flag. Even browserless.io https://docs.browserless.io/blog/2018/06/04/puppeteer-best-practices.html recommends running multiple browsers opposed to running multiple pages

I'm confused because this is an argument against keeping a pool of long running browsers open....

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/GoogleChromeLabs/puppeteer-examples/pull/14#issuecomment-416172041, or mute the thread https://github.com/notifications/unsubscribe-auth/AAOigJeh0Q54JCtldEvyBbZbs6FyvoDpks5uU72xgaJpZM4WD4pV .

ebidel avatar Aug 27 '18 15:08 ebidel

Ok i will add it

rahulkumar66 avatar Sep 04 '18 05:09 rahulkumar66