Skip to content

Commit 68e4ecb

Browse files
committed
bench: update
1 parent f17d100 commit 68e4ecb

File tree

3 files changed

+37
-15
lines changed

3 files changed

+37
-15
lines changed

benchmark/README.md

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,39 @@
11
# Benchmark
22

3-
## Deploy
3+
## Build
44

55
```bash
6-
# run in the root of the project
7-
RUSTFLAGS="-C link-arg=-s" cargo build --release --target x86_64-unknown-linux-musl --example hello_world
8-
mkdir -p benchmark/layer
9-
cp target/x86_64-unknown-linux-musl/release/examples/hello_world benchmark/layer/
10-
cp benchmark/scripts/entry.sh benchmark/layer/
6+
rm -rf ./layer
7+
mkdir -p ./layer
8+
9+
cargo build --release --target x86_64-unknown-linux-musl --example hello_world
10+
cp ../target/x86_64-unknown-linux-musl/release/examples/hello_world ./layer
11+
12+
cp ./scripts/entry.sh ./layer
13+
chmod +x ./layer/entry.sh
1114

12-
cd benchmark
1315
sam build
14-
sam deploy # maybe add '-g' for the first time
15-
cd ..
1616
```
1717

18-
In one line
18+
## Local Test
19+
20+
Check if the proxy works as expected:
21+
22+
```bash
23+
sam local start-api
24+
```
25+
26+
In another terminal:
27+
28+
```bash
29+
curl localhost:3000/disabled
30+
curl localhost:3000/enabled
31+
```
32+
33+
## Deploy
1934

2035
```bash
21-
RUSTFLAGS="-C link-arg=-s" cargo build --release --target x86_64-unknown-linux-musl --example hello_world && mkdir -p benchmark/layer && cp target/x86_64-unknown-linux-musl/release/examples/hello_world benchmark/layer/ && cp benchmark/scripts/entry.sh benchmark/layer/ && cd benchmark && sam build && sam deploy && cd ..
36+
sam deploy -g
2237
```
2338

2439
## Test

benchmark/samconfig.toml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
version = 0.1
2+
23
[default.deploy.parameters]
34
stack_name = "LambdaRuntimeProxyBenchmark"
45
resolve_s3 = true
56
s3_prefix = "LambdaRuntimeProxyBenchmark"
67
region = "us-east-1"
78
capabilities = "CAPABILITY_IAM"
8-
image_repositories = []
9+
10+
[default.local_start_api.parameters]
11+
warm_containers = "EAGER"
12+
[default.local_start_lambda.parameters]
13+
warm_containers = "EAGER"

benchmark/template.yaml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Globals:
77
Runtime: nodejs20.x
88
CodeUri: nodejs
99
MemorySize: 1024
10-
Timeout: 30
10+
Timeout: 5
1111

1212
Resources:
1313
LambdaRuntimeProxyLayer:
@@ -41,5 +41,7 @@ Resources:
4141
Method: get
4242

4343
Outputs:
44-
API:
45-
Value: !Sub "https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/"
44+
ProxyEnabledEndpoint:
45+
Value: !Sub "https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/enabled"
46+
ProxyDisabledEndpoint:
47+
Value: !Sub "https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/disabled"

0 commit comments

Comments
 (0)