【Azure 应用服务】调用Azure Function经常提示超时的分析

简介: 【Azure 应用服务】调用Azure Function经常提示超时的分析

问题描述

Azure Data Factory 通过 Pipeline 调用Azure Function Http Trigger时遇到返回错误” 500 - The request timed out.”

 

问题分析

通过Azure Function的高级工具(Kudu) 查看Function 返回500错误,原因是由于达到了230秒的响应请求的时间。230 秒是 HTTP 触发的函数在响应请求时需要的最长时间,这起因于 Azure 负载均衡器的默认空闲超时,在Azure平台中,这个超时时间是无法修改的。

 

出现请求执行230秒以及以上的时间,是因为函数中处理的业务遇见了大文件操作, 对于这种处理时间较长的情况,建议考虑使用 Durable Functions 异步模式 或 延迟实际工作并返回即时响应。

  • Durable Function的异步操作:可以满足长时间运行的操作,当客户端发生请求后触发启动业务流程协调程序,目标函数会返回Http 202,其中包含值为“statusQueryGetUri”的 Location 标头。客户端轮询 Location 标头中的 URL。 客户端会继续看到包含 Location 标头的 HTTP 202 响应。实例完成或失败后,Location 标头中的终结点返回 HTTP 200。

 

 

参考资料

函数应用超时:https://docs.azure.cn/zh-cn/azure-functions/functions-scale#function-app-timeout-duration

Durable Function异步模式:https://docs.azure.cn/zh-cn/azure-functions/durable/durable-functions-overview?tabs=csharp#pattern-3-async-http-apis

相关文章
|
4天前
|
JavaScript API
【Azure Function】Function App门户上的Test/Run返回错误:Failed to fetch
Running your function in portal requires the app to explicitly accept requests from https://portal.azure.cn. This is known as cross-origin resource sharing (CORS).Configure CORS to add https://portal.azure.cn to allowed origins.
|
19天前
|
C#
【Azure Function】Function App出现System.IO.FileNotFoundException异常
Exception while executing function: xxxxxxx,The type initializer for 'xxxxxx.Storage.Adls2.StoreDataLakeGen2Reading' threw an exception. Could not load file or assembly 'Microsoft.Extensions.Configuration, Version=9.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the
113 64
|
1月前
|
JSON C# 数据格式
【Azure Function】C#独立工作模式下参数类型 ServiceBusReceivedMessage 无法正常工作
Cannot convert input parameter 'message' to type 'Azure.Messaging.ServiceBus.ServiceBusReceivedMessage' from type 'System.String'.
111 73
|
1月前
|
Java Windows
【Azure Function】部署Java Function失败:报错deploy [ERROR] Status code 401和警告 'China North 3' may not be a valid region
1:deploy [ERROR] Status code 401, (empty body). 2: China North 3 may not be a valid region,please refer to https://aka.ms/maven_function_configuration#supported-regions for values. 3:  <azure.functions.maven.plugin.version>1.36.0</azure.functions.maven.plugin.version>
38 11
|
3月前
|
中间件 Docker Python
【Azure Function】FTP上传了Python Function文件后,无法在门户页面加载函数的问题
通过FTP上传Python Function至Azure云后,出现函数列表无法加载的问题。经排查,发现是由于`requirements.txt`中的依赖包未被正确安装。解决方法为:在本地安装依赖包到`.python_packages/lib/site-packages`目录,再将该目录内容上传至云上的`wwwroot`目录,并重启应用。最终成功加载函数列表。
|
4月前
|
Linux Python
【Azure Function】Python Function部署到Azure后报错No module named '_cffi_backend'
ERROR: Error: No module named '_cffi_backend', Cannot find module. Please check the requirements.txt file for the missing module.
110 2
|
6月前
|
Python
【Azure Function】发布 Python Function 到 Azure 成功,但是无法显示Function列表
【Azure Function】发布 Python Function 到 Azure 成功,但是无法显示Function列表
|
6月前
【Azure Function】Azure Function中的Timer Trigger无法自动触发问题
【Azure Function】Azure Function中的Timer Trigger无法自动触发问题
|
6月前
|
C#
【Azure Function】Function App启动时出现 Failed to open local port 4001 错误,这是什么情况呢?
【Azure Function】Function App启动时出现 Failed to open local port 4001 错误,这是什么情况呢?

热门文章

最新文章