新的CloudWatch日志流时Lambda持续时间峰值

发布于 2025-01-20 11:38:37 字数 609 浏览 2 评论 0原文

问题

我有一个 aws lambda,运行时间约为 2 毫秒。每次在该 lambda 日志组中创建一个新的 cloudwatch 日志流时,该 lambda 的第一次运行大约需要 15K 毫秒(x7500 因子)。

我正在寻找一种方法,使 lambda 在约 2 毫秒内永久运行,并完全避免这些持续时间尖峰。

调查细节

  1. 我认为这与幕后容器分配的 lambda 预热有关,因此我向该 lambda 添加了每 3 分钟恒定速率的事件桥触发器。另外,我为该 lambda 分配了预配置并发。但这并没有解决问题。
  2. 我有另一个 lambda,两者都使用相同的代码,但在不同的流程中运行,并且它不会发生。
  3. 请注意,当前没有外部流量,只有具有受控速率的事件桥触发。
  4. 如果相关:我在两个 lambda 中使用带有 NLTK lib 的 python3.7,但延迟的使用的是 wordnet 的词形还原(静态定义为推荐的 此处)。

The problem

I have an aws lambda that runs by ~2ms of runtime duration. Each time a new cloudwatch log stream in that lambda's log-group is created, the first run of that lambda takes ~15K ms (x7500 factor).

I'm looking for a way to make the lambda permanently run in ~2ms, and avoid those duration spikes completely.

Investigation details

  1. I thought that it is related to lambda warmup on behind-the-scenes container allocation, so I added a event-bridge trigger by constant rate of every 3 minutes to that lambda. Also, I allocated provisioned-concurrency for that lambda. But it didn't solve the issue.
  2. I have another lambda, both are using the same code but running in a different flow and it doesn't happen to it.
  3. Note that currently there is no external traffic, only the event-bridge triggering which has a controlled rate.
  4. If it's relevant: I'm using python3.7 with NLTK lib in both lambdas but the delayed one is using wordnet's lemmatization (statically defined as recommended here).

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文