首页 > 解决方案 > 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:

与 httpie.org

我在 devtools 中使用 Chrome 的“copy as curl”复制了 chrome 通过 http 发送的请求,并使用 httpie.org 发布了所有标题

标签: amazon-web-servicesaws-lambdaaws-api-gateway

解决方案


推荐阅读