Skip to content

Commit bf5aeb0

Browse files
committed
tests: add README to benchmark
1 parent 8c19b86 commit bf5aeb0

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

benchmark/README.md

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Cold Start Benchmark
2+
3+
The [benchmark.sh script](./benchmark.sh) is a bash script to compare the cold-start time of using the AWS Lambda Powertools in a semi-automated way. It does so by deploying two Lambda functions which both have the aws-lambda-powertools module installed. One Lambda function will import and initialize the three main utilities (`Metrics`, `Logger`, `Tracer`), while the other one will not.
4+
5+
## Usage
6+
7+
To use the script, you should move into the benchmark folder and run the benchmark script:
8+
9+
```
10+
cd benchmark
11+
./benchmark.sh
12+
```
13+
14+
This will:
15+
16+
* Deploy a CloudFormation stack using guided SAM deployment (*you will need to answer a few questions*).
17+
* Run loops to update the memory setting of the functions to force a cold start, then invoke them. This process is repeated a number of time to get more consistent results.
18+
* Wait for the data to propagate from CloudWatch Logs to CloudWatch Logs Insights.
19+
* Run a query on CloudWatch Logs insights, looking at the **REPORT** line from the logs.
20+
* Delete the CloudFormation stack.

benchmark/benchmark.sh

+3-1
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,13 @@ wait $!
6767
echo
6868

6969
# Gather statistics
70+
# Waiting 2.5 minutes to make sure the data propagates from CloudWatch Logs
71+
# into CloudWatch Logs Insights.
7072
sleep 150
7173
return_code=0
7274
echo -n "INSTRUMENTED="
7375
get_stats $INSTRUMENTED_LOG_GROUP
7476
echo -n "REFERENCE="
7577
get_stats $REFERENCE_LOG_GROUP
7678

77-
exit $return_code
79+
exit $return_code

0 commit comments

Comments
 (0)