amazon-web-services - lamdba 响应时间因客户端而异?
问题描述
我有一个带有 API Gateway 触发器的 Lambda,它接受 HTTP POST 并返回 JSON 响应。运行时是 Node.js 12.x。
当我使用 httpie 工具 (httpie.org) 调用此 lambda 时,响应时间在一秒内。当我使用 curl、wget 或从 chrome(使用 XMLHttpRequest)调用此 lamdda 时,响应时间约为 8 秒。
AWS Lambda Insights 和 XRay 报告以下持续时间:使用 curl、wget 或 chrome:
- 调用:8,44s
- 开销:19ms
与 httpie.org
- 调用:110ms
- 开销:57ms
我在 devtools 中使用 Chrome 的“copy as curl”复制了 chrome 通过 http 发送的请求,并使用 httpie.org 发布了所有标题
解决方案
推荐阅读
- sed - SED 替换包含 CR LF 的字符串
- c - 如何从另一个程序中同时启动两个 C 程序
- python - 如何打印单位矩阵的行
- python - 当特定文本出现在游戏聊天框中时发送击键的 Python 脚本
- reactjs - React Hooks 似乎没有从 API 设置数据
- javascript - GET 请求的响应体为空
- android - 首次启动时卡在启动画面,但如果我们不终止应用程序并再次启动应用程序,则应用程序可以正常工作。(反应原生)Android
- c - 我尝试编辑 .dat 文件,但它不起作用
- vb.net - 如何使用 Visual Studio 2008 在 VB 中获取新网站作为项目
- shell - Jenkinsfile:如何修改管道jenkins中传递的字符串参数