Quarkus saves Java Lambda! ??

It's amazing Quarkus !!!!!! Java's Lambda cold start is Chopaya! !!

I tried it with reference to the following official website.

https://quarkus.io/guides/amazon-lambda#tracing-with-aws-xray-and-graalvm

Test target

Last time AWS Lambda Java is slow? , but with the following differences. Are all Quarkus restrictions? Constraint? is.

entire source
package example;

import javax.inject.Named;

import com.amazonaws.services.lambda.runtime.Context;
import com.amazonaws.services.lambda.runtime.RequestHandler;

import software.amazon.awssdk.services.s3.S3Client;
import software.amazon.awssdk.services.s3.model.PutObjectRequest;
import software.amazon.awssdk.services.s3.model.PutObjectResponse;
import software.amazon.awssdk.core.sync.RequestBody;
import software.amazon.awssdk.regions.Region;

@Named("test")
public class TestLambda implements RequestHandler<Object, Object> {

    @Override
    public Object handleRequest(Object input, Context context) {

        String ENV_BUCKET = System.getenv("BUCKET");

        S3Client s3 = S3Client.builder()
                            .region(Region.AP_NORTHEAST_1)
                            .httpClient(software.amazon.awssdk.http.urlconnection.UrlConnectionHttpClient.builder().build())
                            .build();

        PutObjectResponse result = s3.putObject(
                PutObjectRequest.builder().bucket(ENV_BUCKET).key("filename.txt").build(),
                RequestBody.fromString("contents"));

        System.out.println(result);

        return "";
    }
}

inspection result

Number of times Latency(ms) Processing content
1 2700
2 250
3 305
4 319
5 187

Last time the cold start was 6200ms, so it was really fast!

Verification result (+ Provisioned Concurrency)

What would happen if Quarkus, who is such a chopper, is Provisioned? I'm excited.

Number of times Latency(ms) Processing content
1 417
2 198
3 206
4 270
5 147

Speed that does not disappoint! Great, Quarkus!

reference

https://quarkus.io/guides/amazon-lambda#tracing-with-aws-xray-and-graalvm https://aws.amazon.com/jp/blogs/architecture/field-notes-optimize-your-java-application-for-aws-lambda-with-quarkus/

Recommended Posts

Quarkus saves Java Lambda! ??
Hello Java Lambda
[Java] Lambda expression
Java lambda expression
java neutral lambda expression 1
Understand Java 8 lambda expressions
Java lambda expression variations
Java 8 lambda expression Feature
java lambda expression memo
About Java lambda expressions
Java lambda expression [memo]
Explain Java 8 lambda expressions
Studying Java 8 (lambda expression)
Review java8 ~ Lambda expression ~
Java lambda expression again
Use Lambda Layers with Java
[Java] Functional interface / lambda expression
Java8 stream, lambda expression summary
[Java] Introduction to lambda expressions
Build AWS Lambda with Quarkus
Java lambda expressions learned with Comparator
[Introduction to Java] About lambda expressions
About Lambda, Stream, LocalDate of Java8
Is Java on AWS Lambda slow?
Hello World on AWS Lambda + Java
Java basic learning content 9 (lambda expression)
I tried the Java framework "Quarkus"
Java
What is a lambda expression (Java)
Java
The origin of Java lambda expressions
How to use Java lambda expressions
Implement API Gateway Lambda Authorizer in Java Lambda
Now let's recap the Java lambda expression
I tried to summarize Java lambda expressions
Nowadays Java lambda expressions and Stream API
AWS Lambda with Java starting now Part 1
Working with huge JSON in Java Lambda