Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory Optimization Tips #75

Closed
iamshouvikmitra opened this issue Feb 27, 2020 · 7 comments
Closed

Memory Optimization Tips #75

iamshouvikmitra opened this issue Feb 27, 2020 · 7 comments
Labels

Comments

@iamshouvikmitra
Copy link

What are some of the memory and CPU optimizations we could do maybe in terms of puppeteer flags and other for running this library at scale?
Let's say the use case requires to keep the user to be logged in most of the time say 24/7 from the server side of things to keep all incoming and outgoing messages syncing to a DB and suppose we are using an EC2 instance for hosting the application.
Also, Is using some other hosted service like browserless something you guys would recommend? I am really new to headless browser space and automation using them in general.

@iamshouvikmitra
Copy link
Author

I found that initializing a client with

new Client({
                puppeteer: {
                    args: [
                        '--no-sandbox',
                        '--disable-setuid-sandbox',
                        '--disable-dev-shm-usage',
                        '--disable-accelerated-2d-canvas',
                        '--no-first-run',
                        '--no-zygote',
                        '--disable-gpu'
                      ],
                }
            })

should help but I am not sure, would appreciate your inputs.

@gabriel-tandil
Copy link
Contributor

gabriel-tandil commented Feb 27, 2020

Hi! I run it this way, I'm going to try some of these options you mentioned there.

   , args: [
          '--log-level=3', // fatal only
          '--start-maximized',
          '--no-default-browser-check',
          '--disable-infobars', 
          '--disable-web-security',
          '--disable-site-isolation-trials',
          '--no-experiments',
          '--ignore-gpu-blacklist',
          '--ignore-certificate-errors',
          '--ignore-certificate-errors-spki-list',
          '--disable-gpu',
          '--disable-extensions',
          '--disable-default-apps',
          '--enable-features=NetworkService',
          '--disable-setuid-sandbox',
          '--no-sandbox'
        ]

Greetings

@joaomirandas
Copy link
Contributor

Hi everyone, i run neutral without any args and i realized continually puppeter takes more and more memory, it's a problem if you need keep your application running 24/7.
If you have any ideia of how to decrease this amount i will be glad to know.

My memory consumption in time-window of 12Hours.
Captura de Tela 2020-02-27 às 16 42 20

Notice: I use a lot of other things inside of this docker container so don't scare with how large is my memory but essentially in how this increase with time elapsed.

@aliyss
Copy link
Collaborator

aliyss commented Feb 29, 2020

Is there a difference if it's running headless or not?

@gabriel-tandil
Copy link
Contributor

Beyond consuming less or not running it headless, having an environment without any support for a graphic system is lighter than a complete environment with window manager and other needs.

@stale
Copy link

stale bot commented Apr 1, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Apr 1, 2020
@stale stale bot closed this as completed Apr 8, 2020
@PiyushDuggal-source
Copy link

Hi everyone, i run neutral without any args and i realized continually puppeter takes more and more memory, it's a problem if you need keep your application running 24/7. If you have any ideia of how to decrease this amount i will be glad to know.

My memory consumption in time-window of 12Hours. Captura de Tela 2020-02-27 às 16 42 20

Notice: I use a lot of other things inside of this docker container so don't scare with how large is my memory but essentially in how this increase with time elapsed.

Hey did you try with arguments and compare?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants