我们正在使用API管理来执行一个始终运行的功能应用程序,该应用程序又调用了Azure搜索。功能应用程序会在100毫秒(通常情况下)内响应,但是API管理会间歇性地花费3到8秒来处理。我遍历了跟踪,发现延迟始终在API管理处理结果的后端步骤中(下面的后端示例跟踪)。在这种情况下,返回的数据为664字节。有谁知道是什么原因造成的,更重要的是,如何消除这种延迟?
Azure API管理实例,功能应用程序和Azure搜索都在同一区域。
"backend": [
{
"source": "forward-request",
"timestamp": "2018-10-11T13:33:54.0578250Z",
"elapsed": "00:00:00.0005890",
"data": {
"message": "Request is being forwarded to the backend service. Timeout set to 300 seconds",
"request": {
"method": "GET",
"url": "https://ommitted.azurewebsites.net/api/HollanderSearch/?hollander=125-222L&websiteId=1&retrieveAllProductNames=false&onlyRetrieveProductNames=true&numRecsToRetrieve =25&code=%2Fxu1iz0EimDFnOUvhDVaM4ZejfaW7umV3somaIDCeWJYI5RMIfNnNg%3D%3D&keyword=125-222L",
"headers": [
{
"name": "Ocp-Apim-Subscription-Key",
"value": "ommitted"
},
{
"name": "Postman-Token",
"value": "9e809f11-6e63-4422-8c3f-d61962cec6ac"
},
{
"name": "Cache-Control",
"value": "no-cache"
},
{
"name": "Accept",
"value": "*/*"
},
{
"name": "Accept-Encoding",
"value": "gzip,deflate"
},
{
"name": "User-Agent",
"value": "PostmanRuntime/7.3.0"
},
{
"name": "X-Forwarded-For",
"value": "omitted"
}
]
}
}
},
{
"source": "forward-request",
"timestamp": "2018-10-11T13:33:59.6717259Z",
"elapsed": "00:00:05.6045857",
"data": {
"response": {
"status": {
"code": 200,
"reason": "OK"
},
"headers": [
{
"name": "Pragma",
"value": "no-cache"
},
{
"name": "Transfer-Encoding",
"value": "chunked"
},
{
"name": "Content-Encoding",
"value": "gzip"
},
{
"name": "Vary",
"value": "Accept-Encoding"
},
{
"name": "Cache-Control",
"value": "no-cache"
},
{
"name": "Content-Type",
"value": "application/json; charset=utf-8"
},
{
"name": "Date",
"value": "Thu, 11 Oct 2018 13:33:59 GMT"
},
{
"name": "Expires",
"value": "-1"
},
{
"name": "Set-Cookie",
"value": "ARRAffinity=8065e5ea6c0774f598f30cd38416a122cd6afe1af34a15c7f6430e1a0fe9924c;Path=/;HttpOnly;Domain=omitted-dev.azurewebsites.net"
},
{
"name": "Server",
"value": "Microsoft-IIS/10.0"
},
{
"name": "X-Powered-By",
"value": "ASP.NET"
}
]
}
}
},
{
"source": "decompressor",
"timestamp": "2018-10-11T13:33:59.6717259Z",
"elapsed": "00:00:05.6045976",
"data": "Content-Encoding header with value `gzip` detected in message headers. Content re-compression may require to correctly apply content modification policies."
}
]