匿名中间件的响应时间长 [英] Long response time in anonymous middleware
问题描述
我正在将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屋!