100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps
Java asset-managementbuildingdashboarddataplatformdevice-managementedge-computingenergyenergy-managementenergy-monitorfleet-managementfleet-telematicsiotiot-applicationiot-platformmodbusmqttmqtt-brokerota-updaterules-enginesmartcity
Additional load tests (#2210)
Eric Bariaux6866894939d6
diff --git a/model/src/test/java/org/openremote/model/util/UniqueIdentifierGeneratorTest.java b/model/src/test/java/org/openremote/model/util/UniqueIdentifierGeneratorTest.javanew file mode 100644index 000000000..feb4c83ce--- /dev/null+++ b/model/src/test/java/org/openremote/model/util/UniqueIdentifierGeneratorTest.java@@ -0,0 +1,13 @@+package org.openremote.model.util;++import org.junit.jupiter.api.Test;++import static org.junit.jupiter.api.Assertions.assertEquals;++public class UniqueIdentifierGeneratorTest {++ @Test+ public void generatedAssetIdHasExpectedLength() {+ assertEquals(22, UniqueIdentifierGenerator.generateId("masterlight-1-1").length(), "Asset ids must be 22 characters long");+ }+}diff --git a/setup/build.gradle b/setup/build.gradleindex 3588d50a1..7ff71d001 100644--- a/setup/build.gradle+++ b/setup/build.gradle@@ -10,6 +10,7 @@ sourceSets {integrationdemoload1+ load2}// dependencies declaration@@ -17,6 +18,7 @@ configurations {integrationImplementation.extendsFrom(implementation)demoImplementation.extendsFrom(implementation)load1Implementation.extendsFrom(implementation)+ load2Implementation.extendsFrom(implementation)}dependencies {@@ -29,6 +31,13 @@ tasks.register('load1Jar', Jar) {from sourceSets.load1.output}+tasks.register('load2Jar', Jar) {+ base {+ archivesName = "openremote-load2-${project.name}"+ }+ from sourceSets.load2.output+}+tasks.register('demoJar', Jar) {archiveBaseName.set("openremote-demo-${project.name}")from sourceSets.demo.outputdiff --git a/setup/src/load2/java/org/openremote/setup/load2/KeycloakSetup.java b/setup/src/load2/java/org/openremote/setup/load2/KeycloakSetup.javanew file mode 100644index 000000000..ed9baf457--- /dev/null+++ b/setup/src/load2/java/org/openremote/setup/load2/KeycloakSetup.java@@ -0,0 +1,100 @@+/*+ * Copyright 2025, OpenRemote Inc.+ *+ * See the CONTRIBUTORS.txt file in the distribution for a+ * full listing of individual contributors.+ *+ * This program is free software: you can redistribute it and/or modify+ * it under the terms of the GNU Affero General Public License as+ * published by the Free Software Foundation, either version 3 of the+ * License, or (at your option) any later version.+ *+ * This program is distributed in the hope that it will be useful,+ * but WITHOUT ANY WARRANTY; without even the implied warranty of+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ * GNU Affero General Public License for more details.+ *+ * You should have received a copy of the GNU Affero General Public License+ * along with this program. If not, see <http://www.gnu.org/licenses/>.+ */+package org.openremote.setup.load2;++import org.keycloak.representations.idm.ClientRepresentation;+import org.openremote.manager.setup.AbstractKeycloakSetup;+import org.openremote.model.Constants;+import org.openremote.model.Container;+import org.openremote.model.security.ClientRole;+import org.openremote.model.security.User;++import java.util.List;+import java.util.concurrent.ExecutorService;+import java.util.concurrent.atomic.AtomicInteger;+import java.util.stream.IntStream;++import static org.openremote.container.util.MapAccess.getInteger;+import static org.openremote.model.Constants.KEYCLOAK_CLIENT_ID;+import static org.openremote.model.Constants.MASTER_REALM;+import static org.openremote.model.Constants.RESTRICTED_USER_REALM_ROLE;++public class KeycloakSetup extends AbstractKeycloakSetup {+ private static final ClientRole[] CLIENT_ROLES = new ClientRole[] {+ ClientRole.READ_ASSETS,+ ClientRole.WRITE_ATTRIBUTES+ };++ /**+ * How many accounts to provision+ */+ public static final String OR_SETUP_USERS = "OR_SETUP_USERS";++ public List<User> users;+ protected ExecutorService executor;++ public KeycloakSetup(Container container, ExecutorService executor) {+ super(container);+ this.executor = executor;+ }++ @Override+ public void onStart() throws Exception {++ if (!container.isDevMode()) {+ // Re-enable direct access login+ ClientRepresentation clientRepresentation = keycloakProvider.getClient(MASTER_REALM, KEYCLOAK_CLIENT_ID);+ clientRepresentation.setDirectAccessGrantsEnabled(true);+ keycloakProvider.createUpdateClient(+ MASTER_REALM,+ clientRepresentation+ );+ }++ int accounts = getInteger(container.getConfig(), OR_SETUP_USERS, 0);+ AtomicInteger createdUsers = new AtomicInteger(0);++ if (accounts > 0) {+ IntStream.rangeClosed(1, accounts).forEach(i ->+ executor.submit(() -> {+ createUser(Constants.MASTER_REALM, "user" + i, "user" + i, "User " + i, "", "user" + i + "@openremote.local", true, REGULAR_USER_ROLES);+ createdUsers.incrementAndGet();+ })+ );+ IntStream.rangeClosed(1, accounts).forEach(i ->+ executor.submit(() -> {+ User user = createUser(Constants.MASTER_REALM, User.SERVICE_ACCOUNT_PREFIX + "serviceuser" + i, "serviceuser" + i, null, null, null, true, CLIENT_ROLES);+ keycloakProvider.updateUserRealmRoles(MASTER_REALM, user.getId(), RESTRICTED_USER_REALM_ROLE);+ createdUsers.incrementAndGet();+ })+ );+ }++ // Wait until all users created+ int waitCounter = 0;+ while (createdUsers.get() < 2 * accounts) {+ if (waitCounter > 1000) {+ throw new IllegalStateException("Failed to add all requested user in the specified time");+ }+ waitCounter++;+ Thread.sleep(1000);+ }+ }+}diff --git a/setup/src/load2/java/org/openremote/setup/load2/ManagerSetup.java b/setup/src/load2/java/org/openremote/setup/load2/ManagerSetup.javanew file mode 100644index 000000000..8899a68b1--- /dev/null+++ b/setup/src/load2/java/org/openremote/setup/load2/ManagerSetup.java@@ -0,0 +1,143 @@+/*+ * Copyright 2025, OpenRemote Inc.+ *+ * See the CONTRIBUTORS.txt file in the distribution for a+ * full listing of individual contributors.+ *+ * This program is free software: you can redistribute it and/or modify+ * it under the terms of the GNU Affero General Public License as+ * published by the Free Software Foundation, either version 3 of the+ * License, or (at your option) any later version.+ *+ * This program is distributed in the hope that it will be useful,+ * but WITHOUT ANY WARRANTY; without even the implied warranty of+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ * GNU Affero General Public License for more details.+ *+ * You should have received a copy of the GNU Affero General Public License+ * along with this program. If not, see <http://www.gnu.org/licenses/>.+ */+package org.openremote.setup.load2;+++import org.apache.commons.io.IOUtils;+import org.openremote.manager.mqtt.UserAssetProvisioningMQTTHandler;+import org.openremote.manager.provisioning.ProvisioningService;+import org.openremote.manager.security.ManagerKeycloakIdentityProvider;+import org.openremote.model.Constants;+import org.openremote.model.Container;+import org.openremote.model.asset.Asset;+import org.openremote.model.asset.UserAssetLink;+import org.openremote.model.asset.impl.BuildingAsset;+import org.openremote.model.asset.impl.LightAsset;+import org.openremote.model.asset.impl.WeatherAsset;+import org.openremote.model.attribute.Attribute;+import org.openremote.model.attribute.MetaItem;+import org.openremote.model.provisioning.X509ProvisioningConfig;+import org.openremote.model.provisioning.X509ProvisioningData;+import org.openremote.model.rules.RealmRuleset;+import org.openremote.model.security.ClientRole;+import org.openremote.model.security.User;+import org.openremote.model.syslog.SyslogCategory;+import org.openremote.model.util.UniqueIdentifierGenerator;+import org.openremote.model.util.ValueUtil;+import org.openremote.model.value.MetaItemType;++import java.io.InputStream;+import java.nio.charset.StandardCharsets;+import java.util.Collections;+import java.util.concurrent.Executor;+import java.util.concurrent.atomic.AtomicInteger;+import java.util.logging.Logger;+import java.util.stream.IntStream;++import static org.openremote.container.util.MapAccess.getBoolean;+import static org.openremote.container.util.MapAccess.getInteger;+import static org.openremote.manager.mqtt.UserAssetProvisioningMQTTHandler.UNIQUE_ID_PLACEHOLDER;+import static org.openremote.model.Constants.MASTER_REALM;+import static org.openremote.model.rules.Ruleset.Lang.GROOVY;+import static org.openremote.model.syslog.SyslogCategory.DATA;+import static org.openremote.model.value.ValueType.NUMBER;+import static org.openremote.setup.load2.KeycloakSetup.OR_SETUP_USERS;++public class ManagerSetup extends org.openremote.manager.setup.ManagerSetup {+ public static final String OR_SETUP_ASSETS = "OR_SETUP_ASSETS";+ public static final String OR_SETUP_STORE_DATA_POINTS = "OR_SETUP_STORE_DATA_POINTS";++ protected ProvisioningService provisioningService;+ protected Container container;+ protected Executor executor;++ private static final Logger LOG = SyslogCategory.getLogger(DATA, ManagerSetup.class);++ public ManagerSetup(Container container, Executor executor) {+ super(container);+ this.container = container;+ this.executor = executor;+ provisioningService = container.getService(ProvisioningService.class);+ }++ @SuppressWarnings("ConstantConditions")+ @Override+ public void onStart() throws Exception {+ int accounts = getInteger(container.getConfig(), OR_SETUP_USERS, 0);+ int assets = getInteger(container.getConfig(), OR_SETUP_ASSETS, 0);+ boolean storeDataPoints = getBoolean(container.getConfig(), OR_SETUP_STORE_DATA_POINTS, false);++ AtomicInteger createdAccounts = new AtomicInteger(0);+ if (accounts > 1) {+ IntStream.rangeClosed(1, accounts).forEach(i -> {+ executor.execute(() -> {+ createAssets(i, assets, storeDataPoints);+ createdAccounts.incrementAndGet();+ });+ });++ // Wait until all devices created+ int waitCounter = 0;+ while (createdAccounts.get() < accounts) {+ if (waitCounter > 200) {+ throw new IllegalStateException("Failed to provision all requested devices in the specified time");+ }+ waitCounter++;+ Thread.sleep(10000);+ }+ }+ }++ private void createAssets(int account, int assets, boolean storeDataPoints) {+ String userName = "user" + account;+ String serviceUserName = User.SERVICE_ACCOUNT_PREFIX + "serviceuser" + account;++ User user = identityService.getIdentityProvider().getUserByUsername(MASTER_REALM, userName);+ String userId = user.getId();+ User serviceUser = identityService.getIdentityProvider().getUserByUsername(MASTER_REALM, serviceUserName);+ String serviceUserId = serviceUser.getId();++ Asset building = new BuildingAsset("Building " + account);+ building.setRealm(MASTER_REALM);+ building = assetStorageService.merge(building);+ LOG.info("Created building asset: " + building.getName());+ assetStorageService.storeUserAssetLinks(Collections.singletonList(new UserAssetLink(MASTER_REALM, userId, building.getId())));++ for (int i = 1; i <= assets; i++) {+ String uniqueId = "light-" + account + "-" + i;+ String assetId = UniqueIdentifierGenerator.generateId(MASTER_REALM + uniqueId);+ Asset<?> asset = new LightAsset("Light - " + account + " - " + i);+ asset.getAttribute(LightAsset.BRIGHTNESS).ifPresent( attribute -> {+ attribute.addMeta(new MetaItem<>(MetaItemType.ACCESS_RESTRICTED_WRITE));+ if (storeDataPoints) {+ attribute.addMeta(new MetaItem<>(MetaItemType.STORE_DATA_POINTS));+ }+ });+ asset.setId(assetId);+ asset.setRealm(MASTER_REALM);+ asset.setParent(building);+ asset = assetStorageService.merge(asset);+ LOG.info("Created light asset: " + asset.getName());++ assetStorageService.storeUserAssetLinks(Collections.singletonList(new UserAssetLink(MASTER_REALM, serviceUserId, assetId)));+ assetStorageService.storeUserAssetLinks(Collections.singletonList(new UserAssetLink(asset.getRealm(), userId, asset.getId())));+ }+ }+}diff --git a/setup/src/load2/java/org/openremote/setup/load2/SetupTasks.java b/setup/src/load2/java/org/openremote/setup/load2/SetupTasks.javanew file mode 100644index 000000000..e8c13b603--- /dev/null+++ b/setup/src/load2/java/org/openremote/setup/load2/SetupTasks.java@@ -0,0 +1,49 @@+/*+ * Copyright 2025, OpenRemote Inc.+ *+ * See the CONTRIBUTORS.txt file in the distribution for a+ * full listing of individual contributors.+ *+ * This program is free software: you can redistribute it and/or modify+ * it under the terms of the GNU Affero General Public License as+ * published by the Free Software Foundation, either version 3 of the+ * License, or (at your option) any later version.+ *+ * This program is distributed in the hope that it will be useful,+ * but WITHOUT ANY WARRANTY; without even the implied warranty of+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ * GNU Affero General Public License for more details.+ *+ * You should have received a copy of the GNU Affero General Public License+ * along with this program. If not, see <http://www.gnu.org/licenses/>.+ */+package org.openremote.setup.load2;++import org.openremote.model.Container;+import org.openremote.model.setup.Setup;++import java.util.Arrays;+import java.util.List;+import java.util.concurrent.ExecutorService;+import java.util.concurrent.Executors;++public class SetupTasks implements org.openremote.model.setup.SetupTasks {++ @Override+ public List<Setup> createTasks(Container container, String setupType, boolean keycloakEnabled) {++ ExecutorService executor = Executors.newFixedThreadPool(1);++ return Arrays.asList(+ new KeycloakSetup(container, executor),+ new ManagerSetup(container, executor),+ // A hack to allow shutdown of the setup executor+ new Setup() {+ @Override+ public void onStart() throws Exception {+ executor.shutdown();+ }+ }+ );+ }+}diff --git a/setup/src/load2/resources/META-INF/services/org.openremote.model.ContainerService b/setup/src/load2/resources/META-INF/services/org.openremote.model.ContainerServicenew file mode 100644index 000000000..e69de29bbdiff --git a/setup/src/load2/resources/META-INF/services/org.openremote.model.setup.SetupTasks b/setup/src/load2/resources/META-INF/services/org.openremote.model.setup.SetupTasksnew file mode 100644index 000000000..dca36a3eb--- /dev/null+++ b/setup/src/load2/resources/META-INF/services/org.openremote.model.setup.SetupTasks@@ -0,0 +1 @@+org.openremote.setup.load2.SetupTasksdiff --git a/test/load1-eks/cluster.yaml b/test/load1-eks/cluster.yamlindex 28a99f3aa..80b033efa 100644--- a/test/load1-eks/cluster.yaml+++ b/test/load1-eks/cluster.yaml@@ -5,7 +5,7 @@ metadata:name: ${CLUSTER_NAME}region: ${AWS_REGION}# Kubernetes version to use for cluster, good idea to keep up to date- version: "1.33"+ version: "1.34"availabilityZones:- ${AWS_REGION}a@@ -25,6 +25,8 @@ nodeGroups:instanceType: m8g.2xlargevolumeSize: 32desiredCapacity: 1+ availabilityZones:+ - ${AWS_REGION}aaddons:- name: aws-ebs-csi-driverdiff --git a/test/load2-eks/README.md b/test/load2-eks/README.mdnew file mode 100644index 000000000..831a9fb97--- /dev/null+++ b/test/load2-eks/README.md@@ -0,0 +1,58 @@+# Load Tests++Scripts and configuration files to setup an OpenRemote stack running in an EKS cluster appropriate for load testing.+This includes configuring the cluster to use a more powerful machine+and adapting the values files to configure the memory usage on the different pods.+For the manager, JVM parameters are used to make use of the extra memory available to the container.++This folder contains a different setup than load1 and includes different test scenarios.++The setup is controlled by 2 parameters:+- OR_SETUP_USERS: the number of accounts to create+- OR_SETUP_ASSETS: the number of light assets to create in each account++The setup creates:+- OR_SETUP_USERS standard user account+- In each account, 1 Building asset+- As child of each Building asset, OR_SETUP_ASSETS Light assets+- OR_SETUP_USERS restricted service users, linked to the corresponding Building asset,+with appropriate permission to push attribute values++You build and push the custom manager image in a similar way than for load1, by running+```+./gradlew -PSETUP_JAR=load2 clean installDist++export AWS_DEVELOPERS_ACCOUNT_ID="dev-account-id"+aws ecr get-login-password --region eu-west-1 | docker login --username AWS --password-stdin $AWS_DEVELOPERS_ACCOUNT_ID.dkr.ecr.eu-west-1.amazonaws.com+docker buildx build --push --platform linux/amd64,linux/arm64 -t $AWS_DEVELOPERS_ACCOUNT_ID.dkr.ecr.eu-west-1.amazonaws.com/openremote/manager:load2 manager/build/install/manager/+```++Once deployed, running the load tests can be done using the same clients as for load testing a VM,+but using the scenarios present under `scenarios` in this folder instead.+See `load1` folder for the tools, scripts and documentation.++Two scenarios are provided:+#### connect-and-publish++Runs for a given duration, publishing attribute value changes over MQTT once connected.+For each connection, it publishes ASSETS_COUNT values at the same time (50ms interval), then pauses for MILLIS_BETWEEN_PUBLISHES.++The parameters are:+MANAGER_HOSTNAME: Hostname of the manager to be tested+THREAD_COUNT: Number of parallel accounts that will connect and publish in parallel+ASSETS_COUNT: Number of Light assets for which to publish an attribute during each iteration+RAMP_RATE: Number of thread to add per second during ramp-up+DURATION: Total duration to run the test for+MILLIS_BETWEEN_PUBLISHES: Delay between each publishing iteration++#### connect-settle-test++Connects up to THREAD_COUNT accounts to the system.+Once connected, it does 1 single publish every MILLIS_BETWEEN_PUBLISHES (defaults to 300s).+Goal is to measure the time it takes for the system to allow that many connections and stabilise.++The parameters are:+MANAGER_HOSTNAME: Hostname of the manager to be tested+THREAD_COUNT: Number of parallel accounts that will connect publish in parallel+RAMP_RATE: Number of thread to add per second during ramp-up+MILLIS_BETWEEN_PUBLISHES: Delay between each publishing iterationdiff --git a/test/load2-eks/cluster.yaml b/test/load2-eks/cluster.yamlnew file mode 100644index 000000000..80b033efa--- /dev/null+++ b/test/load2-eks/cluster.yaml@@ -0,0 +1,35 @@+apiVersion: eksctl.io/v1alpha5+kind: ClusterConfig++metadata:+ name: ${CLUSTER_NAME}+ region: ${AWS_REGION}+ # Kubernetes version to use for cluster, good idea to keep up to date+ version: "1.34"++availabilityZones:+ - ${AWS_REGION}a+ - ${AWS_REGION}b++iam:+ withOIDC: true+ serviceAccounts:+ - metadata:+ name: aws-load-balancer-controller+ namespace: kube-system+ wellKnownPolicies:+ awsLoadBalancerController: true++nodeGroups:+ - name: ng-1+ instanceType: m8g.2xlarge+ volumeSize: 32+ desiredCapacity: 1+ availabilityZones:+ - ${AWS_REGION}a++addons:+ - name: aws-ebs-csi-driver+ version: latest+ wellKnownPolicies:+ ebsCSIController: truediff --git a/test/load2-eks/eks-cleanup-load.sh b/test/load2-eks/eks-cleanup-load.shnew file mode 100755index 000000000..e0b2f811c--- /dev/null+++ b/test/load2-eks/eks-cleanup-load.sh@@ -0,0 +1,66 @@+#!/bin/bash++. ./eks-common.sh++CLUSTER_VPC_ID=$(aws eks describe-cluster --name $CLUSTER_NAME --query 'cluster.resourcesVpcConfig.vpcId' --output text --profile or)+if [ -z "$CLUSTER_VPC_ID" ] || [ "$CLUSTER_VPC_ID" = "None" ]; then+ echo "Error: Failed to retrieve VPC ID for cluster '$CLUSTER_NAME'. Aborting."+ exit 1+fi++DNS_NAME=$(aws elbv2 describe-load-balancers --profile or --query "LoadBalancers[?VpcId=='$CLUSTER_VPC_ID' && Type=='network' && Scheme=='internet-facing'].DNSName | [0]")+HOSTED_ZONE_ID=$(aws elbv2 describe-load-balancers --profile or --query "LoadBalancers[?VpcId=='$CLUSTER_VPC_ID' && Type=='network' && Scheme=='internet-facing'].CanonicalHostedZoneId | [0]")++echo "Delete DNS record $FQDN"++aws route53 change-resource-record-sets \+ --hosted-zone-id /hostedzone/Z08751721JH0NB6LLCB4V \+ --change-batch \+ '{"Changes": [ { "Action": "DELETE", "ResourceRecordSet": { "Name": "'$FQDN'", "Type": "A", "AliasTarget":{ "HostedZoneId": '$HOSTED_ZONE_ID',"DNSName": '$DNS_NAME',"EvaluateTargetHealth": false} } } ]}' \+ --profile dnschg++helm uninstall manager+helm uninstall keycloak+helm uninstall postgresql+helm uninstall proxy++echo "Delete VPC peerings"++VPC_PEERING_IDS=$(aws ec2 describe-vpc-peering-connections \+ --filters "Name=accepter-vpc-info.vpc-id,Values=$CLUSTER_VPC_ID" "Name=status-code,Values=active" \+ --query 'VpcPeeringConnections[*].VpcPeeringConnectionId' \+ --profile or \+ --output text)++for peering_id in $VPC_PEERING_IDS; do+ echo "Deleting peering $peering_id"+ aws ec2 delete-vpc-peering-connection --vpc-peering-connection-id $peering_id --profile or+done++# Give the AWS LB Controller time to delete the NLBs after the Service is deleted+while aws elbv2 describe-load-balancers --profile or --query "LoadBalancers[?VpcId=='$CLUSTER_VPC_ID' && Type=='network']" 2>/dev/null | grep '"Code": "active"'; do+ echo "Waiting for load balancers to be deleted..."+ sleep 10+done+helm uninstall aws-load-balancer-controller -n kube-system++MANAGER_VOLUMEID=$(kubectl get pv manager-data-pv -o=jsonpath='{.spec.awsElasticBlockStore.volumeID}')+PSQL_VOLUMEID=$(kubectl get pv postgresql-data-pv -o=jsonpath='{.spec.awsElasticBlockStore.volumeID}')+kubectl delete pv manager-data-pv+kubectl delete pv postgresql-data-pv+aws ec2 delete-volume --volume-id $MANAGER_VOLUMEID+aws ec2 delete-volume --volume-id $PSQL_VOLUMEID+helm uninstall or-setup++# Manually deleting all addons, this should not be required but otherwise the delete cluster fails+# with "2 pods are unevictable from node ..." error messages+eksctl delete addon --cluster $CLUSTER_NAME --name aws-ebs-csi-driver+eksctl delete addon --cluster $CLUSTER_NAME --name vpc-cni+eksctl delete addon --cluster $CLUSTER_NAME --name metrics-server+eksctl delete addon --cluster $CLUSTER_NAME --name coredns+eksctl delete addon --cluster $CLUSTER_NAME --name kube-proxy++eksctl delete cluster --wait --name $CLUSTER_NAME || {+ echo "Clean-up has failed, please check the status in AWS CloudFormation console at https://eu-west-1.console.aws.amazon.com/cloudformation/home?region=eu-west-1#/stacks?filteringText=&filteringStatus=active&viewNested=true"+ echo "Failed clean-ups are often caused by a dangling VPC. Manually delete the VPC and then retry the cluster stack delete operation."+}diff --git a/test/load2-eks/eks-common.sh b/test/load2-eks/eks-common.shnew file mode 100755index 000000000..a0367444a--- /dev/null+++ b/test/load2-eks/eks-common.sh@@ -0,0 +1,47 @@+#!/bin/bash++set -eo pipefail++if [ -z "$AWS_ACCOUNT_ID" ]; then+ echo "Error: AWS_ACCOUNT_ID environment variable is not set"+ echo "Please set it to the ID of the account you want to deploy the cluster into with: export AWS_ACCOUNT_ID=your-account-id"+ exit 1+fi+if [ -z "$AWS_DEVELOPERS_ACCOUNT_ID" ]; then+ echo "Error: $AWS_DEVELOPERS_ACCOUNT_ID environment variable is not set"+ echo "Please set it to the ID of the OpenRemote developers root account with: export AWS_DEVELOPERS_ACCOUNT_ID=dev-account-id"+ exit 1+fi++OR_KUBERNETES_PATH=../../kubernetes++# Name of cluster, not exposed but must be unique within account+export CLUSTER_NAME=loadtest-cluster++# Hostname to use for public access to this instance, always under the openremote.app domain+HOSTNAME=load2+FQDN=$HOSTNAME.openremote.app++export AWS_REGION="eu-west-1"++DNSCHG_ROLE_ARN="arn:aws:iam::$AWS_DEVELOPERS_ACCOUNT_ID:role/route53-full-access"++aws configure set region $AWS_REGION+aws configure --profile or set region $AWS_REGION+aws configure --profile or set output json+aws configure --profile dnschg set source_profile or+aws configure --profile dnschg set role_arn $DNSCHG_ROLE_ARN++if [ -n "$AWS_ACCESS_KEY_ID" ]; then+ aws configure --profile or set aws_access_key_id $AWS_ACCESS_KEY_ID+fi++if [ -n "$AWS_SECRET_ACCESS_KEY" ]; then+ aws configure --profile or set aws_secret_access_key $AWS_SECRET_ACCESS_KEY+fi++if [ -n "$AWS_SESSION_TOKEN" ]; then+ aws configure --profile or set aws_session_token $AWS_SESSION_TOKEN+fi++aws sts assume-role --role-arn $DNSCHG_ROLE_ARN --role-session-name dnschg --profile or --query "Credentials.[AccessKeyId, SecretAccessKey, SessionToken]" --output text | awk -F'\t' '{print "aws_access_key_id "$1"\naws_secret_access_key "$2"\naws_session_token "$3 }' | xargs -L 1 aws configure --profile dnschg setdiff --git a/test/load2-eks/eks-setup-load.sh b/test/load2-eks/eks-setup-load.shnew file mode 100755index 000000000..2b2503023--- /dev/null+++ b/test/load2-eks/eks-setup-load.sh@@ -0,0 +1,74 @@+#!/bin/bash++. ./eks-common.sh++envsubst < cluster.yaml | eksctl create cluster -f - --profile or++# [Installation Guide - AWS Load Balancer Controller](https://kubernetes-sigs.github.io/aws-load-balancer-controller/latest/deploy/installation/)++helm repo add eks https://aws.github.io/eks-charts+helm repo update eks++helm install aws-load-balancer-controller eks/aws-load-balancer-controller \+ -n kube-system \+ --set clusterName=$CLUSTER_NAME \+ --set serviceAccount.create=false \+ --set serviceAccount.name=aws-load-balancer-controller++PSQL_VOLUMEID=$(aws ec2 create-volume --size $(grep "psqlVolumeSize:" values-or-setup-eks-load.yaml | awk '{print $2}' | tr -d '"Gi') \+ --availability-zone eu-west-1a --tag-specifications "ResourceType=volume,Tags=[{Key=Name,Value=psql-data}]" --query VolumeId)+MANAGER_VOLUMEID=$(aws ec2 create-volume --size $(grep "managerVolumeSize:" values-or-setup-eks-load.yaml | awk '{print $2}' | tr -d '"Gi') \+ --availability-zone eu-west-1a --tag-specifications "ResourceType=volume,Tags=[{Key=Name,Value=manager-data}]" --query VolumeId)++# Wait for AWS LB ctrl to be ready+kubectl rollout status deployment aws-load-balancer-controller -n kube-system --timeout=300s++CLUSTER_DNS=$(kubectl get svc kube-dns -n kube-system -o jsonpath='{.spec.clusterIP}:{.spec.ports[?(@.name=="dns")].port}')++helm install or-setup $OR_KUBERNETES_PATH/or-setup -f values-or-setup-eks-load.yaml --set aws.enabled=true --set aws.managerVolumeId=$MANAGER_VOLUMEID --set aws.psqlVolumeId=$PSQL_VOLUMEID++helm install proxy $OR_KUBERNETES_PATH/proxy -f $OR_KUBERNETES_PATH/proxy/values-eks.yaml -f values-proxy-eks-load.yaml --set or.nameserver=$CLUSTER_DNS --set or.hostname=$FQDN++helm install postgresql $OR_KUBERNETES_PATH/postgresql -f $OR_KUBERNETES_PATH/postgresql/values-eks.yaml -f values-postgresql-eks-load.yaml++# Waiting for the LB to be created+# AWS LB Controller only creates an Network LB if there's a service++CLUSTER_VPC_ID=$(aws eks describe-cluster --profile or --name $CLUSTER_NAME --query 'cluster.resourcesVpcConfig.vpcId' --output text)+if [ -z "$CLUSTER_VPC_ID" ] || [ "$CLUSTER_VPC_ID" = "None" ]; then+ echo "Error: Failed to retrieve VPC ID for cluster '$CLUSTER_NAME'. Aborting."+ exit 1+fi++while ! aws elbv2 describe-load-balancers --profile or --query "LoadBalancers[?VpcId=='$CLUSTER_VPC_ID' && Type=='network' && Scheme=='internet-facing']" 2>/dev/null | grep '"Code": "active"'; do+ echo "Waiting for load balancer to be created..."+ sleep 10+done++DNS_NAME=$(aws elbv2 describe-load-balancers --profile or --query "LoadBalancers[?VpcId=='$CLUSTER_VPC_ID' && Type=='network' && Scheme=='internet-facing'].DNSName | [0]")+HOSTED_ZONE_ID=$(aws elbv2 describe-load-balancers --profile or --query "LoadBalancers[?VpcId=='$CLUSTER_VPC_ID' && Type=='network' && Scheme=='internet-facing'].CanonicalHostedZoneId | [0]")++aws route53 change-resource-record-sets \+ --hosted-zone-id /hostedzone/Z08751721JH0NB6LLCB4V \+ --change-batch \+ '{"Changes": [ { "Action": "UPSERT", "ResourceRecordSet": { "Name": "'$FQDN'", "Type": "A", "AliasTarget":{ "HostedZoneId": '$HOSTED_ZONE_ID',"DNSName": '$DNS_NAME',"EvaluateTargetHealth": false} } } ]}' \+ --profile dnschg++helm install keycloak $OR_KUBERNETES_PATH/keycloak -f $OR_KUBERNETES_PATH/keycloak/values-haproxy.yaml \+ -f values-keycloak-eks-load.yaml --set-string or.hostname=$FQDN+helm install manager $OR_KUBERNETES_PATH/manager -f $OR_KUBERNETES_PATH/manager/values-haproxy-eks.yaml \+ -f values-manager-eks-load.yaml --set-string or.hostname=$FQDN \+ --set-string image.repository=$AWS_DEVELOPERS_ACCOUNT_ID.dkr.ecr.eu-west-1.amazonaws.com/openremote/manager++while ! dig +short $FQDN | grep -qE '^[0-9]'; do+ echo "Waiting for DNS resolution..."+ sleep 5+done++# Now that DNS is in place, HAProxy can properly create the certificate+kubectl exec $(kubectl get pod -l "app.kubernetes.io/name=proxy" -o name) -- sh -c "/entrypoint.sh add $FQDN" || {+ echo "Certificate generation failed, please wait a moment and manually execute the following command:"+ echo "kubectl exec \$(kubectl get pod -l \"app.kubernetes.io/name=proxy\" -o name) -- sh -c \"/entrypoint.sh add $FQDN\""+}++echo "Access the manager at https://$FQDN"diff --git a/test/load2-eks/scenarios/connect-and-publish.jmx b/test/load2-eks/scenarios/connect-and-publish.jmxnew file mode 100644index 000000000..e7a444609--- /dev/null+++ b/test/load2-eks/scenarios/connect-and-publish.jmx@@ -0,0 +1,255 @@+<?xml version="1.0" encoding="UTF-8"?>+<jmeterTestPlan version="1.2" properties="5.0" jmeter="5.6.3">+ <hashTree>+ <TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="BZT Generated Test Plan">+ <elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments">+ <collectionProp name="Arguments.arguments"/>+ </elementProp>+ <boolProp name="TestPlan.functional_mode">false</boolProp>+ <boolProp name="TestPlan.serialize_threadgroups">false</boolProp>+ </TestPlan>+ <hashTree>+ <DNSCacheManager guiclass="DNSCachePanel" testclass="DNSCacheManager" testname="DNS Cache Manager">+ <collectionProp name="DNSCacheManager.servers"/>+ <collectionProp name="DNSCacheManager.hosts"/>+ <boolProp name="DNSCacheManager.clearEachIteration">false</boolProp>+ <boolProp name="DNSCacheManager.isCustomResolver">false</boolProp>+ </DNSCacheManager>+ <hashTree/>+ <SetupThreadGroup guiclass="SetupThreadGroupGui" testclass="SetupThreadGroup" testname="setUp Thread Group" enabled="true">+ <intProp name="ThreadGroup.num_threads">1</intProp>+ <intProp name="ThreadGroup.ramp_time">1</intProp>+ <boolProp name="ThreadGroup.same_user_on_next_iteration">true</boolProp>+ <stringProp name="ThreadGroup.on_sample_error">stoptestnow</stringProp>+ <elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller">+ <stringProp name="LoopController.loops">1</stringProp>+ <boolProp name="LoopController.continue_forever">false</boolProp>+ </elementProp>+ </SetupThreadGroup>+ <hashTree>+ <JSR223Sampler guiclass="TestBeanGUI" testclass="JSR223Sampler" testname="Setup" enabled="true">+ <stringProp name="scriptLanguage">groovy</stringProp>+ <stringProp name="parameters"></stringProp>+ <stringProp name="filename"></stringProp>+ <stringProp name="cacheKey">true</stringProp>+ <stringProp name="script">// Store thread count+def threadCount = props.get("THREAD_COUNT") ?: "1000"+if (threadCount instanceof String) {+ threadCount = Integer.parseInt(threadCount)+}+props.put("THREAD_COUNT", threadCount)++log.info(">>>Thread count ${threadCount}")++def host = props.get("MANAGER_HOSTNAME") ?: "localhost"+log.info(">>>Host ${host}")++// Store global var for tracking device init successes - decrement this on each device start and increment on publish success+props.put("successes", new java.util.concurrent.atomic.AtomicInteger(0))</stringProp>+ </JSR223Sampler>+ <hashTree/>+ </hashTree>+ <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="mqtt-client-auto-provision-pub" enabled="true">+ <boolProp name="ThreadGroup.delayedStart">true</boolProp>+ <stringProp name="ThreadGroup.num_threads">${__groovy(props.get("THREAD_COUNT") ?: "1000",)}</stringProp>+ <stringProp name="ThreadGroup.ramp_time">${__groovy(Math.max(1\,(int)((props.get("THREAD_COUNT") ?: "1000").toInteger() / (props.get("RAMP_RATE") ?: "50").toInteger())),)}</stringProp>+ <stringProp name="ThreadGroup.duration">${__groovy(props.get("DURATION") ?: "300",)}</stringProp>+ <boolProp name="ThreadGroup.same_user_on_next_iteration">true</boolProp>+ <boolProp name="ThreadGroup.scheduler">true</boolProp>+ <stringProp name="ThreadGroup.on_sample_error">startnextloop</stringProp>+ <elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController">+ <intProp name="LoopController.loops">-1</intProp>+ <boolProp name="LoopController.continue_forever">false</boolProp>+ </elementProp>+ </ThreadGroup>+ <hashTree>+ <JSR223Sampler guiclass="TestBeanGUI" testclass="JSR223Sampler" testname="Compute assetId">+ <stringProp name="scriptLanguage">groovy</stringProp>+ <stringProp name="parameters"></stringProp>+ <stringProp name="filename"></stringProp>+ <stringProp name="cacheKey">true</stringProp>+ <stringProp name="script">import com.devskiller.friendly_id.Url62;+import com.fasterxml.uuid.Generators;+import com.fasterxml.uuid.impl.NameBasedGenerator;++// Generate asset ids to be used in ForEach controller later+def assetsCount = vars.get("ASSETS_COUNT") ?: "5"+def count = assetsCount.toInteger()+for (int i = 1; i <= count; i++) {+ def assetId = Url62.encode(Generators.nameBasedGenerator().generate("masterlight-${__threadNum}-${i}"))+ vars.put("assetId_${i}", assetId)+}+vars.put("assetId_matchNr", count.toString())+</stringProp>+ </JSR223Sampler>+ <hashTree/>+ <net.xmeter.samplers.ConnectSampler guiclass="net.xmeter.gui.ConnectSamplerUI" testclass="net.xmeter.samplers.ConnectSampler" testname="connect">+ <stringProp name="mqtt.server">${__P(MANAGER_HOSTNAME,localhost)}</stringProp>+ <stringProp name="mqtt.port">8883</stringProp>+ <stringProp name="mqtt.version">3.1</stringProp>+ <stringProp name="mqtt.conn_timeout">10</stringProp>+ <stringProp name="mqtt.protocol">SSL</stringProp>+ <stringProp name="mqtt.ws_path"></stringProp>+ <boolProp name="mqtt.dual_ssl_authentication">false</boolProp>+ <stringProp name="mqtt.clientcert_file_path"></stringProp>+ <stringProp name="mqtt.clientcert_password"></stringProp>+ <stringProp name="mqtt.client_id_prefix">device${__threadNum}</stringProp>+ <boolProp name="mqtt.client_id_suffix">false</boolProp>+ <stringProp name="mqtt.conn_keep_alive">30</stringProp>+ <stringProp name="mqtt.conn_attampt_max">0</stringProp>+ <stringProp name="mqtt.reconn_attampt_max">0</stringProp>+ <stringProp name="mqtt.conn_clean_session">true</stringProp>+ <stringProp name="mqtt.user_name">master:serviceuser${__threadNum}</stringProp>+ <stringProp name="mqtt.password">serviceuser${__threadNum}</stringProp>+ <stringProp name="mqtt.connect_name">mqttconn</stringProp>+ <stringProp name="mqtt.conn_attempt_max">0</stringProp>+ <stringProp name="mqtt.reconn_attempt_max">0</stringProp>+ </net.xmeter.samplers.ConnectSampler>+ <hashTree>+ <JSR223Timer guiclass="TestBeanGUI" testclass="JSR223Timer" testname="Connect Delay Timer" enabled="false">+ <stringProp name="cacheKey">true</stringProp>+ <stringProp name="filename"></stringProp>+ <stringProp name="parameters"></stringProp>+ <stringProp name="script">// Decrement successes counter only if previously succeeded - this is used to track when to stop the test+if (vars.get("success") != null) {+ log.info("Decrement successes")+ props.get("successes").decrementAndGet()+ vars.remove("success")+}++if (vars.getObject("threadCount") == null) {+ vars.putObject("threadCount", props.get("THREAD_COUNT"))+ return 0+}++// After the first iteration we want to simulate a random pause between next reconnection+int upper = 60000+int lower = 1+def delay = (int) (Math.random() * (upper - lower)) + lower;+log.info("CONNECT DELAY ${ctx.threadNum + 1} = ${delay}ms")+return delay</stringProp>+ <stringProp name="scriptLanguage">groovy</stringProp>+ </JSR223Timer>+ <hashTree/>+ </hashTree>+ <net.xmeter.samplers.SubSampler guiclass="net.xmeter.gui.SubSamplerUI" testclass="net.xmeter.samplers.SubSampler" testname="Subscribe attributes" enabled="false">+ <stringProp name="mqtt.topic_name">master/device${__threadNum}/attributevalue/+/${assetId}</stringProp>+ <stringProp name="mqtt.qos_level">0</stringProp>+ <boolProp name="mqtt.add_timestamp">false</boolProp>+ <boolProp name="mqtt.debug_response">true</boolProp>+ <stringProp name="mqtt.sample_condition">number of received messages</stringProp>+ <stringProp name="mqtt.sample_condition_value">6</stringProp>+ <boolProp name="mqtt.sub_async">false</boolProp>+ <stringProp name="mqtt.connect_name">mqttconn</stringProp>+ <stringProp name="mqtt.sample_condition_value_opt">20000</stringProp>+ </net.xmeter.samplers.SubSampler>+ <hashTree>+ <ConstantTimer guiclass="ConstantTimerGui" testclass="ConstantTimer" testname="Constant Timer" enabled="true">+ <stringProp name="ConstantTimer.delay">1000</stringProp>+ </ConstantTimer>+ <hashTree/>+ </hashTree>+ <LoopController guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller">+ <boolProp name="LoopController.continue_forever">true</boolProp>+ <intProp name="LoopController.loops">-1</intProp>+ </LoopController>+ <hashTree>+ <JSR223Sampler guiclass="TestBeanGUI" testclass="JSR223Sampler" testname="JSR223 Sampler">+ <stringProp name="scriptLanguage">groovy</stringProp>+ <stringProp name="parameters"></stringProp>+ <stringProp name="filename"></stringProp>+ <stringProp name="cacheKey">true</stringProp>+ <stringProp name="script">log.info(">>> Will push " + vars.get("assetId_matchNr") + " attribute updates")</stringProp>+ </JSR223Sampler>+ <hashTree>+ <ConstantTimer guiclass="ConstantTimerGui" testclass="ConstantTimer" testname="Constant Timer">+ <stringProp name="ConstantTimer.delay">${__P(MILLIS_BETWEEN_PUBLISHES,1000)}</stringProp>+ </ConstantTimer>+ <hashTree/>+ </hashTree>+ <ForeachController guiclass="ForeachControlPanel" testclass="ForeachController" testname="ForEach Controller">+ <stringProp name="ForeachController.inputVal">assetId</stringProp>+ <stringProp name="ForeachController.returnVal">currentAssetId</stringProp>+ <boolProp name="ForeachController.useSeparator">true</boolProp>+ </ForeachController>+ <hashTree>+ <net.xmeter.samplers.PubSampler guiclass="net.xmeter.gui.PubSamplerUI" testclass="net.xmeter.samplers.PubSampler" testname="Publish brightness">+ <stringProp name="mqtt.topic_name">master/device${__threadNum}/writeattributevalue/brightness/${__groovy(vars.get("currentAssetId"))}</stringProp>+ <stringProp name="mqtt.qos_level">0</stringProp>+ <boolProp name="mqtt.add_timestamp">false</boolProp>+ <stringProp name="mqtt.message_type">String</stringProp>+ <stringProp name="mqtt.message_type_fixed_length">1024</stringProp>+ <stringProp name="mqtt.message_to_sent">${__groovy(new Random().nextInt(100))}</stringProp>+ <boolProp name="mqtt.retained_message">false</boolProp>+ <stringProp name="mqtt.connect_name">mqttconn</stringProp>+ </net.xmeter.samplers.PubSampler>+ <hashTree>+ <ConstantTimer guiclass="ConstantTimerGui" testclass="ConstantTimer" testname="Constant Timer">+ <stringProp name="ConstantTimer.delay">50</stringProp>+ </ConstantTimer>+ <hashTree/>+ </hashTree>+ <JSR223Sampler guiclass="TestBeanGUI" testclass="JSR223Sampler" testname="JSR223 Sampler" enabled="false">+ <stringProp name="scriptLanguage">groovy</stringProp>+ <stringProp name="parameters"></stringProp>+ <stringProp name="filename"></stringProp>+ <stringProp name="cacheKey">true</stringProp>+ <stringProp name="script">log.info(">>>Thread ${__threadNum} - asset ${__evalVar(currentAssetId)}")+log.info(">>>ForEach __jm__ForEach Controller__idx = " + vars.get("__jm__ForEach Controller__idx"))+log.info(">>>Direct vars.get currentAssetId = " + vars.get("currentAssetId"))</stringProp>+ </JSR223Sampler>+ <hashTree/>+ </hashTree>+ <net.xmeter.samplers.AsyncResponseSampler guiclass="net.xmeter.gui.AsyncResponseSamplerUI" testclass="net.xmeter.samplers.AsyncResponseSampler" testname="Check attribute response" enabled="false"/>+ <hashTree>+ <ConstantTimer guiclass="ConstantTimerGui" testclass="ConstantTimer" testname="Constant Timer" enabled="false">+ <stringProp name="ConstantTimer.delay">30</stringProp>+ </ConstantTimer>+ <hashTree/>+ </hashTree>+ </hashTree>+ <net.xmeter.samplers.DisConnectSampler guiclass="net.xmeter.gui.DisConnectSamplerUI" testclass="net.xmeter.samplers.DisConnectSampler" testname="disconnect" enabled="true">+ <stringProp name="mqtt.connect_name">mqttconn</stringProp>+ </net.xmeter.samplers.DisConnectSampler>+ <hashTree/>+ <ResultCollector guiclass="ViewResultsFullVisualizer" testclass="ResultCollector" testname="View Results Tree" enabled="true">+ <boolProp name="ResultCollector.error_logging">false</boolProp>+ <objProp>+ <name>saveConfig</name>+ <value class="SampleSaveConfiguration">+ <time>true</time>+ <latency>true</latency>+ <timestamp>true</timestamp>+ <success>false</success>+ <label>true</label>+ <code>true</code>+ <message>true</message>+ <threadName>true</threadName>+ <dataType>true</dataType>+ <encoding>false</encoding>+ <assertions>false</assertions>+ <subresults>true</subresults>+ <responseData>false</responseData>+ <samplerData>false</samplerData>+ <xml>false</xml>+ <fieldNames>true</fieldNames>+ <responseHeaders>false</responseHeaders>+ <requestHeaders>false</requestHeaders>+ <responseDataOnError>false</responseDataOnError>+ <saveAssertionResultsFailureMessage>true</saveAssertionResultsFailureMessage>+ <assertionsResultsToSave>0</assertionsResultsToSave>+ <bytes>true</bytes>+ <url>true</url>+ <threadCounts>true</threadCounts>+ <sampleCount>true</sampleCount>+ <idleTime>true</idleTime>+ <connectTime>true</connectTime>+ </value>+ </objProp>+ <stringProp name="filename"></stringProp>+ </ResultCollector>+ <hashTree/>+ </hashTree>+ </hashTree>+ </hashTree>+</jmeterTestPlan>diff --git a/test/load2-eks/scenarios/connect-and-publish.yml b/test/load2-eks/scenarios/connect-and-publish.ymlnew file mode 100644index 000000000..c51f63c46--- /dev/null+++ b/test/load2-eks/scenarios/connect-and-publish.yml@@ -0,0 +1,41 @@+settings:+ env:+ JMETER_VERSION: # Set by environment variable in docker image+ JMETER_PLUGIN_MANAGER_VERSION: # Set by environment variable in docker image+ MANAGER_HOSTNAME: # Must be supplied+ THREAD_COUNT: 500+ ASSETS_COUNT: 5+ RAMP_RATE: 20+ DURATION: 300+ MILLIS_BETWEEN_PUBLISHES: 3000++reporting:+ - module: final-stats+ summary: true # overall samples count and percent of failures+ percentiles: true # display average times and percentiles+ summary-labels: true # provides list of sample labels, status, percentage of completed, avg time and errors+ failed-labels: true # provides list of sample labels with failures+ test-duration: true # provides test duration+# dump-csv: filename to export data in CSV format++modules:+ jmeter:+ version: ${JMETER_VERSION}+ detect-plugins: true+ fix-jars: true+ plugins-manager:+ version: ${JMETER_PLUGIN_MANAGER_VERSION}+ properties:+ MANAGER_HOSTNAME: ${MANAGER_HOSTNAME}+ THREAD_COUNT: ${THREAD_COUNT}+ RAMP_RATE: ${RAMP_RATE}+ DURATION: ${DURATION}+ MILLIS_BETWEEN_PUBLISHES: ${MILLIS_BETWEEN_PUBLISHES}++execution:+ - scenario: simple++scenarios:+ simple:+ script: connect-and-publish.jmx+diff --git a/test/load2-eks/scenarios/connect-settle-test.jmx b/test/load2-eks/scenarios/connect-settle-test.jmxnew file mode 100644index 000000000..ec678e0e9--- /dev/null+++ b/test/load2-eks/scenarios/connect-settle-test.jmx@@ -0,0 +1,232 @@+<?xml version="1.0" encoding="UTF-8"?>+<jmeterTestPlan version="1.2" properties="5.0" jmeter="5.6.3">+ <hashTree>+ <TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="BZT Generated Test Plan">+ <elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments">+ <collectionProp name="Arguments.arguments"/>+ </elementProp>+ <boolProp name="TestPlan.functional_mode">false</boolProp>+ <boolProp name="TestPlan.serialize_threadgroups">false</boolProp>+ </TestPlan>+ <hashTree>+ <DNSCacheManager guiclass="DNSCachePanel" testclass="DNSCacheManager" testname="DNS Cache Manager">+ <collectionProp name="DNSCacheManager.servers"/>+ <collectionProp name="DNSCacheManager.hosts"/>+ <boolProp name="DNSCacheManager.clearEachIteration">false</boolProp>+ <boolProp name="DNSCacheManager.isCustomResolver">false</boolProp>+ </DNSCacheManager>+ <hashTree/>+ <SetupThreadGroup guiclass="SetupThreadGroupGui" testclass="SetupThreadGroup" testname="setUp Thread Group" enabled="true">+ <intProp name="ThreadGroup.num_threads">1</intProp>+ <intProp name="ThreadGroup.ramp_time">1</intProp>+ <boolProp name="ThreadGroup.same_user_on_next_iteration">true</boolProp>+ <stringProp name="ThreadGroup.on_sample_error">stoptestnow</stringProp>+ <elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller">+ <stringProp name="LoopController.loops">1</stringProp>+ <boolProp name="LoopController.continue_forever">false</boolProp>+ </elementProp>+ </SetupThreadGroup>+ <hashTree>+ <JSR223Sampler guiclass="TestBeanGUI" testclass="JSR223Sampler" testname="Setup">+ <stringProp name="scriptLanguage">groovy</stringProp>+ <stringProp name="parameters"></stringProp>+ <stringProp name="filename"></stringProp>+ <stringProp name="cacheKey">true</stringProp>+ <stringProp name="script">// Store thread count+def threadCount = props.get("THREAD_COUNT") ?: "1000"+if (threadCount instanceof String) {+ threadCount = Integer.parseInt(threadCount)+}+props.put("THREAD_COUNT", threadCount)++log.info(">>>Thread count ${threadCount}")++// Store global var for tracking device init successes - decrement this on each device start and increment on publish success+props.put("successes", new java.util.concurrent.atomic.AtomicInteger(0))</stringProp>+ </JSR223Sampler>+ <hashTree/>+ </hashTree>+ <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="mqtt-client-auto-provision-pub" enabled="true">+ <boolProp name="ThreadGroup.delayedStart">true</boolProp>+ <stringProp name="ThreadGroup.num_threads">${__groovy(props.get("THREAD_COUNT") ?: "1000",)}</stringProp>+ <stringProp name="ThreadGroup.ramp_time">${__groovy(Math.max(1\,(int)((props.get("THREAD_COUNT") ?: "1000").toInteger() / (props.get("RAMP_RATE") ?: "50").toInteger())),)}</stringProp>+ <stringProp name="ThreadGroup.duration">${__groovy(props.get("DURATION") ?: "300",)}</stringProp>+ <boolProp name="ThreadGroup.same_user_on_next_iteration">true</boolProp>+ <stringProp name="ThreadGroup.on_sample_error">startnextloop</stringProp>+ <elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController">+ <intProp name="LoopController.loops">-1</intProp>+ <boolProp name="LoopController.continue_forever">false</boolProp>+ </elementProp>+ </ThreadGroup>+ <hashTree>+ <JSR223Sampler guiclass="TestBeanGUI" testclass="JSR223Sampler" testname="Compute assetId">+ <stringProp name="scriptLanguage">groovy</stringProp>+ <stringProp name="parameters"></stringProp>+ <stringProp name="filename"></stringProp>+ <stringProp name="cacheKey">true</stringProp>+ <stringProp name="script">import com.devskiller.friendly_id.Url62;+import com.fasterxml.uuid.Generators;+import com.fasterxml.uuid.impl.NameBasedGenerator;++def assetId = Url62.encode(Generators.nameBasedGenerator().generate("masterlight-${__threadNum}-1"))+vars.put("assetId", assetId)+</stringProp>+ </JSR223Sampler>+ <hashTree/>+ <net.xmeter.samplers.ConnectSampler guiclass="net.xmeter.gui.ConnectSamplerUI" testclass="net.xmeter.samplers.ConnectSampler" testname="connect">+ <stringProp name="mqtt.server">${__P(MANAGER_HOSTNAME,localhost)}</stringProp>+ <stringProp name="mqtt.port">8883</stringProp>+ <stringProp name="mqtt.version">3.1</stringProp>+ <stringProp name="mqtt.conn_timeout">10</stringProp>+ <stringProp name="mqtt.protocol">SSL</stringProp>+ <stringProp name="mqtt.ws_path"></stringProp>+ <boolProp name="mqtt.dual_ssl_authentication">false</boolProp>+ <stringProp name="mqtt.clientcert_file_path"></stringProp>+ <stringProp name="mqtt.clientcert_password"></stringProp>+ <stringProp name="mqtt.client_id_prefix">device${__threadNum}</stringProp>+ <boolProp name="mqtt.client_id_suffix">false</boolProp>+ <stringProp name="mqtt.conn_keep_alive">30</stringProp>+ <stringProp name="mqtt.conn_attampt_max">0</stringProp>+ <stringProp name="mqtt.reconn_attampt_max">0</stringProp>+ <stringProp name="mqtt.conn_clean_session">true</stringProp>+ <stringProp name="mqtt.user_name">master:serviceuser${__threadNum}</stringProp>+ <stringProp name="mqtt.password">serviceuser${__threadNum}</stringProp>+ <stringProp name="mqtt.connect_name">mqttconn</stringProp>+ <stringProp name="mqtt.conn_attempt_max">0</stringProp>+ <stringProp name="mqtt.reconn_attempt_max">0</stringProp>+ </net.xmeter.samplers.ConnectSampler>+ <hashTree>+ <JSR223Timer guiclass="TestBeanGUI" testclass="JSR223Timer" testname="Connect Delay Timer">+ <stringProp name="cacheKey">true</stringProp>+ <stringProp name="filename"></stringProp>+ <stringProp name="parameters"></stringProp>+ <stringProp name="script">// Decrement successes counter only if previously succeeded - this is used to track when to stop the test+if (vars.get("success") != null) {+ log.info("Decrement successes")+ props.get("successes").decrementAndGet()+ vars.remove("success")+}++if (vars.getObject("threadCount") == null) {+ vars.putObject("threadCount", props.get("THREAD_COUNT"))+ return 0+}++// After the first iteration we want to simulate a random pause between next reconnection+int upper = 60000+int lower = 1+def delay = (int) (Math.random() * (upper - lower)) + lower;+log.info("CONNECT DELAY ${ctx.threadNum + 1} = ${delay}ms")+return delay</stringProp>+ <stringProp name="scriptLanguage">groovy</stringProp>+ </JSR223Timer>+ <hashTree/>+ </hashTree>+ <net.xmeter.samplers.SubSampler guiclass="net.xmeter.gui.SubSamplerUI" testclass="net.xmeter.samplers.SubSampler" testname="Subscribe attributes">+ <stringProp name="mqtt.topic_name">master/device${__threadNum}/attributevalue/+/${assetId}</stringProp>+ <stringProp name="mqtt.qos_level">0</stringProp>+ <boolProp name="mqtt.add_timestamp">false</boolProp>+ <boolProp name="mqtt.debug_response">true</boolProp>+ <stringProp name="mqtt.sample_condition">specified elapsed time (ms)</stringProp>+ <stringProp name="mqtt.sample_condition_value">1000</stringProp>+ <boolProp name="mqtt.sub_async">false</boolProp>+ <stringProp name="mqtt.connect_name">mqttconn</stringProp>+ <stringProp name="mqtt.sample_condition_value_opt">20000</stringProp>+ </net.xmeter.samplers.SubSampler>+ <hashTree>+ <ConstantTimer guiclass="ConstantTimerGui" testclass="ConstantTimer" testname="Constant Timer">+ <stringProp name="ConstantTimer.delay">1000</stringProp>+ </ConstantTimer>+ <hashTree/>+ </hashTree>+ <JSR223Sampler guiclass="TestBeanGUI" testclass="JSR223Sampler" testname="Check successes">+ <stringProp name="cacheKey">true</stringProp>+ <stringProp name="filename"></stringProp>+ <stringProp name="parameters"></stringProp>+ <stringProp name="script">// Increment successes counter and stop test if all devices are in successful state+def current = props.get("successes").incrementAndGet()+vars.put("success", "")+log.info("CHECKING SUCCESSES: current=${current}")+log.info(">>> thread count " + vars.getObject("threadCount"))++if (current >= vars.getObject("threadCount")) {+ log.info("All threads are successful so stopping test")+ ctx.getEngine().stopTest(true)+}</stringProp>+ <stringProp name="scriptLanguage">groovy</stringProp>+ </JSR223Sampler>+ <hashTree/>+ <LoopController guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller">+ <boolProp name="LoopController.continue_forever">true</boolProp>+ <intProp name="LoopController.loops">-1</intProp>+ </LoopController>+ <hashTree>+ <net.xmeter.samplers.PubSampler guiclass="net.xmeter.gui.PubSamplerUI" testclass="net.xmeter.samplers.PubSampler" testname="Publish brightness">+ <stringProp name="mqtt.topic_name">master/device${__threadNum}/writeattributevalue/brightness/${assetId}</stringProp>+ <stringProp name="mqtt.qos_level">0</stringProp>+ <boolProp name="mqtt.add_timestamp">false</boolProp>+ <stringProp name="mqtt.message_type">String</stringProp>+ <stringProp name="mqtt.message_type_fixed_length">1024</stringProp>+ <stringProp name="mqtt.message_to_sent">${__groovy(new Random().nextInt(100))}</stringProp>+ <boolProp name="mqtt.retained_message">false</boolProp>+ <stringProp name="mqtt.connect_name">mqttconn</stringProp>+ </net.xmeter.samplers.PubSampler>+ <hashTree>+ <ConstantTimer guiclass="ConstantTimerGui" testclass="ConstantTimer" testname="Constant Timer">+ <stringProp name="ConstantTimer.delay">${__P(MILLIS_BETWEEN_PUBLISHES,10000)}</stringProp>+ </ConstantTimer>+ <hashTree/>+ </hashTree>+ <net.xmeter.samplers.AsyncResponseSampler guiclass="net.xmeter.gui.AsyncResponseSamplerUI" testclass="net.xmeter.samplers.AsyncResponseSampler" testname="Check attribute response" enabled="false"/>+ <hashTree>+ <ConstantTimer guiclass="ConstantTimerGui" testclass="ConstantTimer" testname="Constant Timer" enabled="false">+ <stringProp name="ConstantTimer.delay">30</stringProp>+ </ConstantTimer>+ <hashTree/>+ </hashTree>+ </hashTree>+ <net.xmeter.samplers.DisConnectSampler guiclass="net.xmeter.gui.DisConnectSamplerUI" testclass="net.xmeter.samplers.DisConnectSampler" testname="disconnect">+ <stringProp name="mqtt.connect_name">mqttconn</stringProp>+ </net.xmeter.samplers.DisConnectSampler>+ <hashTree/>+ <ResultCollector guiclass="ViewResultsFullVisualizer" testclass="ResultCollector" testname="View Results Tree">+ <boolProp name="ResultCollector.error_logging">false</boolProp>+ <objProp>+ <name>saveConfig</name>+ <value class="SampleSaveConfiguration">+ <time>true</time>+ <latency>true</latency>+ <timestamp>true</timestamp>+ <success>false</success>+ <label>true</label>+ <code>true</code>+ <message>true</message>+ <threadName>true</threadName>+ <dataType>true</dataType>+ <encoding>false</encoding>+ <assertions>false</assertions>+ <subresults>true</subresults>+ <responseData>false</responseData>+ <samplerData>false</samplerData>+ <xml>false</xml>+ <fieldNames>true</fieldNames>+ <responseHeaders>false</responseHeaders>+ <requestHeaders>false</requestHeaders>+ <responseDataOnError>false</responseDataOnError>+ <saveAssertionResultsFailureMessage>true</saveAssertionResultsFailureMessage>+ <assertionsResultsToSave>0</assertionsResultsToSave>+ <bytes>true</bytes>+ <url>true</url>+ <threadCounts>true</threadCounts>+ <sampleCount>true</sampleCount>+ <idleTime>true</idleTime>+ <connectTime>true</connectTime>+ </value>+ </objProp>+ <stringProp name="filename"></stringProp>+ </ResultCollector>+ <hashTree/>+ </hashTree>+ </hashTree>+ </hashTree>+</jmeterTestPlan>diff --git a/test/load2-eks/scenarios/connect-settle-test.yml b/test/load2-eks/scenarios/connect-settle-test.ymlnew file mode 100644index 000000000..7f69098da--- /dev/null+++ b/test/load2-eks/scenarios/connect-settle-test.yml@@ -0,0 +1,38 @@+settings:+ env:+ JMETER_VERSION: # Set by environment variable in docker image+ JMETER_PLUGIN_MANAGER_VERSION: # Set by environment variable in docker image+ MANAGER_HOSTNAME: # Must be supplied+ THREAD_COUNT: 10000+ RAMP_RATE: 50+ MILLIS_BETWEEN_PUBLISHES: 300000++reporting:+ - module: final-stats+ summary: true # overall samples count and percent of failures+ percentiles: true # display average times and percentiles+ summary-labels: true # provides list of sample labels, status, percentage of completed, avg time and errors+ failed-labels: true # provides list of sample labels with failures+ test-duration: true # provides test duration+# dump-csv: filename to export data in CSV format++modules:+ jmeter:+ version: ${JMETER_VERSION}+ detect-plugins: true+ fix-jars: true+ plugins-manager:+ version: ${JMETER_PLUGIN_MANAGER_VERSION}+ properties:+ MANAGER_HOSTNAME: ${MANAGER_HOSTNAME}+ THREAD_COUNT: ${THREAD_COUNT}+ RAMP_RATE: ${RAMP_RATE}+ MILLIS_BETWEEN_PUBLISHES: ${MILLIS_BETWEEN_PUBLISHES}++execution:+ - scenario: simple++scenarios:+ simple:+ script: connect-settle-test.jmx+diff --git a/test/load2-eks/values-keycloak-eks-load.yaml b/test/load2-eks/values-keycloak-eks-load.yamlnew file mode 100644index 000000000..ed0ca53cc--- /dev/null+++ b/test/load2-eks/values-keycloak-eks-load.yaml@@ -0,0 +1,7 @@+resources:+ limits:+ cpu: 1500m+ memory: 5Gi+ requests:+ cpu: 1200m+ memory: 5Gidiff --git a/test/load2-eks/values-manager-eks-load.yaml b/test/load2-eks/values-manager-eks-load.yamlnew file mode 100644index 000000000..47b87c17a--- /dev/null+++ b/test/load2-eks/values-manager-eks-load.yaml@@ -0,0 +1,40 @@+image:+ tag: "load2"++livenessProbe:+ httpGet:+ path: /+ port: 8080+ periodSeconds: 5+readinessProbe:+ httpGet:+ path: /+ port: 8080+ periodSeconds: 5+startupProbe:+ httpGet:+ path: /+ port: 8080+ failureThreshold: 500+ periodSeconds: 10++resources:+ limits:+ cpu: 3200m+ memory: 13Gi+ requests:+ cpu: 3000m+ memory: 13Gi++volumeSize: "16Gi"++or:+ env:+ - name: OR_SETUP_USERS+ value: "5000"+ - name: OR_SETUP_ASSETS+ value: "5"+ - name: OR_SETUP_STORE_DATA_POINTS+ value: "false"+ - name: OR_JAVA_OPTS+ value: "-Dhibernate.generate_statistics=true -XX:InitialRAMPercentage=75 -XX:MaxRAMPercentage=75 -XX:NativeMemoryTracking=summary -Xlog:all=warning:stdout:uptime,level,tags -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/dump.hprof"diff --git a/test/load2-eks/values-or-setup-eks-load.yaml b/test/load2-eks/values-or-setup-eks-load.yamlnew file mode 100644index 000000000..4cc16003e--- /dev/null+++ b/test/load2-eks/values-or-setup-eks-load.yaml@@ -0,0 +1,6 @@+managerVolumeSize: "32Gi"+psqlVolumeSize: "256Gi"++aws:+ # Set enabled to true if deployed under AWS+ enabled: truediff --git a/test/load2-eks/values-postgresql-eks-load.yaml b/test/load2-eks/values-postgresql-eks-load.yamlnew file mode 100644index 000000000..7b8df849e--- /dev/null+++ b/test/load2-eks/values-postgresql-eks-load.yaml@@ -0,0 +1,9 @@+volumeSize: "16Gi"++resources:+ limits:+ cpu: 1500m+ memory: 5Gi+ requests:+ cpu: 1400m+ memory: 5Gidiff --git a/test/load2-eks/values-proxy-eks-load.yaml b/test/load2-eks/values-proxy-eks-load.yamlnew file mode 100644index 000000000..971a2db22--- /dev/null+++ b/test/load2-eks/values-proxy-eks-load.yaml@@ -0,0 +1,7 @@+resources:+ limits:+ cpu: 1000m+ memory: 5Gi+ requests:+ cpu: 1000m+ memory: 5Gi