An example project showing how to enable tiered compilation on a Java AWS Lambda function.

Overview

AWS Lambda Tiered Compilation Sample

Getting started

Download or clone the repository.

To install prerequisite software:

  1. Install AWS CDK
  2. Install Apache Maven (or use your preferred IDE)
  3. Build and package the Java application in the software folder:
cd software/ExampleFunction/
mvn package
  1. Synthesize CDK. This previews changes to your AWS account before it makes them:
cd infrastructure
cdk synth
  1. Deploy the Lambda functions:
cdk deploy --outputs-file outputs.json

The API Gateway endpoint URL is displayed in the output and saved in a file named outputs.json. The contents are similar to:

{
  "ExampleTieredCompStack": {
    "apiendpoint": "https://{YOUR_UNIQUE_ID_HERE}.execute-api.eu-west-1.amazonaws.com"
  }
}

Using Artillery to load test the changes

First, install prerequisites:

  1. Install jq and Artillery Core
  2. Run the following two scripts from the /infrastructure directory:
artillery run -t $(cat outputs.json | jq -r '.ExampleTieredCompStack.apiendpoint') -v '{ "url": "/without" }' loadtest.yml
artillery run -t $(cat outputs.json | jq -r '.ExampleTieredCompStack.apiendpoint') -v '{ "url": "/with" }' loadtest.yml

Check results in Amazon CloudWatch Insights

  1. Navigate to Amazon CloudWatch.
  2. Select Logs then Logs Insights.
  3. Select the following two log groups from the drop-down list:
/aws/lambda/example-with-tiered-comp
/aws/lambda/example-without-tiered-comp
  1. Copy the following query and choose Run query:
filter @type = "REPORT"
| parse @log /\d+:\/aws\/lambda\/example-(?<function>\w+)-\w+/
| stats
count(*) as invocations,
pct(@duration, 0) as p0,
pct(@duration, 25) as p25,
pct(@duration, 50) as p50,
pct(@duration, 75) as p75,
pct(@duration, 90) as p90,
pct(@duration, 95) as p95,
pct(@duration, 99) as p99,
pct(@duration, 100) as p100
group by function, ispresent(@initDuration) as coldstart
| sort by function, coldstart

Resuts

You see results similar to:

Resuts

Security

See CONTRIBUTING for more information.

License

This library is licensed under the MIT-0 License. See the LICENSE file.

You might also like...

Pulsar airquality function

pulsar-airquality-function Developer Workspace Using JDK 8. 1.8.0_292. OPEN JDK 64-bit Server Using IntelliJ IDEA CE 2021.2 Developer Deployment Serve

Jun 27, 2022

spring-cloud-function SpEL RCE, Vultarget & Poc

spring-cloud-function SpEL RCE, Vultarget & Poc

spring-cloud-function SpEL RCE Vultarget You can build it for youself. here is the source of the Vuln App Or you can use the release which built by cc

Nov 30, 2022

This project contains a full example of an application developed using Spring Boot and GraphQL within the Java.

Spring boot GraphQL Example This project contains a full example of an application developed using GraphQL within the Java. The project includes a com

Jul 20, 2022

An assistance platform made using Spring framework that analyses your code, and helps you either to start a devops project, or to turn an existing project into a devops project using open source software (Git, Docker, Jenkins..)

An assistance platform made using Spring framework that analyses your code, and helps you either to start a devops project, or to turn an existing project into a devops project using open source software (Git, Docker, Jenkins..)

DevOpsify Description An assistance platform made using Spring framework that analyses your code, and helps you either to start a devops project, or t

Nov 8, 2022

This is an example of how conditional events can be triggered in Camunda using a simple spring boot project

This is an example of how conditional events can be triggered in Camunda using a simple spring boot project

Camunda Conditional Events Example This example is a Spring Boot Application using Camunda. In this example i'll show a variety of ways that BPMN's Co

Sep 30, 2021

This project was created as a simple example to show how we can implement the hexagonal architecture(software design) proposed by Netflix.

This project was created as a simple example to show how we can implement the hexagonal architecture(software design) proposed by Netflix.

Netflix Hexagonal Architecture Table of contents About the project Description Built with Installation Requirements to run Usage information Run Licen

Dec 20, 2022

The project is an example of using the http web client to promote synchronous and asynchronous https calls.

Web Client Consumer Java Sample The project is an example of using the http web client to promote synchronous and asynchronous https calls. Requiremen

Jan 12, 2022

Spring Boot Project Example by Evren Tan

A Complete Spring Boot Example Project A Complete Spring Boot Example Project with Spring Boot 2.6.2, JDK 17 & Maven. Table of Contents How to Contrib

Nov 28, 2022

An example FTC project using Road Runner.

Road Runner Quickstart An example FTC project using Road Runner. Note: Road Runner is in alpha and many of its APIs are incubating. Installation For m

Mar 25, 2022
Comments
  • Remove layer implementation

    Remove layer implementation

    Issue #, if available: n/a

    Description of changes: Change the implementation to an environment variable instead of a layer.

    By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

    opened by msailes 0
Owner
AWS Samples
AWS Samples
Set of project to test how fast is compilation on your computer

Бенчмарк сборки Android проектов Репозиторий содержит несколько проектов, для которые необходимо запустить тесты и зарепортить их результаты Методика

Android Broadcast 3 Jul 29, 2022
POC showing how to divide endpoint(s) among different Open-API screens

Multiple Open-API groups: Spring boot POC showing how to divide endpoint(s) among different Open-API screens Demo Link (Select definition from top rig

null 6 Dec 15, 2022
backend for a sharing app using SpringBoot, Redis, MySQL, and AWS S3.

moments_v2_backend (Work In Progress) backend for a sharing app using SpringBoot, Redis, MySQL, and AWS S3. This is the second version of my project S

Haiming Sun 53 Dec 26, 2022
AWS SaaS Boost

AWS SaaS Boost Overview AWS SaaS Boost provides organizations with ready-to-use core software elements for successfully running SaaS workloads in the

Amazon Web Services - Labs 839 Dec 27, 2022
This repository shows how to natively extend Quarkus with a custom ConfigSource to use AWS AppConfig values when injecting config properties with @ConfigProperty.

Using AWS AppConfig in a custom MicroProfile ConfigSource This repository shows how to natively extend Quarkus with a custom ConfigSource to use AWS A

AWS Samples 8 May 19, 2022
Z is a Java library providing accessible, consistent function combinators.

Fearless function combination in Java Techniques Unlock your functional programming potential with these combination techniques: Fusion Z.fuse(fn1, fn

J.R. 27 Jun 13, 2022
Spring Boot Login and Registration example with MySQL, JWT, Rest Api - Spring Boot Spring Security Login example

Spring Boot Login example with Spring Security, MySQL and JWT Appropriate Flow for User Login and Registration with JWT Spring Boot Rest Api Architect

null 58 Jan 5, 2023
Spring Boot Security Login example with JWT and H2 example

Spring Boot Security Login example with JWT and H2 example Appropriate Flow for User Login and Registration with JWT and HttpOnly Cookie Spring Boot R

null 50 Dec 21, 2022
This module explains about the example of Spring MVC + Database Integration with MySQL using Hibernate ORM with practical coding example and required JAR dependencies

SpringMVC-Database-Integration This module explains about the example of Spring MVC + Database Integration with MySQL using Hibernate ORM with practic

GowthamRaj K 3 Nov 2, 2021
🔥 强大的动态线程池,并附带监控报警功能(没有依赖中间件),完全遵循阿里巴巴编码规范。Powerful dynamic thread pool, does not rely on any middleware, with monitoring and alarm function.

?? 动态线程池(DTP)系统,包含 Server 端及 SpringBoot Client 端需引入的 Starter. 这个项目做什么? 动态线程池(Dynamic-ThreadPool),下面简称 DTP 系统 美团线程池文章 介绍中,因为业务对线程池参数没有合理配置,触发过几起生产事故,进而

longtai 3.4k Dec 30, 2022