简体   繁体   English

在Visual Studio中调试应用时需要非常长的TTFB

[英]Extremely long TTFB while debugging app in Visual Studio

I have .NET Core MVC project with Vue.js framework which I got to maintain. 我有要维护的带有Vue.js框架的.NET Core MVC项目。

I ran into an issue which is time to full load app when debugging locally in visual studio (via IIS Express). 我在Visual Studio中本地调试时(通过IIS Express)遇到了一个问题,该是时候完全加载应用程序了。 There is several request (to my API controller) for JSON data that takes about 30-40s TTFB which makes full load in about a 1 minute. (对我的API控制器)有几个请求JSON数据的请求,大约30-40s TTFB 30至30-40s ,这将在1分钟内完成全部加载。 But when I ran the single request alone, it takes only about 4s to return data. 但是,当我单独运行单个请求时,返回数据只需要大约4s Even a small 7KB png logo take 17s TTFB, but with the same request alone it takes only 4.5s . 即使是一个很小的7KB png徽标也需要17s TTFB,但是仅凭相同的请求,它就只需4.5s

I tried all possible solutions I found on Google, MSDN and SO... Visual Studio options shenanigans, PerfView analysis, Excluding and even hiding "node_modules" file from VS, but nothing seems to improve it even a little. 我尝试了在Google,MSDN和SO上找到的所有可能的解决方案... Visual Studio选项设计,PerfView分析,甚至从VS排除甚至隐藏“ node_modules”文件,但似乎没有任何改善。

I have also my own training/test Vue.js (little bit less complex) website on the same machine and there is no problem and TTFB is under 1s . 我也在同一台机器上拥有自己的培训/测试Vue.js网站(一点点不太复杂),并且没有问题,并且TTFB在1s

VS Request: VS要求:

VS要求

Request Alone: 单独请求:

单独要求

I ran into the same problem with uploading photos to the server and TTFB time was so high without any reason (at the time). 我在将照片上传到服务器时遇到了同样的问题,并且TTFB时间太长了(当时没有任何理由)。 After digging through similar issues and debugging many times, I have found out that IIS servers do not hold services in the app pool if there is no request lately. 在研究了类似的问题并进行了多次调试之后,我发现如果最近没有请求,则IIS服务器不会在应用程序池中保存服务。 In my case it was the only first endpoint called from FE and they were hosted in different docker images. 就我而言,这是从FE调用的唯一第一个端点,它们托管在不同的docker映像中。 You can check out my questions to see my similar question. 您可以查看我的问题以查看类似的问题。

To solve the issue I added health check endpoints to every single service instance just to keep them awake, to not dropped from application pool of IIS. 为了解决该问题,我向每个服务实例添加了运行状况检查终结点,以仅使它们保持清醒状态,并且不将其从IIS应用程序池中删除。 To do that I implemented health check request with 5 min. 为此,我实施了5分钟的健康检查请求。 interval in my .NET Core Gateway project and problems seem to resolved. 我的.NET Core Gateway项目的时间间隔,问题似乎已解决。 If you're running your projects on IIS, I would suggest you to do the same. 如果您正在IIS上运行项目,建议您也这样做。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM