JetBrains / kotless

Kotlin Serverless Framework
Apache License 2.0
1.16k stars 58 forks source link

Feature Request - Replace Autowarm with Provisioned Concurrency #56

Open onema opened 4 years ago

onema commented 4 years ago

Background

Cold starts and Java functions have always been a bad combo.

A scheduled auto warmer does not fully resolve the issue of cold starts. Concurrent calls will still see cold starts despite the warmer, and may only be helpful for functions that seldom get called. Furthermore having an auto warmer on by default is un-expected and in some instances undesirable.

It would be better to replace the Autowarmer with Provisioned Concurrency which is a lambda feature.

Summary of the feature request

  1. Replace the auto warmer with AWS Lambda Provisioned Concurrency
  2. Allow the user to defined the desired level of concurrency
  3. Provisioned Concurrency should be off by default
TanVD commented 4 years ago

I believe we can add provisioned concurrency as an option along with autowarming. To be honest, right now we are experimenting with GraalVM and the results are very promising. https://ktor.site.kotless.io takes 3 ms for the cold start. I hope that Kotless would be able to provide simple interface to GraalVM compilation and in that case cold start would not be a problem at all.

v3rm0n commented 4 years ago

Meanwhile you can disable autowarm manually and add a custom Terraform file https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lambda_provisioned_concurrency_config

EDIT: can't actually use that since the lambda function is not published...