Skip to content

Commit 3106932

Browse files
chore: create a keycloak 24 benchmark image (#426)
* chore: create a keycloak 24 benchmark image * chore: update benchmark test documentation * chore: point the benchmark builder back at 26 * chore: add 4th test to docs * chore: add 4th test to docs
1 parent 1deeae7 commit 3106932

File tree

4 files changed

+65
-6
lines changed

4 files changed

+65
-6
lines changed

benchmark/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@ run_job:
2222

2323
.PHONY: cleanup
2424
cleanup:
25-
oc -n $(NAMESPACE) delete job $(NAME)
25+
oc -n $(NAMESPACE) delete job $(NAME) --ignore-not-found=true
2626
oc -n $(NAMESPACE) delete secret $(NAME)-secret

benchmark/benchmark-guide.md renamed to benchmark/README.md

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
- You need a keycloak server with dataset provider added to be able to use it for generating test data
88
- To build such server image, run `.github/workflows/publish-image-keycloak-benchmark.yml` that builds an image using `docker/keycloak/Dockerfile-26-perf` that explicitly copies `docker/keycloak/dataset-providers/keycloak-benchmark-dataset-0.15-SNAPSHOT.jar` provider
9-
- Deploy keycloak server run from this image **ONLY** in a test namespace
9+
- Deploy keycloak server run from this image **ONLY** in a test namespace. See the [sso-helm-charts repo](https://github.com/bcgov/sso-helm-charts/tree/main/charts/keycloak).
1010
- After the testing is complete, uninstall the server from the namespace
1111

1212
### Runner Image
@@ -66,7 +66,6 @@ export ADMIN_PASSWORD=
6666
# using 100 users and 100 clients to make 34 req/s for a duration of upto 30 mins
6767
./bin/kcb.sh --scenario=${SCENARIO} --server-url=${SERVER_URL}/auth --admin-username=${ADMIN_USERNAME} --admin-password=${ADMIN_PASSWORD} --users-per-sec=34 --ramp-up=300 --users-per-realm=101 --measurement=1800 --clients-per-realm=101
6868
```
69-
7069
### Locally - with entrypoint.sh
7170

7271
- Create `.env` from `.env.example` and set the appropriate values for the variables
@@ -79,12 +78,33 @@ export ADMIN_PASSWORD=
7978
- Run `make cleanup` to ensure old resources get deleted
8079
- Run `make run_job` to deploy a secret and a job that executes `entrypoint.sh` script in a pod
8180

81+
## ADDITIONAL_CONFIG
82+
83+
There are four runs we have done with the previous versions of keycloak. In order for runs to be comparable the same runs should be done on future versions. These are controlled by the `ADDITIONAL_CONFIG` env var.
84+
85+
### Run 1
86+
87+
ADDITIONAL_CONFIG := "--users-per-sec=34 --ramp-up=300 --users-per-realm=101 --measurement=1800 --clients-per-realm=101"
88+
89+
### Run 2
90+
--users-per-sec=100 --ramp-up=300 --users-per-realm=5001 --measurement=1800 --clients-per-realm=301
91+
`
92+
93+
### Run 3
94+
--users-per-sec=200 --ramp-up=300 --users-per-realm=9000 --measurement=1800 --clients-per-realm=301
95+
96+
### Run 4
97+
This is a different scenerio, it is not an Auth Code flow like the other tests. The new environment vars are:
98+
99+
SCENARIO := "keycloak.scenario.authentication.ClientSecret"
100+
ADDITIONAL_CONFIG := "--users-per-sec=500 --ramp-up=300 --users-per-realm=9995 --measurement=1800 --clients-per-realm=395"
101+
82102
## Reports
83103

84104
- The html report will be generated under the `./results` directory if running locally without using `entrypoint.sh`
85105
- Running `entrypoint.sh` locally or in a pod would send the report via email to the email address set under `RECEPIENT` environment variable
86-
- Download the attachment from the email and use `base64 --decode` to decode the file
87-
- After the decode, you can extract the contents from the archive
106+
- Download the attachment from the email and use `base64 --decode` to decode the file `base64 --decode results.tar.gz>decoded_results.tar.gz`
107+
- After the decode, you can extract the contents from the archive and use the browser to preview them `file://<<PATH_TO_FILE>>/req_browser-to-log---<<TIMESTAMP>>.html`
88108

89109
## References
90110

docker/keycloak/Dockerfile-24-perf

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
FROM maven:3.8.5-openjdk-17-slim AS extensions-builder
2+
3+
COPY ./extensions-24 /tmp/
4+
WORKDIR /tmp/
5+
RUN mvn -B clean package --file pom.xml
6+
7+
FROM registry.redhat.io/rhbk/keycloak-rhel9:24-17 as builder
8+
9+
# Enable health and metrics support
10+
ENV KC_HEALTH_ENABLED=true
11+
ENV KC_METRICS_ENABLED=true
12+
13+
# Configure a database vendor
14+
ENV KC_DB=postgres
15+
16+
# un-comment when dataset required for loadtests
17+
COPY ./dataset-providers/keycloak-benchmark-dataset-0.15-SNAPSHOT.jar /opt/keycloak/providers
18+
19+
COPY --from=extensions-builder /tmp/services/target/bcgov-services-1.0.0.jar /opt/keycloak/providers/
20+
21+
WORKDIR /opt/keycloak
22+
23+
RUN /opt/keycloak/bin/kc.sh build
24+
25+
FROM registry.redhat.io/rhbk/keycloak-rhel9:24-17
26+
27+
COPY --from=builder /opt/keycloak/ /opt/keycloak/
28+
29+
# copy the theme directory to `/opt/keycloak/themes/` for now, but we can consider to archive to be deployed later.
30+
COPY ./extensions-24/themes/src/main/resources/theme /opt/keycloak/themes
31+
32+
COPY ./configuration/24/keycloak.conf /opt/keycloak/conf
33+
34+
COPY ./configuration/24/quarkus.properties /opt/keycloak/conf
35+
36+
COPY ./configuration/24/keycloak-default-user-profile.json /tmp
37+
38+
# change these values to point to a running postgres instance
39+
ENTRYPOINT ["/opt/keycloak/bin/kc.sh"]

k6/k6-runner/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ run_job:
1212

1313
.PHONY: cleanup
1414
cleanup:
15-
oc -n $(NAMESPACE) delete job sso-k6
15+
oc -n $(NAMESPACE) delete job sso-k6 --ignore-not-found=true
1616
oc -n $(NAMESPACE) delete configmap k6-config

0 commit comments

Comments
 (0)