Skip to content

Feature request: Improve Lambda Layer Performance #1725

Open
@perpil

Description

@perpil

Use case

I've been doing some benchmarking of using the lambda layer vs bundling the SDK using esbuild. There appears to be a noticeable performance penalty in using the lambda layer on coldstarts. I'm using dynamic import and importing Tracer, Logger, Metrics and initializing each of them in my initialization. I'm also making calls to secrets manager in initialization so I've timed them and removed their impact from the normalized init duration. I'm seeing a repeatable impact of 100+ ms when using the layer.

init duration secrets loading normalized lambda layer delta notes
849 121 728 none +0 ms This is with bundling using esbuild
1089 167 922 18 +194 ms This is Lambda layer 18
994 112 882 20 +154 ms This is Lambda layer 20

It's possible I've overlooked something, and I'll admit, my sample size is low but repeatable. This has more on the esbuild flags I'm using: https://speedrun.nobackspacecrew.com/blog/2023/09/23/optimizing-lambda-coldstarts.html

Solution/User Experience

If possible, conduct a similar benchmark and explore using esbuild or other techniques that could reduce the impact of using the layer. If there remains a performance penalty vs. bundling the SDK, document it.

Alternative solutions

No response

Acknowledgment

Future readers

Please react with 👍 and your use case to help us understand customer demand.

Metadata

Metadata

Assignees

No one assigned

    Labels

    discussingThe issue needs to be discussed, elaborated, or refinedfeature-requestThis item refers to a feature request for an existing or new utilitylayersItems related to the Lambda Layers pipeline

    Type

    No type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions