quarkusio / quarkus

Quarkus: Supersonic Subatomic Java.
https://quarkus.io
Apache License 2.0
13.57k stars 2.63k forks source link

RESTful Quarkus serverless cold start times are very slow on AWS #10186

Closed zkhan96 closed 1 year ago

zkhan96 commented 4 years ago

Describe the bug I seem to have cold start times of 11s when doing any rest call to my quarkus app in AWS lambda deployed by sam deploy

The app is using API gateway as a proxy to talk to an endpoint on the app.

The app connects to RDS PostgreSQL using a custom credentials provider, does a GET on a very small payload, and returns the JSON to the client.

Expected behaviour Cold start times of 1s.

To Reproduce I am running the quarkus app in JVM mode and building the uber jar by doing:

Configuration

  quarkus:
    datasource:
      credentials-provider: custom
      credentials-provider-name: pg-credentials-provider
      jdbc:
        url: jdbc:postgresql://some-cluster-name
  custom:
    host: some-rds-host-for-custom-credentials-provider

Screenshots Screenshot 2020-06-23 at 11 04 45

A GET on the /health endpoint using the quarkus-smallrye-health extension

Environment (please complete the following information):

Build time: 2020-06-02 20:46:21 UTC Revision: a27f41e4ae5e8a41ab9b19f8dd6d86d7b384dad4

Kotlin: 1.3.72 Groovy: 2.5.11 Ant: Apache Ant(TM) version 1.10.7 compiled on September 1 2019 JVM: 11.0.4 (AdoptOpenJDK 11.0.4+11) OS: Mac OS X 10.14.6 x86_64


**Additional context**
Here are all my dependencies from my build.gradle:
implementation enforcedPlatform("${quarkusPlatformGroupId}:${quarkusPlatformArtifactId}:${quarkusPlatformVersion}")
compileOnly 'org.projectlombok:lombok:1.18.12'
annotationProcessor 'org.projectlombok:lombok:1.18.12'
implementation 'org.lorislab.quarkus:quarkus-hibernate-types:0.1.2'
implementation 'io.quarkus:quarkus-config-yaml'
implementation 'io.quarkus:quarkus-amazon-lambda-http'
implementation 'io.quarkus:quarkus-resteasy'
implementation 'io.quarkus:quarkus-resteasy-jackson'
implementation 'io.quarkus:quarkus-jdbc-postgresql'
implementation 'io.quarkus:quarkus-hibernate-orm'
implementation 'io.quarkus:quarkus-logging-json'
implementation 'io.quarkus:quarkus-spring-data-jpa'
implementation 'io.quarkus:quarkus-smallrye-health'
implementation group: 'com.amazonaws', name: 'aws-java-sdk-rds', version: '1.11.804'

testCompile 'org.testcontainers:junit-jupiter:1.12.5'
testCompile 'org.testcontainers:postgresql:1.12.5'
testImplementation 'io.quarkus:quarkus-junit5'
testImplementation 'io.rest-assured:rest-assured'
testCompile 'io.quarkus:quarkus-junit5-mockito'
testCompileOnly 'org.projectlombok:lombok:1.18.12'
testAnnotationProcessor 'org.projectlombok:lombok:1.18.12'
testCompile 'io.quarkus:quarkus-flyway'
Here is the cloudwatch log:

Duration: 5461.09 ms Billed Duration: 5500 ms Memory Size: 512 MB Max Memory Used: 220 MB Init Duration: 5009.05 ms

martinoneutrino commented 3 years ago

What is the performance with the lambda given a 2048MB memory allocation? Lambda CPU is proporational to memory assigned, and with millisecond billing now, it makes sense to increase the memory to get a nearly proportionally faster response time.

geoand commented 1 year ago

Is this still an issue with the latest Quarkus versions?

geoand commented 1 year ago

Closing for lack of feedback.