Download or clone the repository.
To install prerequisite software:
- Install AWS CDK
- Install Apache Maven (or use your preferred IDE)
- Build and package the Java application in the software folder:
cd software/ExampleFunction/
mvn package
- Synthesize CDK. This previews changes to your AWS account before it makes them:
cd infrastructure
cdk synth
- 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"
}
}
First, install prerequisites:
- Install jq and Artillery Core
- 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
- Navigate to Amazon CloudWatch.
- Select Logs then Logs Insights.
- Select the following two log groups from the drop-down list:
/aws/lambda/example-with-tiered-comp
/aws/lambda/example-without-tiered-comp
- 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
You see results similar to:
See CONTRIBUTING for more information.
This library is licensed under the MIT-0 License. See the LICENSE file.