File tree 3 files changed +37
-15
lines changed 3 files changed +37
-15
lines changed Original file line number Diff line number Diff line change 1
1
# Benchmark
2
2
3
- ## Deploy
3
+ ## Build
4
4
5
5
``` 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
11
14
12
- cd benchmark
13
15
sam build
14
- sam deploy # maybe add '-g' for the first time
15
- cd ..
16
16
```
17
17
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
19
34
20
35
``` 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
22
37
```
23
38
24
39
## Test
Original file line number Diff line number Diff line change 1
1
version = 0.1
2
+
2
3
[default .deploy .parameters ]
3
4
stack_name = " LambdaRuntimeProxyBenchmark"
4
5
resolve_s3 = true
5
6
s3_prefix = " LambdaRuntimeProxyBenchmark"
6
7
region = " us-east-1"
7
8
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"
Original file line number Diff line number Diff line change 7
7
Runtime : nodejs20.x
8
8
CodeUri : nodejs
9
9
MemorySize : 1024
10
- Timeout : 30
10
+ Timeout : 5
11
11
12
12
Resources :
13
13
LambdaRuntimeProxyLayer :
@@ -41,5 +41,7 @@ Resources:
41
41
Method : get
42
42
43
43
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"
You can’t perform that action at this time.
0 commit comments