balderdashy / sails

Realtime MVC Framework for Node.js
https://sailsjs.com
MIT License
22.84k stars 1.95k forks source link

Sails's v1.5.1 routeTargetFnWrapper middleware consuming upwards of 7 seconds when number of request suddenly increases #7212

Open barshan23 opened 2 years ago

barshan23 commented 2 years ago

We're running Sail.js(v1.5.1) app. We're seeing a recent uptick in time consumptions by the routeTargetFnWrapper middleware whenever there is a sudden 2x or 3x ( from 50rpm to 100 or 150rpm) increase in number of requests.

We're getting this data via New Relic.

Is it something known ?

Node version: 10.14 Sails version sails: 1.5.1 ORM hook version sails-hook-orm: 4.0.1 Sockets hook version sails-hook-sockets: 2.0.1 DB adapter & version sails-mysql: 1.0.3 & DB version: MySQL@5.7.26 Skipper adapter & version skipper: "0.9.1",


sailsbot commented 2 years ago

@barshan23 Thanks for posting! We'll take a look as soon as possible.

In the mean time, there are a few ways you can help speed things along:

Please remember: never post in a public forum if you believe you've found a genuine security vulnerability. Instead, disclose it responsibly.

For help with questions about Sails, click here.

eashaw commented 2 years ago

Hi @barshan23, We recommend you analyze the action that is being called by the route.

You can start the server withDEBUG=true sails lift for more detail in your stack trace.

ashuvyas45 commented 2 years ago

@barshan23 i am facing the similar issue. Are you able to find any root cause for this?

HK321 commented 2 years ago

@barshan23 @eashaw I am facing the same issue; when the request rate increases, the middleware takes more time.

image
harisrt commented 2 years ago

Guys, is there any update on this?

eashaw commented 2 years ago

Hi everyone, to help us properly diagnose this error, can you share the code of the action you're seeing this issue in?

rupeshpadhye commented 1 year ago

Hi @eashaw , On production we also facing similar issue , API calls are stuck in middleware. can you guide what can be helpful to you to diagnose the issue

image

eashaw commented 1 year ago

Hi @rupeshpadhye, would you be able to share an example of the code where you're seeing this issue?

HK321 commented 1 year ago

Hey @eashaw,

In my case, the problem wasn't with the middleware. Using CDNs reduced the response time to 70-80ms from 500-600ms, so the problem was related to the region of the server and client. I am leaving this here for others incase they face this issue because of a similar reason.

rupeshpadhye commented 1 year ago

After investing a bit, the issue wasn't related with sails framework. New Relic not able to log the complete trace if the API get's timeouts and adds associate the the time with middleware.

thanks!