新的CloudWatch日志流时Lambda持续时间峰值
问题
我有一个 aws lambda,运行时间约为 2 毫秒。每次在该 lambda 日志组中创建一个新的 cloudwatch 日志流时,该 lambda 的第一次运行大约需要 15K 毫秒(x7500 因子)。
我正在寻找一种方法,使 lambda 在约 2 毫秒内永久运行,并完全避免这些持续时间尖峰。
调查细节
- 我认为这与幕后容器分配的 lambda 预热有关,因此我向该 lambda 添加了每 3 分钟恒定速率的事件桥触发器。另外,我为该 lambda 分配了预配置并发。但这并没有解决问题。
- 我有另一个 lambda,两者都使用相同的代码,但在不同的流程中运行,并且它不会发生。
- 请注意,当前没有外部流量,只有具有受控速率的事件桥触发。
- 如果相关:我在两个 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
- 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.
- I have another lambda, both are using the same code but running in a different flow and it doesn't happen to it.
- Note that currently there is no external traffic, only the event-bridge triggering which has a controlled rate.
- 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论