nestjs / nest

A progressive Node.js framework for building efficient, scalable, and enterprise-grade server-side applications with TypeScript/JavaScript 🚀
https://nestjs.com
MIT License
67.69k stars 7.63k forks source link

nestjs backend crash while sending large amount of websocket connection request using jmeter - need throttle for websocket connection request. #12240

Closed icetrust0212 closed 1 year ago

icetrust0212 commented 1 year ago

Is there an existing issue for this?

Current behavior

Nestjs backend crash when I was doing performance test. I am sending large amount of websocket connection request and it crashes backend.

Minimum reproduction code

https://github.com/balance_capital/binary-options-backend

Steps to reproduce

No response

Expected behavior

I should be able to implement throttle guard for websocket connection request in websocket gateway. I know there is built-in websocket throttler in nestjs. When I use it for @SubscribeEvent('message'), it worked well. But I noticed it doesn't work for websocket connection request.

Package

Other package

No response

NestJS version

No response

Packages versions

     "@nestjs/platform-express": "^9.0.0",
    "@nestjs/platform-socket.io": "^9.2.0",
    "@nestjs/schedule": "^2.1.0",
    "@nestjs/swagger": "^6.1.4",
    "@nestjs/throttler": "^4.2.1",
    "@nestjs/typeorm": "^9.0.1",
    "@nestjs/websockets": "^9.2.1",

Node.js version

16.19.1

In which operating systems have you tested?

Other

No response

micalevisk commented 1 year ago

looks like you repository is private

hariacharya80 commented 1 year ago

@icetrust0212 repo is not publicly accessible.

kamilmysliwiec commented 1 year ago

Are you sure this is related to NestJS, not socket.io?

mowatermelon commented 1 year ago

Socket.io can be configured with maxConnections. Is the number of connections configured relatively low?

kamilmysliwiec commented 1 year ago

We rely on socket.io defaults