Skip to content

use Lambda SnapStart to speed up cold starts #149

@hrodmn

Description

@hrodmn

I tested Lambda SnapStart out in maap-eoapi and it reduced the cold start time of the titiler-pgstac /healthz endpoint from ~6.4 seconds to ~1.5 seconds.

For any given Lambda, the changes required are:

  • Upgrade the runtime to at least Python 3.12
    • for titiler-pgstac you need to make sure libexpat.so.1 is available in LD_LIBRARY_PATH because it is not available by default in the Python 3.12 runtime
  • Add snapStart: lambda.SnapStartConf.ON_PUBLISHED_VERSIONS to the Lambda construct
  • Point the HttpLambdaIntegration at a registered version of the Lambda function
  • Update the handler with runtime hooks that determine specific things to do before taking the snapshot and after loading from a snapshot.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions