在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):electronicarts/gatling-aws-maven-plugin开源软件地址(OpenSource Url):https://github.com/electronicarts/gatling-aws-maven-plugin开源编程语言(OpenSource Language):Java 99.9%开源软件介绍(OpenSource Introduction):Gatling AWS Maven PluginThe Gatling AWS Maven plugin takes the pain out of scaling up your Gatling tests. It runs your load test on a configurable number of EC2 instances, aggregates a single load test report, and uploads the results to S3. All EC2 instances are terminated at the end of the test to ensure you are only paying for what you need. Getting StartedThis section shows you which setup is required to use the plugin, how to configure your existing Maven project, how to run tests locally for testing, and how to let Jenkins start a cluster of EC2 instances that will run your load test. For the 5 minute version of this document, take a look at Quickstart. AWS SetupMake the following changes in AWS to allow the Gatling AWS Maven plugin to launch EC2 instances and upload the results to S3 on your behalf.
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"ec2:RunInstances",
"ec2:StopInstances",
"ec2:CreateTags",
"ec2:TerminateInstances",
"ec2:Describe*"
],
"Resource": "*"
},
{
"Effect": "Allow",
"Action": "autoscaling:Describe*",
"Resource": "*"
},
{
"Effect": "Allow",
"Action": "s3:*",
"Resource": "arn:aws:s3:::loadtest-results/*"
},
{
"Effect": "Allow",
"Action": [
"s3:Get*",
"s3:List*"
],
"Resource": "*"
}
]
} This example policy is very permissive. Consider restricting it more depending on your needs. The plugin expects that the access/secret key are provided at runtime to interact with EC2 and S3. Please refer to the AWS documentation on how to provide the keys to an application. To use the plugin on Jenkins, we recommend setting up password parameters for both values. You can then inject both as environment variables or write them into a temporary
Maven integrationCreate a new Maven project that follows the following structure:
<properties>
<gatling.version>2.2.0</gatling.version>
<gatling-plugin.version>2.2.0</gatling-plugin.version>
<gatling.skip>false</gatling.skip>
<!-- Information required to start EC2 instances and control them via SSH -->
<ssh.user>ec2-user</ssh.user>
<ssh.private.key>${user.home}/.ssh/loadtest.pem</ssh.private.key>
<ec2.key.pair.name>loadtest-keypair</ec2.key.pair.name>
<ec2.security.group>default</ec2.security.group>
<ec2.instance.count>1</ec2.instance.count>
<gatling.local.home>${project.basedir}/gatling/gatling-charts-highcharts-bundle-2.2.0/bin/gatling.sh</gatling.local.home>
<gatling.install.script>${project.basedir}/src/test/resources/install-gatling.sh</gatling.install.script>
<gatling.root>gatling-charts-highcharts-bundle-2.2.0</gatling.root>
<gatling.java.opts> -Xms1g -Xmx25g -Xss8M -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=256M</gatling.java.opts>
<!-- Fully qualified name of the Gatling simulation and a name describing the test -->
<gatling.simulation>com.FooTest</gatling.simulation>
<gatling.test.name>LoadTest</gatling.test.name>
<!-- S3 integration settings -->
<s3.upload.enabled>true</s3.upload.enabled>
<s3.bucket>loadtest-results</s3.bucket>
<s3.subfolder>my-loadtest</s3.subfolder>
<!-- Any additional properties you might have -->
</properties>
<dependencies>
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
<version>2.11.4</version>
</dependency>
<dependency>
<groupId>io.gatling.highcharts</groupId>
<artifactId>gatling-charts-highcharts</artifactId>
<version>${gatling.version}</version>
<scope>test</scope>
</dependency>
<!-- Any additional dependencies you might have -->
<dependencies>
<build>
<sourceDirectory>src/test/scala</sourceDirectory>
<testSourceDirectory>src/test/scala</testSourceDirectory>
<plugins>
<!-- Required for running smaller Gatling simulations locally for debugging purposes -->
<plugin>
<groupId>io.gatling</groupId>
<artifactId>gatling-maven-plugin</artifactId>
<version>${gatling-plugin.version}</version>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>execute</goal>
</goals>
</execution>
</executions>
<configuration>
<dataFolder>src/test/resources/data</dataFolder>
<resultsFolder>target/gatling/results</resultsFolder>
<simulationsFolder>src/test/scala</simulationsFolder>
<simulationClass>${gatling.simulationClass}</simulationClass>
<jvmArgs>
<!-- Enable this for debugging: -->
<!--jvmArg>-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=7000</jvmArg-->
</jvmArgs>
</configuration>
</plugin>
<!-- Required for running large scale Gatling simulations on EC2 instances -->
<plugin>
<groupId>com.ea.gatling</groupId>
<artifactId>gatling-aws-maven-plugin</artifactId>
<version>1.0.11</version>
<configuration>
<simulationOptions>
<custom.simulation.option>some value</custom.simulation.option>
</simulationOptions>
</configuration>
</plugin>
<!-- Any additional plugins you might have -->
</plugins>
</build> You should now be able to run tests locally and launch EC2 instances to run your test remotely. The next two section will show you how. Running tests locallyTo generate load from your local dev environment, run a normal
Running tests remotelyUse the If your test has dependencies required to run, consider adding the Example:
This will spin up 3 c3.large instances and start the Additional InformationCreditsWe want to thank the Gatling team for creating a great load testing tool and maintaining a very active community around it. The main authors of the plugin are Yuriy Gapon and Ingo Jaeckel. LicenseCopyright (C) 2016 Electronic Arts Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY ELECTRONIC ARTS AND ITS CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ELECTRONIC ARTS OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论