wppconnect-team / wppconnect

WPPConnect is an open source project developed by the JavaScript community with the aim of exporting functions from WhatsApp Web to the node, which can be used to support the creation of any interaction, such as customer service, media sending, intelligence recognition based on phrases artificial and many other things, use your imagination
https://wppconnect.io
Other
1.88k stars 332 forks source link

Performance issues #2051

Closed thereis closed 8 months ago

thereis commented 8 months ago

Is there any tips to improve the performance of the client? It looks for me that uses a lot of resources such as CPU rather than memory. I think that's because of puppeteer but the amount of used resources is incredibly high!

It's a 24gb RAM VM with 8 vCPUS.

image

image

I've built as a docker image and it's running on a VM with Docker.

thereis commented 8 months ago

This is my launch option:

this.client = await create({
      session: 'client',
      autoClose: 0,
      waitForLogin: true,
      headless: true,
      statusFind: (statusSession, session) => {
        console.log({ statusSession, session });
      },
      puppeteerOptions: {
        headless: true,
        userDataDir: process.env.USER_DATA_DIR || './.session-data',
        args: [
          '--no-sandbox',
          '--disable-setuid-sandbox',
          '--disable-dev-shm-usage',
          '--disable-accelerated-2d-canvas',
          '--disable-canvas-aa',
          '--disable-gl-drawing-for-tests',
          '--use-gl=desktop',
          '--no-first-run',
          '--no-zygote',
          '--single-process', // <- this one doesn't works in Windows
          '--disable-gpu',
        ],
      },
      disableWelcome: true,
      logQR: false,
      // it will send the qrcode image to discord for the user to login.
      catchQR: (qrCode: string) => {
        this.emit('wppService.onQRCode', qrCode);
      },
    });
momokang commented 8 months ago

The CPU will be high when start to launch Google, after that it's fine for me.

thereis commented 8 months ago

@momokang I've solved the problem using another library than this one. I had a lot of problems with high usage of CPU in larger groups. If you want keep optimal and a low budget for the project, use WhiskeySockets/Baileys

roysG commented 7 months ago

@momokang, do you still working wiht the new library? does it good?