MicroProfile on Quarkus on AWS Lambda on Java / JVM (Amazon Corretto): ARM vs. Intel

To compare the cold- and warmstart performance of an AWS Lambda on ARM_64 (Graviton) to X86_64 (Intel), the MicroProfile with Quarkus as AWS Lambda quickstarter was used to deploy two identical lambdas deployed on Intel and Graviton on Java 11 (Amazon Corretto 11) on a fraction of vCPU (approx. 0.25) behind a Amazon HTTP API Gateway:


public class CDKStack extends Stack {

    static String FUNCTION_BASE_NAME  = "airhacks_Greetings";
    static String lambdaHandler = "io.quarkus.amazon.lambda.runtime.QuarkusStreamHandler::handleRequest";
    static int memory = 512;

    public CDKStack(Construct scope, String id, boolean httpAPIGatewayIntegration) {
        super(scope, id);
        
        var functionName = FUNCTION_BASE_NAME + "Intel";
        var intelFunction = createFunction(functionName, lambdaHandler, Architecture.X86_64,memory,"hello, intel");
        integrateWithHTTPApiGateway(functionName,intelFunction);

        functionName = FUNCTION_BASE_NAME + "ARM";
        var armFunction = createFunction(functionName, lambdaHandler, Architecture.ARM_64, memory,"hello, graviton");
        integrateWithHTTPApiGateway(functionName,armFunction);
    }

    void integrateWithHTTPApiGateway(String functionName,Function function){
        var lambdaIntegration = HttpLambdaIntegration.Builder.create(functionName+"HttpApiIntegration",function).build();
        var httpApiGateway =  HttpApi.Builder.create(this, functionName+"HttpApiIntegration").defaultIntegration(lambdaIntegration).build();
        CfnOutput.Builder.create(this, functionName+"HttpApiIntegrationOutput").value(httpApiGateway.getUrl()+"hello").build();

    }

    Function createFunction(String functionName,String functionHandler, Architecture architecture,int memory,String message) {
        var configuration = Map.of("message",message);
        return Function.Builder.create(this, functionName)
                .runtime(Runtime.JAVA_11)
                .architecture(architecture)
                .environment(configuration)
                .code(Code.fromAsset("../lambda/target/function.zip"))
                .handler(functionHandler)
                .memorySize(memory)
                .functionName(functionName)
                .build();
    }
}

The ARM configuration is a bit faster and costs less:

The MicroProfile on Quarkus as AWS Lambda quickstarter is available from github.com/AdamBien/aws-quarkus-lambda-cdk-plain.

Comments:

Post a Comment:
  • HTML Syntax: NOT allowed
Online Workshops
...the last 150 posts
...the last 10 comments
License