diff --git a/spring-petclinic/manifests/kruize-demos/petclinic.yaml b/spring-petclinic/manifests/kruize-demos/petclinic.yaml new file mode 100644 index 00000000..cdfd2d7e --- /dev/null +++ b/spring-petclinic/manifests/kruize-demos/petclinic.yaml @@ -0,0 +1,98 @@ +# 1. PetClinic Service: Fixed port 8081 and matching selectors +apiVersion: v1 +kind: Service +metadata: + name: petclinic-service + annotations: + prometheus.io/scrape: 'true' + prometheus.io/path: '/manage/prometheus' + labels: + app: petclinic-app +spec: + type: NodePort + ports: + - port: 8081 + targetPort: 8081 + nodePort: 32334 + name: petclinic-port + selector: + app: petclinic-deployment +--- +# 2. PetClinic Deployment: Updated with your specific image and labels +apiVersion: apps/v1 +kind: Deployment +metadata: + name: petclinic-sample + labels: + app: petclinic-app +spec: + replicas: 1 + selector: + matchLabels: + app: petclinic-deployment + template: + metadata: + labels: + name: petclinic-deployment + app: petclinic-deployment + app.kubernetes.io/name: "petclinic-deployment" + version: v1 + spec: + containers: + - name: petclinic-tomcat + image: quay.io/kruizehub/spring_petclinic:2.2.0-jdk-11.0.8-openj9-0.21.0 + imagePullPolicy: IfNotPresent + ports: + - containerPort: 8081 + volumeMounts: + - name: "test-volume" + mountPath: "/opt/jLogs" + # Readiness probe ensures the Load Job waits for the actual JVM to start + readinessProbe: + httpGet: + path: / + port: 8081 + initialDelaySeconds: 20 + periodSeconds: 10 + volumes: + - name: test-volume + emptyDir: {} +--- +# 3. JMeter Load Job: Coordinated to start only when Service is ready +apiVersion: batch/v1 +kind: Job +metadata: + name: petclinic-load-generator +spec: + template: + spec: + # Wait logic ensures JMeter doesn't fire into a void while Tomcat is booting + initContainers: + - name: wait-for-petclinic + image: busybox:1.28 + command: ['sh', '-c', "until nc -z petclinic-service 8081; do echo 'Waiting for PetClinic...'; sleep 2; done;"] + containers: + - name: petclinic-load + image: quay.io/kruizehub/spring_petclinic_load:jmeter_3.3 + command: ["/bin/sh", "-c"] + args: + - | + cd /jmeter/apache-jmeter-${JMETER_VERSION} + + # STAGE 1: Low Load (50 Users) + echo "Starting Stage 1: 50 Users..." + ./bin/jmeter -n -t petclinic.jmx -Jduration=900 -Jusers=50 \ + -JPETCLINIC_HOST=petclinic-service -JPETCLINIC_PORT=8081 + + # STAGE 2: Medium Load (100 Users) + echo "Starting Stage 2: 100 Users..." + ./bin/jmeter -n -t petclinic.jmx -Jduration=600 -Jusers=100 \ + -JPETCLINIC_HOST=petclinic-service -JPETCLINIC_PORT=8081 + + # STAGE 3: Peak Load (150 Users) + echo "Starting Stage 3: 150 Users..." + ./bin/jmeter -n -t petclinic.jmx -Jduration=300 -Jusers=150 \ + -JPETCLINIC_HOST=petclinic-service -JPETCLINIC_PORT=8081 + restartPolicy: Never + backoffLimit: 2 + diff --git a/spring-petclinic/manifests/kruize-demos/service-monitor.yaml b/spring-petclinic/manifests/kruize-demos/service-monitor.yaml new file mode 100644 index 00000000..396e00da --- /dev/null +++ b/spring-petclinic/manifests/kruize-demos/service-monitor.yaml @@ -0,0 +1,14 @@ +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: petclinic + labels: + team: petclinic-frontend +spec: + selector: + matchLabels: + app: petclinic-app + endpoints: + - port: petclinic-port + path: '/manage/prometheus' + diff --git a/techempower/manifests/kruize-demos/postgres.yaml b/techempower/manifests/kruize-demos/postgres.yaml new file mode 100644 index 00000000..1ee0e63b --- /dev/null +++ b/techempower/manifests/kruize-demos/postgres.yaml @@ -0,0 +1,59 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: tfb-database + labels: + app: tfb-database +spec: + replicas: 1 + selector: + matchLabels: + app: tfb-database + template: + metadata: + labels: + name: tfb-database + app: tfb-database + # Add label to the application which is used by kruize/autotune to monitor it + app.kubernetes.io/name: "tfb-database" + version: v1 + spec: + containers: + - name: tfb-database + image: quay.io/kruizehub/tfb-postgres:openshift + imagePullPolicy: IfNotPresent + env: + - name: POSTGRESQL_USER + value: benchmarkdbuser + - name: POSTGRESQL_PASSWORD + value: benchmarkdbpass + - name: POSTGRESQL_DATABASE + value: hello_world + lifecycle: + postStart: + exec: + command: ["/bin/sh", "-c", "sleep 10 && psql -a hello_world < /tmp/create-postgres-data.sql"] + ports: + - containerPort: 5432 + resources: + requests: + cpu: 0.5 + memory: "512Mi" + limits: + cpu: 2 + memory: "1024Mi" +--- +apiVersion: v1 +kind: Service +metadata: + name: tfb-database + labels: + name: tfb-database +spec: + type: ClusterIP + selector: + app: tfb-database + ports: + - protocol: TCP + port: 5432 + targetPort: 5432 diff --git a/techempower/manifests/kruize-demos/quarkus-resteasy-hibernate.yaml b/techempower/manifests/kruize-demos/quarkus-resteasy-hibernate.yaml new file mode 100644 index 00000000..555522ca --- /dev/null +++ b/techempower/manifests/kruize-demos/quarkus-resteasy-hibernate.yaml @@ -0,0 +1,124 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: tfb-qrh-sample + labels: + app: tfb-qrh-app +spec: + replicas: 1 + selector: + matchLabels: + app: tfb-qrh-deployment + template: + metadata: + labels: + name: tfb-qrh-deployment + app: tfb-qrh-deployment + # Add label to the application which is used by kruize/autotune to monitor it + app.kubernetes.io/name: "tfb-qrh-deployment" + app.kubernetes.io/layer: "quarkus" + version: v1 + spec: + volumes: + - name: test-volume + emptyDir: {} + containers: + - name: tfb-server + image: quay.io/kruizehub/tfb-qrh:1.13.2.F_et17 + imagePullPolicy: IfNotPresent + env: + - name: "JAVA_OPTIONS" + value: "-server" + ports: + - containerPort: 8080 + resources: + requests: + cpu: 1.5 + memory: "512Mi" + limits: + cpu: 3.5 + memory: "2048Mi" + volumeMounts: + - name: "test-volume" + mountPath: "/opt/jLogs" +--- +apiVersion: batch/v1 +kind: Job +metadata: + name: tfb-qrh-load-generator +spec: + template: + spec: + terminationGracePeriodSeconds: 0 + # Wait for Quarkus to be ready before starting the load + initContainers: + - name: wait-for-tfb + image: busybox:1.28 + command: ['sh', '-c'] + args: + - | + echo "Waiting for TFB (/plaintext) to be ready..." + for i in $(seq 1 120); do + if wget -qO- http://tfb-qrh-service:8080/plaintext > /dev/null; then + echo "TFB is ready!" + exit 0 + fi + echo "Waiting for app... ($i/120)" + sleep 1 + done + echo "ERROR: TFB did not respond in 2 minutes." + exit 1 + containers: + - name: tfb-qrh-load + image: quay.io/kruizehub/tfb_hyperfoil_load:0.25.2 + env: + - name: TARGET + value: "tfb-qrh-service:8080" + command: ["/bin/sh", "-c"] + args: + - | + echo "Starting 30-minute Multi-Endpoint Benchmark..." + + # --- PHASE 1: Combined Ramp-up (5 mins) --- + for conn in 50 150 300; do + echo "Ramping up: ${conn} connections..." + /opt/run_hyperfoil_load.sh $TARGET "plaintext" 30 12 $conn + /opt/run_hyperfoil_load.sh $TARGET "db" 30 12 $conn + /opt/run_hyperfoil_load.sh $TARGET "queries?queries=20" 40 12 $conn + done + + # --- PHASE 2: Plaintext (CPU focus - 8 mins) --- + echo "Phase 2: High Throughput (Plaintext)..." + /opt/run_hyperfoil_load.sh $TARGET "plaintext" 480 12 400 + + # --- PHASE 3: DB Query (Pool focus - 8 mins) --- + echo "Phase 3: DB Driver & Connection Pool..." + /opt/run_hyperfoil_load.sh $TARGET "db" 480 12 400 + + # --- PHASE 4: Hibernate (Memory focus - 9 mins) --- + echo "Phase 4: Complex ORM & Memory Allocation..." + /opt/run_hyperfoil_load.sh $TARGET "queries?queries=20" 540 12 500 + + echo "Full benchmark complete. Entering 2-minute cooldown..." + sleep 120 + restartPolicy: Never + backoffLimit: 1 + +--- +apiVersion: v1 +kind: Service +metadata: + name: tfb-qrh-service + annotations: + prometheus.io/scrape: 'true' + prometheus.io/path: '/q/metrics' + labels: + app: tfb-qrh-app +spec: + type: NodePort + ports: + - port: 8080 + targetPort: 8080 + name: tfb-qrh-port + selector: + name: tfb-qrh-deployment diff --git a/techempower/manifests/kruize-demos/service-monitor.yaml b/techempower/manifests/kruize-demos/service-monitor.yaml new file mode 100644 index 00000000..62898b69 --- /dev/null +++ b/techempower/manifests/kruize-demos/service-monitor.yaml @@ -0,0 +1,13 @@ +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: tfb-qrh + labels: + team: tfb-qrh-frontend +spec: + selector: + matchLabels: + app: tfb-qrh-app + endpoints: + - port: tfb-qrh-port + path: '/q/metrics'