Skip to content

Commit 5e7664d

Browse files
committed
Add benchmark for go endpoints
1 parent 203d7d3 commit 5e7664d

File tree

8 files changed

+223
-0
lines changed

8 files changed

+223
-0
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
FROM rust:latest as builder
2+
WORKDIR /app
3+
RUN
4+
COPY . .
5+
RUN cargo install drill
6+
CMD ["./benchmark.sh"]
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
## Drill for PayForAdoption
2+
3+
Using [drill](https://github.com/fcsonline/drill), this allows to generate
4+
traffic in the PetSite EKS cluster or locally in dev, without spinning ECS
5+
traffic generator.
6+
7+
This can be useful to test all APIs or boost traffic for Application Signals.
8+
9+
### (Optional) Pick your benchmark environment
10+
11+
In the `benchmark.yaml` file, change the base URL to your PayForAdoption ALB
12+
endpoint if you are not testing it locally as the default is local.
13+
14+
```yaml
15+
concurrency: 4
16+
base: "http://Servic-payfo-[.....].eu-central-1.elb.amazonaws.com"
17+
```
18+
19+
### Running locally
20+
21+
[Install drill](https://github.com/fcsonline/drill?tab=readme-ov-file#install)
22+
and run
23+
24+
```bash
25+
drill --benchmark benchmark.yaml
26+
```
27+
28+
### Running in EKS
29+
30+
1. Authenticate against your EKS cluster
31+
32+
```bash
33+
aws eks update-kubeconfig --name PetSite --region <AWS_REGION>
34+
```
35+
36+
2. Create an ECR image `drill-payforadoption`
37+
38+
3. Build and push
39+
40+
```bash
41+
aws ecr get-login-password --region <YOUR REGION> | docker login --username AWS --password-stdin <ACCOUNT_ID>.dkr.ecr.<AWS_REGION>.amazonaws.com
42+
docker buildx build -t drill-payforadoption . --platform=linux/amd64
43+
docker tag drill-payforadoption:latest <ACCOUNT_ID>.dkr.ecr.<AWS_REGION>.amazonaws.com/drill-payforadoption:latest
44+
docker push <ACCOUNT_ID>.dkr.ecr.<AWS_REGION>.amazonaws.com/drill-payforadoption:latest
45+
```
46+
47+
4. Run in EKS
48+
49+
```bash
50+
kubectl run -it drill-payforadoption --image <ACCOUNT_ID>.dkr.ecr.<AWS_REGION>.amazonaws.com/drill-payforadoption:latest
51+
```
52+
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/usr/bin/env bash
2+
3+
while true
4+
do
5+
drill -s --benchmark benchmark.yaml
6+
sleep 1
7+
done
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
---
2+
concurrency: 4
3+
base: "http://localhost:80"
4+
iterations: 4
5+
rampup: 2
6+
7+
plan:
8+
- name: Health check
9+
request:
10+
url: /health/status
11+
method: GET
12+
13+
- name: Adopt Bunnies
14+
request:
15+
url: /api/home/completeadoption?petId={{ item }}&petType=bunny
16+
method: POST
17+
body: ""
18+
with_items:
19+
- "023"
20+
- "024"
21+
- "025"
22+
- "026"
23+
- "invalid_bunny_id"
24+
25+
- name: Adopt Kittens
26+
request:
27+
url: /api/home/completeadoption?petId={{ item }}&petType=kitten
28+
method: POST
29+
body: ""
30+
with_items:
31+
- "016"
32+
- "017"
33+
- "018"
34+
- "019"
35+
- "020"
36+
- "021"
37+
- "022"
38+
- "invalid_kitten_id"
39+
40+
- name: Adopt Puppies
41+
request:
42+
url: /api/home/completeadoption?petId={{ item }}&petType=puppy
43+
method: POST
44+
body: ""
45+
with_items:
46+
- "001"
47+
- "002"
48+
- "003"
49+
- "004"
50+
- "005"
51+
- "006"
52+
- "007"
53+
- "008"
54+
- "009"
55+
- "010"
56+
- "011"
57+
- "012"
58+
- "013"
59+
- "014"
60+
- "015"
61+
- "invalid_puppy_id"
62+
63+
- name: Cleanup Adoptions
64+
request:
65+
url: /api/home/cleanupadoptions
66+
method: POST
67+
body: ""
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
FROM rust:latest as builder
2+
WORKDIR /app
3+
RUN
4+
COPY . .
5+
RUN cargo install drill
6+
CMD ["./benchmark.sh"]
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
## Drill for PetListAdoptions
2+
3+
Using [drill](https://github.com/fcsonline/drill), this allows to generate
4+
traffic in the PetSite EKS cluster or locally in dev, without spinning ECS
5+
traffic generator.
6+
7+
This can be useful to test all APIs or boost traffic for Application Signals.
8+
9+
### (Optional) Pick your benchmark environment
10+
11+
In the `benchmark.yaml` file, change the base URL to your PetListAdoptions ALB
12+
endpoint if you are not testing it locally as the default is local.
13+
14+
```yaml
15+
concurrency: 4
16+
base: "http://Servic-lista-[...].eu-central-1.elb.amazonaws.com"
17+
```
18+
19+
### Running locally
20+
21+
[Install drill](https://github.com/fcsonline/drill?tab=readme-ov-file#install)
22+
and run
23+
24+
```bash
25+
drill --benchmark benchmark.yaml
26+
```
27+
28+
### Running in EKS
29+
30+
1. Authenticate against your EKS cluster
31+
32+
```bash
33+
aws eks update-kubeconfig --name PetSite --region <AWS_REGION>
34+
```
35+
36+
2. Create an ECR image `drill-petlistadoptions`
37+
38+
3. Build and push
39+
40+
```bash
41+
aws ecr get-login-password --region <YOUR REGION> | docker login --username AWS --password-stdin <ACCOUNT_ID>.dkr.ecr.<AWS_REGION>.amazonaws.com
42+
docker buildx build -t drill-petlistadoptions . --platform=linux/amd64
43+
docker tag drill-petlistadoptions:latest <ACCOUNT_ID>.dkr.ecr.<AWS_REGION>.amazonaws.com/drill-petlistadoptions:latest
44+
docker push <ACCOUNT_ID>.dkr.ecr.<AWS_REGION>.amazonaws.com/drill-petlistadoptions:latest
45+
```
46+
47+
4. Run in EKS
48+
49+
```bash
50+
kubectl run -it drill-petlistadoptions --image <ACCOUNT_ID>.dkr.ecr.<AWS_REGION>.amazonaws.com/drill-petlistadoptions:latest
51+
```
52+
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/usr/bin/env bash
2+
3+
while true
4+
do
5+
drill -s --benchmark benchmark.yaml
6+
sleep 1
7+
done
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
concurrency: 5
3+
base: "http://localhost:80"
4+
iterations: 100
5+
rampup: 2
6+
7+
plan:
8+
- name: Health check
9+
request:
10+
url: /health/status
11+
method: GET
12+
13+
- name: List adoptions
14+
request:
15+
url: /api/adoptionlist/
16+
method: GET
17+
18+
- name: Get Prometheus metrics
19+
request:
20+
url: /metrics
21+
method: GET
22+
23+
- name: List adoptions
24+
request:
25+
url: /api/adoptionlist/
26+
method: GET

0 commit comments

Comments
 (0)