Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve caching of lambda layers #3

Open
acchou opened this issue Mar 5, 2019 · 0 comments
Open

Improve caching of lambda layers #3

acchou opened this issue Mar 5, 2019 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@acchou
Copy link
Collaborator

acchou commented Mar 5, 2019

Currently with AWS, using the packageJson option with faast.js causes a new Lambda Layer to be created that can be reused if the same package.json is used by future functions (only if useDependencyCaching is true, which is the default). The layers created for caching are deleted by garbage collection using the same retentionInDays value as other resources. In practice this means that every 24h the packages will be reinstalled from scratch once, which makes function creation slower than needed in most cases.

We could do one of several things to improve this:

  1. Add a separate retention period to the options, which is longer. Say, 30 days.
  2. Use a smarter caching algorithm to keep a small number of layers around. For example, deleting the layer with the oldest creation date after reaching a limit of, say, 20 layers. The limit could be configured.

Note that the longer the packages are cached, the more likely there will be minor version updates that are missed. On the other hand, more frequent updates means longer lambda creation time, and the possibility that code breaks because dependencies are quietly updated that doesn't fully respect semver.

Suggest going with 2. Not sure what to do about the quiet update problem, maybe faast.js should issue a note to the console.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant