我正在寻找API的性能改进。 我有单元测试,该调用在控制器上执行我的操作。它已完全连接到数据库,因此它更多的是集成测试,而不是简单的单元测试。 当我运行单元测试时,我的通话大约需要100毫秒,但是当我从Postman调用操作时,大约需要1700毫秒。
有人来过吗?
我们维护服务器的人已经提高了马力。 它提供了一些改进,但我们希望在600ms或更短的时间内。
看完一些日志
我发现了
2019-06-05 20:27:06.306 +00:00 [Debug] Request successfully matched the route with name 'null' and template '"api/Invoice/{clientId}/{matterId}"'.
===> 2019-06-05 20:27:06.306 +00:00 [Information] Route matched with "{action = \"GetInvoicesForClientMatter\", controller = \"Invoice\"}". Executing action "Minisoft.Api.Controllers.API.InvoiceController.GetInvoicesForClientMatter (Minisoft.Api)"
===> 2019-06-05 20:27:06.306 +00:00 [Debug] Execution plan of "authorization" filters (in the following order): ["None"]
===> 2019-06-05 20:27:06.306 +00:00 [Debug] Execution plan of "resource" filters (in the following order): ["Microsoft.AspNetCore.Mvc.ViewFeatures.Internal.SaveTempDataFilter"]
===> 2019-06-05 20:27:06.306 +00:00 [Debug] Execution plan of "action" filters (in the following order): ["Microsoft.AspNetCore.Mvc.Infrastructure.ModelStateInvalidFilter (Order: -2000)", "Microsoft.AspNetCore.Mvc.ModelBinding.UnsupportedContentTypeFilter"]
===> 2019-06-05 20:27:06.306 +00:00 [Debug] Execution plan of "exception" filters (in the following order): ["None"]
===> 2019-06-05 20:27:06.306 +00:00 [Debug] Execution plan of "result" filters (in the following order): ["Microsoft.AspNetCore.Mvc.ViewFeatures.Internal.SaveTempDataFilter"]
===> 2019-06-05 20:27:12.369 +00:00 [Debug] Attempting to bind parameter '"clientId"' of type '"System.String"' ...
看起来像“结果”过滤器的执行计划(按以下顺序):[“ Microsoft.AspNetCore.Mvc.ViewFeatures.Internal.SaveTempDataFilter”]
需要6秒才能解决
有理想吗?
Google并不是很有帮助:(