--- type: install name: JMeter Cluster categories: - apps/popular - apps/clusters - apps/dev-and-admin-tools description: | This package is designed for performance testing of web applications - static and dynamic resources. It can be used to simulate a heavy load on a server, group of servers or network to test and analyze overall performance under different load types. logo: /images/jmeter-cluster-logo.png baseUrl: https://raw.githubusercontent.com/sych74/jmeter/master globals: WEBROOT_DIR: /var/www/webroot/ROOT JM_DIR: /root LOG: /var/log/autotests.log RESULTS_DIR: /root/jmeter-results GRAFANA_PASSWORD: ${fn.password(12)} ssl: true nodes: - nodeType: nginxphp cloudlets: 6 nodeGroup: cp env: JELASTIC_PORTS: 22 nodeGroupData: validation: maxCount: 1 displayName: Web - image: devbeta/jmeter:5.1.1-libericajdk-12.0.1 cloudlets: 64 nodeGroup: master extip: true env: JELASTIC_PORTS: 22 GC_ALGO: -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC HEAP: -XX:MaxRAMPercentage=70 -Xms32m nodeGroupData: validation: maxCount: 1 displayName: Master volumes: - /root/jmeter-results volumeMounts: /root/jmeter-results: readOnly: false sourcePath: /var/www/webroot/ROOT sourceNodeGroup: cp - image: devbeta/jmeter:5.1.1-libericajdk-12.0.1 cloudlets: 32 nodeGroup: workers env: JELASTIC_PORTS: 22 GC_ALGO: -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC HEAP: -XX:MaxRAMPercentage=70 -Xms32m metadata: layer: workers displayName: Workers count: 2 scalingMode: STATELESS - image: devbeta/jmeter-influxdb:1.0 cloudlets: 32 nodeGroup: influx env: JELASTIC_PORTS: 22 nodeGroupData: validation: maxCount: 1 displayName: DB skipNodeEmails: true settings: main: fields: - type: radio-fieldset caption: Configuration type name: cfg-type default: 1 values: 1: Use default test plan with tunnable parameters 2: Deploy custom test plan via JMX format 3: WordPress preconfigured testplan showIf: 1: - name: domain caption: Protocol and Domain type: string tooltip: Testing website entry point. inputType: string default: http://example.com regex: "^(?:http(s)?://)?[\\w.-]+(?:\\.[\\w\\.-]+)+[\\w\\-\\._~:/?#[\\]@!\\$&'\\(\\)\\*\\+,;=.]+$" regexText: 'Incorrect Link (example: http(s)://example.com/)' required: true - name: vu caption: Virtual Users (VU) tooltip: Number of active concurrent threads. type: spinner min: 1 max: 640 increment: 1 decimalPrecision: '' default: 50 - name: duration caption: Test Duration, min tooltip: Value should be from 1 to 60 minutes. type: spinner min: 1 max: 60 increment: 1 decimalPrecision: '' default: 30 - name: rampup caption: Ramp-up Period, min tooltip: | The time frame for all virtual users (VU) to become active.
E.g. for 120 VU and ramp-up time 1 minute - 2 new VU will be added each second.
Value range - from 0 to 60 minutes.
To start all VU immediately please set ramp-up period to 0. type: spinner min: 0 max: 60 increment: 1 decimalPrecision: '' default: 20 - name: urls caption: URL List tooltip: | List of website urls that should be included to the test plan. For example: /index.php /wp-login.php. If the field is empty then test plan will be configured only for website root url. type: text inputType: text required: false 2: - name: jmx caption: XML Manifest tooltip: "Please insert XML content of your jmx file here." type: text height: 190 inputType: text required: true 3: - name: domain caption: Protocol and Domain type: string tooltip: Testing website entry point. inputType: string default: http://example.com regex: "^(?:http(s)?://)?[\\w.-]+(?:\\.[\\w\\.-]+)+[\\w\\-\\._~:/?#[\\]@!\\$&'\\(\\)\\*\\+,;=.]+$" regexText: 'Incorrect Link (example: http(s)://example.com/)' required: true - name: vu caption: Virtual Users (VU) tooltip: Number of active concurrent threads. type: spinner min: 1 max: 640 increment: 1 decimalPrecision: '' default: 50 - name: duration caption: Test Duration, min tooltip: Value should be from 1 to 60 minutes. type: spinner min: 1 max: 60 increment: 1 decimalPrecision: '' default: 30 - name: rampup caption: Ramp-up Period, min tooltip: | The time frame for all virtual users (VU) to become active.
E.g. for 120 VU and ramp-up time 1 minute - 2 new VU will be added each second.
Value range - from 0 to 60 minutes.
To start all VU immediately please set ramp-up period to 0. type: spinner min: 0 max: 60 increment: 1 decimalPrecision: '' default: 20 - name: urls caption: URL List tooltip: | List of website urls that should be included to the test plan.
For example: /index.php /hello-world.
If the field is empty then test plan will be configured only for website root url. type: text inputType: text required: false - name: wpLogin caption: WordPress Login type: string tooltip: | WordPress login pattern without numbers, which was generated via: for SW_USER_I in {10..10010}; do wp --allow-root user create "username${SW_USER_I}" "username${SW_USER_I}@example.com" --user_pass="MySuperPassword" --role="subscriber"; done;.
In current example via wp cli will be created 10000 users with usernames from username10 to username10010 and in this field should be specified pattern "username" inputType: string default: username required: true - name: wpPassword caption: WordPress Password type: string tooltip: WordPress preconfigured password for generated users. inputType: string default: password required: true configGrafana: fields: - name: grafanaPassword caption: Grafana Password type: string tooltip: New password for user admin inputType: password required: true configRemoteWorkers: fields: - name: platformList caption: Remote Workers Platform List tooltip: | List of remote Jelastic Platforms with tokens.
Remote Jelastic app should be indicated as full url and token with ";" separator
For example: https://app.demo.jelastic.com/ MYSECURETOKEN1; https://app.demo2.jelastic.com/ MYSECURETOKEN2
If the field is empty then test plan will be configured only for local JMeter workers. type: text height: 150 onInstall: - installJMeterAddon - setupRemoteHosts - setupAuthKey - setupMasterConfigs - setupMasterOpenvpnServer - setupMasterRemoteAppManager - setupCpConfigs - setConfig actions: setupCpConfigs: - cmd[cp]: |- wget ${baseUrl}/configs/nginx.conf -O /etc/nginx/nginx.conf /etc/init.d/nginx restart wget ${baseUrl}/configs/grafana.repo -O /etc/yum.repos.d/grafana.repo yum -y install grafana systemctl daemon-reload systemctl enable grafana-server.service wget ${baseUrl}/configs/grafana.ini -O /etc/grafana/grafana.ini wget ${baseUrl}/configs/grafana.db -O /var/lib/grafana/grafana.db chown -R grafana.grafana /var/lib/grafana systemctl start grafana-server.service wget ${baseUrl}/scripts/grafana-set-password.sh -O /root/grafana-set-password.sh chmod +x /root/grafana-set-password.sh bash /root/grafana-set-password.sh ${globals.GRAFANA_PASSWORD} user: root setupMasterConfigs: - cmd[master]: |- yum install epel-release xmlstarlet -y -q wget ${baseUrl}/configs/TEST_PLAN.template -O ~/TEST_PLAN.template wget ${baseUrl}/configs/TEST_PLAN-WP.template -O ~/TEST_PLAN-WP.template wget ${baseUrl}/scripts/clean-results.sh -O ~/clean-results.sh wget ${baseUrl}/scripts/kill-workers.sh -O ~/kill-workers.sh wget ${baseUrl}/scripts/run-workers.sh -O ~/run-workers.sh wget ${baseUrl}/scripts/prepare_plan.sh -O ~/prepare_plan.sh wget ${baseUrl}/scripts/prepare_wordpress.plan.sh -O ~/prepare_wordpress.plan.sh wget ${baseUrl}/scripts/manage-remote.sh -O ~/manage-remote.sh chmod +x ~/*.sh rm -rf ${globals.RESULTS_DIR}/* mkdir -p ${globals.RESULTS_DIR}/results wget ${baseUrl}/scripts/index.php -O ${globals.RESULTS_DIR}/index.php touch ${globals.RESULTS_DIR}/jmeter-run.log chmod 777 ${globals.RESULTS_DIR}/jmeter-run.log ln -s ${globals.RESULTS_DIR}/jmeter-run.log ${globals.LOG} setupRemoteHosts: - cmd[master]: echo "${nodes.workers.join(address, \n)}" > /root/workers_list setupAuthKey: - cmd[master]: cat /root/.ssh/authorized_keys - cmd[workers]: mkdir -p /root/.ssh;echo "${response.responses.out}" >> /root/.ssh/authorized_keys setupMasterOpenvpnServer: - cmd[master]: |- yum -q -y install fping wget ${baseUrl}/scripts/centos7-vpn.sh -O ~/centos7-vpn.sh chmod +x ~/centos7-vpn.sh APPROVE_INSTALL=y APPROVE_IP=y IPV6_SUPPORT=n PORT_CHOICE=1 PROTOCOL_CHOICE=1 DNS=7 COMPRESSION_ENABLED=n CUSTOMIZE_ENC=n CLIENT=jmworkers PASS=1 bash ~/centos7-vpn.sh setupMasterRemoteAppManager: - cmd[master]: |- wget ${baseUrl}/rpms/jmenv-manager-1-1.x86_64.rpm -O ~/jmenv-manager-1-1.x86_64.rpm rpm -Uvh ~/jmenv-manager-1-1.x86_64.rpm /usr/sbin/chkconfig jmenv-manager on /usr/bin/systemctl daemon-reload /etc/init.d/jmenv-manager start runTest: if (${settings.cfg-type} == 1 || ${settings.cfg-type} == 3): cmd[master]: chmod 755 /var/run/screen;/usr/bin/pkill screen;screen -wipe;screen -d -m /root/run-workers.sh -u ${settings.domain} -d ${settings.duration} if (${settings.cfg-type} == 2): cmd[master]: chmod 755 /var/run/screen;/usr/bin/pkill screen;screen -wipe;screen -d -m /root/run-workers.sh -u custom -d 0 return: type: info message: Progress of the running test is available at [${env.url}](${env.url}) stopTest: - cmd [master]: chmod 755 /var/run/screen;/usr/bin/pkill screen;screen -wipe;screen -d -m /root/kill-workers.sh setConfig: if (${settings.cfg-type} == 1): cmd [master]: bash /root/prepare_plan.sh -u ${settings.vu} -r ${settings.rampup} -t ${settings.duration} -d ${settings.domain} -l '${settings.urls}' if (${settings.cfg-type} == 2): writeFile: nodeGroup: master path: /root/TEST_PLAN.jmx body: ${settings.jmx} if (${settings.cfg-type} == 3): cmd [master]: bash /root/prepare_wordpress.plan.sh -u ${settings.vu} -r ${settings.rampup} -t ${settings.duration} -d ${settings.domain} -l '${settings.urls}' -w ${settings.wpLogin} -p '${settings.wpPassword}' cleanResultsDir: cmd [master]: bash /root/clean-results.sh resetGrafanaPassword: - cmd [cp]: bash /root/grafana-set-password.sh ${settings.grafanaPassword} user: root setRemoteWorkers: - cmd [master]: bash /root/manage-remote.sh '${settings.platformList}' user: root installJMeterAddon: - install: ${baseUrl}/addons/magento/manifest.jps - jps: id: jmeter-addon name: JMeter Cluster Settings description: Run, stop or update the test plan. type: update logo: /images/jmeter-cluster-logo.png onAfterScaleOut[workers]: - setupRemoteHosts - installJMeterAddon - forEach(event.response.nodes): - cmd[master]: cat /root/.ssh/authorized_keys - cmd[${@i.id}]: mkdir -p /root/.ssh;echo "${response.responses.out}" >> /root/.ssh/authorized_keys onAfterScaleIn[workers]: - setupRemoteHosts - installJMeterAddon onAfterSetCloudletCount[workers]: - installJMeterAddon buttons: - action: runTest caption: Run Test logsPath: ${globals.LOG} successText: The test is in progress now! - action: stopTest caption: Stop Test logsPath: ${globals.LOG} successText: The test has been stopped. - settings: main action: setConfig caption: Configure logsPath: ${globals.LOG} submitButtonText: Apply successText: Update has been successfully applied. menu: - action: cleanResultsDir caption: Clean Results logsPath: ${globals.LOG} successText: Results directory was successfully cleaned. - settings: configGrafana action: resetGrafanaPassword caption: Reset Grafana Password logsPath: ${globals.LOG} successText: Password has been successfully changed!. - settings: configRemoteWorkers action: setRemoteWorkers caption: Setup Remote Workers logsPath: ${globals.LOG} successText: Remote Jelastic platforms successfully changed!. nodeCount: ${nodes.workers.length} cloudlets: ${nodes.workers.flexibleCloudlets} currSettings: ${settings.toJSON()} script: | var manifest = eval('(' + MANIFEST + ')'); jps = eval('(' + jps + ')'); currSettings = eval('(' + currSettings + ')'); jps.globals = manifest.globals; jps.actions = manifest.actions; jps.settings = manifest.settings; jps.baseUrl = manifest.baseUrl; var max = parseInt((nodeCount * cloudlets) / 0.25, 10); jps.settings.main.fields[0].showIf[1][1].max = max; jps.settings.main.fields[0].showIf[3][1].max = max; if (currSettings.vu && currSettings.vu > max) { currSettings.vu = max; jelastic.env.control.ExecCmdByGroup('${env.envName}', session, "master", toJSON([{ "command": 'bash /root/prepare_plan.sh -u ' + max }]), false, false, "root"); jelastic.env.control.ExecCmdByGroup('${env.envName}', session, "master", toJSON([{ "command": 'bash /root/prepare_wordpress.plan.sh -u ' + max }]), false, false, "root"); } return { result: 0, onAfterReturn: { install : { jps: jps, settings: currSettings } } }; success: /text/success.md