匿名中间件的响应时间长 [英] Long response time in anonymous middleware

查看:55
本文介绍了匿名中间件的响应时间长的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将NestJS(与Express Server一起使用)用于项目,并尝试优化某些端点上的性能.使用Datadog时,我注意到所有端点的响应时间中约有83%花费在匿名中间件上.有谁知道这是什么中间件以及为什么要花这么长时间?

I'm using NestJS (with Express Server) for a project and trying to optimize the performance on some of the endpoints. Using Datadog I noticed that about 83% of the response time of all endpoints is spent in an anonymous middleware. Does anyone know what middleware this is and why it's taking this long?

由于类似的未解决问题,我怀疑它与框架本身有关.

I suspect that it has to do with the framework itself due to the similar unanswered question here.

推荐答案

You're welcome to go look through the source code yourself, but generally my comment is correct. Nest binds all route handlers and enhancers (guards, interceptors, pipes, and filters) as a large anonymous function, in a very abstract way (does the same thing for Fastify as far as I can tell).

这篇关于匿名中间件的响应时间长的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆