Skip to content

Commit

Permalink
Add a load test to test h1-accesslog-enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
AzeemMuzammil committed Jun 5, 2024
1 parent c5e7370 commit a8d2f46
Show file tree
Hide file tree
Showing 15 changed files with 266 additions and 1 deletion.
14 changes: 14 additions & 0 deletions load-tests/h1_accesslog_enabled/deployment/deployment-patch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: "apps/v1"
kind: Deployment
metadata:
name: no-name
spec:
template:
metadata:
labels:
logs: "true"
spec:
containers:
- name: "h1-accesslog-enable-deployment"
imagePullPolicy: Always

24 changes: 24 additions & 0 deletions load-tests/h1_accesslog_enabled/deployment/ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: h1-accesslog-enabled
annotations:
kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/ssl-passthrough: "true"
nginx.ingress.kubernetes.io/backend-protocol: "HTTPS"
spec:
rules:
- host: bal.perf.test
http:
paths:
- path: "/"
pathType: Prefix
backend:
service:
name: h1-accesslog-enable
port:
number: 9090
tls:
- hosts:
- "bal.perf.test"
15 changes: 15 additions & 0 deletions load-tests/h1_accesslog_enabled/deployment/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
resources:
- h1_accesslog_enabled.yaml
- ingress.yaml
- netty-backend.yaml
patches:
- path: deployment-patch.yaml
target:
group: apps
version: v1
kind: Deployment
name: h1-accesslog-enable-deployment
- path: secret-patch.yaml
target:
version: v1
kind: Secret
35 changes: 35 additions & 0 deletions load-tests/h1_accesslog_enabled/deployment/netty-backend.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: netty-backend
spec:
replicas: 1
selector:
matchLabels:
app: netty-backend
template:
metadata:
labels:
app: netty-backend
logs: "true"
spec:
containers:
- name: netty-container
image: ldclakmal/netty-echo-backend:latest
ports:
- containerPort: 8688
env:
- name: "SSL"
value: "true"

---
apiVersion: v1
kind: Service
metadata:
name: netty
spec:
type: ClusterIP
ports:
- port: 8688
selector:
app: netty-backend
6 changes: 6 additions & 0 deletions load-tests/h1_accesslog_enabled/deployment/secret-patch.yaml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions load-tests/h1_accesslog_enabled/results/summary.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Label,# Samples,Average,Median,90% Line,95% Line,99% Line,Min,Max,Error %,Throughput,Received KB/sec,Std. Dev.,Date,Payload,Users
80 changes: 80 additions & 0 deletions load-tests/h1_accesslog_enabled/scripts/http-post-request.jmx
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
<?xml version="1.0" encoding="UTF-8"?>
<jmeterTestPlan version="1.2" properties="4.0" jmeter="4.0 r1823414">
<hashTree>
<TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="Test Plan" enabled="true">
<stringProp name="TestPlan.comments"></stringProp>
<boolProp name="TestPlan.functional_mode">false</boolProp>
<boolProp name="TestPlan.tearDown_on_shutdown">true</boolProp>
<boolProp name="TestPlan.serialize_threadgroups">false</boolProp>
<elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
<collectionProp name="Arguments.arguments"/>
</elementProp>
<stringProp name="TestPlan.user_define_classpath"></stringProp>
</TestPlan>
<hashTree>
<ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Users" enabled="true">
<stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
<elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true">
<boolProp name="LoopController.continue_forever">false</boolProp>
<intProp name="LoopController.loops">-1</intProp>
</elementProp>
<stringProp name="ThreadGroup.num_threads">${__P(users)}</stringProp>
<stringProp name="ThreadGroup.ramp_time">${__P(rampUpPeriod,60)}</stringProp>
<boolProp name="ThreadGroup.scheduler">true</boolProp>
<stringProp name="ThreadGroup.duration">${__P(duration)}</stringProp>
<stringProp name="ThreadGroup.delay"></stringProp>
</ThreadGroup>
<hashTree>
<HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="HTTP Request" enabled="true">
<elementProp name="HTTPsampler.Files" elementType="HTTPFileArgs">
<collectionProp name="HTTPFileArgs.files">
<elementProp name="${__P(payload)}" elementType="HTTPFileArg">
<stringProp name="File.path">${__P(payload, /home/anjana/repos/ballerina-performance/scripts/payloads/1024B.json)}</stringProp>
<stringProp name="File.paramname"></stringProp>
<stringProp name="File.mimetype"></stringProp>
</elementProp>
</collectionProp>
</elementProp>
<elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
<collectionProp name="Arguments.arguments"/>
</elementProp>
<stringProp name="HTTPSampler.domain">${__P(host,localhost)}</stringProp>
<stringProp name="HTTPSampler.port">${__P(port,9090)}</stringProp>
<stringProp name="HTTPSampler.protocol">${__P(protocol,http)}</stringProp>
<stringProp name="HTTPSampler.contentEncoding"></stringProp>
<stringProp name="HTTPSampler.path">${__P(path)}</stringProp>
<stringProp name="HTTPSampler.method">POST</stringProp>
<boolProp name="HTTPSampler.follow_redirects">true</boolProp>
<boolProp name="HTTPSampler.auto_redirects">false</boolProp>
<boolProp name="HTTPSampler.use_keepalive">true</boolProp>
<boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
<stringProp name="HTTPSampler.embedded_url_re"></stringProp>
<stringProp name="HTTPSampler.implementation">HttpClient4</stringProp>
<stringProp name="HTTPSampler.connect_timeout">10000</stringProp>
<stringProp name="HTTPSampler.response_timeout">30000</stringProp>
</HTTPSamplerProxy>
<hashTree>
<HeaderManager guiclass="HeaderPanel" testclass="HeaderManager" testname="HTTP Header Manager" enabled="true">
<collectionProp name="HeaderManager.headers">
<elementProp name="" elementType="Header">
<stringProp name="Header.name">Content-Type</stringProp>
<stringProp name="Header.value">application/json</stringProp>
</elementProp>
</collectionProp>
</HeaderManager>
<hashTree/>
<ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true">
<collectionProp name="Asserion.test_strings">
<stringProp name="-196708348">${__P(response_size)}</stringProp>
</collectionProp>
<stringProp name="Assertion.custom_message"></stringProp>
<stringProp name="Assertion.test_field">Assertion.response_data</stringProp>
<boolProp name="Assertion.assume_success">false</boolProp>
<intProp name="Assertion.test_type">16</intProp>
</ResponseAssertion>
<hashTree/>
</hashTree>
</hashTree>
</hashTree>
</hashTree>
</jmeterTestPlan>
22 changes: 22 additions & 0 deletions load-tests/h1_accesslog_enabled/scripts/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash -e
# Copyright 2021 WSO2 Inc. (http://wso2.org)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# ----------------------------------------------------------------------------
# Execution script for ballerina performance tests
# ----------------------------------------------------------------------------
set -e
source base-scenario.sh

jmeter -n -t "$scriptsDir/"http-post-request.jmx -l "$resultsDir/"original.jtl -Jusers="$concurrent_users" -Jduration=1800 -Jhost=bal.perf.test -Jport=443 -Jprotocol=https -Jpath=passthrough $payload_flags
7 changes: 7 additions & 0 deletions load-tests/h1_accesslog_enabled/src/Ballerina.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[package]
org = "wso2"
name = "h1_accesslog_enabled"
version = "0.0.1"

[build-options]
cloud = "k8s"
13 changes: 13 additions & 0 deletions load-tests/h1_accesslog_enabled/src/Cloud.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[container.image]
repository= "ballerina"
name="h1_accesslog_enabled"

[cloud.deployment]
min_memory="256Mi"
max_memory="1024Mi"
min_cpu="200m"
max_cpu="2000m"

[cloud.deployment.autoscaling]
min_replicas=1
max_replicas=1
3 changes: 3 additions & 0 deletions load-tests/h1_accesslog_enabled/src/Config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[ballerina.http.accessLogConfig]
console = true
format = "json"
45 changes: 45 additions & 0 deletions load-tests/h1_accesslog_enabled/src/h1_accesslog_enabled.bal
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// Copyright (c) 2024 WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
//
// WSO2 Inc. licenses this file to you under the Apache License,
// Version 2.0 (the "License"); you may not use this file except
// in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.

import ballerina/http;

listener http:Listener securedEP = new (9090,
secureSocket = {
key: {
path: "./security/ballerinaKeystore.p12",
password: "ballerina"
}
},
httpVersion = "1.1"
);

final http:Client nettyEP = check new("https://netty:8688",
secureSocket = {
cert: {
path: "./security/ballerinaTruststore.p12",
password: "ballerina"
},
verifyHostName: false
},
httpVersion = "1.1"
);

service /passthrough on securedEP {
resource function post .(http:Request clientRequest) returns http:Response|error {
http:Response response = check nettyEP->forward("/service/EchoService", clientRequest);
return response;
}
}
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion load-tests/h1_h1_passthrough/scripts/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@
set -e
source base-scenario.sh

jmeter -n -t "$scriptsDir/"http-post-request.jmx -l "$resultsDir/"original.jtl -Jusers="$concurrent_users" -Jduration=3600 -Jhost=bal.perf.test -Jport=443 -Jprotocol=https -Jpath=passthrough $payload_flags
jmeter -n -t "$scriptsDir/"http-post-request.jmx -l "$resultsDir/"original.jtl -Jusers="$concurrent_users" -Jduration=1800 -Jhost=bal.perf.test -Jport=443 -Jprotocol=https -Jpath=passthrough $payload_flags

0 comments on commit a8d2f46

Please sign in to comment.